@@ -242,7 +242,7 @@ static void ri_ExtractValues(Relation rel, HeapTuple tup,
242
242
static void ri_ReportViolation (const RI_ConstraintInfo * riinfo ,
243
243
Relation pk_rel , Relation fk_rel ,
244
244
HeapTuple violator , TupleDesc tupdesc ,
245
- int queryno , bool spi_err );
245
+ int queryno ) pg_attribute_noreturn ( );
246
246
247
247
248
248
/* ----------
@@ -2499,7 +2499,7 @@ RI_Initial_Check(Trigger *trigger, Relation fk_rel, Relation pk_rel)
2499
2499
ri_ReportViolation (& fake_riinfo ,
2500
2500
pk_rel , fk_rel ,
2501
2501
tuple , tupdesc ,
2502
- RI_PLAN_CHECK_LOOKUPPK , false );
2502
+ RI_PLAN_CHECK_LOOKUPPK );
2503
2503
}
2504
2504
2505
2505
if (SPI_finish () != SPI_OK_FINISH )
@@ -3147,11 +3147,13 @@ ri_PerformCheck(const RI_ConstraintInfo *riinfo,
3147
3147
elog (ERROR , "SPI_execute_snapshot returned %d" , spi_result );
3148
3148
3149
3149
if (expect_OK >= 0 && spi_result != expect_OK )
3150
- ri_ReportViolation (riinfo ,
3151
- pk_rel , fk_rel ,
3152
- new_tuple ? new_tuple : old_tuple ,
3153
- NULL ,
3154
- qkey -> constr_queryno , true);
3150
+ ereport (ERROR ,
3151
+ (errcode (ERRCODE_INTERNAL_ERROR ),
3152
+ errmsg ("referential integrity query on \"%s\" from constraint \"%s\" on \"%s\" gave unexpected result" ,
3153
+ RelationGetRelationName (pk_rel ),
3154
+ NameStr (riinfo -> conname ),
3155
+ RelationGetRelationName (fk_rel )),
3156
+ errhint ("This is most likely due to a rule having rewritten the query." )));
3155
3157
3156
3158
/* XXX wouldn't it be clearer to do this part at the caller? */
3157
3159
if (qkey -> constr_queryno != RI_PLAN_CHECK_LOOKUPPK_FROM_PK &&
@@ -3161,7 +3163,7 @@ ri_PerformCheck(const RI_ConstraintInfo *riinfo,
3161
3163
pk_rel , fk_rel ,
3162
3164
new_tuple ? new_tuple : old_tuple ,
3163
3165
NULL ,
3164
- qkey -> constr_queryno , false );
3166
+ qkey -> constr_queryno );
3165
3167
3166
3168
return SPI_processed != 0 ;
3167
3169
}
@@ -3205,7 +3207,7 @@ static void
3205
3207
ri_ReportViolation (const RI_ConstraintInfo * riinfo ,
3206
3208
Relation pk_rel , Relation fk_rel ,
3207
3209
HeapTuple violator , TupleDesc tupdesc ,
3208
- int queryno , bool spi_err )
3210
+ int queryno )
3209
3211
{
3210
3212
StringInfoData key_names ;
3211
3213
StringInfoData key_values ;
@@ -3216,15 +3218,6 @@ ri_ReportViolation(const RI_ConstraintInfo *riinfo,
3216
3218
AclResult aclresult ;
3217
3219
bool has_perm = true;
3218
3220
3219
- if (spi_err )
3220
- ereport (ERROR ,
3221
- (errcode (ERRCODE_INTERNAL_ERROR ),
3222
- errmsg ("referential integrity query on \"%s\" from constraint \"%s\" on \"%s\" gave unexpected result" ,
3223
- RelationGetRelationName (pk_rel ),
3224
- NameStr (riinfo -> conname ),
3225
- RelationGetRelationName (fk_rel )),
3226
- errhint ("This is most likely due to a rule having rewritten the query." )));
3227
-
3228
3221
/*
3229
3222
* Determine which relation to complain about. If tupdesc wasn't passed
3230
3223
* by caller, assume the violator tuple came from there.
0 commit comments