CREATE SCHEMA IF NOT EXISTS raises duplicate key error
问题 To give some context, the command is issued inside a task, and many task might issue the same command from multiple workers at the same time. Each tasks tries to create a postgres schema. I often get the following error: IntegrityError: (IntegrityError) duplicate key value violates unique constraint "pg_namespace_nspname_index" DETAIL: Key (nspname)=(9621584361) already exists. 'CREATE SCHEMA IF NOT EXISTS "9621584361"' Postgres version is PostgreSQL 9.4rc1. Is it a bug in Postgres? 回答1: This