From e04858f147bc17355da53af649b2e927a95bacbb Mon Sep 17 00:00:00 2001 From: Mehmet Yilmaz Date: Tue, 21 Jan 2025 07:53:27 +0000 Subject: [PATCH] test update --- src/test/regress/expected/pg17.out | 23 +++++++++++++++-------- src/test/regress/sql/pg17.sql | 25 +++++++++++++++++-------- 2 files changed, 32 insertions(+), 16 deletions(-) diff --git a/src/test/regress/expected/pg17.out b/src/test/regress/expected/pg17.out index 208bf234b4b..e2afd256350 100644 --- a/src/test/regress/expected/pg17.out +++ b/src/test/regress/expected/pg17.out @@ -2690,15 +2690,21 @@ SELECT * FROM sensor_readings ORDER BY 1; (4 rows) -- End of MERGE ... WHEN NOT MATCHED BY SOURCE tests --- Issue #7846 --- Create a non-distributed table with a random suffix +-- Issue #7846: Test crash scenarios with MERGE on non-distributed and distributed tables +-- Step 1: Connect to a worker node to verify shard visibility +\c postgresql://postgres@localhost::worker_1_port/regression?application_name=psql +SET search_path TO pg17; +-- Step 2: Create and test a non-distributed table CREATE TABLE non_dist_table_12345 (id INTEGER); --- Test crash scenario on a non-distributed table +-- Test MERGE on the non-distributed table MERGE INTO non_dist_table_12345 AS target_0 USING pg_catalog.pg_class AS ref_0 ON target_0.id = ref_0.relpages WHEN NOT MATCHED THEN DO NOTHING; --- Create a distributed table with a random suffix +-- Step 3: Switch back to the coordinator for distributed table operations +\c - - - :master_port +SET search_path TO pg17; +-- Step 4: Create and test a distributed table CREATE TABLE dist_table_67890 (id INTEGER); SELECT create_distributed_table('dist_table_67890', 'id'); create_distributed_table @@ -2706,15 +2712,16 @@ SELECT create_distributed_table('dist_table_67890', 'id'); (1 row) --- Test crash scenario on a distributed table +-- Test MERGE on the distributed table MERGE INTO dist_table_67890 AS target_0 USING pg_catalog.pg_class AS ref_0 ON target_0.id = ref_0.relpages WHEN NOT MATCHED THEN DO NOTHING; ERROR: MERGE INTO an distributed table from Postgres table is not yet supported --- Cleanup -DROP TABLE IF EXISTS non_dist_table_12345; -DROP TABLE IF EXISTS dist_table_67890 CASCADE; +-- Step 5: Cleanup +DROP TABLE non_dist_table_12345; +ERROR: table "non_dist_table_12345" does not exist +DROP TABLE dist_table_67890 CASCADE; -- End of Issue #7846 \set VERBOSITY terse SET client_min_messages TO WARNING; diff --git a/src/test/regress/sql/pg17.sql b/src/test/regress/sql/pg17.sql index a719977731d..b7126184974 100644 --- a/src/test/regress/sql/pg17.sql +++ b/src/test/regress/sql/pg17.sql @@ -1451,29 +1451,38 @@ SELECT * FROM sensor_readings ORDER BY 1; -- End of MERGE ... WHEN NOT MATCHED BY SOURCE tests --- Issue #7846 --- Create a non-distributed table with a random suffix +-- Issue #7846: Test crash scenarios with MERGE on non-distributed and distributed tables +-- Step 1: Connect to a worker node to verify shard visibility +\c postgresql://postgres@localhost::worker_1_port/regression?application_name=psql +SET search_path TO pg17; + +-- Step 2: Create and test a non-distributed table CREATE TABLE non_dist_table_12345 (id INTEGER); --- Test crash scenario on a non-distributed table +-- Test MERGE on the non-distributed table MERGE INTO non_dist_table_12345 AS target_0 USING pg_catalog.pg_class AS ref_0 ON target_0.id = ref_0.relpages WHEN NOT MATCHED THEN DO NOTHING; --- Create a distributed table with a random suffix +-- Step 3: Switch back to the coordinator for distributed table operations +\c - - - :master_port +SET search_path TO pg17; + +-- Step 4: Create and test a distributed table CREATE TABLE dist_table_67890 (id INTEGER); SELECT create_distributed_table('dist_table_67890', 'id'); --- Test crash scenario on a distributed table +-- Test MERGE on the distributed table MERGE INTO dist_table_67890 AS target_0 USING pg_catalog.pg_class AS ref_0 ON target_0.id = ref_0.relpages WHEN NOT MATCHED THEN DO NOTHING; --- Cleanup -DROP TABLE IF EXISTS non_dist_table_12345; -DROP TABLE IF EXISTS dist_table_67890 CASCADE; +-- Step 5: Cleanup +DROP TABLE non_dist_table_12345; +DROP TABLE dist_table_67890 CASCADE; + -- End of Issue #7846 \set VERBOSITY terse