pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jeff Boes <jboes@qtm.net>
To: pgsql-sql@postgresql.org
Subject: How to recognize trigger-inserted rows?
Date: Tue, 26 Oct 2004 12:27:43 -0400
Message-ID: <3Wufd.57556$CT6.24544@sam.nntpserver.com> (raw)

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



view thread (2+ messages)  latest in thread

Message-ID: <3Wufd.57556$CT6.24544@sam.nntpserver.com>
Permalink:  ../3Wufd.57556$CT6.24544@sam.nntpserver.com/
Also on:    postgresql.org/message-id/3Wufd.57556$CT6.24544@sam.nntpserver.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: jboes@qtm.net
  Subject: Re: How to recognize trigger-inserted rows?
  In-Reply-To: <3Wufd.57556$CT6.24544@sam.nntpserver.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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