Re: UUIDs in core WAS: 9.4 Proposal: Initdb creates a single table
От | Christopher Browne |
---|---|
Тема | Re: UUIDs in core WAS: 9.4 Proposal: Initdb creates a single table |
Дата | |
Msg-id | CAFNqd5UsHVXY8Q=WbrsFFu+pV6F1yZk+rdHd=oOu2m7giOp55w@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: UUIDs in core WAS: 9.4 Proposal: Initdb creates a single table (Josh Berkus <josh@agliodbs.com>) |
Список | pgsql-hackers |
Last year, I built a pl/pgsql generator of "version 1-ish" UUIDs, which would combine timestamps with local information to construct data that kind of emulated the timestamp+MAC address that is version #1 of UUID.
Note that there are several versions of UUIDs:a) Having a sequence feeding some local uniqueness would fit with the "clock seq" bits (e.g. - the octets in RFC 4122 entitled clock-seq-and-reserved and clock-seq-low)
b) NOW() provides data for time-low, time-mid, time-high-and-version
c) We'd need 6 hex octets for "node"; I seem to recall there being something established by initdb that might be usable.
The only piece that's directly troublesome, for UUID Type 1, is the "node" value. I'll observe that it isn't unusual for UUID implementations to generate random values for that.
Note that for the other UUID versions, there's NO non-portable data needed.
It seems to me that a "UUIDserial" type, which combined:
a) A sequence, to be the 'clock';
b) Possibly another sequence to store local node ID, which might get seeded from DB internals
would provide a "PostgreSQL-flavoured" version of UUID Type 1.
would provide a "PostgreSQL-flavoured" version of UUID Type 1.
В списке pgsql-hackers по дате отправления: