mirror of
https://github.com/postgres/postgres.git
synced 2025-11-19 13:42:17 +03:00
Add TupleTableSlotOps.is_current_xact_tuple() method
This allows us to abstract how/whether table AM uses transaction identifiers. A custom table AM can use a custom slot, which may not store xmin directly, but determine the tuple belonging to the current transaction in the other way. Discussion: https://postgr.es/m/CAPpHfdurb9ycV8udYqM%3Do0sPS66PJ4RCBM1g-bBpvzUfogY0EA%40mail.gmail.com Reviewed-by: Matthias van de Meent, Mark Dilger, Pavel Borisov Reviewed-by: Nikita Malakhov, Japin Li
This commit is contained in:
@@ -1260,9 +1260,6 @@ RI_FKey_fk_upd_check_required(Trigger *trigger, Relation fk_rel,
|
||||
{
|
||||
const RI_ConstraintInfo *riinfo;
|
||||
int ri_nullcheck;
|
||||
Datum xminDatum;
|
||||
TransactionId xmin;
|
||||
bool isnull;
|
||||
|
||||
/*
|
||||
* AfterTriggerSaveEvent() handles things such that this function is never
|
||||
@@ -1330,10 +1327,7 @@ RI_FKey_fk_upd_check_required(Trigger *trigger, Relation fk_rel,
|
||||
* this if we knew the INSERT trigger already fired, but there is no easy
|
||||
* way to know that.)
|
||||
*/
|
||||
xminDatum = slot_getsysattr(oldslot, MinTransactionIdAttributeNumber, &isnull);
|
||||
Assert(!isnull);
|
||||
xmin = DatumGetTransactionId(xminDatum);
|
||||
if (TransactionIdIsCurrentTransactionId(xmin))
|
||||
if (slot_is_current_xact_tuple(oldslot))
|
||||
return true;
|
||||
|
||||
/* If all old and new key values are equal, no check is needed */
|
||||
|
||||
Reference in New Issue
Block a user