3d3f242d11
* fix(db): add extension function wrappers (avoid shadowing gen_random_uuid) Signed-off-by: filip <filip.harald@gmail.com> * test: added test for extension function wrappers (uuid_generate_v4 and gen_random_bytes) in public schema, covering existence, delegation, correctness, properties, and idempotency. Signed-off-by: filip <filip.harald@gmail.com> --------- Signed-off-by: filip <filip.harald@gmail.com>
27 lines
569 B
PL/PgSQL
27 lines
569 B
PL/PgSQL
CREATE SCHEMA IF NOT EXISTS extensions;
|
|
|
|
CREATE EXTENSION IF NOT EXISTS "uuid-ossp" WITH SCHEMA extensions;
|
|
CREATE EXTENSION IF NOT EXISTS pgcrypto WITH SCHEMA extensions;
|
|
|
|
CREATE OR REPLACE FUNCTION public.uuid_generate_v4()
|
|
RETURNS uuid
|
|
LANGUAGE sql
|
|
VOLATILE
|
|
PARALLEL SAFE
|
|
SET search_path = ''
|
|
AS $$
|
|
SELECT extensions.uuid_generate_v4();
|
|
$$;
|
|
|
|
CREATE OR REPLACE FUNCTION public.gen_random_bytes(size integer)
|
|
RETURNS bytea
|
|
LANGUAGE sql
|
|
VOLATILE
|
|
PARALLEL SAFE
|
|
SET search_path = ''
|
|
AS $$
|
|
SELECT extensions.gen_random_bytes(size);
|
|
$$;
|
|
|
|
NOTIFY pgrst, 'reload schema';
|