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
  [EMAIL PROTECTED]               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to [EMAIL PROTECTED] so that your
message can get through to the mailing list cleanly

Reply via email to