Re: [GENERAL] Rollback on include error in psql

2014-12-29 Thread Adrian Klaver
On 12/29/2014 04:26 PM, David Johnston wrote: On Mon, Dec 29, 2014 at 5:09 PM, Adrian Klaver mailto:adrian.kla...@aklaver.com>>wrote: On 12/29/2014 03:56 PM, David Johnston wrote: ​So you think psql should issue "COMMIT;" even if it is exiting due to "ON_ERROR_STOP"

Re: [GENERAL] Rollback on include error in psql

2014-12-29 Thread David Johnston
On Mon, Dec 29, 2014 at 5:09 PM, Adrian Klaver wrote: > On 12/29/2014 03:56 PM, David Johnston wrote: > >> > ​So you think psql should issue "COMMIT;" even if it is exiting due to >> > "ON_ERROR_STOP"? >> > > I say yes, if it is a non-SQL error. As Viktor stated, SQL errors abort > the transacti

Re: [GENERAL] Rollback on include error in psql

2014-12-29 Thread Adrian Klaver
On 12/29/2014 03:56 PM, David Johnston wrote: ​So you think psql should issue "COMMIT;" even if it is exiting due to "ON_ERROR_STOP"? I say yes, if it is a non-SQL error. As Viktor stated, SQL errors abort the transaction. Whether you do or don't can you show me where in the documen

Re: [GENERAL] Rollback on include error in psql

2014-12-29 Thread David Johnston
On Mon, Dec 29, 2014 at 4:38 PM, Adrian Klaver wrote: > On 12/29/2014 02:55 PM, David Johnston wrote: > >> On Mon, Dec 29, 2014 at 3:37 PM, Adrian Klaver >> mailto:adrian.kla...@aklaver.com>>wrote: >> >> On 12/29/2014 02:28 PM, David Johnston wrote: >> >> On Mon, Dec 29, 2014 at 3:07

Re: [GENERAL] Rollback on include error in psql

2014-12-29 Thread Adrian Klaver
On 12/29/2014 02:55 PM, David Johnston wrote: On Mon, Dec 29, 2014 at 3:37 PM, Adrian Klaver mailto:adrian.kla...@aklaver.com>>wrote: On 12/29/2014 02:28 PM, David Johnston wrote: On Mon, Dec 29, 2014 at 3:07 PM, Adrian Klaver mailto:adrian.kla...@aklaver.com>

Re: [GENERAL] Rollback on include error in psql

2014-12-29 Thread David Johnston
On Mon, Dec 29, 2014 at 3:37 PM, Adrian Klaver wrote: > On 12/29/2014 02:28 PM, David Johnston wrote: > >> On Mon, Dec 29, 2014 at 3:07 PM, Adrian Klaver >> mailto:adrian.kla...@aklaver.com>>wrote: >> >> On 12/29/2014 09:38 AM, David Johnston wrote: >> >> >> This is one of those

Re: [GENERAL] Rollback on include error in psql

2014-12-29 Thread Adrian Klaver
On 12/29/2014 02:28 PM, David Johnston wrote: On Mon, Dec 29, 2014 at 3:07 PM, Adrian Klaver mailto:adrian.kla...@aklaver.com>>wrote: On 12/29/2014 09:38 AM, David Johnston wrote: This is one of those glass half full/empty situations, where it is down to t

Re: [GENERAL] Rollback on include error in psql

2014-12-29 Thread David Johnston
On Mon, Dec 29, 2014 at 3:07 PM, Adrian Klaver wrote: > On 12/29/2014 09:38 AM, David Johnston wrote: > >> >> This is one of those glass half full/empty situations, where it is >> down to the eye of the beholder. I would also say this a perfect >> example of why tests are written, to

Re: [GENERAL] Rollback on include error in psql

2014-12-29 Thread Adrian Klaver
On 12/29/2014 09:38 AM, David Johnston wrote: Copying -bugs to gain broader attention and opinions. On Mon, Dec 29, 2014 at 10:06 AM, Adrian Klaver mailto:adrian.kla...@aklaver.com>>wrote: On 12/29/2014 08:49 AM, David Johnston wrote: On Mon, Dec 29, 2014 at 9:39 AM, Adrian Klaver

Re: [GENERAL] Rollback on include error in psql

2014-12-29 Thread David Johnston
Copying -bugs to gain broader attention and opinions. On Mon, Dec 29, 2014 at 10:06 AM, Adrian Klaver wrote: > On 12/29/2014 08:49 AM, David Johnston wrote: > >> On Mon, Dec 29, 2014 at 9:39 AM, Adrian Klaver >> mailto:adrian.kla...@aklaver.com>>wrote: >> >> >> On 12/29/2014 07:59 AM, David

Re: [GENERAL] Rollback on include error in psql

2014-12-29 Thread Adrian Klaver
On 12/29/2014 08:49 AM, David Johnston wrote: On Mon, Dec 29, 2014 at 9:39 AM, Adrian Klaver mailto:adrian.kla...@aklaver.com>>wrote: On 12/29/2014 07:59 AM, David Johnston wrote: Anyway, the third undocumented bug is that --single-transactions gets to send its COMM

Re: [GENERAL] Rollback on include error in psql

