mirror of https://github.com/citusdata/citus.git
Merge pull request #5238 from citusdata/error_reindex_dist_part_tables
Adds error message for REINDEX TABLE queries on distributed partition…pull/5237/head
commit
f67574496c
|
@ -589,6 +589,13 @@ PreprocessReindexStmt(Node *node, const char *reindexCommand,
|
||||||
|
|
||||||
if (isCitusRelation)
|
if (isCitusRelation)
|
||||||
{
|
{
|
||||||
|
if (PartitionedTable(relationId))
|
||||||
|
{
|
||||||
|
ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
||||||
|
errmsg("REINDEX TABLE queries on distributed partitioned "
|
||||||
|
"tables are not supported")));
|
||||||
|
}
|
||||||
|
|
||||||
DDLJob *ddlJob = palloc0(sizeof(DDLJob));
|
DDLJob *ddlJob = palloc0(sizeof(DDLJob));
|
||||||
ddlJob->targetRelationId = relationId;
|
ddlJob->targetRelationId = relationId;
|
||||||
ddlJob->concurrentIndexCmd = IsReindexWithParam_compat(reindexStatement,
|
ddlJob->concurrentIndexCmd = IsReindexWithParam_compat(reindexStatement,
|
||||||
|
|
|
@ -629,5 +629,20 @@ SELECT row_to_json(x.*) FROM J1_TBL JOIN J2_TBL USING (i) AS x WHERE J1_TBL.t =
|
||||||
{"f1":1}
|
{"f1":1}
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
|
-- we don't support REINDEX TABLE queries on distributed partitioned tables
|
||||||
|
CREATE TABLE dist_part_table (a int) PARTITION BY RANGE (a);
|
||||||
|
CREATE TABLE dist_part_table_1 PARTITION OF dist_part_table FOR VALUES FROM (1) TO (5);
|
||||||
|
CREATE TABLE dist_part_table_2 PARTITION OF dist_part_table FOR VALUES FROM (5) TO (10);
|
||||||
|
SELECT create_distributed_table('dist_part_table', 'a');
|
||||||
|
create_distributed_table
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
|
||||||
|
(1 row)
|
||||||
|
|
||||||
|
CREATE INDEX dist_part_idx ON dist_part_table(a);
|
||||||
|
REINDEX TABLE dist_part_table;
|
||||||
|
ERROR: REINDEX TABLE queries on distributed partitioned tables are not supported
|
||||||
|
-- but we support REINDEXing partitions
|
||||||
|
REINDEX TABLE dist_part_table_1;
|
||||||
set client_min_messages to error;
|
set client_min_messages to error;
|
||||||
drop schema pg14 cascade;
|
drop schema pg14 cascade;
|
||||||
|
|
|
@ -260,5 +260,17 @@ SELECT * FROM J1_TBL JOIN J2_TBL USING (i) AS x WHERE x.i > 1 ORDER BY 1,2,3,4;
|
||||||
-- ORDER BY is not supported for json and this returns 1 row, so it is okay.
|
-- ORDER BY is not supported for json and this returns 1 row, so it is okay.
|
||||||
SELECT row_to_json(x.*) FROM J1_TBL JOIN J2_TBL USING (i) AS x WHERE J1_TBL.t = 'one';
|
SELECT row_to_json(x.*) FROM J1_TBL JOIN J2_TBL USING (i) AS x WHERE J1_TBL.t = 'one';
|
||||||
|
|
||||||
|
-- we don't support REINDEX TABLE queries on distributed partitioned tables
|
||||||
|
CREATE TABLE dist_part_table (a int) PARTITION BY RANGE (a);
|
||||||
|
CREATE TABLE dist_part_table_1 PARTITION OF dist_part_table FOR VALUES FROM (1) TO (5);
|
||||||
|
CREATE TABLE dist_part_table_2 PARTITION OF dist_part_table FOR VALUES FROM (5) TO (10);
|
||||||
|
SELECT create_distributed_table('dist_part_table', 'a');
|
||||||
|
CREATE INDEX dist_part_idx ON dist_part_table(a);
|
||||||
|
|
||||||
|
REINDEX TABLE dist_part_table;
|
||||||
|
|
||||||
|
-- but we support REINDEXing partitions
|
||||||
|
REINDEX TABLE dist_part_table_1;
|
||||||
|
|
||||||
set client_min_messages to error;
|
set client_min_messages to error;
|
||||||
drop schema pg14 cascade;
|
drop schema pg14 cascade;
|
||||||
|
|
Loading…
Reference in New Issue