Skip to content

Commit 7db01fb

Browse files
committed
Test that it works to RESET an invalid reloption
This works today, and it's valuable to ensure it doesn't get broken if/when we get around to refactoring the implementation. Author: Nikolay Shaplov <dhyan@nataraj.su> Discussion: https://postgr.es/m/4563991.km65PDbjlG@thinkpad-pgpro
1 parent b31ba53 commit 7db01fb

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

src/test/regress/expected/reloptions.out

+11
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,17 @@ SELECT reloptions FROM pg_class WHERE oid = 'reloptions_test'::regclass AND
8787
-- RESET fails if a value is specified
8888
ALTER TABLE reloptions_test RESET (fillfactor=12);
8989
ERROR: RESET must not include values for parameters
90+
-- We can RESET an invalid option which for some reason is already set
91+
UPDATE pg_class
92+
SET reloptions = '{fillfactor=13,autovacuum_enabled=false,illegal_option=4}'
93+
WHERE oid = 'reloptions_test'::regclass;
94+
ALTER TABLE reloptions_test RESET (illegal_option);
95+
SELECT reloptions FROM pg_class WHERE oid = 'reloptions_test'::regclass;
96+
reloptions
97+
------------------------------------------
98+
{fillfactor=13,autovacuum_enabled=false}
99+
(1 row)
100+
90101
-- Test vacuum_truncate option
91102
DROP TABLE reloptions_test;
92103
CREATE TEMP TABLE reloptions_test(i INT NOT NULL, j text)

src/test/regress/sql/reloptions.sql

+7
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,13 @@ SELECT reloptions FROM pg_class WHERE oid = 'reloptions_test'::regclass AND
5252
-- RESET fails if a value is specified
5353
ALTER TABLE reloptions_test RESET (fillfactor=12);
5454

55+
-- We can RESET an invalid option which for some reason is already set
56+
UPDATE pg_class
57+
SET reloptions = '{fillfactor=13,autovacuum_enabled=false,illegal_option=4}'
58+
WHERE oid = 'reloptions_test'::regclass;
59+
ALTER TABLE reloptions_test RESET (illegal_option);
60+
SELECT reloptions FROM pg_class WHERE oid = 'reloptions_test'::regclass;
61+
5562
-- Test vacuum_truncate option
5663
DROP TABLE reloptions_test;
5764

0 commit comments

Comments
 (0)