Re: Error on failed COMMIT

2021-03-25 Thread David Steele
On 3/25/21 3:07 PM, Dave Cramer wrote: On Thu, 25 Mar 2021 at 12:04, David Steele > wrote: Test are failing on the cfbot for this patch and it looks like a new patch is needed from Dave, at the least, so marking Waiting on Author. Should we be considering

Re: Error on failed COMMIT

2021-03-25 Thread Dave Cramer
On Thu, 25 Mar 2021 at 12:04, David Steele wrote: > On 1/26/21 1:02 PM, Dave Cramer wrote: > > On Tue, 26 Jan 2021 at 12:46, Laurenz Albe > > wrote: > > > > I see your point from the view of the JDBC driver. > > > > It just feels hacky - somewhat similar

Re: Error on failed COMMIT

2021-03-25 Thread David Steele
On 1/26/21 1:02 PM, Dave Cramer wrote: On Tue, 26 Jan 2021 at 12:46, Laurenz Albe > wrote: I see your point from the view of the JDBC driver. It just feels hacky - somewhat similar to what you say above: don't go through the normal transaction rollba

Re: Error on failed COMMIT

2021-01-26 Thread Dave Cramer
On Tue, 26 Jan 2021 at 12:46, Laurenz Albe wrote: > On Tue, 2021-01-26 at 12:25 -0500, Dave Cramer wrote: > > > After thinking some more about it, I think that COMMIT AND CHAIN would > have > > > to change behavior: if COMMIT throws an error (because the transaction > was > > > aborted), no new t

Re: Error on failed COMMIT

2021-01-26 Thread Laurenz Albe
On Tue, 2021-01-26 at 12:25 -0500, Dave Cramer wrote: > > After thinking some more about it, I think that COMMIT AND CHAIN would have > > to change behavior: if COMMIT throws an error (because the transaction was > > aborted), no new transaction should be started. Everything else seems > > fishy:

Re: Error on failed COMMIT

2021-01-26 Thread Vik Fearing
On 1/26/21 6:34 PM, Vik Fearing wrote: > On 1/26/21 6:20 PM, Laurenz Albe wrote: >> After thinking some more about it, I think that COMMIT AND CHAIN would have >> to change behavior: if COMMIT throws an error (because the transaction was >> aborted), no new transaction should be started. Everythin

Re: Error on failed COMMIT

2021-01-26 Thread Vik Fearing
On 1/26/21 6:20 PM, Laurenz Albe wrote: > After thinking some more about it, I think that COMMIT AND CHAIN would have > to change behavior: if COMMIT throws an error (because the transaction was > aborted), no new transaction should be started. Everything else seems fishy: > the statement fails, b

Re: Error on failed COMMIT

2021-01-26 Thread Dave Cramer
On Tue, 26 Jan 2021 at 12:20, Laurenz Albe wrote: > On Tue, 2021-01-26 at 11:09 -0500, Dave Cramer wrote: > > On Tue, 26 Jan 2021 at 05:05, Laurenz Albe > wrote: > > > > > I wonder about the introduction of the new USER_ERROR level: > > > > > > #define WARNING_CLIENT_ONLY20 /* Warnings to

Re: Error on failed COMMIT

2021-01-26 Thread Laurenz Albe
On Tue, 2021-01-26 at 11:09 -0500, Dave Cramer wrote: > On Tue, 26 Jan 2021 at 05:05, Laurenz Albe wrote: > > > I wonder about the introduction of the new USER_ERROR level: > > > > #define WARNING_CLIENT_ONLY20 /* Warnings to be sent to client as > > usual, but > >

Re: Error on failed COMMIT

2021-01-26 Thread Dave Cramer
On Tue, 26 Jan 2021 at 05:05, Laurenz Albe wrote: > On Mon, 2021-01-25 at 11:29 -0500, Dave Cramer wrote: > > Rebased against head > > > > Here's my summary of the long thread above. > > > > This change is in keeping with the SQL spec. > > > > There is an argument (Tom) that says that this will a

Re: Error on failed COMMIT

2021-01-26 Thread Dave Cramer
On Tue, 26 Jan 2021 at 06:59, Masahiko Sawada wrote: > On Tue, Jan 26, 2021 at 7:06 PM Laurenz Albe > wrote: > > > > On Mon, 2021-01-25 at 11:29 -0500, Dave Cramer wrote: > > > Rebased against head > > > > > > Here's my summary of the long thread above. > > > > > > This change is in keeping with

