add a test

pull/7554/head
copetol 2024-03-07 15:43:07 +03:00
parent ee13bd6f5c
commit 416a201281
3 changed files with 52 additions and 0 deletions

View File

@ -0,0 +1,28 @@
-- create function
CREATE OR REPLACE FUNCTION public.test_err(v1 text)
RETURNS text
LANGUAGE plpgsql
SECURITY DEFINER
AS $function$
begin
return v1 || ' - ok';
END;
$function$;
do $$ declare
lNewValues text;
val text;
begin
val = 'test';
lNewValues = public.test_err(v1 => case when val::text = 'test'::text then 'yes' else 'no' end);
raise notice 'lNewValues= %', lNewValues;
end;$$ ;
NOTICE: lNewValues= yes - ok
CONTEXT: PL/pgSQL function inline_code_block line XX at RAISE
-- call function
SELECT public.test_err('test');
test_err
---------------------------------------------------------------------
test - ok
(1 row)

View File

@ -134,3 +134,5 @@ test: check_mx
test: generated_identity
test: drop_database
test: check_cluster_state
test: function_with_case_when

View File

@ -0,0 +1,22 @@
-- create function
CREATE OR REPLACE FUNCTION public.test_err(v1 text)
RETURNS text
LANGUAGE plpgsql
SECURITY DEFINER
AS $function$
begin
return v1 || ' - ok';
END;
$function$;
do $$ declare
lNewValues text;
val text;
begin
val = 'test';
lNewValues = public.test_err(v1 => case when val::text = 'test'::text then 'yes' else 'no' end);
raise notice 'lNewValues= %', lNewValues;
end;$$ ;
-- call function
SELECT public.test_err('test');