From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Vik Fearing <vik(at)2ndquadrant(dot)fr> |
Cc: | benjie(at)jemjie(dot)com, pgsql-bugs(at)postgresql(dot)org |
Subject: | Re: BUG #14431: ERROR: XX000: relation 5022917 has no triggers ("should not happen") |
Date: | 2016-11-24 16:41:25 |
Message-ID: | 17845.1480005685@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
Vik Fearing <vik(at)2ndquadrant(dot)fr> writes:
> For the archives, the test case at that link is:
Thanks for copying that into the archives.
The "bar" trigger is actually irrelevant and can be dropped from the
example. The problem is that because the FK constraint on "b" is
deferred, there is an FK-check trigger event waiting to be fired
at the end of the transaction, and we're deleting the pg_trigger
row out from under it.
Ordinarily, we'd prevent you from dropping a trigger that has
unfired events, but the code in tablecmds.c is only checking the
"b" table, and the event in question is for "a"'s trigger.
With the attached patch, you get
ERROR: cannot ALTER TABLE "a" because it has pending trigger events
which I think is a sane behavior, although maybe the precise wording
of the error could be quibbled with. (But improving that would
require fooling with the API of CheckTableNotInUse, which does not
seem worthwhile.)
The other approach we could take is to allow the DROP CONSTRAINT and
silently ignore queued trigger events if we can't find their pg_trigger
row ... but that seems pretty scary in terms of its ability to mask bugs,
and it's not consistent with past choices.
Barring objection, I'll add a test case to this and push it.
regards, tom lane
Attachment | Content-Type | Size |
---|---|---|
disallow-activity-on-referenced-table.patch | text/x-diff | 1.1 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | nunziotocci2000 | 2016-11-24 17:55:30 | BUG #14432: sslmode=allow causing authentication to time out |
Previous Message | Vik Fearing | 2016-11-24 12:37:46 | Re: BUG #14431: ERROR: XX000: relation 5022917 has no triggers ("should not happen") |