Hello,
I have recently installed postgresql on a x486 box running debian linux, as a prelude to installing an open source bioinformatics system called the longhorn array database (lad). The lad install requires you to create a postgres user named 'root' with create priveleges, in order to run an install script (which presumably creates a database as owner root). I am able to create a db user named 'root', but get an error when trying to create a db as root.
As postgres (db superuser):
createuser -s -d root
CREATE ROLE
su root
createdb root_db
createdb: could not connect to database template1: FATAL: user "root" does not exist
psql
psql: FATAL: database "root" does not exist
But the user root exists in the system:
As postgres:
psql
List of roles
Role name | Superuser | Create role | Create DB | Connections | Member of
-----------+-----------+-------------+-----------+-------------+-----------
atul | yes | yes | yes | no limit |
postgres | yes | yes | yes | no limit |
root | yes | yes | yes | no limit |
(3 rows)
This shows that root is registered as a db user.
Also, postgres can create a database for root:
As postgres:
createdb -O root root_db
CREATE DATABASE
A database was successfully created with owner 'root':
As postgres:
psql -l
List of databases
Name | Owner | Encoding
-----------+----------+-----------
atul | atul | SQL_ASCII
postgres | postgres | SQL_ASCII
root_db | root | SQL_ASCII
template0 | postgres | SQL_ASCII
template1 | postgres | SQL_ASCII
(5 rows)
But root cannot access it—in fact postgres says the database does not exist!
As postgres:
su root
psql root_db
psql: FATAL: database “root_db” does not exist!
Can anyone tell what's going on here? Why won't postgres allow root to createdb himself, or to use psql?
Thanks in advance for your help!
Atul