Thread: db user named 'root'

db user named 'root'

From
"Atul Shah"
Date:

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

 

 

 

 

 

 

Huntsman Cancer Institute wishes to promote open communication while protecting confidential and/or privileged information.  If you have received this message in error, please inform the sender and delete all copies.

Re: db user named 'root'

From
Tom Lane
Date:
"Atul Shah" <atul.shah@hci.utah.edu> writes:
> 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

Works for me.  Are you sure that you are talking to the same postmaster
in both cases?  It's possible that root and postgres have different PATH
settings or different PGPORT settings or some such.

> Huntsman Cancer Institute wishes to promote open communication while =
> protecting confidential and/or privileged information.  If you have =
> received this message in error, please inform the sender and delete all =
> copies.

You do realize how silly you look with this sort of mumbo-jumbo attached
to mail to an open mailing list, don't you?  Even for private mail, do
your lawyers actually think that this accomplishes anything except
wasting people's disk space?

            regards, tom lane