From: | "Michael Paesold" <mpaesold(at)gmx(dot)at> |
---|---|
To: | "Richard Huxton" <dev(at)archonet(dot)com> |
Cc: | "Greg Sabino Mullane" <greg(at)turnstep(dot)com>, <pgsql-hackers(at)postgresql(dot)org>, <pgsql-patches(at)postgresql(dot)org> |
Subject: | Re: [HACKERS] Continue transactions after errors in psql |
Date: | 2005-04-26 14:30:45 |
Message-ID: | 006a01c54a6c$8be5be20$6f01a8c0@zaphod |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers pgsql-patches |
Richard Huxton wrote:
> Michael Paesold wrote:
>>
>> But people (like me for example) will want to enable this behaviour by
>> default. So they (me too) will put the option in .psqlrc. It is then
>> enabled "by default". But then many of my scripts will destroy data
>> instead of just erroring out.
>> I just don't see why non-interactive mode does need such a switch because
>> there is no way to check if there was an error. So just put two queries
>> there and hope one will work?
>
> DROP TABLE foo;
> CREATE TABLE foo...
This would be:
\set AUTOCOMMIT off
DROP TABLE foo; -- error, rolled back
CREATE TABLE foo ...
COMMIT;
You could as well do:
\set AUTOCOMMIT on -- default
DROP TABLE foo; -- print error message
CREATE TABLE foo ...
There is not much difference, except for locking, ok. I see your point, but
I don't think this makes enabling it by default (even in .psqlrc) any safer.
Best Regards,
Michael Paesold
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2005-04-26 14:35:26 | Re: [HACKERS] Continue transactions after errors in psql |
Previous Message | Tom Lane | 2005-04-26 14:28:53 | Re: [HACKERS] Continue transactions after errors in psql |
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2005-04-26 14:35:26 | Re: [HACKERS] Continue transactions after errors in psql |
Previous Message | Tom Lane | 2005-04-26 14:28:53 | Re: [HACKERS] Continue transactions after errors in psql |