From 291b9ae63dadaf9f9c5f32275d60128cb8bfb3fb Mon Sep 17 00:00:00 2001 From: Mehmet Yilmaz Date: Fri, 15 Nov 2024 14:57:23 +0000 Subject: [PATCH] update --- src/test/regress/expected/pg17_0.out | 110 ++++++++++++++++----------- 1 file changed, 67 insertions(+), 43 deletions(-) diff --git a/src/test/regress/expected/pg17_0.out b/src/test/regress/expected/pg17_0.out index 38127095293..3c09bd4232c 100644 --- a/src/test/regress/expected/pg17_0.out +++ b/src/test/regress/expected/pg17_0.out @@ -7,67 +7,91 @@ SET citus.next_shard_id TO 917000; ALTER SEQUENCE pg_catalog.pg_dist_colocationid_seq RESTART 1400000; SET citus.shard_count TO 1; SET citus.shard_replication_factor TO 1; +-- PostgreSQL 17 now allows exclusion constraints on partitioned tables, lifting the previous restriction. +ALTER SEQUENCE pg_catalog.pg_dist_shardid_seq RESTART 5420000; +ALTER SEQUENCE pg_catalog.pg_dist_placement_placementid_seq RESTART 5420000; +CREATE SCHEMA AT_AddConstNoName; +-- Check "ADD PRIMARY KEY" +CREATE TABLE AT_AddConstNoName.products ( + product_no integer, + name text, + price numeric +); +SELECT create_distributed_table('AT_AddConstNoName.products', 'product_no'); + create_distributed_table +--------------------------------------------------------------------- ---- PostgreSQL 17 now allows exclusion constraints on partitioned tables, lifting the previous restriction. -\c :master_host :master_port -ALTER TABLE AT_AddConstNoName.citus_local_partitioned_table DROP CONSTRAINT citus_local_partitioned_table_partition_col_key; +(1 row) ---- Check "ADD EXCLUDE" errors out for partitioned table since the postgres does not allow it before PG 17 -ALTER TABLE AT_AddConstNoName.citus_local_partitioned_table ADD EXCLUDE(partition_col WITH =); -ERROR: exclusion constraints are not supported on partitioned tables +ALTER TABLE AT_AddConstNoName.products ADD PRIMARY KEY(product_no); +SELECT con.conname + FROM pg_catalog.pg_constraint con + INNER JOIN pg_catalog.pg_class rel ON rel.oid = con.conrelid + INNER JOIN pg_catalog.pg_namespace nsp ON nsp.oid = connamespace + WHERE rel.relname = 'products'; + conname +--------------------------------------------------------------------- + products_pkey +(1 row) + +-- Test with partitioned citus local table +CREATE TABLE AT_AddConstNoName.citus_local_partitioned_table (dist_col int, another_col int, partition_col timestamp) PARTITION BY RANGE (partition_col); +CREATE TABLE AT_AddConstNoName.p1 PARTITION OF AT_AddConstNoName.citus_local_partitioned_table FOR VALUES FROM ('2021-01-01') TO ('2022-01-01'); +CREATE TABLE AT_AddConstNoName.longlonglonglonglonglonglonglonglonglonglonglonglonglonglongabc PARTITION OF AT_AddConstNoName.citus_local_partitioned_table FOR VALUES FROM ('2020-01-01') TO ('2021-01-01'); +SELECT citus_add_local_table_to_metadata('AT_AddConstNoName.citus_local_partitioned_table'); + citus_add_local_table_to_metadata +--------------------------------------------------------------------- ---- Check "ADD CHECK" +(1 row) + +\c - - :master_host :master_port +-- Check "ADD EXCLUDE" errors out for partitioned table since the postgres does not allow it before PG 17 +ALTER TABLE AT_AddConstNoName.citus_local_partitioned_table ADD EXCLUDE(partition_col WITH =); +ERROR: exclusion constraints are not supported on partitioned tables +-- Check "ADD CHECK" SET client_min_messages TO DEBUG1; ALTER TABLE AT_AddConstNoName.citus_local_partitioned_table ADD CHECK (dist_col > 0); -DEBUG: the constraint name on the shards of the partition is too long, switching to sequential and local execution mode to prevent self deadlocks: longlonglonglonglonglonglonglonglonglonglonglo_537570f5_5_check -DEBUG: verifying table "longlonglonglonglonglonglonglonglonglonglonglonglonglonglongabc" -DEBUG: verifying table "p1" +DEBUG: the constraint name on the shards of the partition is too long, switching to sequential and local execution mode to prevent self deadlocks: longlonglonglonglonglonglonglonglonglonglonglon_537570f5__check +DEBUG: verifying table "longlonglonglonglonglonglonglonglonglonglonglonglonglonglongabc" +DEBUG: verifying table "p1" +DEBUG: verifying table "p1_917002" +DEBUG: verifying table "longlonglonglonglonglonglonglonglonglonglonglon_537570f5_917001" RESET client_min_messages; - SELECT con.conname - FROM pg_catalog.pg_constraint con - INNER JOIN pg_catalog.pg_class rel ON rel.oid = con.conrelid - INNER JOIN pg_catalog.pg_namespace nsp ON nsp.oid = connamespace - WHERE rel.relname = 'citus_local_partitioned_table'; - conname ----------------------------------------------------------------------- + FROM pg_catalog.pg_constraint con + INNER JOIN pg_catalog.pg_class rel ON rel.oid = con.conrelid + INNER JOIN pg_catalog.pg_namespace nsp ON nsp.oid = connamespace + WHERE rel.relname = 'citus_local_partitioned_table'; + conname +--------------------------------------------------------------------- citus_local_partitioned_table_check (1 row) -\c :public_worker_1_host :worker_1_port - +\c - - :public_worker_1_host :worker_1_port SELECT con.conname - FROM pg_catalog.pg_constraint con - INNER JOIN pg_catalog.pg_class rel ON rel.oid = con.conrelid - INNER JOIN pg_catalog.pg_namespace nsp ON nsp.oid = connamespace - WHERE rel.relname LIKE 'longlonglonglonglonglonglonglonglong%' - ORDER BY con.conname ASC; - conname ----------------------------------------------------------------------- - citus_local_partitioned_table_check - citus_local_partitioned_table_check - citus_local_partitioned_table_check + FROM pg_catalog.pg_constraint con + INNER JOIN pg_catalog.pg_class rel ON rel.oid = con.conrelid + INNER JOIN pg_catalog.pg_namespace nsp ON nsp.oid = connamespace + WHERE rel.relname LIKE 'longlonglonglonglonglonglonglonglong%' ORDER BY con.conname ASC; + conname +--------------------------------------------------------------------- citus_local_partitioned_table_check - citus_local_partitioned_table_check -(5 rows) +(1 row) -\c :master_host :master_port +\c - - :master_host :master_port ALTER TABLE AT_AddConstNoName.citus_local_partitioned_table DROP CONSTRAINT citus_local_partitioned_table_check; - -\c :public_worker_1_host :worker_1_port - +\c - - :public_worker_1_host :worker_1_port SELECT con.conname - FROM pg_catalog.pg_constraint con - INNER JOIN pg_catalog.pg_class rel ON rel.oid = con.conrelid - INNER JOIN pg_catalog.pg_namespace nsp ON nsp.oid = connamespace - WHERE rel.relname LIKE 'longlonglonglonglonglonglonglonglong%' - ORDER BY con.conname ASC; + FROM pg_catalog.pg_constraint con + INNER JOIN pg_catalog.pg_class rel ON rel.oid = con.conrelid + INNER JOIN pg_catalog.pg_namespace nsp ON nsp.oid = connamespace + WHERE rel.relname LIKE 'longlonglonglonglonglonglonglonglong%' ORDER BY con.conname ASC; conname ----------------------------------------------------------------------- +--------------------------------------------------------------------- (0 rows) ---- Clean up +-- Clean up \set VERBOSITY terse SET client_min_messages TO ERROR; DROP SCHEMA pg17 CASCADE; -ERROR: operation is not allowed on this node \ No newline at end of file +ERROR: operation is not allowed on this node