From: | Bruce Momjian <bruce(at)momjian(dot)us> |
---|---|
To: | Robert Haas <robertmhaas(at)gmail(dot)com> |
Cc: | Andres Freund <andres(at)2ndquadrant(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, Morten Hustveit <morten(at)eventures(dot)vc>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Suggestion: Issue warning when calling SET TRANSACTION outside transaction block |
Date: | 2013-11-19 20:27:20 |
Message-ID: | 20131119202720.GW28149@momjian.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Tue, Nov 19, 2013 at 01:37:56PM -0500, Bruce Momjian wrote:
> On Tue, Nov 19, 2013 at 01:31:55PM -0500, Bruce Momjian wrote:
> > On Tue, Nov 19, 2013 at 01:20:47PM -0500, Robert Haas wrote:
> > > I think the pattern is and should be different for toplevel
> > > transaction control commands than for other things. If you issue a
> > > BEGIN, we want it to end up that you're definitely in a transaction at
> > > that point, and if you issue a COMMIT or ROLLBACK or ABORT, we want
> > > you to definitely be out of a transaction after that. This is
> > > important for reasons discussed on Andrew's thread about pre-commit
> > > triggers just today.
> > >
> > > The same considerations don't apply elsewhere; the user has made a
> > > mistake, and there's no particular reason not to throw an ERROR. We
> > > could throw a WARNING or NOTICE and pretend like things are OK, but
> > > there doesn't seem to be much point, certainly not enough to justify
> > > changing long-established behavior.
> >
> > OK, what I am hearing you say is that we should change ABORT from NOTICE
> > to WARNING, leave SAVEPOINT/ROLLBACK TO SAVEPOINT as WARNING (so all
> > transaction control commands are warnings), and leave the new SET
> > commands as ERRORs. Works for me.
>
> Sorry, even I am getting confused. SAVEPOINT/ROLLBACK TO SAVEPOINT stay
> as ERROR, so effectively only top-level transaction control commands
> BEGIN WORK/ABORT/COMMIT are WARNINGS.
Does anyone know if this C comment justifies why ABORT is a NOTICE and
not WARNING?
/*
* The user issued ABORT when not inside a transaction. Issue a
* NOTICE and go to abort state. The upcoming call to
* CommitTransactionCommand() will then put us back into the
* default state.
*/
--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com
+ Everyone has their own god. +
From | Date | Subject | |
---|---|---|---|
Next Message | Andres Freund | 2013-11-19 20:32:41 | Re: Turning recovery.conf into GUCs |
Previous Message | Bruce Momjian | 2013-11-19 20:20:53 | Re: LISTEN / NOTIFY enhancement request for Postgresql |