Re: Opinion wanted on UUID/GUID datatype output formats.

From: Josh Berkus <josh(at)agliodbs(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Cc: Gevik Babakhani <pgdev(at)xs4all(dot)nl>
Subject: Re: Opinion wanted on UUID/GUID datatype output formats.
Date: 2006-09-14 21:02:44
Message-ID: 200609141402.45084.josh@agliodbs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2006-09-14 21:11:52 Re: Draft release notes
Previous Message Bruce Momjian 2006-09-14 20:58:14 Re: Draft release notes