Re: What Is The Firing Order? - Mailing list pgsql-general

From
Subject Re: What Is The Firing Order?
Date
Msg-id 200109080224.27aa@lh00.opsion.fr
Whole thread Raw
In response to What Is The Firing Order?  (<cnliou@eurosport.com>)
List pgsql-general
> I don't think oid order would help, because what
> happens if you've say got a trigger and then want
> to add another before it?  I'd guess the most
> general way would be to give triggers some kind of
> numeric ordering not associated with anything else,
> but then you need ways to set it on create
> trigger and probably an alter trigger way to
> change it. :(  I'd guess that there'd be a
> default value if you didn't set it, and that
> triggers of the same value would run in
> indeterminate order like before.

Being an ignorant end user, I would like to add some
humble and stupid opinions.

I too feel using creation timestamps of FK constraint
and custom trigger to determine the firing order
being inconvient for me due to 2 problems:

Problem 1:

I do a lot of table creations like this:
CREATE TABLE table1 (
CONSTRAINT fk1 FOREIGN KEY (field1) REFERENCES table2
(field1) ON UPDATE CASCADE ON DELETE CASCADE,
PRIMARY KEY (field1,field2),
field1 TEXT,
field2 TEXT,
field3 TEXT
);

Then, I create the trigger for table1 UPDATE event.

If the execution order is determined by timestamp or
oid, then I really am happy _now_. However, as
pointed by you experts, problem happens when I want
to change my mind and want my trigger be fired before
fk1. Since trigger can only be created after table is
created, there is no way for me to make the trigger
fired before FK. Am I correct?

Problem 2:

Suppose I dump the database and drop it and then
restore it from the dump file, and my machine runs
"too fast", can it happen that postgresql creates the
same timestamps for the FK and trigger?

Best Regards,

CN

--------------------------------------------------------
You too can have your own email address from Eurosport.
http://www.eurosport.com






pgsql-general by date:

Previous
From:
Date:
Subject: Uniquely identify a connection?
Next
From: David Ford
Date:
Subject: Re: Problem w/ dumping huge table and no disk space