Batching multiple CREATE TABLE commands

Поиск
Список
Период
Сортировка
От Richard Huxton
Тема Batching multiple CREATE TABLE commands
Дата
Msg-id 419DBE24.3080903@archonet.com
обсуждение исходный текст
Ответ на Re: How to make a good documentation of a database ?  (Nageshwar Rao <NageshwarR@PLANETASIA.COM>)
Список pgsql-general
Nageshwar Rao wrote:
> Hi,
> I have set of create table statements. I need to execute them at one go
> instead of running individual statement to create a table.
> Help !

Nageshwar - two tips for posting to the mailing lists
  1. Don't reply to an existing message with a new question
  2. Make sure the subject line describes your question.
Otherwise, many people won't notice your question and you'll get less
people able to help.

As to the best way of executing multiple CREATE TABLE statements, that
depends on whether you are using psql or some other client. With psql
I'd put the statements in a file, then use something like:
   psql -f my_commands.sql
   psql < my_commands.sql
Or, if you're logged into psql you could use:
   \i my_commands.sql
All covered in the man page for psql.

I always wrap the whole lot in BEGIN ... COMMIT so that if (usually
when) I make a mistake it rolls back all the changes.

HTH
--
   Richard Huxton
   Archonet Ltd

В списке pgsql-general по дате отправления:

Предыдущее
От: "Premsun Choltanwanich"
Дата:
Сообщение: How to make lo_import and lo_export to use file on client local machine?
Следующее
От: jseymour@linxnet.com (Jim Seymour)
Дата:
Сообщение: Re: pgEdit public beta for Macintosh and Windows