pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
How to recognize trigger-inserted rows?
2+ messages / 2 participants
[nested] [flat]

* How to recognize trigger-inserted rows?
@ 2004-10-26 16:27  Jeff Boes <jboes@qtm.net>
  0 siblings, 0 replies; 2+ messages in thread

From: Jeff Boes @ 2004-10-26 16:27 UTC (permalink / raw)
  To: 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@qtm.net



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* How to recognize trigger-inserted rows?
@ 2004-10-26 17:00  Jeff Boes <jboes@nexcerpt.com>
  0 siblings, 0 replies; 2+ messages in thread

From: jboes@nexcerpt.com @ 2004-10-26 17:00 UTC (permalink / raw)
  To: 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.



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2004-10-26 17:00 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2004-10-26 16:27 How to recognize trigger-inserted rows? Jeff Boes <jboes@qtm.net>
2004-10-26 17:00 How to recognize trigger-inserted rows? Jeff Boes <jboes@nexcerpt.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox