Thanks, Tom. Now I got it. I didn't tryed to change BEFORE to AFTER, but reminded something I learned coding triggers a long time ago, and I forgot. This could be a fortune:
"The rough rule of thumb is that BEFORE triggers are good for adjusting the contents of the row that's about to be stored, while AFTER triggers are what to use to propagate changes elsewhere." And the full version (from manual): "Typically, row-level BEFORE triggers are used for checking or modifying the data that will be inserted or updated. For example, a BEFORE trigger might be used to insert the current time into a timestamp column, or to check that two elements of the row are consistent. Row-level AFTER triggers are most sensibly used to propagate the updates to other tables, or make consistency checks against other tables. The reason for this division of labor is that an AFTER trigger can be certain it is seeing the final value of the row, while a BEFOREtrigger cannot; there might be other BEFORE triggers firing after it. If you have no specific reason to make a trigger BEFORE or AFTER, the BEFORE case is more efficient, since the information about the operation doesn't have to be saved until end of statement." I became a rusty DBA poluting pgsql-bugs, sorry. RTFM for myself. :) -- Daniel Cristian Cruz クルズ クリスチアン ダニエル