Re: Creating a table in a different database

Поиск
Список
Период
Сортировка
От Aaron Bono
Тема Re: Creating a table in a different database
Дата
Msg-id bf05e51c0606060157y2dca378cs6c347aeeff85f550@mail.gmail.com
обсуждение исходный текст
Ответ на Creating a table in a different database  ("Simon Dale" <sdale@rm.com>)
Список 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 по дате отправления:

Предыдущее
От: "Simon Dale"
Дата:
Сообщение: Creating a table in a different database
Следующее
От: "H.J. Sanders"
Дата:
Сообщение: logfile