Re: Command Triggers

From: Andres Freund <andres(at)anarazel(dot)de>
To: pgsql-hackers(at)postgresql(dot)org
Cc: Dimitri Fontaine <dimitri(at)2ndquadrant(dot)fr>, Robert Haas <robertmhaas(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Greg Smith <greg(at)2ndquadrant(dot)com>, Bruce Momjian <bruce(at)momjian(dot)us>, Alvaro Herrera <alvherre(at)commandprompt(dot)com>
Subject: Re: Command Triggers
Date: 2012-01-14 00:23:20
Message-ID: 201201140123.20514.andres@anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Friday, January 13, 2012 11:53:32 PM Dimitri Fontaine wrote:
> Andres Freund <andres(at)anarazel(dot)de> writes:
> > I personally think this is an error and those details should at least be
> > available on the c level (e.g. some pg_command_trigger_get_plan()
> > function, only available via C) to allow sensible playing around with
> > that knowledge. I don't really see making progress towards a nice
> > interface unless we get something to play around with out there.
>
> If you target C coded triggers then all you need to do is provide a
> pointer to the Node *parsetree, I would think. What else?
Yes.

Being able to turn that into a statement again is still valuable imo.

> The drawback though is still the same, the day you do that you've
> proposed a public API and changing the parsetree stops being internal
> refactoring.
Yes, sure. I don't particularly care though actually. Changing some generic
guts of trigger functions is not really that much of a problem compared to the
other stuff involoved in a version migration.

> The way around this problem is that if you want a command
> trigger in C, just write an extension that implements the Process
> Utility hook.
The point is that with CREATE COMMAND TRIGGER only the internal part of the
triggers need to change. No the external interface. Which is a big difference
from my pov.
Also hooks are relatively hard to stack, i.e. its hard to use them sensibly
from multiple independent projects. They also cannot be purely installed via
extensions/sql.

Andres

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Noah Misch 2012-01-14 01:02:31 Re: Disabled features on Hot Standby
Previous Message Tom Lane 2012-01-14 00:17:43 Re: Remembering bug #6123