Re: Opinion wanted on UUID/GUID datatype output formats. - Mailing list pgsql-hackers

From Josh Berkus
Subject Re: Opinion wanted on UUID/GUID datatype output formats.
Date
Msg-id 200609141402.45084.josh@agliodbs.com
Whole thread Raw
In response to Opinion wanted on UUID/GUID datatype output formats.  (Gevik Babakhani <pgdev@xs4all.nl>)
List pgsql-hackers
Gevik,

> select format_uuid(mypk,'format3') from tbluuid;
> and then get: {6b13c5a1-afb4-dcf5-ce8f-8b4656b6c93c}
> (which would be MSSQL compatible)

> What do the PostgreSQL masters think? :)

There are no masters here.   Except in replication.

I think that we should have a formatting function, but it should be developer 
defined rather than pre-set, like to_char is. For example, instead of:

> select format_uuid(mypk,'format3') from tbluuid;
> and then get: {6b13c5a1-afb4-dcf5-ce8f-8b4656b6c93c}

Have:

select format_uuid(mypk,'HHHHHH-HHHH-HHHH-HHHH-HHHHHHHHHHH')
... to get the same result.   Or you could even support regexes:

select format_uuid(mypk,'[0-9a-f]{6}-[0-9a-f]{6}-[0-9a-f]{6}-[0-9a-f]{6}')

... but something which allows the definition of "ad-hoc" formating masks so 
that we can cover compatibility with products of which we're not yet aware.

-- 
Josh Berkus
PostgreSQL @ Sun
San Francisco


pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: Draft release notes
Next
From: Tom Lane
Date:
Subject: Re: Draft release notes