Alvaro Herrera <alvherre@2ndquadrant.com> writes:
> Now, it annoys me that we now have three places that know about object
> types supported by event triggers: there's a large struct of command tag
> substrings (event_trigger_support), then there's these two functions.
> It might be better to add ObjectType and ObjectClass entries to the
> struct, so that only the struct needs to know about that. The problem
> is that these two functions would have to walk the struct every time,
> instead of being a simple switch.
Back when I added an dedicated event per command, Robert asked me to
work on such a big struct containing all the parameters in the same
place. Then we got back to only a couple of events, and completely
forgot about that.
You can have a look at how it did look like here:
https://github.com/dimitri/postgres/blob/evt_trig_v1/src/backend/utils/cache/evtcache.c
And rather than walk the struct, I did install a couple of dedicated
hash tables so that you could do direct and fast lookups.
Regards,
--
Dimitri Fontaine
http://2ndQuadrant.fr PostgreSQL : Expertise, Formation et Support