> You don't alter first. You need to drop the constraint on
> second and add a new constraint on second with on delete
> cascade.
Could you give me an example of this? This is what I tried:
ALTER TABLE "second" ADD CONSTRAINT "secondfk"
FOREIGN KEY (record_num) REFERENCES "first"("record_num")
ON DELETE CASCADE
which gave me this error:
ERROR: secondfk referential integrity violation - key referenced
from second not found in first
What am I doing wrong?
Also, from the looks of it, it seems like what will happen is
when records from "second" are deleted, the referenced records
in "first" will be deleted, too. Is this the case? If so,
what I want to happen is that when records are deleted in the
"first table" (the root or parent table, if you will), records
will also be deleted in the "second" table. Again, if so, how
do I go about setting this functionality up?
Chris