diff --git a/.unreleased/pr_6754 b/.unreleased/pr_6754 new file mode 100644 index 000000000..b1d7d1569 --- /dev/null +++ b/.unreleased/pr_6754 @@ -0,0 +1 @@ +Implements: #6754 Allow DROP CONSTRAINT on compressed hypertables diff --git a/src/process_utility.c b/src/process_utility.c index a50bc8d0d..bd7140df4 100644 --- a/src/process_utility.c +++ b/src/process_utility.c @@ -250,10 +250,11 @@ check_alter_table_allowed_on_ht_with_compression(Hypertable *ht, AlterTableStmt /* this is passed down in `process_altertable_change_owner` */ case AT_SetTableSpace: /* this is passed down in `process_altertable_set_tablespace_end` */ - case AT_SetStatistics: /* should this be pushed down in some way? */ - case AT_AddColumn: /* this is passed down */ - case AT_ColumnDefault: /* this is passed down */ - case AT_DropColumn: /* this is passed down */ + case AT_SetStatistics: /* should this be pushed down in some way? */ + case AT_AddColumn: /* this is passed down */ + case AT_ColumnDefault: /* this is passed down */ + case AT_DropColumn: /* this is passed down */ + case AT_DropConstraint: /* this is passed down */ #if PG14_GE case AT_ReAddStatistics: case AT_SetCompression: diff --git a/tsl/test/expected/compression_errors-13.out b/tsl/test/expected/compression_errors-13.out index 06b046f9c..fd931ce00 100644 --- a/tsl/test/expected/compression_errors-13.out +++ b/tsl/test/expected/compression_errors-13.out @@ -208,8 +208,10 @@ ALTER TABLE foo ADD CONSTRAINT chk CHECK(b > 0); ERROR: operation not supported on hypertables that have compression enabled ALTER TABLE foo ADD CONSTRAINT chk UNIQUE(b); ERROR: operation not supported on hypertables that have compression enabled +--should succeed +BEGIN; ALTER TABLE foo DROP CONSTRAINT chk_existing; -ERROR: operation not supported on hypertables that have compression enabled +ROLLBACK; --note that the time column "a" should not be added to the end of the order by list again (should appear first) SELECT * FROM _timescaledb_catalog.compression_settings WHERE relid = 'foo'::regclass; relid | segmentby | orderby | orderby_desc | orderby_nullsfirst diff --git a/tsl/test/expected/compression_errors-14.out b/tsl/test/expected/compression_errors-14.out index 06b046f9c..fd931ce00 100644 --- a/tsl/test/expected/compression_errors-14.out +++ b/tsl/test/expected/compression_errors-14.out @@ -208,8 +208,10 @@ ALTER TABLE foo ADD CONSTRAINT chk CHECK(b > 0); ERROR: operation not supported on hypertables that have compression enabled ALTER TABLE foo ADD CONSTRAINT chk UNIQUE(b); ERROR: operation not supported on hypertables that have compression enabled +--should succeed +BEGIN; ALTER TABLE foo DROP CONSTRAINT chk_existing; -ERROR: operation not supported on hypertables that have compression enabled +ROLLBACK; --note that the time column "a" should not be added to the end of the order by list again (should appear first) SELECT * FROM _timescaledb_catalog.compression_settings WHERE relid = 'foo'::regclass; relid | segmentby | orderby | orderby_desc | orderby_nullsfirst diff --git a/tsl/test/expected/compression_errors-15.out b/tsl/test/expected/compression_errors-15.out index 06b046f9c..fd931ce00 100644 --- a/tsl/test/expected/compression_errors-15.out +++ b/tsl/test/expected/compression_errors-15.out @@ -208,8 +208,10 @@ ALTER TABLE foo ADD CONSTRAINT chk CHECK(b > 0); ERROR: operation not supported on hypertables that have compression enabled ALTER TABLE foo ADD CONSTRAINT chk UNIQUE(b); ERROR: operation not supported on hypertables that have compression enabled +--should succeed +BEGIN; ALTER TABLE foo DROP CONSTRAINT chk_existing; -ERROR: operation not supported on hypertables that have compression enabled +ROLLBACK; --note that the time column "a" should not be added to the end of the order by list again (should appear first) SELECT * FROM _timescaledb_catalog.compression_settings WHERE relid = 'foo'::regclass; relid | segmentby | orderby | orderby_desc | orderby_nullsfirst diff --git a/tsl/test/expected/compression_errors-16.out b/tsl/test/expected/compression_errors-16.out index afd3dd9a4..15050c2b9 100644 --- a/tsl/test/expected/compression_errors-16.out +++ b/tsl/test/expected/compression_errors-16.out @@ -208,8 +208,10 @@ ALTER TABLE foo ADD CONSTRAINT chk CHECK(b > 0); ERROR: operation not supported on hypertables that have compression enabled ALTER TABLE foo ADD CONSTRAINT chk UNIQUE(b); ERROR: operation not supported on hypertables that have compression enabled +--should succeed +BEGIN; ALTER TABLE foo DROP CONSTRAINT chk_existing; -ERROR: operation not supported on hypertables that have compression enabled +ROLLBACK; --note that the time column "a" should not be added to the end of the order by list again (should appear first) SELECT * FROM _timescaledb_catalog.compression_settings WHERE relid = 'foo'::regclass; relid | segmentby | orderby | orderby_desc | orderby_nullsfirst diff --git a/tsl/test/sql/compression_errors.sql.in b/tsl/test/sql/compression_errors.sql.in index a81f2b8fd..6a70f3c3d 100644 --- a/tsl/test/sql/compression_errors.sql.in +++ b/tsl/test/sql/compression_errors.sql.in @@ -112,7 +112,11 @@ ALTER TABLE foo ALTER COLUMN t SET NOT NULL; ALTER TABLE foo RESET (timescaledb.compress); ALTER TABLE foo ADD CONSTRAINT chk CHECK(b > 0); ALTER TABLE foo ADD CONSTRAINT chk UNIQUE(b); + +--should succeed +BEGIN; ALTER TABLE foo DROP CONSTRAINT chk_existing; +ROLLBACK; --note that the time column "a" should not be added to the end of the order by list again (should appear first) SELECT * FROM _timescaledb_catalog.compression_settings WHERE relid = 'foo'::regclass;