From 1a9d365c4283db3ee7985d77e1bb4797b1dc64e1 Mon Sep 17 00:00:00 2001 From: Akshay Joshi Date: Fri, 6 Dec 2019 19:01:55 +0530 Subject: [PATCH] Fix reverse engineering SQL issue where when clause is not visible for PG/EPAS 12. Fixes #4976. --- docs/en_US/release_notes_4_16.rst | 1 + .../tables/templates/triggers/sql/pg/10_plus/properties.sql | 2 +- .../tables/templates/triggers/sql/ppas/10_plus/properties.sql | 2 +- .../tables/templates/triggers/sql/ppas/12_plus/properties.sql | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/en_US/release_notes_4_16.rst b/docs/en_US/release_notes_4_16.rst index b250108e0..3135b42d4 100644 --- a/docs/en_US/release_notes_4_16.rst +++ b/docs/en_US/release_notes_4_16.rst @@ -51,6 +51,7 @@ Bug fixes | `Issue #4965 `_ - Fix an issue where the Interval data type is not displayed in the properties dialog of table/column. | `Issue #4966 `_ - Fix 'Could not find the object on the server.' error while refreshing the check constraint. | `Issue #4975 `_ - Fix issue where the user can not switch the UI language. It's a regression of #4348. +| `Issue #4976 `_ - Fix reverse engineering SQL issue where when clause is not visible for PG/EPAS 12. | `Issue #4978 `_ - Fix pgAdmin4 failed to start issue after upgrading to version 4.15. | `Issue #4985 `_ - Fix an issue where the inherited table name with quotes did not escape correctly. | `Issue #4991 `_ - Fix an issue where context menu is open along with submenu and the focus is not on context menu or submenu. diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/triggers/sql/pg/10_plus/properties.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/triggers/sql/pg/10_plus/properties.sql index d6500f3a1..2ba0eae17 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/triggers/sql/pg/10_plus/properties.sql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/triggers/sql/pg/10_plus/properties.sql @@ -1,6 +1,6 @@ SELECT t.oid,t.tgname AS name, t.xmin, t.tgenabled AS is_enable_trigger, 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'), + COALESCE(substring(pg_get_triggerdef(t.oid), 'WHEN (.*) EXECUTE (PROCEDURE|FUNCTION)'), 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, diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/triggers/sql/ppas/10_plus/properties.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/triggers/sql/ppas/10_plus/properties.sql index d6500f3a1..2ba0eae17 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/triggers/sql/ppas/10_plus/properties.sql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/triggers/sql/ppas/10_plus/properties.sql @@ -1,6 +1,6 @@ SELECT t.oid,t.tgname AS name, t.xmin, t.tgenabled AS is_enable_trigger, 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'), + COALESCE(substring(pg_get_triggerdef(t.oid), 'WHEN (.*) EXECUTE (PROCEDURE|FUNCTION)'), 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, diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/triggers/sql/ppas/12_plus/properties.sql b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/triggers/sql/ppas/12_plus/properties.sql index b9da5d1d9..d4ef8efc8 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/triggers/sql/ppas/12_plus/properties.sql +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/templates/triggers/sql/ppas/12_plus/properties.sql @@ -1,6 +1,6 @@ SELECT t.oid,t.tgname AS name, t.xmin, t.tgenabled AS is_enable_trigger, 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'), + COALESCE(substring(pg_get_triggerdef(t.oid), 'WHEN (.*) EXECUTE (PROCEDURE|FUNCTION)'), 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,