Search Postgresql Archives

Re: Connect without specifying a database?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



lists@xxxxxxxxx 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;



--
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux