@@ -454,10 +454,10 @@ RI_FKey_check_upd(PG_FUNCTION_ARGS)
454454 * ri_Check_Pk_Match
455455 *
456456 * 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
458458 * event. Returns true if a match is found in the PK table.
459459 *
460- * We assume the caller checked that theold_row contains no NULL key values,
460+ * We assume the caller checked that theoldslot contains no NULL key values,
461461 * since otherwise a match is impossible.
462462 */
463463static bool
@@ -625,7 +625,7 @@ ri_restrict(TriggerData *trigdata, bool is_no_action)
625625const RI_ConstraintInfo * riinfo ;
626626Relation fk_rel ;
627627Relation pk_rel ;
628- TupleTableSlot * old_slot ;
628+ TupleTableSlot * oldslot ;
629629RI_QueryKey qkey ;
630630SPIPlanPtr qplan ;
631631
@@ -640,7 +640,7 @@ ri_restrict(TriggerData *trigdata, bool is_no_action)
640640 */
641641fk_rel = table_open (riinfo -> fk_relid ,RowShareLock );
642642pk_rel = trigdata -> tg_relation ;
643- old_slot = trigdata -> tg_trigslot ;
643+ oldslot = trigdata -> tg_trigslot ;
644644
645645/*
646646 * If another PK row now exists providing the old key values, we
@@ -649,7 +649,7 @@ ri_restrict(TriggerData *trigdata, bool is_no_action)
649649 * allow another row to be substituted.
650650 */
651651if (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 ))
653653{
654654table_close (fk_rel ,RowShareLock );
655655return PointerGetDatum (NULL );
@@ -716,7 +716,7 @@ ri_restrict(TriggerData *trigdata, bool is_no_action)
716716 */
717717ri_PerformCheck (riinfo ,& qkey ,qplan ,
718718fk_rel ,pk_rel ,
719- old_slot ,NULL ,
719+ oldslot ,NULL ,
720720true,/* must detect new rows */
721721SPI_OK_SELECT );
722722
@@ -741,7 +741,7 @@ RI_FKey_cascade_del(PG_FUNCTION_ARGS)
741741const RI_ConstraintInfo * riinfo ;
742742Relation fk_rel ;
743743Relation pk_rel ;
744- TupleTableSlot * old_slot ;
744+ TupleTableSlot * oldslot ;
745745RI_QueryKey qkey ;
746746SPIPlanPtr qplan ;
747747
@@ -759,7 +759,7 @@ RI_FKey_cascade_del(PG_FUNCTION_ARGS)
759759 */
760760fk_rel = table_open (riinfo -> fk_relid ,RowExclusiveLock );
761761pk_rel = trigdata -> tg_relation ;
762- old_slot = trigdata -> tg_trigslot ;
762+ oldslot = trigdata -> tg_trigslot ;
763763
764764if (SPI_connect ()!= SPI_OK_CONNECT )
765765elog (ERROR ,"SPI_connect failed" );
@@ -818,7 +818,7 @@ RI_FKey_cascade_del(PG_FUNCTION_ARGS)
818818 */
819819ri_PerformCheck (riinfo ,& qkey ,qplan ,
820820fk_rel ,pk_rel ,
821- old_slot ,NULL ,
821+ oldslot ,NULL ,
822822true,/* must detect new rows */
823823SPI_OK_DELETE );
824824
@@ -843,8 +843,8 @@ RI_FKey_cascade_upd(PG_FUNCTION_ARGS)
843843const RI_ConstraintInfo * riinfo ;
844844Relation fk_rel ;
845845Relation pk_rel ;
846- TupleTableSlot * new_slot ;
847- TupleTableSlot * old_slot ;
846+ TupleTableSlot * newslot ;
847+ TupleTableSlot * oldslot ;
848848RI_QueryKey qkey ;
849849SPIPlanPtr qplan ;
850850
@@ -863,8 +863,8 @@ RI_FKey_cascade_upd(PG_FUNCTION_ARGS)
863863 */
864864fk_rel = table_open (riinfo -> fk_relid ,RowExclusiveLock );
865865pk_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 ;
868868
869869if (SPI_connect ()!= SPI_OK_CONNECT )
870870elog (ERROR ,"SPI_connect failed" );
@@ -935,7 +935,7 @@ RI_FKey_cascade_upd(PG_FUNCTION_ARGS)
935935 */
936936ri_PerformCheck (riinfo ,& qkey ,qplan ,
937937fk_rel ,pk_rel ,
938- old_slot , new_slot ,
938+ oldslot , newslot ,
939939true,/* must detect new rows */
940940SPI_OK_UPDATE );
941941
@@ -989,7 +989,7 @@ ri_setnull(TriggerData *trigdata)
989989const RI_ConstraintInfo * riinfo ;
990990Relation fk_rel ;
991991Relation pk_rel ;
992- TupleTableSlot * old_slot ;
992+ TupleTableSlot * oldslot ;
993993RI_QueryKey qkey ;
994994SPIPlanPtr qplan ;
995995
@@ -1004,7 +1004,7 @@ ri_setnull(TriggerData *trigdata)
10041004 */
10051005fk_rel = table_open (riinfo -> fk_relid ,RowExclusiveLock );
10061006pk_rel = trigdata -> tg_relation ;
1007- old_slot = trigdata -> tg_trigslot ;
1007+ oldslot = trigdata -> tg_trigslot ;
10081008
10091009if (SPI_connect ()!= SPI_OK_CONNECT )
10101010elog (ERROR ,"SPI_connect failed" );
@@ -1075,7 +1075,7 @@ ri_setnull(TriggerData *trigdata)
10751075 */
10761076ri_PerformCheck (riinfo ,& qkey ,qplan ,
10771077fk_rel ,pk_rel ,
1078- old_slot ,NULL ,
1078+ oldslot ,NULL ,
10791079true,/* must detect new rows */
10801080SPI_OK_UPDATE );
10811081
@@ -1129,7 +1129,7 @@ ri_setdefault(TriggerData *trigdata)
11291129const RI_ConstraintInfo * riinfo ;
11301130Relation fk_rel ;
11311131Relation pk_rel ;
1132- TupleTableSlot * old_slot ;
1132+ TupleTableSlot * oldslot ;
11331133RI_QueryKey qkey ;
11341134SPIPlanPtr qplan ;
11351135
@@ -1144,7 +1144,7 @@ ri_setdefault(TriggerData *trigdata)
11441144 */
11451145fk_rel = table_open (riinfo -> fk_relid ,RowExclusiveLock );
11461146pk_rel = trigdata -> tg_relation ;
1147- old_slot = trigdata -> tg_trigslot ;
1147+ oldslot = trigdata -> tg_trigslot ;
11481148
11491149if (SPI_connect ()!= SPI_OK_CONNECT )
11501150elog (ERROR ,"SPI_connect failed" );
@@ -1215,7 +1215,7 @@ ri_setdefault(TriggerData *trigdata)
12151215 */
12161216ri_PerformCheck (riinfo ,& qkey ,qplan ,
12171217fk_rel ,pk_rel ,
1218- old_slot ,NULL ,
1218+ oldslot ,NULL ,
12191219true,/* must detect new rows */
12201220SPI_OK_UPDATE );
12211221
@@ -1251,11 +1251,11 @@ ri_setdefault(TriggerData *trigdata)
12511251 * trigger must be fired, false if we can prove the constraint will still
12521252 * be satisfied.
12531253 *
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.
12551255 */
12561256bool
12571257RI_FKey_pk_upd_check_required (Trigger * trigger ,Relation pk_rel ,
1258- TupleTableSlot * old_slot ,TupleTableSlot * new_slot )
1258+ TupleTableSlot * oldslot ,TupleTableSlot * newslot )
12591259{
12601260const RI_ConstraintInfo * riinfo ;
12611261
@@ -1265,11 +1265,11 @@ RI_FKey_pk_upd_check_required(Trigger *trigger, Relation pk_rel,
12651265 * If any old key value is NULL, the row could not have been
12661266 * referenced by an FK row, so no check is needed.
12671267 */
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 )
12691269return false;
12701270
12711271/* 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))
12731273return false;
12741274
12751275/* Else we need to fire the trigger. */
@@ -1287,7 +1287,7 @@ RI_FKey_pk_upd_check_required(Trigger *trigger, Relation pk_rel,
12871287 */
12881288bool
12891289RI_FKey_fk_upd_check_required (Trigger * trigger ,Relation fk_rel ,
1290- TupleTableSlot * old_slot ,TupleTableSlot * new_slot )
1290+ TupleTableSlot * oldslot ,TupleTableSlot * newslot )
12911291{
12921292const RI_ConstraintInfo * riinfo ;
12931293int ri_nullcheck ;
@@ -1297,7 +1297,7 @@ RI_FKey_fk_upd_check_required(Trigger *trigger, Relation fk_rel,
12971297
12981298riinfo = ri_FetchConstraintInfo (trigger ,fk_rel , false);
12991299
1300- ri_nullcheck = ri_NullCheck (RelationGetDescr (fk_rel ),new_slot ,riinfo , false);
1300+ ri_nullcheck = ri_NullCheck (RelationGetDescr (fk_rel ),newslot ,riinfo , false);
13011301
13021302/*
13031303 * 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,
13501350 * UPDATE check. (We could skip this if we knew the INSERT
13511351 * trigger already fired, but there is no easy way to know that.)
13521352 */
1353- xminDatum = slot_getsysattr (old_slot ,MinTransactionIdAttributeNumber ,& isnull );
1353+ xminDatum = slot_getsysattr (oldslot ,MinTransactionIdAttributeNumber ,& isnull );
13541354Assert (!isnull );
13551355xmin = DatumGetTransactionId (xminDatum );
13561356if (TransactionIdIsCurrentTransactionId (xmin ))
13571357return true;
13581358
13591359/* 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))
13611361return false;
13621362
13631363/* Else we need to fire the trigger. */
@@ -2047,7 +2047,7 @@ static bool
20472047ri_PerformCheck (const RI_ConstraintInfo * riinfo ,
20482048RI_QueryKey * qkey ,SPIPlanPtr qplan ,
20492049Relation fk_rel ,Relation pk_rel ,
2050- TupleTableSlot * old_slot ,TupleTableSlot * new_slot ,
2050+ TupleTableSlot * oldslot ,TupleTableSlot * newslot ,
20512051bool detectNewRows ,int expect_OK )
20522052{
20532053Relation query_rel ,
@@ -2090,17 +2090,17 @@ ri_PerformCheck(const RI_ConstraintInfo *riinfo,
20902090}
20912091
20922092/* Extract the parameters to be passed into the query */
2093- if (new_slot )
2093+ if (newslot )
20942094{
2095- ri_ExtractValues (source_rel ,new_slot ,riinfo ,source_is_pk ,
2095+ ri_ExtractValues (source_rel ,newslot ,riinfo ,source_is_pk ,
20962096vals ,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 ,
20992099vals + riinfo -> nkeys ,nulls + riinfo -> nkeys );
21002100}
21012101else
21022102{
2103- ri_ExtractValues (source_rel ,old_slot ,riinfo ,source_is_pk ,
2103+ ri_ExtractValues (source_rel ,oldslot ,riinfo ,source_is_pk ,
21042104vals ,nulls );
21052105}
21062106
@@ -2170,7 +2170,7 @@ ri_PerformCheck(const RI_ConstraintInfo *riinfo,
21702170(SPI_processed == 0 )== (qkey -> constr_queryno == RI_PLAN_CHECK_LOOKUPPK ))
21712171ri_ReportViolation (riinfo ,
21722172pk_rel ,fk_rel ,
2173- new_slot ?new_slot :old_slot ,
2173+ newslot ?newslot :oldslot ,
21742174NULL ,
21752175qkey -> constr_queryno );
21762176