Skip site navigation (1) Skip section navigation (2)

How to recognize trigger-inserted rows?

From: Jeff Boes <jboes(at)qtm(dot)net>
To: pgsql-sql(at)postgresql(dot)org
Subject: How to recognize trigger-inserted rows?
Date: 2004-10-26 16:27:43
Message-ID: 3Wufd.57556$ (view raw, whole thread or download thread mbox)
Lists: pgsql-sql
I have a table with an INSERT/UPDATE/DELETE statement trigger. The 
trigger's action is to insert "jobs" into a queue noting that the table 
has changed.

A number of other tables have FK relationships with this table, and they 
have their own statement triggers that fire on DELETE.

When I delete a number of rows from the first table, the cascading 
deletes into the other tables generate a rather large number of 
trigger-fires, so I end up with way too many rows in the queue-table.

What I would like to do is, within the transaction doing the top-level 
delete, examine the queue-table for duplicate rows and remove those, 
since they are extraneous.

Ideally I would look for rows that have the same transaction ID, but I'm 
having trouble determining what the current ID is. I'm using Pg 7.4.

(Posted from an account used as a SPAM dump. If you really want to get
in touch with me, dump the 'jboes' and substitute 'mur'.)
Jeffery Boes <>< jboes(at)qtm(dot)net

pgsql-sql by date

Next:From: Jeff BoesDate: 2004-10-26 17:00:01
Subject: How to recognize trigger-inserted rows?
Previous:From: Adrian MaierDate: 2004-10-26 06:13:54
Subject: Re: [HACKERS] Question on the 8.0Beta Version

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group