diff options
| author | Peter Eisentraut | 2019-12-20 07:25:43 +0000 |
|---|---|---|
| committer | Peter Eisentraut | 2019-12-20 07:27:37 +0000 |
| commit | df7fe9e2d707da69a4437fb6f9e695c070882160 (patch) | |
| tree | 75db38ed1676d8c4323a9f11bc6ef977d212c328 /src/test/modules | |
| parent | 8c6d30f211390df911072d33f0114a31f066a4cd (diff) | |
Disallow dropping rules on system tables by default
This was previously not covered by allow_system_table_mods, but now it
is. The impact in practice is probably low, but this makes it
consistent with most other DDL commands.
Reviewed-by: Robert Haas <robertmhaas@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/ee9df1af-c0d8-7c82-5be7-39ce4e3b0a9d%402ndquadrant.com
Diffstat (limited to 'src/test/modules')
| -rw-r--r-- | src/test/modules/unsafe_tests/expected/alter_system_table.out | 11 | ||||
| -rw-r--r-- | src/test/modules/unsafe_tests/sql/alter_system_table.sql | 10 |
2 files changed, 19 insertions, 2 deletions
diff --git a/src/test/modules/unsafe_tests/expected/alter_system_table.out b/src/test/modules/unsafe_tests/expected/alter_system_table.out index ca7eabe9bbc..ecd1505cdcd 100644 --- a/src/test/modules/unsafe_tests/expected/alter_system_table.out +++ b/src/test/modules/unsafe_tests/expected/alter_system_table.out @@ -81,7 +81,16 @@ CREATE RULE r1 AS ON INSERT TO pg_description DO INSTEAD NOTHING; ERROR: permission denied: "pg_description" is a system catalog ALTER RULE r1 ON pg_description RENAME TO r2; ERROR: permission denied: "pg_description" is a system catalog ---DROP RULE r2 ON pg_description; +-- now make one to test dropping: +SET allow_system_table_mods TO on; +CREATE RULE r2 AS ON INSERT TO pg_description DO INSTEAD NOTHING; +RESET allow_system_table_mods; +DROP RULE r2 ON pg_description; +ERROR: permission denied: "pg_description" is a system catalog +-- cleanup: +SET allow_system_table_mods TO on; +DROP RULE r2 ON pg_description; +RESET allow_system_table_mods; SET allow_system_table_mods = on; -- create new table in pg_catalog BEGIN; diff --git a/src/test/modules/unsafe_tests/sql/alter_system_table.sql b/src/test/modules/unsafe_tests/sql/alter_system_table.sql index 44cb3c7148a..5663570d312 100644 --- a/src/test/modules/unsafe_tests/sql/alter_system_table.sql +++ b/src/test/modules/unsafe_tests/sql/alter_system_table.sql @@ -79,7 +79,15 @@ ALTER TRIGGER t1 ON pg_description RENAME TO t2; -- rules CREATE RULE r1 AS ON INSERT TO pg_description DO INSTEAD NOTHING; ALTER RULE r1 ON pg_description RENAME TO r2; ---DROP RULE r2 ON pg_description; +-- now make one to test dropping: +SET allow_system_table_mods TO on; +CREATE RULE r2 AS ON INSERT TO pg_description DO INSTEAD NOTHING; +RESET allow_system_table_mods; +DROP RULE r2 ON pg_description; +-- cleanup: +SET allow_system_table_mods TO on; +DROP RULE r2 ON pg_description; +RESET allow_system_table_mods; SET allow_system_table_mods = on; |
