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

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

Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> writes:
> 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:

Ah yes, that's minimal code duplication and cleaner effect.

> RenameStmt:
> if (stmt allows event triggers)
> ProcessSlowUtility(...);
> else
> ExecRenameStmt(stmt);
> break;
>
> while in ProcessSlowUtility it'd just look normal:
>
> RenameStmt:
> ExecRenameStmt(stmt);
> break;

I like it globally. Do you think some inline magic needs to happen to
try and convince the compiler to process the whole thing as a single
function? My understanding is that while there's no way to require the
inlining to happen we still have some provisions to hint the compilers
wanting to listen, or something like that.

> 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.

And even better, could easily be made different from a call site to the
next, by simply upgrading the complex command into the main utility
switch.

Do you want me to work on a patch at the end of this week?

Regards,
--
Dimitri Fontaine
http://2ndQuadrant.fr PostgreSQL : Expertise, Formation et Support

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Alvaro Herrera 2013-04-09 20:24:11 Re: [COMMITTERS] pgsql: Add sql_drop event for event triggers
Previous Message Kevin Grittner 2013-04-09 18:04:21 pgsql: Create a distinction between a populated matview and a scannable

Browse pgsql-hackers by date

  From Date Subject
Next Message Bert 2013-04-09 20:03:01 introduction
Previous Message Stephen R. van den Berg 2013-04-09 19:34:32 Re: Success (Re: page 1 of relation global/11787 was uninitialized)