Re: Referencing OLD/NEW Rows on Trigger Definition - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Referencing OLD/NEW Rows on Trigger Definition
Date
Msg-id 26138.1092424856@sss.pgh.pa.us
Whole thread Raw
In response to Referencing OLD/NEW Rows on Trigger Definition  (henryyipca@yahoo.ca (Henry))
List pgsql-hackers
henryyipca@yahoo.ca (Henry) writes:
> As part of the project, we need to implement a new feature for the
> trigger creation in
> PostgreSQL, which defines aliases for the "old" and "new" data by
> adding
> the REFERENCING clause to the CREATE TRIGGER statement.  Based on my
> research, the following items need to be modified to support the
> REFERENCING option.

> - modify backend\parser\gram.y and keyword.c
> - modify CreateTrigStmt node struct
> - modify pg_trigger struct in pg_trigger.h, Trigger and TriggerDesc
> structs in rel.h, TriggerData struct in trigger.h
> - modify CreateTrigger(), RelationBuildTriggers(), InsertTrigger(),
> CopyTriggerDesc(), FreeTriggerDesc(), ExecBSInsertTriggers(),
> ExecASInsertTriggers(), ExecBRInsertTriggers(),
> ExecARInsertTriggers(), ExecBSDeleteTriggers(),
> ExecASDeleteTriggers(), ExecBRDeleteTriggers(),
> ExecARDeleteTriggers(), ExecBSUpdateTriggers(),
> ExecASUpdateTriggers(), ExecBRUpdateTriggers(), ExecBRUpdateTriggers()
> - to handle the new option, create new fuctions
> ExecBSOInsertTriggers(), ExecASOInsertTriggers(),
> ExecBROInsertTriggers(), ExecAROInsertTriggers(),
> ExecBSNInsertTriggers(), ExecASNInsertTriggers(),
> ExecBRNInsertTriggers(), ExecARNInsertTriggers(),
> ExecBSODeleteTriggers(), ExecASODeleteTriggers(),
> ExecBRODeleteTriggers(), ExecARODeleteTriggers(),
> ExecBSNDeleteTriggers(), ExecASNDeleteTriggers(),
> ExecBRNDeleteTriggers(), ExecARNDeleteTriggers(),
> ExecBSOUpdateTriggers(), ExecASOUpdateTriggers(),
> ExecBROUpdateTriggers(), ExecBROUpdateTriggers(),
> ExecBSNUpdateTriggers(), ExecASNUpdateTriggers(),
> ExecBRNUpdateTriggers(), ExecBRNUpdateTriggers()
> - add supports to ExecutePlan(), ExecInsert(), ExecDelete(),
> ExecUpdate() in \backend\executor\execMain.c
> - add supports to backend\node\equalfuncs.c and copyfuncs.c

Seems to me you are hacking on way more than you want to.  Take another
look at your design and see if there isn't a smaller design struggling
to get out.  In particular, why are you touching any of the executor
(which hardly deals in column names at all) rather than implementing the
aliasing in plpgsql?
        regards, tom lane


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Asserting existing key to be primary
Next
From: Tom Lane
Date:
Subject: Re: BEGIN EXCEPTION END - small bug?