diff options
| author | Tom Lane <tgl@sss.pgh.pa.us> | 2020-04-03 11:24:56 -0400 |
|---|---|---|
| committer | Tom Lane <tgl@sss.pgh.pa.us> | 2020-04-03 11:24:56 -0400 |
| commit | 82bc56e63387176809349b559ee224c11671d818 (patch) | |
| tree | 0d5a1f3a4c434d785545e35de677a2be3dd31601 | |
| parent | d269f858b40fd7dcd0bc63a70d7d340d902afe1e (diff) | |
Fix bogus CALLED_AS_TRIGGER() defenses.
contrib/lo's lo_manage() thought it could use
trigdata->tg_trigger->tgname in its error message about
not being called as a trigger. That naturally led to a core dump.
unique_key_recheck() figured it could Assert that fcinfo->context
is a TriggerData node in advance of having checked that it's
being called as a trigger. That's harmless in production builds,
and perhaps not that easy to reach in any case, but it's logically
wrong.
The first of these per bug #16340 from William Crowell;
the second from manual inspection of other CALLED_AS_TRIGGER
call sites.
Back-patch the lo.c change to all supported branches, the
other to v10 where the thinko crept in.
Discussion: https://postgr.es/m/16340-591c7449dc7c8c47@postgresql.org
| -rw-r--r-- | contrib/lo/lo.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/contrib/lo/lo.c b/contrib/lo/lo.c index 953659305fb..2b450b8ea8c 100644 --- a/contrib/lo/lo.c +++ b/contrib/lo/lo.c @@ -35,8 +35,7 @@ lo_manage(PG_FUNCTION_ARGS) HeapTuple trigtuple; /* The original value of tuple */ if (!CALLED_AS_TRIGGER(fcinfo)) /* internal error */ - elog(ERROR, "%s: not fired by trigger manager", - trigdata->tg_trigger->tgname); + elog(ERROR, "lo_manage: not fired by trigger manager"); if (!TRIGGER_FIRED_FOR_ROW(trigdata->tg_event)) /* internal error */ elog(ERROR, "%s: must be fired for row", |
