mirror of
https://github.com/postgres/postgres.git
synced 2025-04-29 13:56:47 +03:00
Add tests for pg_get_functiondef
This commit is contained in:
parent
a7b8f0661d
commit
7cd56f218d
@ -189,6 +189,50 @@ SELECT proname, proisstrict FROM pg_proc
|
|||||||
functest_f_4 | t
|
functest_f_4 | t
|
||||||
(4 rows)
|
(4 rows)
|
||||||
|
|
||||||
|
-- pg_get_functiondef tests
|
||||||
|
SELECT pg_get_functiondef('functest_A_1'::regproc);
|
||||||
|
pg_get_functiondef
|
||||||
|
--------------------------------------------------------------------
|
||||||
|
CREATE OR REPLACE FUNCTION temp_func_test.functest_a_1(text, date)+
|
||||||
|
RETURNS boolean +
|
||||||
|
LANGUAGE sql +
|
||||||
|
AS $function$SELECT $1 = 'abcd' AND $2 > '2001-01-01'$function$ +
|
||||||
|
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
SELECT pg_get_functiondef('functest_B_3'::regproc);
|
||||||
|
pg_get_functiondef
|
||||||
|
-----------------------------------------------------------------
|
||||||
|
CREATE OR REPLACE FUNCTION temp_func_test.functest_b_3(integer)+
|
||||||
|
RETURNS boolean +
|
||||||
|
LANGUAGE sql +
|
||||||
|
STABLE +
|
||||||
|
AS $function$SELECT $1 = 0$function$ +
|
||||||
|
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
SELECT pg_get_functiondef('functest_C_3'::regproc);
|
||||||
|
pg_get_functiondef
|
||||||
|
-----------------------------------------------------------------
|
||||||
|
CREATE OR REPLACE FUNCTION temp_func_test.functest_c_3(integer)+
|
||||||
|
RETURNS boolean +
|
||||||
|
LANGUAGE sql +
|
||||||
|
SECURITY DEFINER +
|
||||||
|
AS $function$SELECT $1 < 0$function$ +
|
||||||
|
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
SELECT pg_get_functiondef('functest_F_2'::regproc);
|
||||||
|
pg_get_functiondef
|
||||||
|
-----------------------------------------------------------------
|
||||||
|
CREATE OR REPLACE FUNCTION temp_func_test.functest_f_2(integer)+
|
||||||
|
RETURNS boolean +
|
||||||
|
LANGUAGE sql +
|
||||||
|
STRICT +
|
||||||
|
AS $function$SELECT $1 = 50$function$ +
|
||||||
|
|
||||||
|
(1 row)
|
||||||
|
|
||||||
-- information_schema tests
|
-- information_schema tests
|
||||||
CREATE FUNCTION functest_IS_1(a int, b int default 1, c text default 'foo')
|
CREATE FUNCTION functest_IS_1(a int, b int default 1, c text default 'foo')
|
||||||
RETURNS int
|
RETURNS int
|
||||||
|
@ -134,6 +134,14 @@ SELECT proname, proisstrict FROM pg_proc
|
|||||||
'functest_F_4'::regproc) ORDER BY proname;
|
'functest_F_4'::regproc) ORDER BY proname;
|
||||||
|
|
||||||
|
|
||||||
|
-- pg_get_functiondef tests
|
||||||
|
|
||||||
|
SELECT pg_get_functiondef('functest_A_1'::regproc);
|
||||||
|
SELECT pg_get_functiondef('functest_B_3'::regproc);
|
||||||
|
SELECT pg_get_functiondef('functest_C_3'::regproc);
|
||||||
|
SELECT pg_get_functiondef('functest_F_2'::regproc);
|
||||||
|
|
||||||
|
|
||||||
-- information_schema tests
|
-- information_schema tests
|
||||||
|
|
||||||
CREATE FUNCTION functest_IS_1(a int, b int default 1, c text default 'foo')
|
CREATE FUNCTION functest_IS_1(a int, b int default 1, c text default 'foo')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user