Re: Equivalent to "use database" in postgre

From: John R Pierce <pierce(at)hogranch(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Equivalent to "use database" in postgre
Date: 2010-06-25 18:21:19
Message-ID: 4C24F39F.3070002@hogranch.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 06/25/10 4:10 AM, javijava wrote:
> i need to know how to do a simple script that create a database,the y
> select it (in other languajes using USE) and after create tables with this
> database.
>
>
> How can I say "use name_database" on postgre sql?
>
> Thanks in advance 4 the help!!
>

IF you are using the psql command line utility to execute these scripts,
then
\c dbname
will connect to a new database. However, if you're processing these
scripts some other way, then your app will have to disconnect from the
one database and connect to the other itself (this is what the \c
command tells psql to do)

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2010-06-25 18:29:53 Re: PG dump and restore
Previous Message Joshua D. Drake 2010-06-25 18:07:01 Re: Backup issues