Commit 06ae362
Ignore duplicate_table error in concurrent init
When multiple PostgresMessageQueue instances share the same table
name but use different Sql connections (e.g., mq1 and mq2 in
tests), their concurrent CREATE TABLE IF NOT EXISTS statements can
race. Despite the IF NOT EXISTS clause, PostgreSQL can raise error
42P07 (duplicate_table) under concurrent DDL due to a known race
condition in catalog lookups.
Previously, only the pg_type_typname_nsp_index constraint violation
was suppressed. Now the 42P07 error code is also ignored, since
it simply means the table already exists — exactly the condition
that IF NOT EXISTS is meant to handle.
This surfaced in CI as an uncaught promise rejection when two
listeners started concurrently on separate connections.
Co-Authored-By: Claude <noreply@anthropic.com>1 parent 22a610d commit 06ae362
1 file changed
Lines changed: 7 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
361 | 361 | | |
362 | 362 | | |
363 | 363 | | |
364 | | - | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
365 | 371 | | |
366 | 372 | | |
367 | 373 | | |
| |||
0 commit comments