Difference between revisions of "Postgres uuid"
Jump to navigation
Jump to search
Line 4: | Line 4: | ||
select replace((select gen_random_uuid()::TEXT), '-', '') ; | select replace((select gen_random_uuid()::TEXT), '-', '') ; | ||
+ | ``` | ||
+ | |||
+ | |||
+ | ``` | ||
+ | CREATE OR REPLACE FUNCTION jb() | ||
+ | RETURNS TEXT AS $$ | ||
+ | DECLARE | ||
+ | rtv TEXT := 'test'; | ||
+ | _uuid text := (select replace((select gen_random_uuid()::TEXT), '-', '')); | ||
+ | BEGIN | ||
+ | -- PERFORM 'test'; | ||
+ | -- PERFORM uuid; | ||
+ | CREATE ROLE _uuid; | ||
+ | RETURN _uuid; | ||
+ | END; | ||
+ | $$ LANGUAGE plpgsql; | ||
``` | ``` |
Revision as of 15:24, 2 April 2023
select gen_random_uuid (); select replace((select gen_random_uuid()::TEXT), '-', '') ;
CREATE OR REPLACE FUNCTION jb() RETURNS TEXT AS $$ DECLARE rtv TEXT := 'test'; _uuid text := (select replace((select gen_random_uuid()::TEXT), '-', '')); BEGIN -- PERFORM 'test'; -- PERFORM uuid; CREATE ROLE _uuid; RETURN _uuid; END; $$ LANGUAGE plpgsql;