Issue Details (XML | Word | Printable)

Key: CORE-1682
Type: Improvement Improvement
Status: Closed Closed
Resolution: Fixed
Priority: Minor Minor
Assignee: Adriano dos Santos Fernandes
Reporter: Le Roy Arnaud
Votes: 0
Watchers: 1

If you were logged in you would be able to see more operations.
Firebird Core

Improve the way of use uuid

Created: 10/Jan/08 09:13 AM   Updated: 19/Jan/16 05:01 AM
Component/s: API / Client Library
Affects Version/s: 2.1 Beta 2
Fix Version/s: 2.5 Alpha 1

Environment: all

QA Status: No test

 Description  « Hide
Ideas about to improve UUID usage in Firebird
and make easiest usage in different language

Problems with actual uuid store in char(16) generated with gen_uuid() in fb 2.1
All the characters used in this uuid are not valid characters in urls.
so it's very problematic to create sql command in full text with uuid.
In tools like ibexpert you can't do copy/paste on ident
( So solve a problem it's more Headaches )

If you have an existing application and made some query in full string
you can't convert it to use uuid

Maybe solution
Have a function like create_uuid() in uuidUDF by Ian Newby
creates a 22 char string guid, which is a compressed form where the order of the sections
is reversed to allow firebirds index prefix compression to take place.
All the characters used in this uuid are valid characters in urls.

 All   Comments   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Dmitry Yemanov added a comment - 10/Jan/08 09:39 AM
GUIDs are intentionally made binary (CHAR(16) OCTETS) to allow better performance when used as primary keys. If you just need a text representation, I think a new built-in function (e.g. FORMAT_UUID) would be a better solution. We already have an appropriate feature request: CORE-1656.

Le Roy Arnaud added a comment - 10/Jan/08 11:31 AM
what do you mean by FORMAT_UUID

 to affect a variable, you see something like that
  id = FORMAT_UUID()

do you think it's possible to have different format
( like in the udf uuidUDF )
a 36 char string guid representation.
a 22 char string guid (compressed form)

Many thanks

Dmitry Yemanov added a comment - 10/Jan/08 01:15 PM
I meant FORMAT_UUID(<uuid_field>) or FORMAT_UUID(GET_UUID()). Both are valid and just transform a binary representation to a textual one. Well, something like GEN_UUID(AS TEXT) is also possible, but I'm not sure it's really important.

As for the format, IMO we should support only the RFC4122 one, i.e. 36 chars.

Le Roy Arnaud added a comment - 10/Jan/08 02:09 PM
i think it could be a good thing if this function could generate a char(22) version to improve performance without lost any flexibility with unreadable character as we have with char(16) version.

Adriano dos Santos Fernandes added a comment - 10/Jan/08 06:45 PM
FORMAT_UUID alone is not good.

We need UUID_TO_CHAR and CHAR_TO_UUID functions.

These names seems very verbose (long) but I don't have good ones.

Adriano dos Santos Fernandes added a comment - 10/Jan/08 08:12 PM
I resolved the ticket (as fixed) without intention.

Le Roy Arnaud added a comment - 11/Jan/08 04:41 AM
Another suggestion is to create an uuid datatype with a size of 16 octet,
and when you select it you obtain a text compliant with the rfc4122 (plain text char 36) and when you do a update on this you can pass a text on this form {72fcfb90-c024-11dc-95ff-0800200c9a66} for exemple.

In sql server, we have this comportment with uuid type, and it's quite easy to use in application .

perhaps it's not a good idea because it's too dificult to implement or not respect the type definition in firebird or other thing !