Re: Vote totals for SET in aborted transaction

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: "Marc G(dot) Fournier" <scrappy(at)hub(dot)org>
Cc: Hannu Krosing <hannu(at)tm(dot)ee>, Scott Marlowe <scott(dot)marlowe(at)ihs(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Vote totals for SET in aborted transaction
Date: 2002-04-29 16:45:02
Message-ID: 200204291645.g3TGj2w11278@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Marc G. Fournier wrote:
> On Mon, 29 Apr 2002, Bruce Momjian wrote:
>
> > Hannu Krosing wrote:
> > > On Mon, 2002-04-29 at 17:09, Scott Marlowe wrote:
> > > > For this reason, I propose that a transaction should "inherit" its
> > > > environment, and that all changes EXCEPT for those affecting tuples should
> > > > be rolled back after completion, leaving the environment the way we found
> > > > it. If you need the environment changed, do it OUTSIDE the transaction.
> > >
> > > Unfortunately there is no such time in postgresql where commands are
> > > done outside transaction.
> > >
> > > If you don't issue BEGIN; then each command is implicitly run in its own
> > > transaction.
> > >
> > > Rolling each command back unless it is in implicit transaction would
> > > really confuse the user.
> >
> > Agreed, very non-intuitive. And can you imagine how many applications
> > we would break.
>
> Since there is obviously no defined standard for how a SET should be
> treated within a transaction ... who cares? God, how many changes have we
> made in the past that "break applications" but did them anyway?

Well, I think SET being always rolled back in a multi-statement
transaction is not the behavior most people would want. I am sure there
are some cases people would want it, but I doubt it should be the
default.

> Just as a stupid question here ... but, why do we wrap single queries into
> a transaction anyway? IMHO, a transaction is meant to tell the backend to
> remember this sequence of events, so that if it fails, you can roll it
> back ... with a single INSERT/UPDATE/DELETE, why 'auto-wrapper' it with a
> BEGIN/END?

Because INSERT/UPDATE/DELETE is actually INSERT/UPDATE/DELETE on every
effected row, with tiggers and all, so it is not as _single_ as it
appears.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Olivier PRENANT 2002-04-29 16:46:10 Re: clarification of timestamp
Previous Message tony 2002-04-29 16:42:13 Re: pid gets overwritten in OSX