Re: Command Triggers, patch v11

From: Thom Brown <thom(at)linux(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Dimitri Fontaine <dimitri(at)2ndquadrant(dot)fr>, pgsql-hackers(at)postgresql(dot)org, Andres Freund <andres(at)anarazel(dot)de>
Subject: Re: Command Triggers, patch v11
Date: 2012-03-09 15:09:04
Message-ID: CAA-aLv6-uZ+oNDzRAc9XrH8M6RJgSi7+VviozjoiCM5FNz07tg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 9 March 2012 15:05, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Robert Haas <robertmhaas(at)gmail(dot)com> writes:
>> On Fri, Mar 9, 2012 at 9:22 AM, Thom Brown <thom(at)linux(dot)com> wrote:
>>> Sorry, I meant any command trigger.  It's because none of the commands
>>> can be run on a standby, so the triggers don't seem appropriate.
>
>> I'm not convinced.  Right now, it's fairly useless - all the triggers
>> could possibly do is throw an error, and an error is going to get
>> thrown anyway, so it's only a question of which error message the user
>> will see.  But we discussed before the idea of adding a capability for
>> BEFORE triggers to request that the actual execution of the command
>> get skipped, and then it's possible to imagine this being useful.
>
> Um, surely the "you can't do that in a read-only session" error is going
> to get thrown long before the command trigger could be called?

Yes, at the moment that's the case. I said that this wasn't the case
for utility commands but I've noticed the message is different for
those:

ERROR: cannot execute VACUUM during recovery

vs

ERROR: cannot execute CREATE TABLE in a read-only transaction

So my complaint around that was misleading and wrong.

--
Thom

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2012-03-09 15:10:10 pg_upgrade and umask
Previous Message Tom Lane 2012-03-09 15:05:05 Re: Command Triggers, patch v11