Re: Connection Pools and DISCARD ALL

Поиск
Список
Период
Сортировка
От Simon Riggs
Тема Re: Connection Pools and DISCARD ALL
Дата
Msg-id 1191509416.4223.150.camel@ebony.site
обсуждение исходный текст
Ответ на Re: Connection Pools and DISCARD ALL  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: Connection Pools and DISCARD ALL  (Neil Conway <neilc@samurai.com>)
Список pgsql-hackers
On Thu, 2007-10-04 at 10:29 -0400, Tom Lane wrote:
> Simon Riggs <simon@2ndquadrant.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
reissue. 

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.

http://svr5.postgresql.org/pgsql-interfaces/2001-02/msg00116.php

--  Simon Riggs 2ndQuadrant  http://www.2ndQuadrant.com



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Alvaro Herrera
Дата:
Сообщение: Re: [SQL] Why does the sequence skip a number with generate_series?
Следующее
От: Gregory Stark
Дата:
Сообщение: Re: uh-oh, dugong failing again