aws / aws/pgactive

Multiple UNIQUE constraint violation error not logged/outputted (INSERT/INSERT Conflict)

Open
#315 0 comments 0 reactions 1 assignee Claimed by @sharmay View on GitHub
Dominant language
C
Stars
1.1k
Forks
38
Avg merge
2d 21h
Merged PRs (30d)
4

Description

Hello, I conducted a test to verify that multiple UNIQUE constraint violations are detected in an INSERT/INSERT conflict, resulting in the error "multiple unique constraints violated by remotely INSERTed tuple."

1. Both Node1 and Node2 have a `test_table` (id int PRIMARY KEY, email text UNIQUE, username text UNIQUE).
2. On Node2: Pauses the replication apply process.: SELECT pgactive.pgactive_apply_pause();
3. On Node2: Insert data. : INSERT INTO test_table VALUES (1,'dup@example.com', 'username1');
           INSERT INTO test_table VALUES (2,'username2@example.com', 'dup_user');
4. On Node1: Insert data. : INSERT INTO test_table VALUES (100, 'dup@example.com', 'dup_user');
5. On Node2 : Resume the replication apply process. : SELECT pgactive.pgactive_apply_resume();
6. Result : The error "multiple unique constraints violated by remotely INSERTed tuple." was not logged in the
PostgreSQL server log. Additionally, on Node2, logs were recorded showing an INSERT/INSERT conflict
between the tuple {"id":1, "email":"dup@example.com","username":"username1"} and
the tuple {"id":100, "email":"dup@example.com","username":dup_user"} from Node1.

Questions:
I conducted a test expecting the error "multiple unique constraints violated by remotely INSERTed tuple." to appear in the PostgreSQL server log on Node2. However, this error was not output. Instead, the conflict log for a INSERT/INSERT conflict involving a single UNIQUE constraint violation was recorded. Is the above procedure appropriate as a test to detect multiple UNIQUE constraint violations? Thank you!

Environment:
- PostgreSQL Version: 18.3
- Extension: pgactive (latest)
- Setup: Active-Active replication between 2 nodes.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.