Avoid an exception on GreenPlum when retrieving RE-SQL on a table. Fixes #3409
parent
a6ee27cf25
commit
226c872a84
|
@ -34,4 +34,5 @@ Bug fixes
|
||||||
| `Bug #3333 <https://redmine.postgresql.org/issues/3333>`_ - Ensure the runtime core application is setup before trying to access any settings
|
| `Bug #3333 <https://redmine.postgresql.org/issues/3333>`_ - Ensure the runtime core application is setup before trying to access any settings
|
||||||
| `Bug #3342 <https://redmine.postgresql.org/issues/3342>`_ - Set SESSION_COOKIE_SAMESITE='Lax' per Flask recommendation to prevents sending cookies with CSRF-prone requests from external sites, such as submitting a form
|
| `Bug #3342 <https://redmine.postgresql.org/issues/3342>`_ - Set SESSION_COOKIE_SAMESITE='Lax' per Flask recommendation to prevents sending cookies with CSRF-prone requests from external sites, such as submitting a form
|
||||||
| `Bug #3353 <https://redmine.postgresql.org/issues/3353>`_ - Handle errors properly if they occur when renaming a database
|
| `Bug #3353 <https://redmine.postgresql.org/issues/3353>`_ - Handle errors properly if they occur when renaming a database
|
||||||
| `Bug #3392 <https://redmine.postgresql.org/issues/3392>`_ - Fix IPv6 support in the container build.
|
| `Bug #3392 <https://redmine.postgresql.org/issues/3392>`_ - Fix IPv6 support in the container build.
|
||||||
|
| `Bug #3409 <https://redmine.postgresql.org/issues/3409>`_ - Avoid an exception on GreenPlum when retrieving RE-SQL on a table.
|
|
@ -0,0 +1,23 @@
|
||||||
|
SELECT t.oid,t.tgname AS name, t.xmin, t.*, relname, CASE WHEN relkind = 'r' THEN TRUE ELSE FALSE END AS parentistable,
|
||||||
|
nspname, des.description, l.lanname, p.prosrc, p.proname AS tfunction,
|
||||||
|
COALESCE(substring(pg_get_triggerdef(t.oid), 'WHEN (.*) EXECUTE PROCEDURE'),
|
||||||
|
substring(pg_get_triggerdef(t.oid), 'WHEN (.*) \\$trigger')) AS whenclause,
|
||||||
|
-- We need to convert tgargs column bytea datatype to array datatype
|
||||||
|
(string_to_array(encode(tgargs, 'escape'), E'\\000')::text[])[1:tgnargs] AS custom_tgargs,
|
||||||
|
{% if datlastsysoid %}
|
||||||
|
(CASE WHEN t.oid <= {{ datlastsysoid}}::oid THEN true ElSE false END) AS is_sys_trigger,
|
||||||
|
{% endif %}
|
||||||
|
(CASE WHEN tgconstraint != 0::OID THEN true ElSE false END) AS is_constraint_trigger,
|
||||||
|
(CASE WHEN tgenabled = 'O' THEN true ElSE false END) AS is_enable_trigger
|
||||||
|
FROM pg_trigger t
|
||||||
|
JOIN pg_class cl ON cl.oid=tgrelid
|
||||||
|
JOIN pg_namespace na ON na.oid=relnamespace
|
||||||
|
LEFT OUTER JOIN pg_description des ON (des.objoid=t.oid AND des.classoid='pg_trigger'::regclass)
|
||||||
|
LEFT OUTER JOIN pg_proc p ON p.oid=t.tgfoid
|
||||||
|
LEFT OUTER JOIN pg_language l ON l.oid=p.prolang
|
||||||
|
WHERE NOT tgisinternal
|
||||||
|
AND tgrelid = {{tid}}::OID
|
||||||
|
{% if trid %}
|
||||||
|
AND t.oid = {{trid}}::OID
|
||||||
|
{% endif %}
|
||||||
|
ORDER BY tgname;
|
|
@ -1,23 +1 @@
|
||||||
SELECT t.oid,t.tgname AS name, t.xmin, t.*, relname, CASE WHEN relkind = 'r' THEN TRUE ELSE FALSE END AS parentistable,
|
SELECT 1 WHERE 1 = 2;
|
||||||
nspname, des.description, l.lanname, p.prosrc, p.proname AS tfunction,
|
|
||||||
COALESCE(substring(pg_get_triggerdef(t.oid), 'WHEN (.*) EXECUTE PROCEDURE'),
|
|
||||||
substring(pg_get_triggerdef(t.oid), 'WHEN (.*) \\$trigger')) AS whenclause,
|
|
||||||
-- We need to convert tgargs column bytea datatype to array datatype
|
|
||||||
(string_to_array(encode(tgargs, 'escape'), E'\\000')::text[])[1:tgnargs] AS custom_tgargs,
|
|
||||||
{% if datlastsysoid %}
|
|
||||||
(CASE WHEN t.oid <= {{ datlastsysoid}}::oid THEN true ElSE false END) AS is_sys_trigger,
|
|
||||||
{% endif %}
|
|
||||||
(CASE WHEN tgconstraint != 0::OID THEN true ElSE false END) AS is_constraint_trigger,
|
|
||||||
(CASE WHEN tgenabled = 'O' THEN true ElSE false END) AS is_enable_trigger
|
|
||||||
FROM pg_trigger t
|
|
||||||
JOIN pg_class cl ON cl.oid=tgrelid
|
|
||||||
JOIN pg_namespace na ON na.oid=relnamespace
|
|
||||||
LEFT OUTER JOIN pg_description des ON (des.objoid=t.oid AND des.classoid='pg_trigger'::regclass)
|
|
||||||
LEFT OUTER JOIN pg_proc p ON p.oid=t.tgfoid
|
|
||||||
LEFT OUTER JOIN pg_language l ON l.oid=p.prolang
|
|
||||||
WHERE NOT tgisinternal
|
|
||||||
AND tgrelid = {{tid}}::OID
|
|
||||||
{% if trid %}
|
|
||||||
AND t.oid = {{trid}}::OID
|
|
||||||
{% endif %}
|
|
||||||
ORDER BY tgname;
|
|
||||||
|
|
|
@ -1003,6 +1003,8 @@ class BaseTableView(PGChildNodeView, BasePartitionTable):
|
||||||
if not status:
|
if not status:
|
||||||
return internal_server_error(errormsg=res)
|
return internal_server_error(errormsg=res)
|
||||||
|
|
||||||
|
if len(res['rows']) == 0:
|
||||||
|
continue
|
||||||
data = dict(res['rows'][0])
|
data = dict(res['rows'][0])
|
||||||
# Adding parent into data dict, will be using it while creating sql
|
# Adding parent into data dict, will be using it while creating sql
|
||||||
data['schema'] = schema
|
data['schema'] = schema
|
||||||
|
|
Loading…
Reference in New Issue