Re: Error on failed COMMIT

2021-01-26 Thread Masahiko Sawada
On Tue, Jan 26, 2021 at 7:06 PM Laurenz Albe wrote: > > On Mon, 2021-01-25 at 11:29 -0500, Dave Cramer wrote: > > Rebased against head > > > > Here's my summary of the long thread above. > > > > This change is in keeping with the SQL spec. > > > > There is an argument (Tom) that says that this wil

Re: Error on failed COMMIT

2021-01-26 Thread Laurenz Albe
On Mon, 2021-01-25 at 11:29 -0500, Dave Cramer wrote: > Rebased against head > > Here's my summary of the long thread above. > > This change is in keeping with the SQL spec. > > There is an argument (Tom) that says that this will annoy more people than it > will please. > I presume this is du

Re: Error on failed COMMIT

2021-01-25 Thread Dave Cramer
Apologies, I should have checked again to make sure the patch applied. This one does and passes tests. Dave Cramer www.postgres.rocks On Mon, 25 Jan 2021 at 09:09, Dave Cramer wrote: > Rebased against head > > Here's my summary of the long thread above. > > This change is in keeping with the

Re: Error on failed COMMIT

2021-01-25 Thread Dave Cramer
Rebased against head Here's my summary of the long thread above. This change is in keeping with the SQL spec. There is an argument (Tom) that says that this will annoy more people than it will please. I presume this is due to the fact that libpq behaviour will change. As the author of the JDBC

Re: Error on failed COMMIT

2021-01-22 Thread Masahiko Sawada
On Thu, Jan 7, 2021 at 11:29 PM Dave Cramer wrote: > > I could if someone wants to commit to reviewing it. > I've updated it a number of times but it seems nobody wants to review it. Since this has a long thread, how about summarizing what consensus we reached and what discussion we still need if

Re: Error on failed COMMIT

2021-01-07 Thread Dave Cramer
I could if someone wants to commit to reviewing it. I've updated it a number of times but it seems nobody wants to review it. Dave Cramer www.postgres.rocks On Thu, 7 Jan 2021 at 09:27, Masahiko Sawada wrote: > Hi Dave, > > On Tue, Dec 1, 2020 at 6:49 PM Georgios Kokolatos > wrote: > > > > Hi

Re: Error on failed COMMIT

2021-01-07 Thread Masahiko Sawada
Hi Dave, On Tue, Dec 1, 2020 at 6:49 PM Georgios Kokolatos wrote: > > Hi, > > this patch fails on the cfbot yet it has received an update during the > current CF. > > I will move it to the next CF and mark it there as Waiting on Author. > This patch has not been updated for almost 2 months. Acc

Re: Error on failed COMMIT

2020-12-01 Thread Georgios Kokolatos
Hi, this patch fails on the cfbot yet it has received an update during the current CF. I will move it to the next CF and mark it there as Waiting on Author. Cheers, Georgios The new status of this patch is: Needs review

Re: Error on failed COMMIT

2020-11-10 Thread Georgios Kokolatos
Hi, I noticed that this patch fails on the cfbot. For this, I changed the status to: 'Waiting on Author'. Cheers, //Georgios The new status of this patch is: Waiting on Author

Re: Error on failed COMMIT

2020-11-10 Thread Dave Cramer
On Mon, 9 Nov 2020 at 16:26, Dave Cramer wrote: > > > On Wed, 30 Sep 2020 at 18:14, Andrew Dunstan < > andrew.duns...@2ndquadrant.com> wrote: > >> >> On 8/4/20 12:19 PM, Dave Cramer wrote: >> > Attached is the rebased patch for consideration. >> > >> > >> >> >> It's a bit sad this has been hangin

Re: Error on failed COMMIT

2020-11-09 Thread Dave Cramer
On Wed, 30 Sep 2020 at 18:14, Andrew Dunstan wrote: > > On 8/4/20 12:19 PM, Dave Cramer wrote: > > Attached is the rebased patch for consideration. > > > > > > > It's a bit sad this has been hanging around so long without attention. > > > The previous discussion seems to give the patch a clean bi

Re: Error on failed COMMIT

2020-10-30 Thread Georgios Kokolatos
Hi, thank you for your contribution. I did notice that the cfbot [1] is failing for this patch. Please try to address the issue for the upcoming commitfest. Cheers, //Georgios [1] http://cfbot.cputube.org/dave-cramer.html

Re: Error on failed COMMIT

