Re: BUG #6226: Broken foreign key stored on database (parent deleted with children still readable, BUG#6225 Update) - Mailing list pgsql-bugs

From Daniel Cristian Cruz
Subject Re: BUG #6226: Broken foreign key stored on database (parent deleted with children still readable, BUG#6225 Update)
Date
Msg-id CACffM9GNDyQ8czxTPc5Y7A5cY5EudgUnmz5bfB1vitBtRRkD-w@mail.gmail.com
Whole thread Raw
In response to Re: BUG #6226: Broken foreign key stored on database (parent deleted with children still readable, BUG#6225 Update)  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: BUG #6226: Broken foreign key stored on database (parent deleted with children still readable, BUG#6225 Update)  (Daniel Cristian Cruz <danielcristian@gmail.com>)
List pgsql-bugs
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. :)
--=20
Daniel Cristian Cruz
=E3=82=AF=E3=83=AB=E3=82=BA =E3=82=AF=E3=83=AA=E3=82=B9=E3=83=81=E3=82=A2=
=E3=83=B3 =E3=83=80=E3=83=8B=E3=82=A8=E3=83=AB

pgsql-bugs by date:

Previous
From: Craig Ringer
Date:
Subject: Re: BUG #6233: pg_dump hangs with Access Violation C0000005
Next
From: "Stefan Franke"
Date:
Subject: BUG #6241: JDBC: blob doesnot work with bytea