user3086180
user3086180

Reputation: 41

Can't create PostgreSQL database

I had debian system with postgres 9.1.x installed from debian packages, I needed to install pldebugger.

So installed postgresql 9.1.9 from source with pldebbuger. Started posgresql with 'old' postgres data directory.

Now I'm trying to create new databese 'test_test'

Everythings look fine:

psql -U postgres --list

... test_test             | postgres        | UTF8     | en_US.UTF-8 |
en_US.UTF-8 | ...

But when i try to access that DB, i get error:

FATAL: database "test_test" does not exist DETAIL: The database subdirectory "base/48433052" is missing.

Why Postgres can not create new database files?

Upvotes: 2

Views: 3466

Answers (1)

user3086180
user3086180

Reputation: 41

I have solved this problem by recreating template1 db:

update pg_database set datistemplate = FALSE where datname = 'template1'; drop database template1; create database template1 with template = template0 encoding = 'UTF8'; update pg_database set datistemplate = TRUE where datname = 'template1';

Upvotes: 2

Related Questions