@@ -121,8 +121,6 @@ static MemoryContext ModuleContext = NULL;
121121static Package * LastPackage = NULL ;
122122/* Recent variable */
123123static Variable * LastVariable = NULL ;
124- /* Recent row type id */
125- static Oid LastTypeId = InvalidOid ;
126124
127125/* Saved hook values for recall */
128126static ExecutorEnd_hook_type prev_ExecutorEnd = NULL ;
@@ -706,8 +704,7 @@ variable_insert(PG_FUNCTION_ARGS)
706704 init_record (record , tupdesc , variable );
707705 variable -> is_deleted = false;
708706 }
709- else if (LastTypeId == RECORDOID || !OidIsValid (LastTypeId ) ||
710- LastTypeId != tupType )
707+ else
711708 {
712709 /*
713710 * We need to check attributes of the new row if this is a transient
@@ -716,8 +713,6 @@ variable_insert(PG_FUNCTION_ARGS)
716713 check_attributes (variable , tupdesc );
717714 }
718715
719- LastTypeId = tupType ;
720-
721716 insert_record (variable , rec );
722717
723718 /* Release resources */
@@ -742,6 +737,7 @@ variable_update(PG_FUNCTION_ARGS)
742737 bool res ;
743738 Oid tupType ;
744739 int32 tupTypmod ;
740+ TupleDesc tupdesc = NULL ;
745741
746742 /* Checks */
747743 CHECK_ARGS_FOR_NULL ();
@@ -794,17 +790,9 @@ variable_update(PG_FUNCTION_ARGS)
794790 tupType = HeapTupleHeaderGetTypeId (rec );
795791 tupTypmod = HeapTupleHeaderGetTypMod (rec );
796792
797- if (LastTypeId == RECORDOID || !OidIsValid (LastTypeId ) ||
798- LastTypeId != tupType )
799- {
800- TupleDesc tupdesc = NULL ;
801-
802- tupdesc = lookup_rowtype_tupdesc (tupType , tupTypmod );
803- check_attributes (variable , tupdesc );
804- ReleaseTupleDesc (tupdesc );
805- }
806-
807- LastTypeId = tupType ;
793+ tupdesc = lookup_rowtype_tupdesc (tupType , tupTypmod );
794+ check_attributes (variable , tupdesc );
795+ ReleaseTupleDesc (tupdesc );
808796
809797 res = update_record (variable , rec );
810798
@@ -1330,7 +1318,6 @@ resetVariablesCache(void)
13301318 /* Remove package and variable from cache */
13311319 LastPackage = NULL ;
13321320 LastVariable = NULL ;
1333- LastTypeId = InvalidOid ;
13341321}
13351322
13361323/*
0 commit comments