This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- Based off IETF draft, https://datatracker.ietf.org/doc/draft-peabody-dispatch-new-uuid-format/ | |
| create or replace function uuid_generate_v7() | |
| returns uuid | |
| as $$ | |
| declare | |
| unix_ts_ms bytea; | |
| uuid_bytes bytea; | |
| begin | |
| unix_ts_ms = substring(int8send(floor(extract(epoch from clock_timestamp()) * 1000)::bigint) from 3); |
OlderNewer