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

Commit5a5531a

Browse files
committed
Apply Jeroen van Vianen's patch for failure to check heap_openr failure
in RI triggers. This is fixed in another way in current sources, butmight as well apply this patch to REL7_0 branch so that 7.0.3 need notsuffer this crash.
1 parent3017000 commit5a5531a

File tree

1 file changed

+74
-2
lines changed

1 file changed

+74
-2
lines changed

‎src/backend/utils/adt/ri_triggers.c

Lines changed: 74 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*
77
*1999 Jan Wieck
88
*
9-
* $Header: /cvsroot/pgsql/src/backend/utils/adt/ri_triggers.c,v 1.14 2000/04/12 17:15:51 momjian Exp $
9+
* $Header: /cvsroot/pgsql/src/backend/utils/adt/ri_triggers.c,v 1.14.2.1 2000/09/23 21:15:26 tgl Exp $
1010
*
1111
* ----------
1212
*/
@@ -204,6 +204,13 @@ RI_FKey_check(FmgrInfo *proinfo)
204204
*/
205205
fk_rel=trigdata->tg_relation;
206206
pk_rel=heap_openr(tgargs[RI_PK_RELNAME_ARGNO],NoLock);
207+
208+
if (pk_rel==NULL)
209+
{
210+
elog(ERROR,"RI constraint %s cannot find table %s",
211+
tgargs[RI_CONSTRAINT_NAME_ARGNO],tgargs[RI_PK_RELNAME_ARGNO]);
212+
}
213+
207214
if (TRIGGER_FIRED_BY_UPDATE(trigdata->tg_event))
208215
{
209216
old_row=trigdata->tg_trigtuple;
@@ -564,6 +571,12 @@ RI_FKey_noaction_del(FmgrInfo *proinfo)
564571
pk_rel=trigdata->tg_relation;
565572
old_row=trigdata->tg_trigtuple;
566573

574+
if (fk_rel==NULL)
575+
{
576+
elog(ERROR,"RI constraint %s cannot find table %s",
577+
tgargs[RI_CONSTRAINT_NAME_ARGNO],tgargs[RI_FK_RELNAME_ARGNO]);
578+
}
579+
567580
switch (ri_DetermineMatchType(tgargs[RI_MATCH_TYPE_ARGNO]))
568581
{
569582
/* ----------
@@ -775,6 +788,12 @@ RI_FKey_noaction_upd(FmgrInfo *proinfo)
775788
new_row=trigdata->tg_newtuple;
776789
old_row=trigdata->tg_trigtuple;
777790

791+
if (fk_rel==NULL)
792+
{
793+
elog(ERROR,"RI constraint %s cannot find table %s",
794+
tgargs[RI_CONSTRAINT_NAME_ARGNO],tgargs[RI_FK_RELNAME_ARGNO]);
795+
}
796+
778797
switch (ri_DetermineMatchType(tgargs[RI_MATCH_TYPE_ARGNO]))
779798
{
780799
/* ----------
@@ -990,6 +1009,12 @@ RI_FKey_cascade_del(FmgrInfo *proinfo)
9901009
pk_rel=trigdata->tg_relation;
9911010
old_row=trigdata->tg_trigtuple;
9921011

1012+
if (fk_rel==NULL)
1013+
{
1014+
elog(ERROR,"RI constraint %s cannot find table %s",
1015+
tgargs[RI_CONSTRAINT_NAME_ARGNO],tgargs[RI_FK_RELNAME_ARGNO]);
1016+
}
1017+
9931018
switch (ri_DetermineMatchType(tgargs[RI_MATCH_TYPE_ARGNO]))
9941019
{
9951020
/* ----------
@@ -1189,6 +1214,12 @@ RI_FKey_cascade_upd(FmgrInfo *proinfo)
11891214
new_row=trigdata->tg_newtuple;
11901215
old_row=trigdata->tg_trigtuple;
11911216

1217+
if (fk_rel==NULL)
1218+
{
1219+
elog(ERROR,"RI constraint %s cannot find table %s",
1220+
tgargs[RI_CONSTRAINT_NAME_ARGNO],tgargs[RI_FK_RELNAME_ARGNO]);
1221+
}
1222+
11921223
switch (ri_DetermineMatchType(tgargs[RI_MATCH_TYPE_ARGNO]))
11931224
{
11941225
/* ----------
@@ -1421,6 +1452,12 @@ RI_FKey_restrict_del(FmgrInfo *proinfo)
14211452
pk_rel=trigdata->tg_relation;
14221453
old_row=trigdata->tg_trigtuple;
14231454

1455+
if (fk_rel==NULL)
1456+
{
1457+
elog(ERROR,"RI constraint %s cannot find table %s",
1458+
tgargs[RI_CONSTRAINT_NAME_ARGNO],tgargs[RI_FK_RELNAME_ARGNO]);
1459+
}
1460+
14241461
switch (ri_DetermineMatchType(tgargs[RI_MATCH_TYPE_ARGNO]))
14251462
{
14261463
/* ----------
@@ -1637,6 +1674,12 @@ RI_FKey_restrict_upd(FmgrInfo *proinfo)
16371674
new_row=trigdata->tg_newtuple;
16381675
old_row=trigdata->tg_trigtuple;
16391676

1677+
if (fk_rel==NULL)
1678+
{
1679+
elog(ERROR,"RI constraint %s cannot find table %s",
1680+
tgargs[RI_CONSTRAINT_NAME_ARGNO],tgargs[RI_FK_RELNAME_ARGNO]);
1681+
}
1682+
16401683
switch (ri_DetermineMatchType(tgargs[RI_MATCH_TYPE_ARGNO]))
16411684
{
16421685
/* ----------
@@ -1852,6 +1895,12 @@ RI_FKey_setnull_del(FmgrInfo *proinfo)
18521895
pk_rel=trigdata->tg_relation;
18531896
old_row=trigdata->tg_trigtuple;
18541897

1898+
if (fk_rel==NULL)
1899+
{
1900+
elog(ERROR,"RI constraint %s cannot find table %s",
1901+
tgargs[RI_CONSTRAINT_NAME_ARGNO],tgargs[RI_FK_RELNAME_ARGNO]);
1902+
}
1903+
18551904
switch (ri_DetermineMatchType(tgargs[RI_MATCH_TYPE_ARGNO]))
18561905
{
18571906
/* ----------
@@ -2064,6 +2113,12 @@ RI_FKey_setnull_upd(FmgrInfo *proinfo)
20642113
old_row=trigdata->tg_trigtuple;
20652114
match_type=ri_DetermineMatchType(tgargs[RI_MATCH_TYPE_ARGNO]);
20662115

2116+
if (fk_rel==NULL)
2117+
{
2118+
elog(ERROR,"RI constraint %s cannot find table %s",
2119+
tgargs[RI_CONSTRAINT_NAME_ARGNO],tgargs[RI_FK_RELNAME_ARGNO]);
2120+
}
2121+
20672122
switch (match_type)
20682123
{
20692124
/* ----------
@@ -2317,6 +2372,12 @@ RI_FKey_setdefault_del(FmgrInfo *proinfo)
23172372
pk_rel=trigdata->tg_relation;
23182373
old_row=trigdata->tg_trigtuple;
23192374

2375+
if (fk_rel==NULL)
2376+
{
2377+
elog(ERROR,"RI constraint %s cannot find table %s",
2378+
tgargs[RI_CONSTRAINT_NAME_ARGNO],tgargs[RI_FK_RELNAME_ARGNO]);
2379+
}
2380+
23202381
switch (ri_DetermineMatchType(tgargs[RI_MATCH_TYPE_ARGNO]))
23212382
{
23222383
/* ----------
@@ -2573,9 +2634,14 @@ RI_FKey_setdefault_upd(FmgrInfo *proinfo)
25732634
pk_rel=trigdata->tg_relation;
25742635
new_row=trigdata->tg_newtuple;
25752636
old_row=trigdata->tg_trigtuple;
2576-
25772637
match_type=ri_DetermineMatchType(tgargs[RI_MATCH_TYPE_ARGNO]);
25782638

2639+
if (fk_rel==NULL)
2640+
{
2641+
elog(ERROR,"RI constraint %s cannot find table %s",
2642+
tgargs[RI_CONSTRAINT_NAME_ARGNO],tgargs[RI_FK_RELNAME_ARGNO]);
2643+
}
2644+
25792645
switch (match_type)
25802646
{
25812647
/* ----------
@@ -2842,6 +2908,12 @@ RI_FKey_keyequal_upd(void)
28422908
new_row=trigdata->tg_newtuple;
28432909
old_row=trigdata->tg_trigtuple;
28442910

2911+
if (fk_rel==NULL)
2912+
{
2913+
elog(ERROR,"RI constraint %s cannot find table %s",
2914+
tgargs[RI_CONSTRAINT_NAME_ARGNO],tgargs[RI_FK_RELNAME_ARGNO]);
2915+
}
2916+
28452917
switch (ri_DetermineMatchType(tgargs[RI_MATCH_TYPE_ARGNO]))
28462918
{
28472919
/* ----------

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp