summaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorRobert Haas2016-07-26 20:07:02 +0000
committerRobert Haas2016-07-26 20:07:02 +0000
commit976b24fb477464907737d28cdf18e202fa3b1a5b (patch)
treed1e0bdb50e5bc4db9e5fb138171427780310409e /src/test
parentfe5e3fce798dccf3f298b65c5d9a132e9646712a (diff)
Change various deparsing functions to return NULL for invalid input.
Previously, some functions returned various fixed strings and others failed with a cache lookup error. Per discussion, standardize on returning NULL. Although user-exposed "cache lookup failed" error messages might normally qualify for bug-fix treatment, no back-patch; the risk of breaking user code which is accustomed to the current behavior seems too high. Michael Paquier
Diffstat (limited to 'src/test')
-rw-r--r--src/test/regress/expected/rules.out37
-rw-r--r--src/test/regress/sql/rules.sql8
2 files changed, 45 insertions, 0 deletions
diff --git a/src/test/regress/expected/rules.out b/src/test/regress/expected/rules.out
index ad44ae2af13..7c633ac8d7d 100644
--- a/src/test/regress/expected/rules.out
+++ b/src/test/regress/expected/rules.out
@@ -3057,3 +3057,40 @@ SELECT * FROM hat_data WHERE hat_name IN ('h8', 'h9', 'h7') ORDER BY hat_name;
DROP RULE hat_upsert ON hats;
drop table hats;
drop table hat_data;
+-- tests for pg_get_*def with invalid objects
+SELECT pg_get_constraintdef(0);
+ pg_get_constraintdef
+----------------------
+
+(1 row)
+
+SELECT pg_get_functiondef(0);
+ pg_get_functiondef
+--------------------
+
+(1 row)
+
+SELECT pg_get_indexdef(0);
+ pg_get_indexdef
+-----------------
+
+(1 row)
+
+SELECT pg_get_ruledef(0);
+ pg_get_ruledef
+----------------
+
+(1 row)
+
+SELECT pg_get_triggerdef(0);
+ pg_get_triggerdef
+-------------------
+
+(1 row)
+
+SELECT pg_get_viewdef(0);
+ pg_get_viewdef
+----------------
+
+(1 row)
+
diff --git a/src/test/regress/sql/rules.sql b/src/test/regress/sql/rules.sql
index 4299a5b1722..111c9ba062a 100644
--- a/src/test/regress/sql/rules.sql
+++ b/src/test/regress/sql/rules.sql
@@ -1144,3 +1144,11 @@ DROP RULE hat_upsert ON hats;
drop table hats;
drop table hat_data;
+
+-- tests for pg_get_*def with invalid objects
+SELECT pg_get_constraintdef(0);
+SELECT pg_get_functiondef(0);
+SELECT pg_get_indexdef(0);
+SELECT pg_get_ruledef(0);
+SELECT pg_get_triggerdef(0);
+SELECT pg_get_viewdef(0);