2020-09-30 Thread Andrew Dunstan
On 8/4/20 12:19 PM, Dave Cramer wrote: > Attached is the rebased patch for consideration. > > It's a bit sad this has been hanging around so long without attention. The previous discussion seems to give the patch a clean bill of health for most/all of the native drivers. Are there any implica

Re: Error on failed COMMIT

2020-08-04 Thread Dave Cramer
Attached is the rebased patch for consideration. Dave Cramer www.postgres.rocks > > 0001-Throw-error-and-rollback-on-a-failed-transaction-ins.patch Description: Binary data

Re: Error on failed COMMIT

2020-04-18 Thread Tony Locke
On Thu, 16 Apr 2020 at 21:16, Shay Rojansky wrote: > Npgsql would be fine. In fact, Npgsql doesn't have any specific expectations > nor any specific logic around commit; it assumes errors may be returned for > any command (COMMIT or otherwise), and surfaces those errors as .NET > exceptions. H

Re: Error on failed COMMIT

2020-03-30 Thread Shay Rojansky
Apologies for not responding earlier, busy times. Fourth, it is not clear how many applications would break if COMMIT >> started issuing an error rather than return success a with ROLLBACK tag. >> Certainly SQL scripts would be fine. They would have one additional >> error in the script output,

Re: Error on failed COMMIT

2020-03-30 Thread Vik Fearing
On 3/30/20 6:05 PM, Dave Cramer wrote: > So it appears this is currently languishing as unresolved and feature > freeze is imminent. > > What has to be done to get a decision one way or another before feature > freeze. > > I have provided a patch that could be reviewed and at least be considered

Re: Error on failed COMMIT

2020-03-30 Thread Dave Cramer
On Tue, 17 Mar 2020 at 19:32, Dave Cramer wrote: > > > On Tue, 17 Mar 2020 at 19:23, Bruce Momjian wrote: > >> On Tue, Mar 17, 2020 at 07:15:05PM -0400, Dave Cramer wrote: >> > On Tue, 17 Mar 2020 at 16:47, Bruce Momjian wrote: >> > Third, the idea that individual interfaces, e.g. JDBC, sho

Re: Error on failed COMMIT

2020-03-17 Thread Dave Cramer
On Tue, 17 Mar 2020 at 19:23, Bruce Momjian wrote: > On Tue, Mar 17, 2020 at 07:15:05PM -0400, Dave Cramer wrote: > > On Tue, 17 Mar 2020 at 16:47, Bruce Momjian wrote: > > Third, the idea that individual interfaces, e.g. JDBC, should throw > an > > error in this case while the server ju

Re: Error on failed COMMIT

2020-03-17 Thread Bruce Momjian
On Tue, Mar 17, 2020 at 07:15:05PM -0400, Dave Cramer wrote: > On Tue, 17 Mar 2020 at 16:47, Bruce Momjian wrote: > Third, the idea that individual interfaces, e.g. JDBC, should throw an > error in this case while the server just changes the COMMIT return tag > to ROLLBACK is confusing

Re: Error on failed COMMIT

2020-03-17 Thread Dave Cramer
On Tue, 17 Mar 2020 at 16:47, Bruce Momjian wrote: > On Fri, Mar 6, 2020 at 01:12:10PM -0500, Robert Haas wrote: > > On Fri, Mar 6, 2020 at 11:55 AM Dave Cramer > wrote: > > > There have been some arguments that the client can fix this easily. > > > > > > Turns out it is not as easy as one migh

Re: Error on failed COMMIT

2020-03-17 Thread Vladimir Sitnikov
Bruce, thanks for taking the time to summarize. Bruce>Fourth, it is not clear how many applications would break if COMMIT Bruce>started issuing an error rather than return success None. Bruce>applications that issue COMMIT and expect success after a transaction Bruce>block has failed An applica

Re: Error on failed COMMIT

2020-03-17 Thread Bruce Momjian
On Fri, Mar 6, 2020 at 01:12:10PM -0500, Robert Haas wrote: > On Fri, Mar 6, 2020 at 11:55 AM Dave Cramer wrote: > > There have been some arguments that the client can fix this easily. > > > > Turns out it is not as easy as one might think. > > > > If the client (in this case JDBC) uses conn.comm

Re: Error on failed COMMIT

2020-03-06 Thread Robert Haas
On Fri, Mar 6, 2020 at 11:55 AM Dave Cramer wrote: > There have been some arguments that the client can fix this easily. > > Turns out it is not as easy as one might think. > > If the client (in this case JDBC) uses conn.commit() then yes relatively easy > as we know that commit is being executed

