Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit7b15522

Browse files
committed
Fix bogus CALLED_AS_TRIGGER() defenses.
contrib/lo's lo_manage() thought it could usetrigdata->tg_trigger->tgname in its error message aboutnot being called as a trigger. That naturally led to a core dump.unique_key_recheck() figured it could Assert that fcinfo->contextis a TriggerData node in advance of having checked that it'sbeing called as a trigger. That's harmless in production builds,and perhaps not that easy to reach in any case, but it's logicallywrong.The first of these per bug #16340 from William Crowell;the second from manual inspection of other CALLED_AS_TRIGGERcall sites.Back-patch the lo.c change to all supported branches, theother to v10 where the thinko crept in.Discussion:https://postgr.es/m/16340-591c7449dc7c8c47@postgresql.org
1 parent42da1db commit7b15522

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

‎contrib/lo/lo.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@ lo_manage(PG_FUNCTION_ARGS)
3333
HeapTupletrigtuple;/* The original value of tuple*/
3434

3535
if (!CALLED_AS_TRIGGER(fcinfo))/* internal error */
36-
elog(ERROR,"%s: not fired by trigger manager",
37-
trigdata->tg_trigger->tgname);
36+
elog(ERROR,"lo_manage: not fired by trigger manager");
3837

3938
if (!TRIGGER_FIRED_FOR_ROW(trigdata->tg_event))/* internal error */
4039
elog(ERROR,"%s: must be fired for row",

‎src/backend/commands/constraint.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
Datum
3838
unique_key_recheck(PG_FUNCTION_ARGS)
3939
{
40-
TriggerData*trigdata=castNode(TriggerData,fcinfo->context);
40+
TriggerData*trigdata= (TriggerData*)fcinfo->context;
4141
constchar*funcname="unique_key_recheck";
4242
HeapTuplenew_row;
4343
ItemPointerDatatmptid;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp