Re: many sql file and one transaction - Mailing list pgsql-general

From salah jubeh
Subject Re: many sql file and one transaction
Date
Msg-id 1318941607.31636.YahooMailNeo@web161508.mail.bf1.yahoo.com
Whole thread Raw
In response to many sql file and one transaction  (salah jubeh <s_jubeh@yahoo.com>)
Responses Re: many sql file and one transaction  (Cédric Villemain <cedric.villemain.debian@gmail.com>)
List pgsql-general
Hello,

Thanks for the reply.

I considered  cat as an option but I did not go for it, because of the number of sql files I have is large  which makes the code not readable 

The second thing, which is more important is because I have some advantages with  using -f such as the line number which causing the error.

Regards




 

 


From: "andreas@a-kretschmer.de" <andreas@a-kretschmer.de>
To: salah jubeh <s_jubeh@yahoo.com>
Sent: Tuesday, October 18, 2011 2:23 PM
Subject: Re: [GENERAL] many sql file and one transaction


Zitat von salah jubeh <s_jubeh@yahoo.com>:

> 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


cat module1.sql module2.sql module_etc.sql | psql


Regards, Andreas



pgsql-general by date:

Previous
From: Alban Hertroys
Date:
Subject: Re: many sql file and one transaction
Next
From: Cédric Villemain
Date:
Subject: Re: many sql file and one transaction