You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I got the following error in Postgres when starting up 2 instances, both running the same new migration in parallel (one succeeded, one didn't). The migration itself is a simple CREATE TABLE IF NOT EXISTS ... Of course restarting the failed instance was not a problem and the error was not there anymore. This was the error:
Execution Error: error returned from database: duplicate key value violates unique constraint "pg_class_relname_nsp_index"
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I got the following error in Postgres when starting up 2 instances, both running the same new migration in parallel (one succeeded, one didn't). The migration itself is a simple
CREATE TABLE IF NOT EXISTS ...
Of course restarting the failed instance was not a problem and the error was not there anymore. This was the error:The docs mention atomic migrations for Postgres, but is it possible that this might not be enough?
Someone else is using
pg_advisory_xact_lock
here to fix that issue: https://stackoverflow.com/questions/74261789/postgres-create-table-if-not-exists-%E2%87%92-23505I couldn't find any similar question in issues, has anybody stumbled on this?
Beta Was this translation helpful? Give feedback.
All reactions