@@ -454,10 +454,10 @@ RI_FKey_check_upd(PG_FUNCTION_ARGS)
454
454
* ri_Check_Pk_Match
455
455
*
456
456
* Check to see if another PK row has been created that provides the same
457
- * key values as the "old_row " that's been modified or deleted in our trigger
457
+ * key values as the "oldslot " that's been modified or deleted in our trigger
458
458
* event. Returns true if a match is found in the PK table.
459
459
*
460
- * We assume the caller checked that the old_row contains no NULL key values,
460
+ * We assume the caller checked that the oldslot contains no NULL key values,
461
461
* since otherwise a match is impossible.
462
462
*/
463
463
static bool
@@ -625,7 +625,7 @@ ri_restrict(TriggerData *trigdata, bool is_no_action)
625
625
const RI_ConstraintInfo * riinfo ;
626
626
Relation fk_rel ;
627
627
Relation pk_rel ;
628
- TupleTableSlot * old_slot ;
628
+ TupleTableSlot * oldslot ;
629
629
RI_QueryKey qkey ;
630
630
SPIPlanPtr qplan ;
631
631
@@ -640,7 +640,7 @@ ri_restrict(TriggerData *trigdata, bool is_no_action)
640
640
*/
641
641
fk_rel = table_open (riinfo -> fk_relid , RowShareLock );
642
642
pk_rel = trigdata -> tg_relation ;
643
- old_slot = trigdata -> tg_trigslot ;
643
+ oldslot = trigdata -> tg_trigslot ;
644
644
645
645
/*
646
646
* If another PK row now exists providing the old key values, we
@@ -649,7 +649,7 @@ ri_restrict(TriggerData *trigdata, bool is_no_action)
649
649
* allow another row to be substituted.
650
650
*/
651
651
if (is_no_action &&
652
- ri_Check_Pk_Match (pk_rel , fk_rel , old_slot , riinfo ))
652
+ ri_Check_Pk_Match (pk_rel , fk_rel , oldslot , riinfo ))
653
653
{
654
654
table_close (fk_rel , RowShareLock );
655
655
return PointerGetDatum (NULL );
@@ -716,7 +716,7 @@ ri_restrict(TriggerData *trigdata, bool is_no_action)
716
716
*/
717
717
ri_PerformCheck (riinfo , & qkey , qplan ,
718
718
fk_rel , pk_rel ,
719
- old_slot , NULL ,
719
+ oldslot , NULL ,
720
720
true, /* must detect new rows */
721
721
SPI_OK_SELECT );
722
722
@@ -741,7 +741,7 @@ RI_FKey_cascade_del(PG_FUNCTION_ARGS)
741
741
const RI_ConstraintInfo * riinfo ;
742
742
Relation fk_rel ;
743
743
Relation pk_rel ;
744
- TupleTableSlot * old_slot ;
744
+ TupleTableSlot * oldslot ;
745
745
RI_QueryKey qkey ;
746
746
SPIPlanPtr qplan ;
747
747
@@ -759,7 +759,7 @@ RI_FKey_cascade_del(PG_FUNCTION_ARGS)
759
759
*/
760
760
fk_rel = table_open (riinfo -> fk_relid , RowExclusiveLock );
761
761
pk_rel = trigdata -> tg_relation ;
762
- old_slot = trigdata -> tg_trigslot ;
762
+ oldslot = trigdata -> tg_trigslot ;
763
763
764
764
if (SPI_connect () != SPI_OK_CONNECT )
765
765
elog (ERROR , "SPI_connect failed" );
@@ -818,7 +818,7 @@ RI_FKey_cascade_del(PG_FUNCTION_ARGS)
818
818
*/
819
819
ri_PerformCheck (riinfo , & qkey , qplan ,
820
820
fk_rel , pk_rel ,
821
- old_slot , NULL ,
821
+ oldslot , NULL ,
822
822
true, /* must detect new rows */
823
823
SPI_OK_DELETE );
824
824
@@ -843,8 +843,8 @@ RI_FKey_cascade_upd(PG_FUNCTION_ARGS)
843
843
const RI_ConstraintInfo * riinfo ;
844
844
Relation fk_rel ;
845
845
Relation pk_rel ;
846
- TupleTableSlot * new_slot ;
847
- TupleTableSlot * old_slot ;
846
+ TupleTableSlot * newslot ;
847
+ TupleTableSlot * oldslot ;
848
848
RI_QueryKey qkey ;
849
849
SPIPlanPtr qplan ;
850
850
@@ -863,8 +863,8 @@ RI_FKey_cascade_upd(PG_FUNCTION_ARGS)
863
863
*/
864
864
fk_rel = table_open (riinfo -> fk_relid , RowExclusiveLock );
865
865
pk_rel = trigdata -> tg_relation ;
866
- new_slot = trigdata -> tg_newslot ;
867
- old_slot = trigdata -> tg_trigslot ;
866
+ newslot = trigdata -> tg_newslot ;
867
+ oldslot = trigdata -> tg_trigslot ;
868
868
869
869
if (SPI_connect () != SPI_OK_CONNECT )
870
870
elog (ERROR , "SPI_connect failed" );
@@ -935,7 +935,7 @@ RI_FKey_cascade_upd(PG_FUNCTION_ARGS)
935
935
*/
936
936
ri_PerformCheck (riinfo , & qkey , qplan ,
937
937
fk_rel , pk_rel ,
938
- old_slot , new_slot ,
938
+ oldslot , newslot ,
939
939
true, /* must detect new rows */
940
940
SPI_OK_UPDATE );
941
941
@@ -989,7 +989,7 @@ ri_setnull(TriggerData *trigdata)
989
989
const RI_ConstraintInfo * riinfo ;
990
990
Relation fk_rel ;
991
991
Relation pk_rel ;
992
- TupleTableSlot * old_slot ;
992
+ TupleTableSlot * oldslot ;
993
993
RI_QueryKey qkey ;
994
994
SPIPlanPtr qplan ;
995
995
@@ -1004,7 +1004,7 @@ ri_setnull(TriggerData *trigdata)
1004
1004
*/
1005
1005
fk_rel = table_open (riinfo -> fk_relid , RowExclusiveLock );
1006
1006
pk_rel = trigdata -> tg_relation ;
1007
- old_slot = trigdata -> tg_trigslot ;
1007
+ oldslot = trigdata -> tg_trigslot ;
1008
1008
1009
1009
if (SPI_connect () != SPI_OK_CONNECT )
1010
1010
elog (ERROR , "SPI_connect failed" );
@@ -1075,7 +1075,7 @@ ri_setnull(TriggerData *trigdata)
1075
1075
*/
1076
1076
ri_PerformCheck (riinfo , & qkey , qplan ,
1077
1077
fk_rel , pk_rel ,
1078
- old_slot , NULL ,
1078
+ oldslot , NULL ,
1079
1079
true, /* must detect new rows */
1080
1080
SPI_OK_UPDATE );
1081
1081
@@ -1129,7 +1129,7 @@ ri_setdefault(TriggerData *trigdata)
1129
1129
const RI_ConstraintInfo * riinfo ;
1130
1130
Relation fk_rel ;
1131
1131
Relation pk_rel ;
1132
- TupleTableSlot * old_slot ;
1132
+ TupleTableSlot * oldslot ;
1133
1133
RI_QueryKey qkey ;
1134
1134
SPIPlanPtr qplan ;
1135
1135
@@ -1144,7 +1144,7 @@ ri_setdefault(TriggerData *trigdata)
1144
1144
*/
1145
1145
fk_rel = table_open (riinfo -> fk_relid , RowExclusiveLock );
1146
1146
pk_rel = trigdata -> tg_relation ;
1147
- old_slot = trigdata -> tg_trigslot ;
1147
+ oldslot = trigdata -> tg_trigslot ;
1148
1148
1149
1149
if (SPI_connect () != SPI_OK_CONNECT )
1150
1150
elog (ERROR , "SPI_connect failed" );
@@ -1215,7 +1215,7 @@ ri_setdefault(TriggerData *trigdata)
1215
1215
*/
1216
1216
ri_PerformCheck (riinfo , & qkey , qplan ,
1217
1217
fk_rel , pk_rel ,
1218
- old_slot , NULL ,
1218
+ oldslot , NULL ,
1219
1219
true, /* must detect new rows */
1220
1220
SPI_OK_UPDATE );
1221
1221
@@ -1251,11 +1251,11 @@ ri_setdefault(TriggerData *trigdata)
1251
1251
* trigger must be fired, false if we can prove the constraint will still
1252
1252
* be satisfied.
1253
1253
*
1254
- * new_slot will be NULL if this is called for a delete.
1254
+ * newslot will be NULL if this is called for a delete.
1255
1255
*/
1256
1256
bool
1257
1257
RI_FKey_pk_upd_check_required (Trigger * trigger , Relation pk_rel ,
1258
- TupleTableSlot * old_slot , TupleTableSlot * new_slot )
1258
+ TupleTableSlot * oldslot , TupleTableSlot * newslot )
1259
1259
{
1260
1260
const RI_ConstraintInfo * riinfo ;
1261
1261
@@ -1265,11 +1265,11 @@ RI_FKey_pk_upd_check_required(Trigger *trigger, Relation pk_rel,
1265
1265
* If any old key value is NULL, the row could not have been
1266
1266
* referenced by an FK row, so no check is needed.
1267
1267
*/
1268
- if (ri_NullCheck (RelationGetDescr (pk_rel ), old_slot , riinfo , true) != RI_KEYS_NONE_NULL )
1268
+ if (ri_NullCheck (RelationGetDescr (pk_rel ), oldslot , riinfo , true) != RI_KEYS_NONE_NULL )
1269
1269
return false;
1270
1270
1271
1271
/* If all old and new key values are equal, no check is needed */
1272
- if (new_slot && ri_KeysEqual (pk_rel , old_slot , new_slot , riinfo , true))
1272
+ if (newslot && ri_KeysEqual (pk_rel , oldslot , newslot , riinfo , true))
1273
1273
return false;
1274
1274
1275
1275
/* Else we need to fire the trigger. */
@@ -1287,7 +1287,7 @@ RI_FKey_pk_upd_check_required(Trigger *trigger, Relation pk_rel,
1287
1287
*/
1288
1288
bool
1289
1289
RI_FKey_fk_upd_check_required (Trigger * trigger , Relation fk_rel ,
1290
- TupleTableSlot * old_slot , TupleTableSlot * new_slot )
1290
+ TupleTableSlot * oldslot , TupleTableSlot * newslot )
1291
1291
{
1292
1292
const RI_ConstraintInfo * riinfo ;
1293
1293
int ri_nullcheck ;
@@ -1297,7 +1297,7 @@ RI_FKey_fk_upd_check_required(Trigger *trigger, Relation fk_rel,
1297
1297
1298
1298
riinfo = ri_FetchConstraintInfo (trigger , fk_rel , false);
1299
1299
1300
- ri_nullcheck = ri_NullCheck (RelationGetDescr (fk_rel ), new_slot , riinfo , false);
1300
+ ri_nullcheck = ri_NullCheck (RelationGetDescr (fk_rel ), newslot , riinfo , false);
1301
1301
1302
1302
/*
1303
1303
* If all new key values are NULL, the row satisfies the constraint, so no
@@ -1350,14 +1350,14 @@ RI_FKey_fk_upd_check_required(Trigger *trigger, Relation fk_rel,
1350
1350
* UPDATE check. (We could skip this if we knew the INSERT
1351
1351
* trigger already fired, but there is no easy way to know that.)
1352
1352
*/
1353
- xminDatum = slot_getsysattr (old_slot , MinTransactionIdAttributeNumber , & isnull );
1353
+ xminDatum = slot_getsysattr (oldslot , MinTransactionIdAttributeNumber , & isnull );
1354
1354
Assert (!isnull );
1355
1355
xmin = DatumGetTransactionId (xminDatum );
1356
1356
if (TransactionIdIsCurrentTransactionId (xmin ))
1357
1357
return true;
1358
1358
1359
1359
/* If all old and new key values are equal, no check is needed */
1360
- if (ri_KeysEqual (fk_rel , old_slot , new_slot , riinfo , false))
1360
+ if (ri_KeysEqual (fk_rel , oldslot , newslot , riinfo , false))
1361
1361
return false;
1362
1362
1363
1363
/* Else we need to fire the trigger. */
@@ -2047,7 +2047,7 @@ static bool
2047
2047
ri_PerformCheck (const RI_ConstraintInfo * riinfo ,
2048
2048
RI_QueryKey * qkey , SPIPlanPtr qplan ,
2049
2049
Relation fk_rel , Relation pk_rel ,
2050
- TupleTableSlot * old_slot , TupleTableSlot * new_slot ,
2050
+ TupleTableSlot * oldslot , TupleTableSlot * newslot ,
2051
2051
bool detectNewRows , int expect_OK )
2052
2052
{
2053
2053
Relation query_rel ,
@@ -2090,17 +2090,17 @@ ri_PerformCheck(const RI_ConstraintInfo *riinfo,
2090
2090
}
2091
2091
2092
2092
/* Extract the parameters to be passed into the query */
2093
- if (new_slot )
2093
+ if (newslot )
2094
2094
{
2095
- ri_ExtractValues (source_rel , new_slot , riinfo , source_is_pk ,
2095
+ ri_ExtractValues (source_rel , newslot , riinfo , source_is_pk ,
2096
2096
vals , nulls );
2097
- if (old_slot )
2098
- ri_ExtractValues (source_rel , old_slot , riinfo , source_is_pk ,
2097
+ if (oldslot )
2098
+ ri_ExtractValues (source_rel , oldslot , riinfo , source_is_pk ,
2099
2099
vals + riinfo -> nkeys , nulls + riinfo -> nkeys );
2100
2100
}
2101
2101
else
2102
2102
{
2103
- ri_ExtractValues (source_rel , old_slot , riinfo , source_is_pk ,
2103
+ ri_ExtractValues (source_rel , oldslot , riinfo , source_is_pk ,
2104
2104
vals , nulls );
2105
2105
}
2106
2106
@@ -2170,7 +2170,7 @@ ri_PerformCheck(const RI_ConstraintInfo *riinfo,
2170
2170
(SPI_processed == 0 ) == (qkey -> constr_queryno == RI_PLAN_CHECK_LOOKUPPK ))
2171
2171
ri_ReportViolation (riinfo ,
2172
2172
pk_rel , fk_rel ,
2173
- new_slot ? new_slot : old_slot ,
2173
+ newslot ? newslot : oldslot ,
2174
2174
NULL ,
2175
2175
qkey -> constr_queryno );
2176
2176
0 commit comments