Commit 976b24fb authored by Robert Haas's avatar Robert Haas

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
parent fe5e3fce
This diff is collapsed.
......@@ -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)
......@@ -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);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment