Re: What Is The Firing Order?
От | |
---|---|
Тема | Re: What Is The Firing Order? |
Дата | |
Msg-id | 200109080224.27aa@lh00.opsion.fr обсуждение исходный текст |
Ответ на | What Is The Firing Order? (<cnliou@eurosport.com>) |
Список | 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 по дате отправления: