How to change the default database for a user - Mailing list pgsql-general

From Alexander Farber
Subject How to change the default database for a user
Date
Msg-id 943abd910601300902t33d29ca4oe0e087c3bec1a035@mail.gmail.com
Whole thread Raw
Responses Re: How to change the default database for a user
List pgsql-general
Hello,

I've created a user and a database both wrongly named "phpbb".
After that I have renamed both to "punbb" using "ALTER DATABASE"
and "ALTER USER". Now everything works fine, except I always
have to specify the database when connecting (both using psql or
the PQconnectdb() from my C-program):

    h754814:afarber {103} psql -U punbb
    psql: FATAL:  database "phpbb" does not exist

    h754814:afarber {104} psql -U punbb punbb
    Welcome to psql 8.1.0, the PostgreSQL interactive terminal.
    ....
    punbb-> \l
              List of databases
       Name    |    Owner    | Encoding
    -----------+-------------+-----------
     postgres  | _postgresql | SQL_ASCII
     punbb     | _postgresql | SQL_ASCII
     template0 | _postgresql | SQL_ASCII
     template1 | _postgresql | SQL_ASCII
    (4 rows)

    punbb-> \du
                                    List of roles
      Role name  | Superuser | Create role | Create DB | Connections |
Member of
    -------------+-----------+-------------+-----------+-------------+-----------
     _postgresql | yes       | yes         | yes       | no limit    |
     punbb       | no        | no          | no        | no limit    |
    (2 rows)

    punbb-> select * from pg_user;
       usename   | usesysid | usecreatedb | usesuper | usecatupd |
passwd  | valuntil | useconfig
    -------------+----------+-------------+----------+-----------+----------+----------+-----------
     _postgresql |       10 | t           | t        | t         |
******** |          |
     punbb       |    16384 | f           | f        | f         |
******** |          |
    (2 rows)

How do I please set the database "punbb" to be the default
database for the user called "punbb"?

Regards
Alex

pgsql-general by date:

Previous
From: Rick Gigger
Date:
Subject: Re: postgresql performace degrading after a while
Next
From: Doug McNaught
Date:
Subject: Re: How to change the default database for a user