Re: Error on failed COMMIT

2020-03-06 Thread Dave Cramer
On Thu, 27 Feb 2020 at 08:30, Dave Cramer wrote: > > > On Thu, 27 Feb 2020 at 07:44, Dave Cramer > wrote: > >> >> >> >> On Wed, 26 Feb 2020 at 16:57, Vik Fearing >> wrote: >> >>> On 26/02/2020 22:22, Tom Lane wrote: >>> > Dave Cramer writes: >>> >> OK, here is a patch that actually doesn't lea

Re: Error on failed COMMIT

2020-02-27 Thread Dave Cramer
On Thu, 27 Feb 2020 at 07:44, Dave Cramer wrote: > > > > On Wed, 26 Feb 2020 at 16:57, Vik Fearing wrote: > >> On 26/02/2020 22:22, Tom Lane wrote: >> > Dave Cramer writes: >> >> OK, here is a patch that actually doesn't leave the transaction in a >> failed >> >> state but emits the error and r

Re: Error on failed COMMIT

2020-02-27 Thread Dave Cramer
On Wed, 26 Feb 2020 at 16:57, Vik Fearing wrote: > On 26/02/2020 22:22, Tom Lane wrote: > > Dave Cramer writes: > >> OK, here is a patch that actually doesn't leave the transaction in a > failed > >> state but emits the error and rolls back the transaction. > > > >> This is far from complete as

Re: Error on failed COMMIT

2020-02-26 Thread Vladimir Sitnikov
But if the SQL is /*commit*/rollback, then the driver should not raise an exception. The exception should be only for the case when the client asks to commit and the database can't do that. The resulting command tag alone is not enough. Vladimir

Re: Error on failed COMMIT

2020-02-26 Thread Robert Haas
On Wed, Feb 26, 2020 at 11:53 PM Vladimir Sitnikov wrote: > Pushing full SQL parser to the driver is not the best idea taking into the > account the extensibility the core has. That wouldn't be necessary. You could just do strcmp() on the command tag. -- Robert Haas EnterpriseDB: http://www.en

Re: Error on failed COMMIT

2020-02-26 Thread Dave Cramer
On Wed, 26 Feb 2020 at 16:57, Vik Fearing wrote: > On 26/02/2020 22:22, Tom Lane wrote: > > Dave Cramer writes: > >> OK, here is a patch that actually doesn't leave the transaction in a > failed > >> state but emits the error and rolls back the transaction. > > > >> This is far from complete as

Re: Error on failed COMMIT

2020-02-26 Thread Vik Fearing
On 26/02/2020 22:22, Tom Lane wrote: > Dave Cramer writes: >> OK, here is a patch that actually doesn't leave the transaction in a failed >> state but emits the error and rolls back the transaction. > >> This is far from complete as it fails a number of tests and does not cover >> all of the pos

Re: Error on failed COMMIT

2020-02-26 Thread Tom Lane
Dave Cramer writes: > OK, here is a patch that actually doesn't leave the transaction in a failed > state but emits the error and rolls back the transaction. > This is far from complete as it fails a number of tests and does not cover > all of the possible paths. > But I'd like to know if this i

Re: Error on failed COMMIT

2020-02-26 Thread Dave Cramer
On Wed, 26 Feb 2020 at 13:46, Vik Fearing wrote: > On 25/02/2020 12:11, Laurenz Albe wrote: > > On Tue, 2020-02-25 at 13:25 +0530, Robert Haas wrote: > >> On Tue, Feb 25, 2020 at 12:47 PM Vladimir Sitnikov > >> wrote: > >>> Noone suggested that "commit leaves the session in a transaction > state

Re: Error on failed COMMIT

2020-02-26 Thread Vik Fearing
On 25/02/2020 12:11, Laurenz Albe wrote: > On Tue, 2020-02-25 at 13:25 +0530, Robert Haas wrote: >> On Tue, Feb 25, 2020 at 12:47 PM Vladimir Sitnikov >> wrote: >>> Noone suggested that "commit leaves the session in a transaction state". >>> Of course, every commit should terminate the transaction

Re: Error on failed COMMIT

2020-02-26 Thread Haumacher, Bernhard
Am 24.02.2020 um 13:34 schrieb Robert Haas: As I said upthread, I think one of the things that would be pretty badly broken by this is psql -f something.sql, where something.sql contains a series of blocks of the form "begin; something; something; something; commit;". Right now whichever transact

