0002-Add-tests-for-pg_get_functiondef.patch

text/plain

Filename: 0002-Add-tests-for-pg_get_functiondef.patch
Type: text/plain
Part: 1
Message: Re: CALL stmt, ERROR: unrecognized node type: 113 bug

Patch

Format: format-patch
Series: patch 0002
Subject: Add tests for pg_get_functiondef
File+
src/test/regress/expected/create_function_3.out 44 0
src/test/regress/sql/create_function_3.sql 8 0
From cd94f187228be3e66c741469681a5703413eecef Mon Sep 17 00:00:00 2001
From: Peter Eisentraut <peter_e@gmx.net>
Date: Mon, 12 Feb 2018 14:03:04 -0500
Subject: [PATCH 2/3] Add tests for pg_get_functiondef

---
 src/test/regress/expected/create_function_3.out | 44 +++++++++++++++++++++++++
 src/test/regress/sql/create_function_3.sql      |  8 +++++
 2 files changed, 52 insertions(+)

diff --git a/src/test/regress/expected/create_function_3.out b/src/test/regress/expected/create_function_3.out
index 2fd25b8593..5ff1e0dd86 100644
--- a/src/test/regress/expected/create_function_3.out
+++ b/src/test/regress/expected/create_function_3.out
@@ -189,6 +189,50 @@ SELECT proname, proisstrict FROM pg_proc
  functest_f_4 | t
 (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
 CREATE FUNCTION functest_IS_1(a int, b int default 1, c text default 'foo')
     RETURNS int
diff --git a/src/test/regress/sql/create_function_3.sql b/src/test/regress/sql/create_function_3.sql
index 6c411bdfda..fbdf8310e3 100644
--- a/src/test/regress/sql/create_function_3.sql
+++ b/src/test/regress/sql/create_function_3.sql
@@ -134,6 +134,14 @@ CREATE FUNCTION functest_F_4(int) RETURNS bool LANGUAGE 'sql'
                      '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
 
 CREATE FUNCTION functest_IS_1(a int, b int default 1, c text default 'foo')
-- 
2.16.1