mirror of https://github.com/citusdata/citus.git
Fixes a bug that prevents upgrades when there COMPRESSION and DEFAULT columns
parent
9d05c30c13
commit
d397dd0dfe
|
@ -377,6 +377,14 @@ pg_get_tableschemadef_string(Oid tableRelationId, IncludeSequenceDefaults
|
|||
atttypmod);
|
||||
appendStringInfoString(&buffer, attributeTypeName);
|
||||
|
||||
#if PG_VERSION_NUM >= PG_VERSION_14
|
||||
if (CompressionMethodIsValid(attributeForm->attcompression))
|
||||
{
|
||||
appendStringInfo(&buffer, " COMPRESSION %s",
|
||||
GetCompressionMethodName(attributeForm->attcompression));
|
||||
}
|
||||
#endif
|
||||
|
||||
/* if this column has a default value, append the default value */
|
||||
if (attributeForm->atthasdef)
|
||||
{
|
||||
|
@ -448,14 +456,6 @@ pg_get_tableschemadef_string(Oid tableRelationId, IncludeSequenceDefaults
|
|||
appendStringInfoString(&buffer, " NOT NULL");
|
||||
}
|
||||
|
||||
#if PG_VERSION_NUM >= PG_VERSION_14
|
||||
if (CompressionMethodIsValid(attributeForm->attcompression))
|
||||
{
|
||||
appendStringInfo(&buffer, " COMPRESSION %s",
|
||||
GetCompressionMethodName(attributeForm->attcompression));
|
||||
}
|
||||
#endif
|
||||
|
||||
if (attributeForm->attcollation != InvalidOid &&
|
||||
attributeForm->attcollation != DEFAULT_COLLATION_OID)
|
||||
{
|
||||
|
|
|
@ -1376,6 +1376,35 @@ SELECT create_distributed_table('ctlt1', 'a');
|
|||
(1 row)
|
||||
|
||||
CREATE TABLE ctlt_all_2 (LIKE ctlt1 INCLUDING ALL);
|
||||
CREATE TABLE compression_and_defaults (
|
||||
data text COMPRESSION lz4 DEFAULT '"{}"'::text COLLATE "C" NOT NULL PRIMARY KEY,
|
||||
rev text
|
||||
)
|
||||
WITH (
|
||||
autovacuum_vacuum_scale_factor='0.01',
|
||||
fillfactor='75'
|
||||
);
|
||||
SELECT create_distributed_table('compression_and_defaults', 'data', colocate_with:='none');
|
||||
create_distributed_table
|
||||
---------------------------------------------------------------------
|
||||
|
||||
(1 row)
|
||||
|
||||
CREATE TABLE compression_and_generated_col (
|
||||
data text COMPRESSION lz4 GENERATED ALWAYS AS (rev || '{]') STORED COLLATE "C" NOT NULL,
|
||||
rev text
|
||||
)
|
||||
WITH (
|
||||
autovacuum_vacuum_scale_factor='0.01',
|
||||
fillfactor='75'
|
||||
);
|
||||
SELECT create_distributed_table('compression_and_generated_col', 'rev', colocate_with:='none');
|
||||
create_distributed_table
|
||||
---------------------------------------------------------------------
|
||||
|
||||
(1 row)
|
||||
|
||||
DROP TABLE compression_and_defaults, compression_and_generated_col;
|
||||
-- cleanup
|
||||
set client_min_messages to error;
|
||||
drop extension postgres_fdw cascade;
|
||||
|
|
|
@ -713,6 +713,30 @@ CREATE STATISTICS ctlt1_expr_stat ON (a || b) FROM ctlt1;
|
|||
CREATE TABLE ctlt_all (LIKE ctlt1 INCLUDING ALL);
|
||||
SELECT create_distributed_table('ctlt1', 'a');
|
||||
CREATE TABLE ctlt_all_2 (LIKE ctlt1 INCLUDING ALL);
|
||||
|
||||
CREATE TABLE compression_and_defaults (
|
||||
data text COMPRESSION lz4 DEFAULT '"{}"'::text COLLATE "C" NOT NULL PRIMARY KEY,
|
||||
rev text
|
||||
)
|
||||
WITH (
|
||||
autovacuum_vacuum_scale_factor='0.01',
|
||||
fillfactor='75'
|
||||
);
|
||||
|
||||
SELECT create_distributed_table('compression_and_defaults', 'data', colocate_with:='none');
|
||||
|
||||
CREATE TABLE compression_and_generated_col (
|
||||
data text COMPRESSION lz4 GENERATED ALWAYS AS (rev || '{]') STORED COLLATE "C" NOT NULL,
|
||||
rev text
|
||||
)
|
||||
WITH (
|
||||
autovacuum_vacuum_scale_factor='0.01',
|
||||
fillfactor='75'
|
||||
);
|
||||
SELECT create_distributed_table('compression_and_generated_col', 'rev', colocate_with:='none');
|
||||
|
||||
DROP TABLE compression_and_defaults, compression_and_generated_col;
|
||||
|
||||
-- cleanup
|
||||
set client_min_messages to error;
|
||||
drop extension postgres_fdw cascade;
|
||||
|
|
Loading…
Reference in New Issue