Ensure the DROP statements in reverse engineered SQL are properly quoted for all objects. Fixes #4440

This commit is contained in:
Shubham Agarwal
2020-04-16 13:06:50 +05:30
committed by Akshay Joshi
parent 8254e9f030
commit d6cab7b421
18 changed files with 24 additions and 20 deletions

View File

@@ -32,6 +32,7 @@ Bug fixes
| `Issue #3988 <https://redmine.postgresql.org/issues/3988>`_ - Fixed cursor disappeared issue in the query editor for some of the characters when zoomed out.
| `Issue #4206 <https://redmine.postgresql.org/issues/4206>`_ - Ensure that the grant wizard should be closed on pressing the ESC key.
| `Issue #4292 <https://redmine.postgresql.org/issues/4292>`_ - Added dark mode support for the configuration dialog on Windows/macOS runtime.
| `Issue #4440 <https://redmine.postgresql.org/issues/4440>`_ - Ensure the DROP statements in reverse engineered SQL are properly quoted for all objects.
| `Issue #4445 <https://redmine.postgresql.org/issues/4445>`_ - Ensure all object names in the title line of the reverse-engineered SQL are not quoted.
| `Issue #4512 <https://redmine.postgresql.org/issues/4512>`_ - Fixed calendar opening issue on the exception tab inside the schedules tab of pgAgent.
| `Issue #4709 <https://redmine.postgresql.org/issues/4709>`_ - Added schema-qualified dictionary names in FTS configuration to avoid confusion of duplicate names.

View File

@@ -211,10 +211,12 @@ class ForeignDataWrapperView(PGChildNodeView):
def wrap(*args, **kwargs):
# Here args[0] will hold self & kwargs will hold gid,sid,did
self = args[0]
self.manager = get_driver(PG_DEFAULT_DRIVER).connection_manager(
driver = get_driver(PG_DEFAULT_DRIVER)
self.manager = driver.connection_manager(
kwargs['sid']
)
self.conn = self.manager.connection(did=kwargs['did'])
self.qtIdent = driver.qtIdent
# Set the template path for the SQL scripts
self.template_path = 'foreign_data_wrappers/sql/#{0}#'.format(
@@ -746,11 +748,12 @@ class ForeignDataWrapperView(PGChildNodeView):
)
sql += "\n"
sql_header = u"""-- Foreign Data Wrapper: {0}
sql_header = u"""-- Foreign Data Wrapper: {0}\n\n""".format(
res['rows'][0]['name'])
-- DROP FOREIGN DATA WRAPPER {0}
sql_header += """-- DROP FOREIGN DATA WRAPPER {0}
""".format(res['rows'][0]['name'])
""".format(self.qtIdent(self.conn, res['rows'][0]['name']))
sql = sql_header + sql

View File

@@ -1,6 +1,6 @@
-- Foreign Data Wrapper: Fdw1_$%{}[]()&*^!@"'`\/#
-- DROP FOREIGN DATA WRAPPER Fdw1_$%{}[]()&*^!@"'`\/#
-- DROP FOREIGN DATA WRAPPER "Fdw1_$%{}[]()&*^!@""'`\/#"
CREATE FOREIGN DATA WRAPPER "Fdw1_$%{}[]()&*^!@""'`\/#"
OPTIONS (opt1 'val1', opt2 'valopt2');

View File

@@ -1,6 +1,6 @@
-- Foreign Data Wrapper: Fdw1_$%{}[]()&*^!@"'`\/#
-- DROP FOREIGN DATA WRAPPER Fdw1_$%{}[]()&*^!@"'`\/#
-- DROP FOREIGN DATA WRAPPER "Fdw1_$%{}[]()&*^!@""'`\/#"
CREATE FOREIGN DATA WRAPPER "Fdw1_$%{}[]()&*^!@""'`\/#";

View File

@@ -1,6 +1,6 @@
-- Foreign Data Wrapper: Fdw1_$%{}[]()&*^!@"'`\/#
-- DROP FOREIGN DATA WRAPPER Fdw1_$%{}[]()&*^!@"'`\/#
-- DROP FOREIGN DATA WRAPPER "Fdw1_$%{}[]()&*^!@""'`\/#"
CREATE FOREIGN DATA WRAPPER "Fdw1_$%{}[]()&*^!@""'`\/#"
OPTIONS (opt1 'val1');

View File

@@ -1,6 +1,6 @@
-- Foreign Data Wrapper: Fdw1_$%{}[]()&*^!@"'`\/#
-- DROP FOREIGN DATA WRAPPER Fdw1_$%{}[]()&*^!@"'`\/#
-- DROP FOREIGN DATA WRAPPER "Fdw1_$%{}[]()&*^!@""'`\/#"
CREATE FOREIGN DATA WRAPPER "Fdw1_$%{}[]()&*^!@""'`\/#"
OPTIONS (opt1 'val1', opt2 'val2');

View File

@@ -1,6 +1,6 @@
-- Foreign Data Wrapper: Fdw2_$%{}[]()&*^!@"'`\/#
-- DROP FOREIGN DATA WRAPPER Fdw2_$%{}[]()&*^!@"'`\/#
-- DROP FOREIGN DATA WRAPPER "Fdw2_$%{}[]()&*^!@""'`\/#"
CREATE FOREIGN DATA WRAPPER "Fdw2_$%{}[]()&*^!@""'`\/#"
VALIDATOR pg_catalog.postgresql_fdw_validator

View File

@@ -1,6 +1,6 @@
-- Foreign Data Wrapper: Fdw2_$%{}[]()&*^!@"'`\/#
-- DROP FOREIGN DATA WRAPPER Fdw2_$%{}[]()&*^!@"'`\/#
-- DROP FOREIGN DATA WRAPPER "Fdw2_$%{}[]()&*^!@""'`\/#"
CREATE FOREIGN DATA WRAPPER "Fdw2_$%{}[]()&*^!@""'`\/#"
VALIDATOR pg_catalog.postgresql_fdw_validator

View File

@@ -1,6 +1,6 @@
-- Foreign Data Wrapper: Fdw1_$%{}[]()&*^!@"'`\/#
-- DROP FOREIGN DATA WRAPPER Fdw1_$%{}[]()&*^!@"'`\/#
-- DROP FOREIGN DATA WRAPPER "Fdw1_$%{}[]()&*^!@""'`\/#"
CREATE FOREIGN DATA WRAPPER "Fdw1_$%{}[]()&*^!@""'`\/#"
VALIDATOR pg_catalog.postgresql_fdw_validator

View File

@@ -1,6 +1,6 @@
-- Foreign Data Wrapper: Fdw1_$%{}[]()&*^!@"'`\/#
-- DROP FOREIGN DATA WRAPPER Fdw1_$%{}[]()&*^!@"'`\/#
-- DROP FOREIGN DATA WRAPPER "Fdw1_$%{}[]()&*^!@""'`\/#"
CREATE FOREIGN DATA WRAPPER "Fdw1_$%{}[]()&*^!@""'`\/#";

View File

@@ -1,6 +1,6 @@
-- Foreign Data Wrapper: Fdw1_$%{}[]()&*^!@"'`\/#
-- DROP FOREIGN DATA WRAPPER Fdw1_$%{}[]()&*^!@"'`\/#
-- DROP FOREIGN DATA WRAPPER "Fdw1_$%{}[]()&*^!@""'`\/#"
CREATE FOREIGN DATA WRAPPER "Fdw1_$%{}[]()&*^!@""'`\/#"
OPTIONS (opt1 'val1', opt2 'valopt2');

View File

@@ -1,6 +1,6 @@
-- Foreign Data Wrapper: Fdw1_$%{}[]()&*^!@"'`\/#
-- DROP FOREIGN DATA WRAPPER Fdw1_$%{}[]()&*^!@"'`\/#
-- DROP FOREIGN DATA WRAPPER "Fdw1_$%{}[]()&*^!@""'`\/#"
CREATE FOREIGN DATA WRAPPER "Fdw1_$%{}[]()&*^!@""'`\/#";

View File

@@ -1,6 +1,6 @@
-- Foreign Data Wrapper: Fdw1_$%{}[]()&*^!@"'`\/#
-- DROP FOREIGN DATA WRAPPER Fdw1_$%{}[]()&*^!@"'`\/#
-- DROP FOREIGN DATA WRAPPER "Fdw1_$%{}[]()&*^!@""'`\/#"
CREATE FOREIGN DATA WRAPPER "Fdw1_$%{}[]()&*^!@""'`\/#"
OPTIONS (opt1 'val1');

View File

@@ -1,6 +1,6 @@
-- Foreign Data Wrapper: Fdw1_$%{}[]()&*^!@"'`\/#
-- DROP FOREIGN DATA WRAPPER Fdw1_$%{}[]()&*^!@"'`\/#
-- DROP FOREIGN DATA WRAPPER "Fdw1_$%{}[]()&*^!@""'`\/#"
CREATE FOREIGN DATA WRAPPER "Fdw1_$%{}[]()&*^!@""'`\/#"
OPTIONS (opt1 'val1', opt2 'val2');

View File

@@ -1,6 +1,6 @@
-- Foreign Data Wrapper: Fdw2_$%{}[]()&*^!@"'`\/#
-- DROP FOREIGN DATA WRAPPER Fdw2_$%{}[]()&*^!@"'`\/#
-- DROP FOREIGN DATA WRAPPER "Fdw2_$%{}[]()&*^!@""'`\/#"
CREATE FOREIGN DATA WRAPPER "Fdw2_$%{}[]()&*^!@""'`\/#"
VALIDATOR pg_catalog.postgresql_fdw_validator

View File

@@ -1,6 +1,6 @@
-- Foreign Data Wrapper: Fdw2_$%{}[]()&*^!@"'`\/#
-- DROP FOREIGN DATA WRAPPER Fdw2_$%{}[]()&*^!@"'`\/#
-- DROP FOREIGN DATA WRAPPER "Fdw2_$%{}[]()&*^!@""'`\/#"
CREATE FOREIGN DATA WRAPPER "Fdw2_$%{}[]()&*^!@""'`\/#"
VALIDATOR pg_catalog.postgresql_fdw_validator

View File

@@ -1,6 +1,6 @@
-- Foreign Data Wrapper: Fdw1_$%{}[]()&*^!@"'`\/#
-- DROP FOREIGN DATA WRAPPER Fdw1_$%{}[]()&*^!@"'`\/#
-- DROP FOREIGN DATA WRAPPER "Fdw1_$%{}[]()&*^!@""'`\/#"
CREATE FOREIGN DATA WRAPPER "Fdw1_$%{}[]()&*^!@""'`\/#"
VALIDATOR pg_catalog.postgresql_fdw_validator

View File

@@ -1,6 +1,6 @@
-- Foreign Data Wrapper: Fdw1_$%{}[]()&*^!@"'`\/#
-- DROP FOREIGN DATA WRAPPER Fdw1_$%{}[]()&*^!@"'`\/#
-- DROP FOREIGN DATA WRAPPER "Fdw1_$%{}[]()&*^!@""'`\/#"
CREATE FOREIGN DATA WRAPPER "Fdw1_$%{}[]()&*^!@""'`\/#";