2014-12-29 Thread David Johnston
On Mon, Dec 29, 2014 at 9:49 AM, David Johnston wrote: > On Mon, Dec 29, 2014 at 9:39 AM, Adrian Klaver > wrote: > >> On 12/29/2014 07:59 AM, David Johnston wrote: >> >>> >>> Anyway, the third undocumented bug is that --single-transactions gets to >>> send its COMMIT even if ON_ERROR_STOP​ >>> ​

Re: [GENERAL] Rollback on include error in psql

2014-12-29 Thread David Johnston
On Mon, Dec 29, 2014 at 9:39 AM, Adrian Klaver wrote: > On 12/29/2014 07:59 AM, David Johnston wrote: > >> >> Anyway, the third undocumented bug is that --single-transactions gets to >> send its COMMIT even if ON_ERROR_STOP​ >> ​takes hold before the end of the script. I imagined it such that on

Re: [GENERAL] Rollback on include error in psql

2014-12-29 Thread Adrian Klaver
On 12/29/2014 07:59 AM, David Johnston wrote: On Mon, Dec 29, 2014 at 8:49 AM, Adrian Klaver mailto:adrian.kla...@aklaver.com>>wrote: On 12/28/2014 05:04 PM, David G Johnston wrote: > Adrian Klaver-4 wrote >> On 12/28/2014 10:06 AM, Viktor Shitkovskiy wrote: >>> I include my o

Re: [GENERAL] Rollback on include error in psql

2014-12-29 Thread David Johnston
On Mon, Dec 29, 2014 at 8:49 AM, Adrian Klaver wrote: > On 12/28/2014 05:04 PM, David G Johnston wrote: > > Adrian Klaver-4 wrote > >> On 12/28/2014 10:06 AM, Viktor Shitkovskiy wrote: > >>> I include my own scripts. Each of them creates some table or makes some > >>> changes to existing tables.

Re: [GENERAL] Rollback on include error in psql

2014-12-29 Thread Adrian Klaver
On 12/28/2014 05:04 PM, David G Johnston wrote: > Adrian Klaver-4 wrote >> On 12/28/2014 10:06 AM, Viktor Shitkovskiy wrote: >>> I include my own scripts. Each of them creates some table or makes some >>> changes to existing tables. >> >> It is hard to say where to go from here without more informa

Re: [GENERAL] Rollback on include error in psql

2014-12-28 Thread Viktor Shitkovskiy
So should I report a bug somewhere? As a workaround I'm currently using a wrapper bash script that parses the source psql script and checks if the 'include' and 'copy-from' files do really exist. On Mon, Dec 29, 2014 at 4:04 AM, David G Johnston < david.g.johns...@gmail.com> wrote: > > I would s

Re: [GENERAL] Rollback on include error in psql

2014-12-28 Thread David G Johnston
Adrian Klaver-4 wrote > On 12/28/2014 10:06 AM, Viktor Shitkovskiy wrote: >> I include my own scripts. Each of them creates some table or makes some >> changes to existing tables. > > It is hard to say where to go from here without more information. really? This seems like a documentation bug (o

Re: [GENERAL] Rollback on include error in psql

2014-12-28 Thread Adrian Klaver
On 12/28/2014 10:06 AM, Viktor Shitkovskiy wrote: I include my own scripts. Each of them creates some table or makes some changes to existing tables. It is hard to say where to go from here without more information. The options you are passing to psql all have caveats: AUTOCOMMIT When o

Re: [GENERAL] Rollback on include error in psql

2014-12-28 Thread Viktor Shitkovskiy
I include my own scripts. Each of them creates some table or makes some changes to existing tables. Yes, I want a complete rollback. > > Where is the \include coming from? > > What is in the tableX.cre files? > > So if I am following you want a complete rollback on non-SQL or SQL > errors, correc

Re: [GENERAL] Rollback on include error in psql

2014-12-28 Thread Viktor Shitkovskiy
I use --single-transaction flag. But anyway, adding BEGIN and COMMIT doesn't change anything. I stil get that problem. On Sun, Dec 28, 2014 at 5:43 PM, Melvin Davidson wrote: > You did not show the complete script. > Did you remember to start the "transaction" with BEGIN; and end with > COMMIT;?

Re: [GENERAL] Rollback on include error in psql

2014-12-28 Thread Adrian Klaver
On 12/28/2014 12:02 AM, Viktor Shitkovskiy wrote: Hello. I'm trying to execute an sql script file in a single transation. The file contains includes for some other scripts which in my example create some tables. It looks like this: \include ../tables/table1.cre \include ../tables/table

Re: [GENERAL] Rollback on include error in psql

2014-12-28 Thread Melvin Davidson
You did not show the complete script. Did you remember to start the "transaction" with BEGIN; and end with COMMIT;? eg: BEGIN; \include ../tables/table1.cre \include ../tables/table2.cre ... \include ../tables/table10.cre COMMIT; On Sun, Dec 28, 2014 at 3:02 AM, Viktor Shitkovskiy wrote: > Hell

[GENERAL] Rollback on include error in psql

2014-12-28 Thread Viktor Shitkovskiy
Hello. I'm trying to execute an sql script file in a single transation. The file contains includes for some other scripts which in my example create some tables. It looks like this: \include ../tables/table1.cre \include ../tables/table2.cre ... \include ../tables/table10.cre I'm