v63_nisha-edits.txt
text/plain
Filename: v63_nisha-edits.txt
Type: text/plain
Part: 0
From 329e970906b8970ed38cd1ac074dd0e4fb6ec25c Mon Sep 17 00:00:00 2001
From: Nisha Moond <nisha.moond412@gmail.com>
Date: Fri, 3 Jul 2026 16:59:01 +0530
Subject: [PATCH v_nisha 2/2] nisha edits
---
src/include/replication/conflict.h | 2 +-
src/include/replication/worker_internal.h | 3 ++-
src/test/subscription/t/035_conflicts.pl | 25 +++++++++++++----------
3 files changed, 17 insertions(+), 13 deletions(-)
diff --git a/src/include/replication/conflict.h b/src/include/replication/conflict.h
index 4db3a36d4df..06420ab0416 100644
--- a/src/include/replication/conflict.h
+++ b/src/include/replication/conflict.h
@@ -10,9 +10,9 @@
#define CONFLICT_H
#include "access/xlogdefs.h"
-#include "access/genam.h"
#include "datatype/timestamp.h"
#include "nodes/pg_list.h"
+#include "utils/relcache.h"
/* Avoid including execnodes.h here */
typedef struct EState EState;
diff --git a/src/include/replication/worker_internal.h b/src/include/replication/worker_internal.h
index 394f4c6265e..dc4d3db4abb 100644
--- a/src/include/replication/worker_internal.h
+++ b/src/include/replication/worker_internal.h
@@ -114,7 +114,8 @@ typedef struct LogicalRepWorker
* State of the transaction in parallel apply worker.
*
* The enum values must have the same order as the transaction state
- * transitions.
+ * transitions. PARALLEL_TRANS_FINISHED and PARALLEL_TRANS_ERROR are
+ * mutually exclusive terminal states.
*/
typedef enum ParallelTransState
{
diff --git a/src/test/subscription/t/035_conflicts.pl b/src/test/subscription/t/035_conflicts.pl
index 6a7d094712d..7e6d0707042 100644
--- a/src/test/subscription/t/035_conflicts.pl
+++ b/src/test/subscription/t/035_conflicts.pl
@@ -101,12 +101,13 @@ my $conflict_check = $node_subscriber->safe_psql('postgres',
"SELECT count(*) >= 1 FROM $clt WHERE conflict_type = 'multiple_unique_conflicts';");
is($conflict_check, 't', 'Verified multiple_unique_conflicts logged into conflict log table');
-my $json_query = "SELECT local_conflicts FROM $clt;";
-my $raw_json = $node_subscriber->safe_psql('postgres', $json_query);
-
-# Verify that '2' is present inside the JSON structure using a regex
-# This matches the key/value pattern for "a": 2
-like($raw_json, qr/\\"a\\":2/, 'Verified that key 2 exists in the local_conflicts');
+# Verify all 3 conflicting local rows are captured with correct key values
+my $keys = $node_subscriber->safe_psql('postgres',
+ "SELECT (unnest(local_conflicts)->'tuple'->>'a')::int
+ FROM $clt WHERE conflict_type = 'multiple_unique_conflicts'
+ ORDER BY 1;");
+is($keys, "2\n3\n4",
+ 'local_conflicts captures correct conflicting key values for INSERT');
pass('multiple_unique_conflicts detected during insert');
@@ -153,11 +154,13 @@ $conflict_check = $node_subscriber->safe_psql('postgres',
"SELECT count(*) >= 1 FROM $clt WHERE conflict_type = 'multiple_unique_conflicts';");
is($conflict_check, 't', 'Verified multiple_unique_conflicts logged into conflict log table');
-$raw_json = $node_subscriber->safe_psql('postgres', $json_query);
-
-# Verify that '6' is present inside the JSON structure using a regex
-# This matches the key/value pattern for "a": 6
-like($raw_json, qr/\\"a\\":6/, 'Verified that key 6 exists in the local_conflicts');
+# Verify all 3 conflicting local rows are captured with correct key values
+$keys = $node_subscriber->safe_psql('postgres',
+ "SELECT (unnest(local_conflicts)->'tuple'->>'a')::int
+ FROM $clt WHERE conflict_type = 'multiple_unique_conflicts'
+ ORDER BY 1;");
+is($keys, "6\n7\n8",
+ 'local_conflicts captures correct conflicting key values for UPDATE');
pass('multiple_unique_conflicts detected during update');
--
2.50.1 (Apple Git-155)