Postgres uuid
Jump to navigation
Jump to search
select gen_random_uuid (); select replace((select gen_random_uuid()::TEXT), '-', '') ;
create or replace function create_user_readonly ( unm varchar, pwd varchar ) returns varchar(10) as $$ begin execute format($f$create role %I login password '%s'$f$,unm,pwd); execute format('alter role %I set transaction_read_only to on',unm); return 'success'; end; $$ language plpgsql;
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;