Thread: working on support triggers on columns

working on support triggers on columns

From
"Mark Wu"
Date:
<div class="Section1" style="layout-grid:15.6pt"><p class="MsoNormal"><font face="Times New Roman" size="2"><span
lang="EN-US"style="font-size:10.5pt"><br /> I'm currently working on a master student research project “support
triggerson columns” that is supervised by a professor from my university (Ottawa U).  I have contacted Neil Conway
whosename is with this item on the TODO list. It happened that he actually lives very close to me(Queen's U in
Kingston).He has agreed that I work on this.<br /> Please take a look of my design (Some of the ideas are from Neil)<br
/><br/> - change gram.y for CREATE TRIGGER to support the optional column list for this feature,<br /> - change
CreateTrigStmt,trigger, trigdesc node to add support for an optional List of columns; change the various Node  support
functions(equalfuncs.c, copyfuncs.c, etc.)<br /> - change InsertTrigger, (Copy+Free+ equal)TriggerDesc, Relationbuild
functionto add support an optional List of columns.<br /> - change the pg_trigger system catalog to support the new
column.<br /> - change CreateTrigger() to perform some semantic analysis on the list of columns (ensure no column names
areduplicated,  ensure each name references an extent and non-dropped column, and so forth)<br /> - when deciding which
triggersto invoke (executePlan() in execMain.c), add logic to compare the list of columns in the  to-be-executed
commandwith the list of columns in any applicable columns,and only fire a trigger of the column lists  that are
appropriatelycompatible<br /> -investigate the interaction between the column list and rules<br /><br
/></span></font><pclass="MsoNormal"><font face="Times New Roman" size="2"><span lang="EN-US" style="font-size:10.5pt">I
havespent the past four months on this and I have finished the YYpaser, Catalog, trigger creation and some other
supportfunctions, I am working on trigger execution right now. I expect the project will be completed by the end of
July.I would like to know your comments on my design and the procedure of getting my work accepted.<br /><br />
Thanks<br/> Mark Wu<br /><br /><br /></span></font><font face="Arial" size="1"><span lang="EN-US"
style="font-size:9.0pt;
font-family:Arial"></span></font></div>

Re: working on support triggers on columns

From
Robert Treat
Date:
On Mon, 2004-06-28 at 22:21, Mark Wu wrote:
> 
> I'm currently working on a master student research project "support
> triggers on columns" that is supervised by a professor from my
> university (Ottawa U).  I have contacted Neil Conway whose name is with
> this item on the TODO list. It happened that he actually lives very
> close to me(Queen's U in Kingston). He has agreed that I work on this.
> Please take a look of my design (Some of the ideas are from Neil)
> 
> - change gram.y for CREATE TRIGGER to support the optional column list
> for this feature,
> - change CreateTrigStmt, trigger, trigdesc node to add support for an
> optional List of columns; change the various Node  support functions
> (equalfuncs.c, copyfuncs.c, etc.)
> - change InsertTrigger, (Copy+Free+ equal)TriggerDesc, Relationbuild
> function to add support an optional List of columns.
> - change the pg_trigger system catalog to support the new column .
> - change CreateTrigger() to perform some semantic analysis on the list
> of columns (ensure no column names are duplicated,  ensure each name
> references an extent and non-dropped column, and so forth)
> - when deciding which triggers to invoke (executePlan() in execMain.c),
> add logic to compare the list of columns in the  to-be-executed command
> with the list of columns in any applicable columns,and only fire a
> trigger of the column lists  that are appropriately compatible
> -investigate the interaction between the column list and rules
> 
> 

Just to clarify, will the column based triggers be settable once per row
or once per statement or both?  will they have access to NEW/OLD data in
the column?  

> 
> I have spent the past four months on this and I have finished the
> YYpaser, Catalog, trigger creation and some other support functions, I
> am working on trigger execution right now. I expect the project will be
> completed by the end of July. I would like to know your comments on my
> design and the procedure of getting my work accepted.
> 

once you have a working patch, post it to pgsql-patches. if it is not
against cvs head make sure you state which branch it is against and that
the patch is for review and after that you'll probably need to begin
work on getting it to work with cvs head at that time (note we will be
in the middle of beta for 7.5 at that point). If it is against cvs head
then just expect to get some feedback on things to clean up. 

oh, and if you haven't already, check out
http://developer.postgresql.org/readtext.php?src/FAQ/FAQ_DEV.html+Developers-FAQ


Robert Treat
-- 
Build A Brighter Lamp :: Linux Apache {middleware} PostgreSQL



Re: working on support triggers on columns

From
"Greg Sabino Mullane"
Date:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
> I would like to know your comments on my design and the
> procedure of getting my work accepted.
Glad to see this is being handled by someone. Other things
of the top of my head:
Add support for psql to display the information. Add support
for tab-completion if needed. *Update all relevant documentation.*
Consider a mechanism for adding or dropping columns (e.g.
ALTER TRIGGER). Handle dropped columns (via ALTER TABLE)
gracefully. Write comprehensive tests. Make sure you have
full permission and rights to donate the work to the project.
Thanks for the work: hopefully this will make it into 7.6 (8.1 ?)
- --
Greg Sabino Mullane greg@turnstep.com
PGP Key: 0x14964AC8 200407021828
-----BEGIN PGP SIGNATURE-----
iD8DBQFA5eLpvJuQZxSWSsgRAmSWAKCIjN3nbtZMqWZ3rCCirjYDG0meogCgrnMD
+qVc1lfPJ8epbvKMacC3YD4=
=e2pq
-----END PGP SIGNATURE-----




Re: working on support triggers on columns

From
Christopher Kings-Lynne
Date:
> Glad to see this is being handled by someone. Other things
> of the top of my head:
>  
> Add support for psql to display the information.

For that he needs to update pg_get_triggerdef() in 
src/backend/utils/adt/ruleutils.c  He should probably also check pg_dump 
support for them.

> Add support
> for tab-completion if needed. *Update all relevant documentation.*
> Consider a mechanism for adding or dropping columns (e.g.
> ALTER TRIGGER). Handle dropped columns (via ALTER TABLE)
> gracefully. 

Not necessary ISTM - there's no way to alter existing triggers, and I 
don't see why we should bother with adding a command just for this.

Chris