Re: Connect without specifying a database? - Mailing list pgsql-general

From Tom Lane
Subject Re: Connect without specifying a database?
Date
Msg-id 25459.1239468992@sss.pgh.pa.us
Whole thread Raw
In response to Re: Connect without specifying a database?  ("lists@mgreg.com" <lists@mgreg.com>)
Responses Re: Connect without specifying a database?
List pgsql-general
[ forgot to respond to this bit... ]

"lists@mgreg.com" <lists@mgreg.com> writes:
> What if you hit that edge case where there are in fact no databases?

There is no such edge case.  DROP DATABASE has to be issued while
connected to some database, and it won't let you drop the DB you're
connected to.

> I suppose you could
> always run "createdb" just in case before you do anything else, but
> that seems counterintuitive.

And CREATE DATABASE has to be issued while connected to some database,
so createdb still has to have a default database to connect to.  There
really is no state in Postgres corresponding to "connected but not
connected to any particular database".

It does all hang together.  You will need to lose a lot of MySQL
preconceptions along the way, I fear.

            regards, tom lane

pgsql-general by date:

Previous
From: John R Pierce
Date:
Subject: Re: Connect without specifying a database?
Next
From: "lists@mgreg.com"
Date:
Subject: Re: Connect without specifying a database?