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."
- Both Node1 and Node2 have a
test_table (id int PRIMARY KEY, email text UNIQUE, username text UNIQUE).
- On Node2: Pauses the replication apply process.: SELECT pgactive.pgactive_apply_pause();
- 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');
- On Node1: Insert data. : INSERT INTO test_table VALUES (100, 'dup@example.com', 'dup_user');
- On Node2 : Resume the replication apply process. : SELECT pgactive.pgactive_apply_resume();
- 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.
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."
test_table(id int PRIMARY KEY, email text UNIQUE, username text UNIQUE).INSERT INTO test_table VALUES (2,'username2@example.com', 'dup_user');
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: