F.67. pg_uuidv7 — extension to generate UUID version 7 and some other functions#
F.67. pg_uuidv7 — extension to generate UUID version 7 and some other functions #
F.67.1. Usage #
Create extension:
CREATE EXTENSION pg_uuidv7;
Generate uuid v7:
SELECT uuidv7();
Extract timestamp from uuid (return NULL if it is not possible):
SELECT tt_uuid_extract_timestamp(uuidv7());
SELECT tt_uuid_extract_timestamp('0192957f-4613-7f3a-bf89-42f5df84f543');
Extract uuid version (return NULL if it is not possible):
SELECT uuid_extract_version(gen_random_uuid());
SELECT uuid_extract_version(uuidv7());
SELECT uuid_extract_version('11111111-1111-5111-8111-111111111111');