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

From henryyipca@yahoo.ca (Henry)
Subject Re: Referencing OLD/NEW Rows on Trigger Definition
Date
Msg-id b48a6e26.0408181219.72035814@posting.google.com
Whole thread Raw
In response to Referencing OLD/NEW Rows on Trigger Definition  (henryyipca@yahoo.ca (Henry))
List pgsql-hackers
> 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
Thanks for Tom's advices.

Here are my updated design.

1. modify backend\parser\gram.y and keyword.c to make an automatic alias
for OLD/NEW record (handle REFERENCING option) for CREATE TRIGGER query.
2. add two new fields (int old / char *identifier) into CreateTrigStmt
node struct to receive parameters from the CREATE TRIGGER query.
3. add one field (NameData tgidentifier) into CATALOG(pg_trigger) to store
the alias name.
4. add one field (char *identifier) into Trigger struct to store the alias
name for loading the trigger.
5. modify CreateTrigger() in trigger.c to insert new triggers into
pg_trigger with the new fields.
6. modify RelationBuildTriggers() in trigger.c for loading triggers with
new fields for the relation being accessed.
7. add supports to backend\node\equalfuncs.c and copyfuncs.c.

Any comments or advices would be appreciated.


Henry


pgsql-hackers by date:

Previous
From: Rodrigo Bonfa
Date:
Subject: PostgreSQL as a DDBMS
Next
From: Christopher Browne
Date:
Subject: Re: [ADMIN] Pseudo-Off-topic-survey: Opinions about future of Postgresql(MySQL)?