Tom Lane wrote:
> Bruce Momjian <pgman@candle.pha.pa.us> writes:
> > Tom Lane wrote:
> >> Perhaps RESET AUTOCOMMIT is a good enough answer?
>
> > I was unclear on that. RESET sets it back to the postgresql.conf value,
> > right? Do we know that the session didn't change it earlier in the
> > script? That's where it gets tricky.
>
> You're postulating a scenario in which some snippet of code doesn't know
> what the surrounding script/application likes for AUTOCOMMIT, but does
> know enough about the context to know that it's not inside a transaction
> block already. That combination seems moderately implausible to me.
> Anyone have an example where it'd really be useful?
Well, in most cases, if you don't know, you do BEGIN ... COMMIT, but in
the case of VACUUM/TRUNCATE, you can't do that, so you need some smarts.
It is a contrived example. I am just throwing it out for illumination.
I often throw out scenarios at the edges to see if it strikes anyone as
a problem. When it doesn't, we can move ahead.
-- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610)
359-1001+ If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square,
Pennsylvania19073