[SQL] Order of trigger execution: AFTER DELETE ON EACH ROW doesn't appear to be working properly

2008-10-13 Thread Christopher Maier
I've got a series of triggers that are responsible for maintaining deduced data in a table (background for this can be found in an earlier mailing list posting: http://archives.postgresql.org/pgsql-sql/2008-10/msg00041.php) . This problem concerns the order in which my triggers are executed.

Re: [SQL] Problem with delete trigger: how to allow only triggers to delete a row?

2008-10-13 Thread Christopher Maier
On Oct 10, 2008, at 5:16 PM, Christopher Maier wrote: On Oct 10, 2008, at 4:53 PM, Tom Lane wrote: Alvaro Herrera <[EMAIL PROTECTED]> writes: Looks like you should revoke DELETE privilege from plain users, and have your delete trigger be a security definer function. There would be anothe

Re: [SQL] Order of trigger execution: AFTER DELETE ON EACH ROW doesn't appear to be working properly

2008-10-13 Thread Tom Lane
"Christopher Maier" <[EMAIL PROTECTED]> writes: > ... Based on debugging messages I added > to the triggers, it looks like the before row triggers fire for ALL > the rows first, THEN all the after row triggers fire. That's correct. After triggers are queued up and fired at end of statement.

Re: [SQL] Order of trigger execution: AFTER DELETE ON EACH ROW doesn't appear to be working properly

2008-10-13 Thread Adrian Klaver
-- Original message -- From: "Christopher Maier" <[EMAIL PROTECTED]> > > As you can see, doing a row-by-row delete works fine, but when doing a > bulk delete, all the before triggers are grouped together, as are all > the after triggers. > > Why are these ca

[SQL] Updating Query of 1 table from data in another

2008-10-13 Thread Chris Preston
Hello all, I'm still new to postgres If I have 2 tables with the following data structure Agentno and agentname (along with many other fields) this table is called agent_master And I have another table with agentno and agentname. Table called updatetable When I add data in the updateta

Re: [SQL] Updating Query of 1 table from data in another

2008-10-13 Thread Scott Marlowe
On Mon, Oct 13, 2008 at 1:23 PM, Chris Preston <[EMAIL PROTECTED]> wrote: > Hello all, I'm still new to postgres > > If I have 2 tables with the following data structure > > Agentno and agentname (along with many other fields) this table is called > agent_master > > And I have another table with ag

Re: [SQL] Order of trigger execution: AFTER DELETE ON EACH ROW doesn't appear to be working properly

2008-10-13 Thread Christopher Maier
On Oct 13, 2008, at 3:08 PM, Adrian Klaver wrote: -- Original message -- From: "Christopher Maier" <[EMAIL PROTECTED]> As you can see, doing a row-by-row delete works fine, but when doing a bulk delete, all the before triggers are grouped together, as are