pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Aaron Bono <postgresql@aranya.com>
To: Simon Dale <sdale@rm.com>
Cc: pgsql-admin@postgresql.org
Subject: Re: Creating a table in a different database
Date: Tue, 6 Jun 2006 03:57:50 -0500
Message-ID: <bf05e51c0606060157y2dca378cs6c347aeeff85f550@mail.gmail.com> (raw)
In-Reply-To: <416F947BF5BA9E40B5F9AA649422212E078BA5AE@ex-mail2.internal.rmplc.net>
References: <416F947BF5BA9E40B5F9AA649422212E078BA5AE@ex-mail2.internal.rmplc.net>

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?
>

view thread (2+ messages)

Message-ID: <bf05e51c0606060157y2dca378cs6c347aeeff85f550@mail.gmail.com>
Permalink:  ../bf05e51c0606060157y2dca378cs6c347aeeff85f550@mail.gmail.com/
Also on:    postgresql.org/message-id/bf05e51c0606060157y2dca378cs6c347aeeff85f550@mail.gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: postgresql@aranya.com, sdale@rm.com
  Subject: Re: Creating a table in a different database
  In-Reply-To: <bf05e51c0606060157y2dca378cs6c347aeeff85f550@mail.gmail.com>
  References: <416F947BF5BA9E40B5F9AA649422212E078BA5AE@ex-mail2.internal.rmplc.net> <bf05e51c0606060157y2dca378cs6c347aeeff85f550@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox