Re: many sql file and one transaction

Поиск
Список
Период
Сортировка
От Alban Hertroys
Тема Re: many sql file and one transaction
Дата
Msg-id CAF-3MvM33DMGTv2eQSpXuPVXk+n68ONTEMhnJ_ngYfzSTss3Qg@mail.gmail.com
обсуждение исходный текст
Ответ на many sql file and one transaction  (salah jubeh <s_jubeh@yahoo.com>)
Список pgsql-general
On 18 October 2011 14:11, salah jubeh <s_jubeh@yahoo.com> wrote:
> Hello,
>
> I have many SQL script files to update schema, delete data, unit test
> ....etc.  I want to run all the files in one transaction using shell script
> to ease the installation procedure. I can do that from the psql client by
> using the \i option
>
> BEGIN;
> \i  / .../ module1.sql
> \i  / .../ module2.sql
> \i  / .../ module_etc.sql
> COMMIT;
>
> Is there a way to do that  using psql command  shell script.
>
> I.E.
> I want to run the following  in one transaction,
> psql  -f  module1.sql
> psql  -f  module2.sql
> psql  -f  module_etc.sql

You can't use the above, as each psql instance has their own session.

You could cat the files together and feed them to psql though.
--
If you can't see the forest for the trees,
Cut the trees and you'll see there is no forest.

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

Предыдущее
От: salah jubeh
Дата:
Сообщение: many sql file and one transaction
Следующее
От: salah jubeh
Дата:
Сообщение: Re: many sql file and one transaction