@@ -79,11 +79,21 @@ init_attributes(HashVariableEntry *variable, TupleDesc tupdesc,
7979 sprintf (hash_name , "Records hash for variable \"%s\"" , variable -> name );
8080
8181 record = & (variable -> value .record );
82+
83+ #if PG_VERSION_NUM >= 110000
84+ record -> hctx = AllocSetContextCreateExtended (topctx ,
85+ hash_name , 0 ,
86+ ALLOCSET_DEFAULT_MINSIZE ,
87+ ALLOCSET_DEFAULT_INITSIZE ,
88+ ALLOCSET_DEFAULT_MAXSIZE );
89+ #else
8290 record -> hctx = AllocSetContextCreate (topctx ,
8391 hash_name ,
8492 ALLOCSET_DEFAULT_MINSIZE ,
8593 ALLOCSET_DEFAULT_INITSIZE ,
8694 ALLOCSET_DEFAULT_MAXSIZE );
95+ #endif
96+
8797 oldcxt = MemoryContextSwitchTo (record -> hctx );
8898 record -> tupdesc = CreateTupleDescCopyConstr (tupdesc );
8999
@@ -99,7 +109,7 @@ init_attributes(HashVariableEntry *variable, TupleDesc tupdesc,
99109 HASH_FUNCTION | HASH_COMPARE );
100110
101111 /* Get hash and match functions for key type. */
102- keyid = record -> tupdesc -> attrs [ 0 ] -> atttypid ;
112+ keyid = GetTupleDescAttr ( record -> tupdesc , 0 ) -> atttypid ;
103113 typentry = lookup_type_cache (keyid ,
104114 TYPECACHE_HASH_PROC_FINFO |
105115 TYPECACHE_CMP_PROC_FINFO );
@@ -142,8 +152,8 @@ check_attributes(HashVariableEntry *variable, TupleDesc tupdesc)
142152 /* Second, check columns type. */
143153 for (i = 0 ; i < tupdesc -> natts ; i ++ )
144154 {
145- Form_pg_attribute attr1 = variable -> value .record .tupdesc -> attrs [ i ] ,
146- attr2 = tupdesc -> attrs [ i ] ;
155+ Form_pg_attribute attr1 = GetTupleDescAttr ( variable -> value .record .tupdesc , i ) ,
156+ attr2 = GetTupleDescAttr ( tupdesc , i ) ;
147157
148158 if ((attr1 -> atttypid != attr2 -> atttypid )
149159 || (attr1 -> attndims != attr2 -> attndims )
@@ -163,7 +173,7 @@ check_record_key(HashVariableEntry *variable, Oid typid)
163173{
164174 Assert (variable -> typid == RECORDOID );
165175
166- if (variable -> value .record .tupdesc -> attrs [ 0 ] -> atttypid != typid )
176+ if (GetTupleDescAttr ( variable -> value .record .tupdesc , 0 ) -> atttypid != typid )
167177 ereport (ERROR ,
168178 (errcode (ERRCODE_INVALID_PARAMETER_VALUE ),
169179 errmsg ("requested value type differs from variable \"%s\" "
0 commit comments