How to do a "CREATE DATABASE" and then connect to it?

From: Joseph Brenner <doom(at)kzsu(dot)stanford(dot)edu>
To: pgsql-general(at)postgresql(dot)org
Subject: How to do a "CREATE DATABASE" and then connect to it?
Date: 2006-06-02 19:46:24
Message-ID: 200606021946.k52JkO395405@mail0.rawbw.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


After you do a "CREATE DATABASE", how do you programatically
connect to what you just created?

In the psql monitor, you'd use the "\c" command.

If the DATABASE already exists when you connect to postgresql,
you use the name when you connect (e.g. "dbname=...").

I'm getting the impression I need to do this in multiple steps,
which is workable, but seems a little silly.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Joshua D. Drake 2006-06-02 20:31:11 Re: How to do a "CREATE DATABASE" and then connect to it?
Previous Message Joseph Brenner 2006-06-02 19:43:17 Re: Querying for strings that match after prefix