Re: [HACKERS] pgsql: Add sql_drop event for event triggers

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Dimitri Fontaine <dimitri(at)2ndquadrant(dot)fr>
Cc: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, pgsql-hackers(at)postgresql(dot)org, pgsql-committers(at)postgresql(dot)org
Subject: Re: [HACKERS] pgsql: Add sql_drop event for event triggers
Date: 2013-04-09 16:36:03
Message-ID: 3513.1365525363@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

Dimitri Fontaine <dimitri(at)2ndquadrant(dot)fr> writes:
> Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> writes:
>> Personally, I'd really like to see the InvokeDDLCommandEventTriggers
>> macros go away; that's not a coding style I find nice. If we had a
>> separate switch containing just the event-supporting calls, we could
>> drop that in favor of one invocation of the trigger stuff before and
>> after the switch.

> That needs either lots of code duplication or some smarts that I don't
> see yet, because of the EventTriggerSupportsObjectType stuff. Anyways
> I'm not much into C macrology myself

Yeah, I was just looking at the IfSupported variant. In the structure
I just suggested (separate ProcessSlowUtility function), we could make
that work by having switch cases for some statements in both functions,
perhaps like this:

RenameStmt:
if (stmt allows event triggers)
ProcessSlowUtility(...);
else
ExecRenameStmt(stmt);
break;

while in ProcessSlowUtility it'd just look normal:

RenameStmt:
ExecRenameStmt(stmt);
break;

This would also get rid of the assumption that's currently wired into
InvokeDDLCommandEventTriggersIfSupported that the only sort of dynamic
test that can be needed is an EventTriggerSupportsObjectType call.
In the sketch above, the if() could be testing any property of the stmt.

regards, tom lane

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Kevin Grittner 2013-04-09 18:04:21 pgsql: Create a distinction between a populated matview and a scannable
Previous Message Tom Lane 2013-04-09 16:28:03 Re: [COMMITTERS] pgsql: Add sql_drop event for event triggers

Browse pgsql-hackers by date

  From Date Subject
Next Message Kevin Grittner 2013-04-09 16:39:52 Re: Call for Google Summer of Code mentors, admins
Previous Message Tom Lane 2013-04-09 16:28:03 Re: [COMMITTERS] pgsql: Add sql_drop event for event triggers