mirror of https://github.com/citusdata/citus.git
Adds propagation of ALTER TABLE .. ALTER COLUMN .. SET COMPRESSION ..
parent
902af39a04
commit
e1f5520e1a
|
@ -2445,12 +2445,16 @@ ErrorIfUnsupportedAlterTableStmt(AlterTableStmt *alterTableStatement)
|
||||||
case AT_ReplicaIdentity:
|
case AT_ReplicaIdentity:
|
||||||
case AT_ValidateConstraint:
|
case AT_ValidateConstraint:
|
||||||
case AT_DropConstraint: /* we do the check for invalidation in AlterTableDropsForeignKey */
|
case AT_DropConstraint: /* we do the check for invalidation in AlterTableDropsForeignKey */
|
||||||
|
#if PG_VERSION_NUM >= PG_VERSION_14
|
||||||
|
case AT_SetCompression:
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* We will not perform any special check for:
|
* We will not perform any special check for:
|
||||||
* ALTER TABLE .. ALTER COLUMN .. SET NOT NULL
|
* ALTER TABLE .. ALTER COLUMN .. SET NOT NULL
|
||||||
* ALTER TABLE .. REPLICA IDENTITY ..
|
* ALTER TABLE .. REPLICA IDENTITY ..
|
||||||
* ALTER TABLE .. VALIDATE CONSTRAINT ..
|
* ALTER TABLE .. VALIDATE CONSTRAINT ..
|
||||||
|
* ALTER TABLE .. ALTER COLUMN .. SET COMPRESSION ..
|
||||||
*/
|
*/
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -219,13 +219,54 @@ CALL citus_cleanup_orphaned_shards();
|
||||||
NOTICE: cleaned up 1 orphaned shards
|
NOTICE: cleaned up 1 orphaned shards
|
||||||
SELECT result AS column_compression FROM run_command_on_workers($$SELECT ARRAY(
|
SELECT result AS column_compression FROM run_command_on_workers($$SELECT ARRAY(
|
||||||
SELECT attname || ' ' || attcompression FROM pg_attribute WHERE attrelid::regclass::text LIKE 'pg14.col\_compression%' AND attnum > 0 ORDER BY 1
|
SELECT attname || ' ' || attcompression FROM pg_attribute WHERE attrelid::regclass::text LIKE 'pg14.col\_compression%' AND attnum > 0 ORDER BY 1
|
||||||
)$$) ORDER BY length(result);
|
)$$);
|
||||||
column_compression
|
column_compression
|
||||||
---------------------------------------------------------------------
|
---------------------------------------------------------------------
|
||||||
{"a p","a p","b ","b "}
|
{"a p","a p","b ","b "}
|
||||||
{"a p","a p","b ","b "}
|
{"a p","a p","b ","b "}
|
||||||
(2 rows)
|
(2 rows)
|
||||||
|
|
||||||
|
-- test propagation of ALTER TABLE .. ALTER COLUMN .. SET COMPRESSION ..
|
||||||
|
ALTER TABLE col_compression ALTER COLUMN b SET COMPRESSION pglz;
|
||||||
|
ALTER TABLE col_compression ALTER COLUMN a SET COMPRESSION default;
|
||||||
|
SELECT result AS column_compression FROM run_command_on_workers($$SELECT ARRAY(
|
||||||
|
SELECT attname || ' ' || attcompression FROM pg_attribute WHERE attrelid::regclass::text LIKE 'pg14.col\_compression%' AND attnum > 0 ORDER BY 1
|
||||||
|
)$$);
|
||||||
|
column_compression
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
{"a ","a ","b p","b p"}
|
||||||
|
{"a ","a ","b p","b p"}
|
||||||
|
(2 rows)
|
||||||
|
|
||||||
|
-- test propagation of ALTER TABLE .. ADD COLUMN .. COMPRESSION ..
|
||||||
|
ALTER TABLE col_compression ADD COLUMN c TEXT COMPRESSION pglz;
|
||||||
|
SELECT result AS column_compression FROM run_command_on_workers($$SELECT ARRAY(
|
||||||
|
SELECT attname || ' ' || attcompression FROM pg_attribute WHERE attrelid::regclass::text LIKE 'pg14.col\_compression%' AND attnum > 0 ORDER BY 1
|
||||||
|
)$$);
|
||||||
|
column_compression
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
{"a ","a ","b p","b p","c p","c p"}
|
||||||
|
{"a ","a ","b p","b p","c p","c p"}
|
||||||
|
(2 rows)
|
||||||
|
|
||||||
|
-- test attaching to a partitioned table with column compression
|
||||||
|
CREATE TABLE col_comp_par (a TEXT COMPRESSION pglz, b TEXT) PARTITION BY RANGE (a);
|
||||||
|
SELECT create_distributed_table('col_comp_par', 'a');
|
||||||
|
create_distributed_table
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
CREATE TABLE col_comp_par_1 PARTITION OF col_comp_par FOR VALUES FROM ('abc') TO ('def');
|
||||||
|
SELECT result AS column_compression FROM run_command_on_workers($$SELECT ARRAY(
|
||||||
|
SELECT attname || ' ' || attcompression FROM pg_attribute WHERE attrelid::regclass::text LIKE 'pg14.col\_comp\_par\_1\_%' AND attnum > 0 ORDER BY 1
|
||||||
|
)$$);
|
||||||
|
column_compression
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
{"a p","b "}
|
||||||
|
{"a p","b "}
|
||||||
|
(2 rows)
|
||||||
|
|
||||||
RESET citus.multi_shard_modify_mode;
|
RESET citus.multi_shard_modify_mode;
|
||||||
-- test procedure OUT parameters with procedure pushdown
|
-- test procedure OUT parameters with procedure pushdown
|
||||||
CREATE TABLE test_proc_table (a int);
|
CREATE TABLE test_proc_table (a int);
|
||||||
|
|
|
@ -77,7 +77,30 @@ SELECT rebalance_table_shards('col_compression', rebalance_strategy := 'by_shard
|
||||||
CALL citus_cleanup_orphaned_shards();
|
CALL citus_cleanup_orphaned_shards();
|
||||||
SELECT result AS column_compression FROM run_command_on_workers($$SELECT ARRAY(
|
SELECT result AS column_compression FROM run_command_on_workers($$SELECT ARRAY(
|
||||||
SELECT attname || ' ' || attcompression FROM pg_attribute WHERE attrelid::regclass::text LIKE 'pg14.col\_compression%' AND attnum > 0 ORDER BY 1
|
SELECT attname || ' ' || attcompression FROM pg_attribute WHERE attrelid::regclass::text LIKE 'pg14.col\_compression%' AND attnum > 0 ORDER BY 1
|
||||||
)$$) ORDER BY length(result);
|
)$$);
|
||||||
|
|
||||||
|
-- test propagation of ALTER TABLE .. ALTER COLUMN .. SET COMPRESSION ..
|
||||||
|
ALTER TABLE col_compression ALTER COLUMN b SET COMPRESSION pglz;
|
||||||
|
ALTER TABLE col_compression ALTER COLUMN a SET COMPRESSION default;
|
||||||
|
SELECT result AS column_compression FROM run_command_on_workers($$SELECT ARRAY(
|
||||||
|
SELECT attname || ' ' || attcompression FROM pg_attribute WHERE attrelid::regclass::text LIKE 'pg14.col\_compression%' AND attnum > 0 ORDER BY 1
|
||||||
|
)$$);
|
||||||
|
|
||||||
|
-- test propagation of ALTER TABLE .. ADD COLUMN .. COMPRESSION ..
|
||||||
|
ALTER TABLE col_compression ADD COLUMN c TEXT COMPRESSION pglz;
|
||||||
|
SELECT result AS column_compression FROM run_command_on_workers($$SELECT ARRAY(
|
||||||
|
SELECT attname || ' ' || attcompression FROM pg_attribute WHERE attrelid::regclass::text LIKE 'pg14.col\_compression%' AND attnum > 0 ORDER BY 1
|
||||||
|
)$$);
|
||||||
|
|
||||||
|
-- test attaching to a partitioned table with column compression
|
||||||
|
CREATE TABLE col_comp_par (a TEXT COMPRESSION pglz, b TEXT) PARTITION BY RANGE (a);
|
||||||
|
SELECT create_distributed_table('col_comp_par', 'a');
|
||||||
|
|
||||||
|
CREATE TABLE col_comp_par_1 PARTITION OF col_comp_par FOR VALUES FROM ('abc') TO ('def');
|
||||||
|
|
||||||
|
SELECT result AS column_compression FROM run_command_on_workers($$SELECT ARRAY(
|
||||||
|
SELECT attname || ' ' || attcompression FROM pg_attribute WHERE attrelid::regclass::text LIKE 'pg14.col\_comp\_par\_1\_%' AND attnum > 0 ORDER BY 1
|
||||||
|
)$$);
|
||||||
|
|
||||||
RESET citus.multi_shard_modify_mode;
|
RESET citus.multi_shard_modify_mode;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue