Re: move from 1 database to another

From: "P(dot)M" <pmdanger(at)yahoo(dot)com>
To: Ragnar <gnari(at)hive(dot)is>, "PostgreSQL General \(EN\)" <pgsql-general(at)postgresql(dot)org>
Subject: Re: move from 1 database to another
Date: 2006-05-26 18:00:32
Message-ID: 20060526180032.1147.qmail@web33212.mail.mud.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Thanks.
it works well.

Ragnar <gnari(at)hive(dot)is> wrote: On fim, 2006-05-25 at 11:52 -0700, P.M wrote:

> I would like to know how can i move from 1 database to another one ?
>
> basically i want to run a *.sql script in which i connect under a
> particular database (for example : template1 or postgres) and my *.sql
> script should create a new database (for example : test) and after
> execute several SQL command under test database.

I guess you are asking how to connect to a new database
in the middleof a sql script

Assuming the script will be run by psql, you can use
\connect test

gnari

---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

http://archives.postgresql.org


---------------------------------
Yahoo! Messenger with Voice. PC-to-Phone calls for ridiculously low rates.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Andrew Sullivan 2006-05-26 18:12:44 Re: Making query without trigger
Previous Message Tom Lane 2006-05-26 17:47:21 Re: pg_dump on 7.4