You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
CREATE EXTENSION IF NOT EXISTS pgcrypto;
CREATE OR REPLACEFUNCTIONgenerate_ulid() RETURNS uuid
AS $$
SELECT (lpad(to_hex(floor(extract(epoch FROM clock_timestamp()) *1000)::bigint), 12, '0') || encode(gen_random_bytes(10), 'hex'))::uuid;
$$ LANGUAGE SQL;
Output:
CREATE EXTENSION IF NOT EXISTS pgcrypto;
CREATE
OR REPLACE FUNCTION generate_ulid() RETURNS uuid AS $ $
SELECT
(
lpad(
to_hex(
floor(
extract(
epoch
FROM
clock_timestamp()
) *1000
) :: bigint
),
12,
'0'
) || encode(gen_random_bytes(10), 'hex')
) :: uuid;
$ $ LANGUAGE SQL;
The text was updated successfully, but these errors were encountered:
Input:
Output:
The text was updated successfully, but these errors were encountered: