Re: Connect without specifying a database?

Поиск
Список
Период
Сортировка
От John R Pierce
Тема Re: Connect without specifying a database?
Дата
Msg-id 49E0CAC5.1070908@hogranch.com
обсуждение исходный текст
Ответ на Re: Connect without specifying a database?  ("lists@mgreg.com" <lists@mgreg.com>)
Список pgsql-general
lists@mgreg.com wrote:
> I'm sorry, I'm confused by your reply.  I may have said "table" when I
> meant "database".  I believe it absolutely *does* make sense to
> connect without specifying a database first.  What if you hit that
> edge case where there are in fact no databases?  I suppose you could
> always run "createdb" just in case before you do anything else, but
> that seems counterintuitive.

that 'edge case' is one in which postgres isn't running.  you have to
run initdb to initialize the database cluster before you can start the
postmaster.  initdb creates template0, template1, and, in 8.x and newer,
postgres databases

the postgres database administrator account can do...

    $ psql -l

to list all databases, or...

    $ psql
    ....
    postgres=# \l

or, in sql, while connected to {template1 | template0 | postgres | ... }

    select datname,... from pg_catalog.pg_database;



В списке pgsql-general по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Connect without specifying a database?
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Connect without specifying a database?