From: | Dave Vitek <dvitek(at)grammatech(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | createdb: ... duplicate key value violates unique constraint "pg_database_datname_index" |
Date: | 2010-03-11 19:46:37 |
Message-ID: | 4B99489D.7000900@grammatech.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hi all,
On a new x86_64 windows 7 SMP, a new database server was being set up by
some test automation. We are using official 8.4.2 binaries.
It runs:
initdb -D c:\... --no-locale
... eventually this outputs the "Success. You can now start the database
server using ..." message. Once that exits (with 0) it proceeds to
start postgres:
postgres -D c:\...
Then we wait for the .pid file to show up.
Once that happens we do createdb:
createdb -h 127.0.0.1 -p 1234 abc
createdb: database creation failed: ERROR: duplicate key value violates
unique constraint "pg_database_datname_index"
This is not reproducible and only happens occasionally. We do sometimes
get the "database is starting up" error (and we just retry if that
happens). For technical reasons I no longer remember, we found it
problematic to use pg_ctl -w on windows, and I do not remember whether
it always waited long enough anyway.
Is there a proper way to wait for postgres to start up other than
waiting until the pid file exists and retrying things whenever you get
the "database is starting up" error? Is the error I am describing
indicative of something else?
Once, we got this slightly different error when creating the second
table in the freshly created database:
duplicate key value violates unique constraint "pg_type_typname_nsp_index"
It had some primitive columns and a foreign key reference to the first
table (which only had primitive columns).
We run this test automation quite a few platforms and have never
encountered this problem on any of them:
- All flavors of windows NT from win2k onwards, including an older win7 box
- linux: x86 + x86_64
- macos: x86_64
- solaris: sparc + x86 + x86_64
- Dave
From | Date | Subject | |
---|---|---|---|
Next Message | Dave Vitek | 2010-03-11 20:17:04 | Re: createdb: ... duplicate key value violates unique constraint "pg_database_datname_index" |
Previous Message | Garrett Murphy | 2010-03-11 19:25:01 | Re: Joining one-to-one and one-to-many tables |