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: Peter Eisentraut <peter_e(at)gmx(dot)net>, Barry Lind <blind(at)xythos(dot)com>, Neil Conway <neilc(at)samurai(dot)com>, 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-24 18:57:03
Message-ID: 200303241857.h2OIv3K29692@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tom Lane wrote:
> Peter Eisentraut <peter_e(at)gmx(dot)net> writes:
> > We can just say, "Don't alter the client encoding behind the back of the
> > driver."
>
> We can perhaps get away with saying that for client_encoding, but what
> of DateStyle? "SET" has been the traditional way to adjust that since
> the stone age.
>
> It seems to me there is not a lot of distance between what I originally
> suggested (transmit values of interesting variables at connection start)
> and what we're talking about here (transmit values of interesting
> variables at connection start and then again if they change). I'm more
> than willing to do the small amount of additional work needed, if it
> makes interface libraries' job easier.

I have been thinking about this SET thing, and here are some more ideas.

One idea is for SET to return a command tag that has more information,
like we do for INSERT/UPDATE/DELETE. It could return the variable
modified and the new value. Of course, that doesn't help with SET
inside transactions because it is only the COMMIT where it should show.
One idea there is for COMMIT to indicate that _some_ SET variable was
changed, and the client has to query the backend for each value it is in
interested in. There is also RESET to deal with, and RESET ALL, which
could change multiple SET values.

For autocommit on the client side, I assume folks realize that the
clients are going to have to parse the query string to find out if BEGIN
is needed, e.g.:

INSERT;COMMIT;INSERT;COMMIT

It will have to deal with quote detection and backslash handling, e.g.
\; doesn't terminate a query, I think.

Also, are we removing the behavior that SET _doesn't_ start a
transaction in autocommit off mode? As I remember, autocommit was the
primary reason we wanted that behavior, and with no SET AUTOCOMMIT, it
seems strange.

--
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 Joe Conway 2003-03-24 18:57:50 Re: SQL99 ARRAY support proposal
Previous Message Robert Treat 2003-03-24 18:38:29 Re: Regular expressions in PostgreSQL