mirror of https://github.com/citusdata/citus.git
Merge pull request #6026 from citusdata/fix_col_names
Fixes a bug that prevents using COMPRESSION and CONSTRAINT on a columnpull/6036/head
commit
7a4253ace0
|
@ -377,6 +377,14 @@ pg_get_tableschemadef_string(Oid tableRelationId, IncludeSequenceDefaults
|
||||||
atttypmod);
|
atttypmod);
|
||||||
appendStringInfoString(&buffer, attributeTypeName);
|
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 this column has a default value, append the default value */
|
||||||
if (attributeForm->atthasdef)
|
if (attributeForm->atthasdef)
|
||||||
{
|
{
|
||||||
|
@ -448,14 +456,6 @@ pg_get_tableschemadef_string(Oid tableRelationId, IncludeSequenceDefaults
|
||||||
appendStringInfoString(&buffer, " NOT NULL");
|
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 &&
|
if (attributeForm->attcollation != InvalidOid &&
|
||||||
attributeForm->attcollation != DEFAULT_COLLATION_OID)
|
attributeForm->attcollation != DEFAULT_COLLATION_OID)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1376,6 +1376,35 @@ SELECT create_distributed_table('ctlt1', 'a');
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
CREATE TABLE ctlt_all_2 (LIKE ctlt1 INCLUDING ALL);
|
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
|
-- cleanup
|
||||||
set client_min_messages to error;
|
set client_min_messages to error;
|
||||||
drop extension postgres_fdw cascade;
|
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);
|
CREATE TABLE ctlt_all (LIKE ctlt1 INCLUDING ALL);
|
||||||
SELECT create_distributed_table('ctlt1', 'a');
|
SELECT create_distributed_table('ctlt1', 'a');
|
||||||
CREATE TABLE ctlt_all_2 (LIKE ctlt1 INCLUDING ALL);
|
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
|
-- cleanup
|
||||||
set client_min_messages to error;
|
set client_min_messages to error;
|
||||||
drop extension postgres_fdw cascade;
|
drop extension postgres_fdw cascade;
|
||||||
|
|
Loading…
Reference in New Issue