timescaledb/test/sql/reloptions.sql
Dmitry Simonenko 8ca17e704c Fix ALTER TABLE SET with normal tables
Running ALTER TABLE SET with multiple SET clauses on a regular PostgreSQL table
produces irrelevant error when timescaledb extension is installed.

Fix #5641
2023-05-04 16:32:25 +03:00

36 lines
1.3 KiB
SQL

-- This file and its contents are licensed under the Apache License 2.0.
-- Please see the included NOTICE for copyright information and
-- LICENSE-APACHE for a copy of the license.
CREATE TABLE reloptions_test(time integer, temp float8, color integer)
WITH (fillfactor=75, autovacuum_vacuum_threshold=100);
SELECT create_hypertable('reloptions_test', 'time', chunk_time_interval => 3);
INSERT INTO reloptions_test VALUES (4, 24.3, 1), (9, 13.3, 2);
-- Show that reloptions are inherited by chunks
SELECT relname, reloptions FROM pg_class
WHERE relname ~ '^_hyper.*' AND relkind = 'r';
-- Alter reloptions
ALTER TABLE reloptions_test SET (fillfactor=80, parallel_workers=8);
\set ON_ERROR_STOP 0
ALTER TABLE reloptions_test SET (fillfactor=80), SET (parallel_workers=8);
\set ON_ERROR_STOP 1
SELECT relname, reloptions FROM pg_class
WHERE relname ~ '^_hyper.*' AND relkind = 'r';
ALTER TABLE reloptions_test RESET (fillfactor);
SELECT relname, reloptions FROM pg_class
WHERE relname ~ '^_hyper.*' AND relkind = 'r';
-- Test reloptions on a regular table
CREATE TABLE reloptions_test2(time integer, temp float8, color integer);
ALTER TABLE reloptions_test2 SET (fillfactor=80, parallel_workers=8);
ALTER TABLE reloptions_test2 SET (fillfactor=80), SET (parallel_workers=8);
DROP TABLE reloptions_test2;