![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
A before trigger doesn't always fire. If a column being inserted into is too small for the incoming data, psql complains: ERROR: value too long for type ... without giving the trigger procedure a chance to deal with it. |
#3
| |||
| |||
|
|
Thomas Erskine <thomas.erskine (AT) sympatico (DOT) ca> writes: A before trigger doesn't always fire. If a column being inserted into is too small for the incoming data, psql complains: ERROR: value too long for type ... without giving the trigger procedure a chance to deal with it. I believe this is a feature, not a bug: a CHAR(4) field should never, ever contain > 4 characters. Whether there is a trigger that is yet to be processed is not relevant. |
#4
| |||
| |||
|
|
Seems to me too, from the standard: "The order of execution of a set of triggers is ascending by value of their timestamp of creation in their descriptors, such that the oldest trigger executes first. If one or more triggers have the same timestamp value, then their relative order of execution is implementation-defined." |
#5
| |||
| |||
|
|
I don't know how the check for the data integrity is implemented but if is a trigger |
|
1) Create table 2) create a before insert trigger: trigger_a 3) create a before insert trigger: trigger_b test=# insert into test values ( 10 ); NOTICE: TRIGGER A NOTICE: TRIGGER B INSERT 3416835 1 |
#6
| |||
| |||
|
|
Gaetano Mendola <mendola (AT) bigfoot (DOT) com> writes: I don't know how the check for the data integrity is implemented but if is a trigger It isn't -- trigger firing order is irrelevant to the original question. |
|
1) Create table 2) create a before insert trigger: trigger_a 3) create a before insert trigger: trigger_b test=# insert into test values ( 10 ); NOTICE: TRIGGER A NOTICE: TRIGGER B INSERT 3416835 1 The firing order of triggers in PostgreSQL is documented: it is done alphabetically. When this was discussed, the consensus was that the "fire by creation order" part of the spec is not very useful, so we decided to deviate from it deliberately. |
#7
| |||
| |||
|
|
Well, it is. If the data integrity was done with a system trigger created at table creation time the firing order is relevant. |
|
Good to hear. So, why the standard is there ? |
![]() |
| Thread Tools | |
| Display Modes | |
| |