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

From Simon Dale
Subject Creating a table in a different database
Date
Msg-id 416F947BF5BA9E40B5F9AA649422212E078BA5AE@ex-mail2.internal.rmplc.net
Whole thread Raw
Responses Re: Creating a table in a different database  ("Aaron Bono" <postgresql@aranya.com>)
List pgsql-admin

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?

 

Thanks,

 

Simon

You might be interested in this...
Professor Tim Brighouse describes the key features shared by successful schools in his new book - Download your copy now

Visit our Website at www.rm.com

This message is confidential. You should not copy it or disclose its contents to anyone. You may use and apply the information for the intended purpose only. Internet communications are not secure; therefore, RM does not accept legal responsibility for the contents of this message. Any views or opinions presented are those of the author only and not of RM. If this email has come to you in error, please delete it, along with any attachments. Please note that RM may intercept incoming and outgoing email communications.

Freedom of Information Act 2000
This email and any attachments may contain confidential information belonging to RM. Where the email and any attachments do contain information of a confidential nature, including without limitation information relating to trade secrets, special terms or prices these shall be deemed for the purpose of the Freedom of Information Act 2000 as information provided in confidence by RM and the disclosure of which would be prejudicial to RM's commercial interests.

This email has been scanned for viruses by Trend ScanMail.

pgsql-admin by date:

Previous
From: Tom Lane
Date:
Subject: Re: postgres dying
Next
From: "Aaron Bono"
Date:
Subject: Re: Creating a table in a different database