Fix reverse engineered sql for Foreign Data Wrapper created on EPAS server in redwood mode. Fixes #4450

This commit is contained in:
Akshay Joshi
2019-07-09 12:21:13 +05:30
parent 08e6d54184
commit a17687e27c
3 changed files with 22 additions and 5 deletions

View File

@@ -1,8 +1,16 @@
{# ============= Get all the properties of foreign data wrapper ============= #}
SELECT fdw.oid as fdwoid, fdwname as name, fdwhandler, fdwvalidator, description,
array_to_string(fdwoptions, ',') AS fdwoptions, pg_get_userbyid(fdwowner) as fdwowner, array_to_string(fdwacl::text[], ', ') as acl,
quote_ident(vp_nsp.nspname)||'.'||quote_ident(vp.proname) AS fdwvalue,
quote_ident(vh_nsp.nspname)||'.'||quote_ident(vh.proname) AS fdwhan
CASE
-- EPAS in redwood mode, concatenation of a string with NULL results as the original string
WHEN vp.proname IS NULL THEN NULL
ELSE quote_ident(vp_nsp.nspname)||'.'||quote_ident(vp.proname)
END fdwvalue,
CASE
-- EPAS in redwood mode, concatenation of a string with NULL results as the original string
WHEN vh.proname IS NULL THEN NULL
ELSE quote_ident(vh_nsp.nspname)||'.'||quote_ident(vh.proname)
END fdwhan
FROM pg_foreign_data_wrapper fdw
LEFT OUTER JOIN pg_proc vh on vh.oid=fdwhandler
LEFT OUTER JOIN pg_proc vp on vp.oid=fdwvalidator

View File

@@ -1,8 +1,16 @@
{# ============= Get all the properties of foreign data wrapper ============= #}
SELECT fdw.oid as fdwoid, fdwname as name, fdwhandler, fdwvalidator, description,
array_to_string(fdwoptions, ',') AS fdwoptions, pg_get_userbyid(fdwowner) as fdwowner, array_to_string(fdwacl::text[], ', ') as acl,
quote_ident(vp_nsp.nspname)||'.'||quote_ident(vp.proname) AS fdwvalue,
quote_ident(vh_nsp.nspname)||'.'||quote_ident(vh.proname) AS fdwhan
CASE
-- EPAS in redwood mode, concatenation of a string with NULL results as the original string
WHEN vp.proname IS NULL THEN NULL
ELSE quote_ident(vp_nsp.nspname)||'.'||quote_ident(vp.proname)
END fdwvalue,
CASE
-- EPAS in redwood mode, concatenation of a string with NULL results as the original string
WHEN vh.proname IS NULL THEN NULL
ELSE quote_ident(vh_nsp.nspname)||'.'||quote_ident(vh.proname)
END fdwhan
FROM pg_foreign_data_wrapper fdw
LEFT OUTER JOIN pg_proc vh on vh.oid=fdwhandler
LEFT OUTER JOIN pg_proc vp on vp.oid=fdwvalidator