Re: A bad behavior under autocommit off mode

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Barry Lind <blind(at)xythos(dot)com>
Cc: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>, 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-21 22:33:53
Message-ID: 15930.1048286033@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Barry Lind <blind(at)xythos(dot)com> writes:
> In the previous email I discusses why autocommit perhaps shouldn't be a
> GUC parameter. From a jdbc perspective what was said in that email
> generally applies to client_encoding and datestyle as well.

Hmm. I'm not sure that it makes sense for clients to want to change
client_encoding on the fly, but it's harder to make that claim for
datestyle. And datestyle has been a SET variable for so long that we
would get a *lot* of compatibility flak if we took it away.

I had originally been thinking of reporting client_encoding as a field
of some message sent only at backend startup. However, what if we send
such a message whenever one of the variables it includes changes?
(This is basically Bruce's idea from last night, but refined to only
send the data when it changes, rather than on every query; that should
eliminate the bandwidth-wastage objection.)

I'm not convinced that it's worth the trouble to make the set of
reported variables be configurable on-the-fly as Bruce was suggesting.
client_encoding and datestyle are candidates to send this way, but are
there really others?

A point that would have to be considered is what to do when a SET
operation is rolled back by transaction abort. I think what we'd need
to do is retransmit each time the effective value changes; so it'd
work like this:

-- initial DateStyle is foo
BEGIN;
SET DateStyle TO bar;
-- backend sends status message showing DateStyle = bar
SELECT ...
-- reported dates will use DateStyle bar
ROLLBACK;
-- backend sends status message showing DateStyle = foo

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2003-03-21 22:36:03 Re: [INTERFACES] Roadmap for FE/BE protocol redesign
Previous Message Bruce Momjian 2003-03-21 22:16:56 Re: A bad behavior under autocommit off mode