Skip site navigation (1) Skip section navigation (2)

Re: Connection Pools and DISCARD ALL

From: Simon Riggs <simon(at)2ndquadrant(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Connection Pools and DISCARD ALL
Date: 2007-10-04 14:50:16
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackerspgsql-patches
On Thu, 2007-10-04 at 10:29 -0400, Tom Lane wrote:
> Simon Riggs <simon(at)2ndquadrant(dot)com> writes:
> > As committed, DISCARD ALL does everything but cannot be issued inside a
> > transaction block.
> > I'd like to propose that DISCARD ALL also issue a ROLLBACK command if it
> > is issued from within a transaction block.
> That was *intentional* to prevent mistakes. 

I understand; I'm challenging that intention. Neil's original commit
message said that was "intended to catch programmer mistakes" and that
such use is "probably unintended". 

If the developer has attempted to issue it in the wrong place, he's
probably also forgot to handle errors correctly, i.e. ROLLBACK then

If we care about helping the developer we should make the command end
the transaction block if one exists then issue it. Less code for the
developer, less mistakes.

>  Somebody who wants the
> above behavior can send "ROLLBACK; DISCARD ALL".

...which generates an ERROR if no transaction is in progress and fills
the log needlessly.

  Simon Riggs

In response to


pgsql-hackers by date

Next:From: Gregory StarkDate: 2007-10-04 14:53:48
Subject: Re: uh-oh, dugong failing again
Previous:From: Michael MeskesDate: 2007-10-04 14:47:50
Subject: Re: Not *quite* there on ecpg fixes

pgsql-patches by date

Next:From: Tom LaneDate: 2007-10-04 19:26:53
Subject: Re: initdb of regression test failed.
Previous:From: Tom LaneDate: 2007-10-04 14:29:00
Subject: Re: Connection Pools and DISCARD ALL

Privacy Policy | About PostgreSQL
Copyright © 1996-2018 The PostgreSQL Global Development Group