Re: Creating a table in a different database - Mailing list pgsql-admin

From Aaron Bono
Subject Re: Creating a table in a different database
Date
Msg-id bf05e51c0606060157y2dca378cs6c347aeeff85f550@mail.gmail.com
Whole thread Raw
In response to Creating a table in a different database  ("Simon Dale" <sdale@rm.com>)
List pgsql-admin
I just create .sql files with all the commands I want to run and then run them in psql with the "\i myscript.sql".

If you want to switch databases in psql, use the \c[onnect] [DBNAME|- [USER]] .  For example "\c my_database my_user".

I recommend going into psql and typing in "\?" for a list of common commands you can use.

-Aaron

On 6/6/06, Simon Dale < sdale@rm.com> wrote:

Hi,

 

The CREATE TABLE command creates a table in the current database. What I want to achieve is a SQL script that will create a database and a user and then create some tables and functions in the new database.

 

Is it possible to do this in a single SQL file, and if so, how do I change the database part way through the file to create the tables in the correct database?


pgsql-admin by date:

Previous
From: "Simon Dale"
Date:
Subject: Creating a table in a different database
Next
From: "H.J. Sanders"
Date:
Subject: logfile