Re: Error on failed COMMIT

2020-02-26 Thread Vladimir Sitnikov
Just one more data point: drivers do allow users to execute queries in a free form. Shat is the user might execute /*comment*/commit/*comment*/ as a free-form SQL, and they would expect that the resulting behaviour should be exactly the same as .commit() API call (==silent rollback is converted to

Re: Error on failed COMMIT

2020-02-25 Thread Laurenz Albe
On Tue, 2020-02-25 at 13:25 +0530, Robert Haas wrote: > On Tue, Feb 25, 2020 at 12:47 PM Vladimir Sitnikov > wrote: > > Noone suggested that "commit leaves the session in a transaction state". > > Of course, every commit should terminate the transaction. > > However, if a commit fails (for any rea

Re: Error on failed COMMIT

2020-02-25 Thread Vladimir Sitnikov
Tom>I think we still end up concluding that altering this behavior has more Tom>downside than upside. What is the downside? Applications, drivers, and poolers already expect that commit might produce an error and terminate the transaction at the same time. "The data is successfully committed to

Re: Error on failed COMMIT

2020-02-24 Thread Robert Haas
On Tue, Feb 25, 2020 at 12:47 PM Vladimir Sitnikov wrote: > Noone suggested that "commit leaves the session in a transaction state". > Of course, every commit should terminate the transaction. > However, if a commit fails (for any reason), it should produce the relevant > ERROR that explains what

Re: Error on failed COMMIT

2020-02-24 Thread Vladimir Sitnikov
Robert>Now, of course, it's also true that if what the server does makes Robert>users sad, maybe the server should do something different The server makes users sad as it reports the same end result (=="commit failed") differently. Sometimes the server produces ERROR, and sometimes the server prod

Re: Error on failed COMMIT

2020-02-24 Thread Robert Haas
On Mon, Feb 24, 2020 at 6:40 PM Dave Cramer wrote: > Fair enough. What I meant to say was that the driver isn't in the business of > providing different semantics than the server provides. Still don't agree. The server doesn't make any decision about what semantics the driver has to provide. The

Re: Error on failed COMMIT

2020-02-24 Thread Vladimir Sitnikov
>do you think most common connection poolers would continue to >work after making this change? Of course, they should. There are existing cases when commit responds with an error: deferrable constraints. There's nothing new except it is suggested to make the behavior of commit/prepare failure (e.

Re: Error on failed COMMIT

2020-02-24 Thread Dave Cramer
On Mon, 24 Feb 2020 at 17:59, Merlin Moncure wrote: > On Mon, Feb 24, 2020 at 4:06 PM Vladimir Sitnikov > wrote: > > > > Merlin>My biggest sense of alarm with the proposed change is that it > could > > Merlin>leave applications in a state where the transaction is hanging > there > > > > How come

Re: Error on failed COMMIT

2020-02-24 Thread Merlin Moncure
On Mon, Feb 24, 2020 at 4:06 PM Vladimir Sitnikov wrote: > > Merlin>My biggest sense of alarm with the proposed change is that it could > Merlin>leave applications in a state where the transaction is hanging there > > How come? > The spec says commit ends the transaction. > Can you please clarify

Re: Error on failed COMMIT

2020-02-24 Thread Vik Fearing
On 12/02/2020 00:27, Tom Lane wrote: > Vik Fearing writes: >> On 11/02/2020 23:35, Tom Lane wrote: >>> So I assume you're imagining that that would leave us still in >>> transaction-aborted state, and the session is basically dead in >>> the water until the user thinks to issue ROLLBACK instead? >

Re: Error on failed COMMIT

2020-02-24 Thread Vladimir Sitnikov
Merlin>My biggest sense of alarm with the proposed change is that it could Merlin>leave applications in a state where the transaction is hanging there How come? The spec says commit ends the transaction. Can you please clarify where the proposed change leaves a hanging transaction? Just in case,

Re: Error on failed COMMIT

2020-02-24 Thread Merlin Moncure
On Sun, Feb 23, 2020 at 7:59 PM Dave Cramer wrote: > > I think the fact that this is a violation of the SQL SPEC lends considerable > credence to the argument for changing the behaviour. > Since this can lead to losing a transaction I think there is even more reason > to look at changing the beh

Re: Error on failed COMMIT

2020-02-24 Thread David Fetter
On Mon, Feb 24, 2020 at 06:40:16PM +0100, Vik Fearing wrote: > On 24/02/2020 18:37, David Fetter wrote: > > > If we'd done this from a clean sheet of paper, it would have been the > > right decision. We're not there, and haven't been for decades. > > OTOH, it's never too late to do the right thin

Re: Error on failed COMMIT

2020-02-24 Thread Vik Fearing
On 24/02/2020 18:37, David Fetter wrote: > If we'd done this from a clean sheet of paper, it would have been the > right decision. We're not there, and haven't been for decades. OTOH, it's never too late to do the right thing. -- Vik Fearing

Re: Error on failed COMMIT

2020-02-24 Thread David Fetter
On Mon, Feb 24, 2020 at 06:04:28PM +0530, Robert Haas wrote: > On Mon, Feb 24, 2020 at 1:56 PM Shay Rojansky wrote: > > As Dave wrote, the problem here isn't with the driver, but with framework > > or user-code which swallows the initial exception and allows code to > > continue to the commit. N

Re: Error on failed COMMIT

2020-02-24 Thread Shay Rojansky
>> If we think the current *user-visible* behavior is problematic (commit on failed transaction completes without throwing), then the only remaining question is where this behavior should be fixed - at the server or at the driver. As I wrote above, from the user's perspective it makes no difference

Re: Error on failed COMMIT

2020-02-24 Thread Dave Cramer
If we did change the server behavior, it seems unlikely that > every driver would adjust their behavior to the new server behavior > all at once and that they would all get it right while also all > preserving backward compatibility with current releases in case a > newer driver is used with an old

Re: Error on failed COMMIT

2020-02-24 Thread Dave Cramer
On Mon, 24 Feb 2020 at 07:34, Robert Haas wrote: > On Mon, Feb 24, 2020 at 1:56 PM Shay Rojansky wrote: > > As Dave wrote, the problem here isn't with the driver, but with > framework or user-code which swallows the initial exception and allows code > to continue to the commit. Npgsql (and I'm s

Re: Error on failed COMMIT

2020-02-24 Thread Dave Cramer
On Mon, 24 Feb 2020 at 07:25, Robert Haas wrote: > On Mon, Feb 24, 2020 at 7:29 AM Dave Cramer > wrote: > > Well the driver really isn't in the business of changing the semantics > of the server. > > I mean, I just can't agree with that way of characterizing it. It > seems clear enough that the

Re: Error on failed COMMIT

2020-02-24 Thread Robert Haas
On Mon, Feb 24, 2020 at 1:56 PM Shay Rojansky wrote: > As Dave wrote, the problem here isn't with the driver, but with framework or > user-code which swallows the initial exception and allows code to continue to > the commit. Npgsql (and I'm sure the JDBC driver too) does surface PostgreSQL > e

Re: Error on failed COMMIT

2020-02-24 Thread Robert Haas
On Mon, Feb 24, 2020 at 1:31 PM Vik Fearing wrote: > On 24/02/2020 02:31, Robert Haas wrote: > > I am really struggling to see why this is anything but a bug in the > > JDBC driver. > > I can follow your logic for it being a bug in the JDBC driver, but > "anything but"? No, this is (also) an undo

Re: Error on failed COMMIT

2020-02-24 Thread Robert Haas
On Mon, Feb 24, 2020 at 7:29 AM Dave Cramer wrote: > Well the driver really isn't in the business of changing the semantics of the > server. I mean, I just can't agree with that way of characterizing it. It seems clear enough that the driver not only should not change the semantics of the server

Re: Error on failed COMMIT

2020-02-24 Thread Shay Rojansky
> First, to repeat what I said before, the COMMIT only returns a ROLLBACK command tag if there's been a previous ERROR. So, if you haven't ignored the prior ERROR, you should be fine. [...] > I am really struggling to see why this is anything but a bug in the JDBC driver As Dave wrote, the problem

Re: Error on failed COMMIT

2020-02-24 Thread Vik Fearing
On 24/02/2020 02:31, Robert Haas wrote: > I am really struggling to see why this is anything but a bug in the > JDBC driver. I can follow your logic for it being a bug in the JDBC driver, but "anything but"? No, this is (also) an undocumented violation of SQL. -- Vik Fearing

Re: Error on failed COMMIT

2020-02-23 Thread Dave Cramer
On Sun, 23 Feb 2020 at 20:31, Robert Haas wrote: > On Sun, Feb 23, 2020 at 11:11 AM Shay Rojansky wrote: > > I'd like to second Dave on this, from the .NET perspective - actual > client access is done via standard drivers in almost all cases, and these > drivers generally adhere to database API

Re: Error on failed COMMIT

2020-02-23 Thread Robert Haas
On Sun, Feb 23, 2020 at 11:11 AM Shay Rojansky wrote: > I'd like to second Dave on this, from the .NET perspective - actual client > access is done via standard drivers in almost all cases, and these drivers > generally adhere to database API abstractions (JDBC for Java, ADO.NET for > .NET, and

Re: Error on failed COMMIT

2020-02-23 Thread Vladimir Sitnikov
Shay> Asking drivers to do this at the client have the exact same breakage impact as the server change, since the user-visible behavior changes in the same way +1 Dave>While we can certainly code around this in the client drivers I don't believe they should be responsible for fixing the failings

Re: Error on failed COMMIT

2020-02-23 Thread Dave Cramer
On Sun, 23 Feb 2020 at 00:41, Shay Rojansky wrote: > > > On Fri, 14 Feb 2020 at 14:37, Robert Haas wrote: >> >>> On Fri, Feb 14, 2020 at 2:08 PM Dave Cramer >>> wrote: >>> > Well now you are asking the driver to re-interpret the results in a >>> different way than the server which is not what w

Re: Error on failed COMMIT

2020-02-22 Thread Shay Rojansky
On Fri, 14 Feb 2020 at 14:37, Robert Haas wrote: > >> On Fri, Feb 14, 2020 at 2:08 PM Dave Cramer >> wrote: >> > Well now you are asking the driver to re-interpret the results in a >> different way than the server which is not what we tend to do. >> > >> > The server throws an error we throw an e

Re: Error on failed COMMIT

2020-02-19 Thread Haumacher, Bernhard
Am 17.02.2020 um 23:12 schrieb Dave Cramer: On Mon, 17 Feb 2020 at 13:02, Haumacher, Bernhard > wrote: ... would be an appropriate solution. PostgreSQL reports the "unsuccessful" commit through the "ROLLBACK" status code and the driver translates this in

Re: Error on failed COMMIT

2020-02-17 Thread Alvaro Herrera
On 2020-Feb-14, Dave Cramer wrote: > On Fri, 14 Feb 2020 at 15:19, Alvaro Herrera > wrote: > > > Do you mean "if con.commit() results in a rollback, then an exception is > > thrown, unless the parameter XYZ is set to PQR"? > > No. JDBC has a number of connection parameters which change internal

Re: Error on failed COMMIT

2020-02-17 Thread Dave Cramer
On Mon, 17 Feb 2020 at 13:02, Haumacher, Bernhard wrote: > Am 14.02.2020 um 20:36 schrieb Robert Haas: > > On Fri, Feb 14, 2020 at 2:08 PM Dave Cramer > wrote: > >> Well now you are asking the driver to re-interpret the results in a > different way than the server which is not what we tend to do

Re: Error on failed COMMIT

2020-02-17 Thread Haumacher, Bernhard
Am 14.02.2020 um 20:36 schrieb Robert Haas: On Fri, Feb 14, 2020 at 2:08 PM Dave Cramer wrote: Well now you are asking the driver to re-interpret the results in a different way than the server which is not what we tend to do. The server throws an error we throw an error. We really aren't in t

Re: Error on failed COMMIT

2020-02-14 Thread Dave Cramer
On Fri, 14 Feb 2020 at 15:19, Alvaro Herrera wrote: > On 2020-Feb-14, Dave Cramer wrote: > > > I offered to make the behaviour in the JDBC driver dependent on a > > configuration parameter > > Do you mean "if con.commit() results in a rollback, then an exception is > thrown, unless the parameter

Re: Error on failed COMMIT

2020-02-14 Thread Alvaro Herrera
On 2020-Feb-14, Dave Cramer wrote: > I offered to make the behaviour in the JDBC driver dependent on a > configuration parameter Do you mean "if con.commit() results in a rollback, then an exception is thrown, unless the parameter XYZ is set to PQR"? -- Álvaro Herrerahttps://www

Re: Error on failed COMMIT

2020-02-14 Thread Dave Cramer
On Fri, 14 Feb 2020 at 15:07, Tom Lane wrote: > Dave Cramer writes: > > On Fri, 14 Feb 2020 at 14:37, Robert Haas wrote: > >> I'm not trying to deny that you might find some other server behavior > >> more convenient. You might. And, to Vik's original point, it might be > >> more compliant with

Re: Error on failed COMMIT

2020-02-14 Thread Tom Lane
Dave Cramer writes: > On Fri, 14 Feb 2020 at 14:37, Robert Haas wrote: >> I'm not trying to deny that you might find some other server behavior >> more convenient. You might. And, to Vik's original point, it might be >> more compliant with the spec, too. But since changing that would have >> a pr

Re: Error on failed COMMIT

2020-02-14 Thread Dave Cramer
On Fri, 14 Feb 2020 at 14:37, Robert Haas wrote: > On Fri, Feb 14, 2020 at 2:08 PM Dave Cramer > wrote: > > Well now you are asking the driver to re-interpret the results in a > different way than the server which is not what we tend to do. > > > > The server throws an error we throw an error. W

Re: Error on failed COMMIT

2020-02-14 Thread Robert Haas
On Fri, Feb 14, 2020 at 2:08 PM Dave Cramer wrote: > Well now you are asking the driver to re-interpret the results in a different > way than the server which is not what we tend to do. > > The server throws an error we throw an error. We really aren't in the > business of re-interpreting the se

Re: Error on failed COMMIT

2020-02-14 Thread Dave Cramer
On Fri, 14 Feb 2020 at 13:29, Robert Haas wrote: > On Fri, Feb 14, 2020 at 1:04 PM Dave Cramer > wrote: > > Thing is that con.commit() DOESN'T return a status code, nor does it > throw an exception as we silently ROLLBACK here. > > Why not? There's nothing keeping the driver from doing either of

Re: Error on failed COMMIT

2020-02-14 Thread Robert Haas
On Fri, Feb 14, 2020 at 1:04 PM Dave Cramer wrote: > Thing is that con.commit() DOESN'T return a status code, nor does it throw an > exception as we silently ROLLBACK here. Why not? There's nothing keeping the driver from doing either of those things, is there? I mean, if using libpq, you can us

Re: Error on failed COMMIT

2020-02-14 Thread Dave Cramer
On Fri, 14 Feb 2020 at 12:37, Robert Haas wrote: > On Thu, Feb 13, 2020 at 2:38 AM Haumacher, Bernhard > wrote: > > Assume the application is written in Java and sees Postgres through the > > JDBC driver: > > > > composeTransaction() { > > Connection con = getConnection(); // implicitly "beg

Re: Error on failed COMMIT

2020-02-14 Thread Robert Haas
On Thu, Feb 13, 2020 at 2:38 AM Haumacher, Bernhard wrote: > Assume the application is written in Java and sees Postgres through the > JDBC driver: > > composeTransaction() { > Connection con = getConnection(); // implicitly "begin" > try { >insertFrameworkLevelState(con); >

Re: Error on failed COMMIT

2020-02-12 Thread Haumacher, Bernhard
Am 12.02.2020 um 00:27 schrieb Tom Lane: Vik Fearing writes: Actually, I was imagining that it would end the transaction as it does today, just with an error code. This is backed up by General Rule 9 which says "The current SQL-transaction is terminated." Hm ... that would be sensible, but I'm

Re: Error on failed COMMIT

2020-02-11 Thread Dave Cramer
On Tue, 11 Feb 2020 at 17:35, Tom Lane wrote: > Vik Fearing writes: > > There is a current discussion off-list about what should happen when a > > COMMIT is issued for a transaction that cannot be committed for whatever > > reason. PostgreSQL returns ROLLBACK as command tag but otherwise > succ

Re: Error on failed COMMIT

2020-02-11 Thread Tom Lane
Vik Fearing writes: > On 11/02/2020 23:35, Tom Lane wrote: >> So I assume you're imagining that that would leave us still in >> transaction-aborted state, and the session is basically dead in >> the water until the user thinks to issue ROLLBACK instead? > Actually, I was imagining that it would e

Re: Error on failed COMMIT

2020-02-11 Thread Vik Fearing
On 11/02/2020 23:35, Tom Lane wrote: > Vik Fearing writes: >> There is a current discussion off-list about what should happen when a >> COMMIT is issued for a transaction that cannot be committed for whatever >> reason. PostgreSQL returns ROLLBACK as command tag but otherwise succeeds. > >> It s

Re: Error on failed COMMIT

2020-02-11 Thread Tom Lane
Vik Fearing writes: > There is a current discussion off-list about what should happen when a > COMMIT is issued for a transaction that cannot be committed for whatever > reason. PostgreSQL returns ROLLBACK as command tag but otherwise succeeds. > It seems like [ trying to commit a failed transac