mirror of
https://github.com/timescale/timescaledb.git
synced 2025-05-17 02:53:51 +08:00
Allow DROP CONSTRAINT on compressed hypertables
Removing constraints is always safe so there is no reason to block it on compressed hypertables. Adding constraints is still blocked for compressed hypertables as verifying of constraints currently requires decompressed hypertable.
This commit is contained in:
parent
67ad085d18
commit
3bb331860d
1
.unreleased/pr_6754
Normal file
1
.unreleased/pr_6754
Normal file
@ -0,0 +1 @@
|
|||||||
|
Implements: #6754 Allow DROP CONSTRAINT on compressed hypertables
|
@ -250,10 +250,11 @@ check_alter_table_allowed_on_ht_with_compression(Hypertable *ht, AlterTableStmt
|
|||||||
/* this is passed down in `process_altertable_change_owner` */
|
/* this is passed down in `process_altertable_change_owner` */
|
||||||
case AT_SetTableSpace:
|
case AT_SetTableSpace:
|
||||||
/* this is passed down in `process_altertable_set_tablespace_end` */
|
/* this is passed down in `process_altertable_set_tablespace_end` */
|
||||||
case AT_SetStatistics: /* should this be pushed down in some way? */
|
case AT_SetStatistics: /* should this be pushed down in some way? */
|
||||||
case AT_AddColumn: /* this is passed down */
|
case AT_AddColumn: /* this is passed down */
|
||||||
case AT_ColumnDefault: /* this is passed down */
|
case AT_ColumnDefault: /* this is passed down */
|
||||||
case AT_DropColumn: /* this is passed down */
|
case AT_DropColumn: /* this is passed down */
|
||||||
|
case AT_DropConstraint: /* this is passed down */
|
||||||
#if PG14_GE
|
#if PG14_GE
|
||||||
case AT_ReAddStatistics:
|
case AT_ReAddStatistics:
|
||||||
case AT_SetCompression:
|
case AT_SetCompression:
|
||||||
|
@ -208,8 +208,10 @@ ALTER TABLE foo ADD CONSTRAINT chk CHECK(b > 0);
|
|||||||
ERROR: operation not supported on hypertables that have compression enabled
|
ERROR: operation not supported on hypertables that have compression enabled
|
||||||
ALTER TABLE foo ADD CONSTRAINT chk UNIQUE(b);
|
ALTER TABLE foo ADD CONSTRAINT chk UNIQUE(b);
|
||||||
ERROR: operation not supported on hypertables that have compression enabled
|
ERROR: operation not supported on hypertables that have compression enabled
|
||||||
|
--should succeed
|
||||||
|
BEGIN;
|
||||||
ALTER TABLE foo DROP CONSTRAINT chk_existing;
|
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)
|
--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;
|
SELECT * FROM _timescaledb_catalog.compression_settings WHERE relid = 'foo'::regclass;
|
||||||
relid | segmentby | orderby | orderby_desc | orderby_nullsfirst
|
relid | segmentby | orderby | orderby_desc | orderby_nullsfirst
|
||||||
|
@ -208,8 +208,10 @@ ALTER TABLE foo ADD CONSTRAINT chk CHECK(b > 0);
|
|||||||
ERROR: operation not supported on hypertables that have compression enabled
|
ERROR: operation not supported on hypertables that have compression enabled
|
||||||
ALTER TABLE foo ADD CONSTRAINT chk UNIQUE(b);
|
ALTER TABLE foo ADD CONSTRAINT chk UNIQUE(b);
|
||||||
ERROR: operation not supported on hypertables that have compression enabled
|
ERROR: operation not supported on hypertables that have compression enabled
|
||||||
|
--should succeed
|
||||||
|
BEGIN;
|
||||||
ALTER TABLE foo DROP CONSTRAINT chk_existing;
|
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)
|
--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;
|
SELECT * FROM _timescaledb_catalog.compression_settings WHERE relid = 'foo'::regclass;
|
||||||
relid | segmentby | orderby | orderby_desc | orderby_nullsfirst
|
relid | segmentby | orderby | orderby_desc | orderby_nullsfirst
|
||||||
|
@ -208,8 +208,10 @@ ALTER TABLE foo ADD CONSTRAINT chk CHECK(b > 0);
|
|||||||
ERROR: operation not supported on hypertables that have compression enabled
|
ERROR: operation not supported on hypertables that have compression enabled
|
||||||
ALTER TABLE foo ADD CONSTRAINT chk UNIQUE(b);
|
ALTER TABLE foo ADD CONSTRAINT chk UNIQUE(b);
|
||||||
ERROR: operation not supported on hypertables that have compression enabled
|
ERROR: operation not supported on hypertables that have compression enabled
|
||||||
|
--should succeed
|
||||||
|
BEGIN;
|
||||||
ALTER TABLE foo DROP CONSTRAINT chk_existing;
|
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)
|
--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;
|
SELECT * FROM _timescaledb_catalog.compression_settings WHERE relid = 'foo'::regclass;
|
||||||
relid | segmentby | orderby | orderby_desc | orderby_nullsfirst
|
relid | segmentby | orderby | orderby_desc | orderby_nullsfirst
|
||||||
|
@ -208,8 +208,10 @@ ALTER TABLE foo ADD CONSTRAINT chk CHECK(b > 0);
|
|||||||
ERROR: operation not supported on hypertables that have compression enabled
|
ERROR: operation not supported on hypertables that have compression enabled
|
||||||
ALTER TABLE foo ADD CONSTRAINT chk UNIQUE(b);
|
ALTER TABLE foo ADD CONSTRAINT chk UNIQUE(b);
|
||||||
ERROR: operation not supported on hypertables that have compression enabled
|
ERROR: operation not supported on hypertables that have compression enabled
|
||||||
|
--should succeed
|
||||||
|
BEGIN;
|
||||||
ALTER TABLE foo DROP CONSTRAINT chk_existing;
|
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)
|
--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;
|
SELECT * FROM _timescaledb_catalog.compression_settings WHERE relid = 'foo'::regclass;
|
||||||
relid | segmentby | orderby | orderby_desc | orderby_nullsfirst
|
relid | segmentby | orderby | orderby_desc | orderby_nullsfirst
|
||||||
|
@ -112,7 +112,11 @@ ALTER TABLE foo ALTER COLUMN t SET NOT NULL;
|
|||||||
ALTER TABLE foo RESET (timescaledb.compress);
|
ALTER TABLE foo RESET (timescaledb.compress);
|
||||||
ALTER TABLE foo ADD CONSTRAINT chk CHECK(b > 0);
|
ALTER TABLE foo ADD CONSTRAINT chk CHECK(b > 0);
|
||||||
ALTER TABLE foo ADD CONSTRAINT chk UNIQUE(b);
|
ALTER TABLE foo ADD CONSTRAINT chk UNIQUE(b);
|
||||||
|
|
||||||
|
--should succeed
|
||||||
|
BEGIN;
|
||||||
ALTER TABLE foo DROP CONSTRAINT chk_existing;
|
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)
|
--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;
|
SELECT * FROM _timescaledb_catalog.compression_settings WHERE relid = 'foo'::regclass;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user