How to change the default database for a user

Поиск
Список
Период
Сортировка
От Alexander Farber
Тема How to change the default database for a user
Дата
Msg-id 943abd910601300902t33d29ca4oe0e087c3bec1a035@mail.gmail.com
обсуждение исходный текст
Ответы Re: How to change the default database for a user  (Doug McNaught <doug@mcnaught.org>)
Список 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 по дате отправления:

Предыдущее
От: Rick Gigger
Дата:
Сообщение: Re: postgresql performace degrading after a while
Следующее
От: Doug McNaught
Дата:
Сообщение: Re: How to change the default database for a user