Re: [GENERAL] "Database does not exist" weirdness - Mailing list pgsql-general

From Alan Hodgson
Subject Re: [GENERAL] "Database does not exist" weirdness
Date
Msg-id 6421366.bTpXBSyCdR@skynet.simkin.ca
Whole thread Raw
In response to [GENERAL] "Database does not exist" weirdness  (Michael Tyson <michael@tyson.id.au>)
List pgsql-general
On Friday 17 February 2017 18:18:20 Michael Tyson wrote:
> postgres=# \q
> pi@raspi ~ $ sudo -u postgres psql testdb
> psql: FATAL:  database "testdb" does not exist
> pi@raspi ~ $ sudo -u postgres createdb testdb
> createdb: database creation failed: ERROR:  duplicate key value violates
> unique constraint "pg_database_datname_index" DETAIL:  Key
> (datname)=(testdb) already exists.
>

Something's seriously borked in your PostgreSQL data files. The message it
should give you if the database exists is:

createdb: database creation failed: ERROR:  database "testdb" already exists

It looks like it partially exists in the catalog but not really. I can't guess
how you got to such a state, but you should probably nuke your data directory
and start over with a fresh initdb.


pgsql-general by date:

Previous
From: Tim Bellis
Date:
Subject: Re: [GENERAL] Autovacuum stuck for hours, blocking queries
Next
From: Tom Lane
Date:
Subject: Re: [GENERAL] "Database does not exist" weirdness