move test in schedule file; add schema to test

pull/7554/head
copetol 2024-03-07 16:51:33 +03:00
parent 416a201281
commit fd78c560d8
3 changed files with 12 additions and 8 deletions

View File

@ -1,5 +1,7 @@
CREATE SCHEMA function_with_case;
SET search_path TO function_with_case;
-- create function
CREATE OR REPLACE FUNCTION public.test_err(v1 text)
CREATE OR REPLACE FUNCTION test_err(v1 text)
RETURNS text
LANGUAGE plpgsql
SECURITY DEFINER
@ -14,13 +16,13 @@ do $$ declare
val text;
begin
val = 'test';
lNewValues = public.test_err(v1 => case when val::text = 'test'::text then 'yes' else 'no' end);
lNewValues = 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');
SELECT test_err('test');
test_err
---------------------------------------------------------------------
test - ok

View File

@ -110,6 +110,7 @@ test: run_command_on_all_nodes
test: background_task_queue_monitor
test: other_databases grant_role_from_non_maindb role_operations_from_non_maindb seclabel_non_maindb
test: citus_internal_access
test: function_with_case_when
# Causal clock test
test: clock
@ -134,5 +135,3 @@ test: check_mx
test: generated_identity
test: drop_database
test: check_cluster_state
test: function_with_case_when

View File

@ -1,5 +1,8 @@
CREATE SCHEMA function_with_case;
SET search_path TO function_with_case;
-- create function
CREATE OR REPLACE FUNCTION public.test_err(v1 text)
CREATE OR REPLACE FUNCTION test_err(v1 text)
RETURNS text
LANGUAGE plpgsql
SECURITY DEFINER
@ -14,9 +17,9 @@ do $$ declare
val text;
begin
val = 'test';
lNewValues = public.test_err(v1 => case when val::text = 'test'::text then 'yes' else 'no' end);
lNewValues = 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');
SELECT test_err('test');