Changes in Trigger Firing

From: Sameer Kumar <sameer(dot)kumar(at)ashnik(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Changes in Trigger Firing
Date: 2013-12-04 06:50:30
Message-ID: CADp-Sm64HjCutCWYO8nswP8P65yTMh_1U_Y5XZ0X7ww1_CV1vQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgadmin-hackers pgsql-hackers

Hi all,

I am doing some changes in trigger firing mechanism (as a POC first, I will
share my work if people find it useful and if it works).

I am going to extend the trigger calls to child tables. So that in trigger
definition I can create triggers with CASCADED TRUE | FALSE option.

This will enable me to extend certain triggers to child tables and get over
the scenarios when a record gets inserted in child table and any *after
insert* triggers on parent tables never get fired.

I am right now trying to change pg_trigger and CreateTrigger function. I
have made changes in below files:
trigger.c:
- Added a New Variable cascadedOption (bool)
- Added a new statement in trigger.c to set the value:
values[Anum_pg_trigger_tgiscascaded - 1] =
BoolGetDatum(stmt->cascadedOption);
- Added a new column in CATALOG definition of pg_trigger in
pg_trigger.h
bool tgiscascaded;
- In pg_trigger.h, added a new position for values
#define Anum_pg_trigger_tgiscascaded 16
- Modified parsenode.h to add a new element in Structure for trigger
statement -CreateTrigStmt

bool cascadedOption;

CreateTrigStmt is passed to CreateTrigger function as an arguement. I am
struggling to understand how the values for various members of trigger are
set and where [which file] calls CreateTrigStmt.

Can someone provide some help on this?

Best Regards,
*Sameer Kumar | Database Consultant*

*ASHNIK PTE. LTD. *101 Cecil Street, #11-11 Tong Eng Building, Singapore
069533
M : *+65 8110 0350* T: +65 6438 3504 | www.ashnik.com
www.facebook.com/ashnikbiz | www.twitter.com/ashnikbiz

[image: email patch]

This email may contain confidential, privileged or copyright material and
is solely for the use of the intended recipient(s).

Responses

Browse pgadmin-hackers by date

  From Date Subject
Next Message Dhiraj Chawla 2013-12-04 09:08:21 Text goes out of header area in html reports
Previous Message J.F. Oster 2013-12-03 15:27:19 Re: PATCH: Choose best width for Data Output columns of Query tool

Browse pgsql-hackers by date

  From Date Subject
Next Message Shigeru Hanada 2013-12-04 06:56:29 Re: Custom Scan APIs (Re: Custom Plan node)
Previous Message Álvaro Hernández Tortosa 2013-12-04 06:42:14 Re: RFC: programmable file format for postgresql.conf