File tree Expand file tree Collapse file tree 2 files changed +52
-0
lines changed Expand file tree Collapse file tree 2 files changed +52
-0
lines changed Original file line number Diff line number Diff line change @@ -189,6 +189,50 @@ SELECT proname, proisstrict FROM pg_proc
189189 functest_f_4 | t
190190(4 rows)
191191
192+ -- pg_get_functiondef tests
193+ SELECT pg_get_functiondef('functest_A_1'::regproc);
194+ pg_get_functiondef
195+ --------------------------------------------------------------------
196+ CREATE OR REPLACE FUNCTION temp_func_test.functest_a_1(text, date)+
197+ RETURNS boolean +
198+ LANGUAGE sql +
199+ AS $function$SELECT $1 = 'abcd' AND $2 > '2001-01-01'$function$ +
200+
201+ (1 row)
202+
203+ SELECT pg_get_functiondef('functest_B_3'::regproc);
204+ pg_get_functiondef
205+ -----------------------------------------------------------------
206+ CREATE OR REPLACE FUNCTION temp_func_test.functest_b_3(integer)+
207+ RETURNS boolean +
208+ LANGUAGE sql +
209+ STABLE +
210+ AS $function$SELECT $1 = 0$function$ +
211+
212+ (1 row)
213+
214+ SELECT pg_get_functiondef('functest_C_3'::regproc);
215+ pg_get_functiondef
216+ -----------------------------------------------------------------
217+ CREATE OR REPLACE FUNCTION temp_func_test.functest_c_3(integer)+
218+ RETURNS boolean +
219+ LANGUAGE sql +
220+ SECURITY DEFINER +
221+ AS $function$SELECT $1 < 0$function$ +
222+
223+ (1 row)
224+
225+ SELECT pg_get_functiondef('functest_F_2'::regproc);
226+ pg_get_functiondef
227+ -----------------------------------------------------------------
228+ CREATE OR REPLACE FUNCTION temp_func_test.functest_f_2(integer)+
229+ RETURNS boolean +
230+ LANGUAGE sql +
231+ STRICT +
232+ AS $function$SELECT $1 = 50$function$ +
233+
234+ (1 row)
235+
192236-- information_schema tests
193237CREATE FUNCTION functest_IS_1(a int, b int default 1, c text default 'foo')
194238 RETURNS int
Original file line number Diff line number Diff line change @@ -134,6 +134,14 @@ SELECT proname, proisstrict FROM pg_proc
134134 ' functest_F_4' ::regproc) ORDER BY proname;
135135
136136
137+ -- pg_get_functiondef tests
138+
139+ SELECT pg_get_functiondef(' functest_A_1' ::regproc);
140+ SELECT pg_get_functiondef(' functest_B_3' ::regproc);
141+ SELECT pg_get_functiondef(' functest_C_3' ::regproc);
142+ SELECT pg_get_functiondef(' functest_F_2' ::regproc);
143+
144+
137145-- information_schema tests
138146
139147CREATE FUNCTION functest_IS_1 (a int , b int default 1 , c text default ' foo' )
You can’t perform that action at this time.
0 commit comments