Re: A bad behavior under autocommit off mode

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Hiroshi Inoue <Inoue(at)tpf(dot)co(dot)jp>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: A bad behavior under autocommit off mode
Date: 2003-03-20 04:36:41
Message-ID: 200303200436.h2K4aff19771@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tom Lane wrote:
> Hiroshi Inoue <Inoue(at)tpf(dot)co(dot)jp> writes:
> > Bruce Momjian wrote:
> >> This patch removes that "stuff all queries into a single transaction"
> >> behavior and makes them function just like queries arriving separately.
> >> This does BREAK BACKWARD COMPATIBILITY. However, if they want the old
> >> behavior, they just need to wrap BEGIN/COMMIT around the query string.
>
> > Does the change worth the trouble ?
> > Please don't break BACKWARD COMPATIBILITY easily.
>
> I do not like this change either. It breaks long-established behavior
> simply to have an easy fix for a recently-introduced bug (and what's
> more, a bug in a feature that we may end up removing completely; I like
> Peter's idea that autocommit on the client side is a better approach).

I don't like pushing autocommit to the client.

> It would be a serious error to imagine that psql -c strings are the only
> case where this behavior applies. PQexec and interfaces based on it
> exhibit the same behavior. The behavior is actually useful for
> pipelining (send several queries in one PQsendQuery, read and process
> the results one at a time with PQgetResult; then the server's processing
> of the additional commands is overlapped with client-side processing of
> the results). So I believe there are applications out there depending
> on it.

The fix only changes the 'make it all one transaction' behavior. It
does not effect sending multiple queries in a string --- what will
happen with the patch is that the queries will be processed using normal
transaction commit rules, rather than bunched up. Yes, I am sure this
bunching is used a lot.

Clearly we don't want to do this just to fix autocommit --- there are
other ways. But I do think the roll-queries-into-one-transaction is
strange and should be removed with the patch.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2003-03-20 04:39:34 Re: fixups for 7.3 to contrib directories
Previous Message Tom Lane 2003-03-20 04:32:46 Re: A bad behavior under autocommit off mode