Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Rowley2024-12-03 04:12:38 +0000
committerDavid Rowley2024-12-03 04:12:38 +0000
commit4171c44c9b791da3c00386dc6d8e6b1842e3036b (patch)
tree304a009d9a2b3b3df52033019a3f210a53f79823 /src/backend/utils/cache
parentd28dff3f6cd6a7562fb2c211ac0fb74a33ffd032 (diff)
Revert "Introduce CompactAttribute array in TupleDesc"
This reverts commit d28dff3f6cd6a7562fb2c211ac0fb74a33ffd032. Quite a large number of buildfarm members didn't like this commit and it's not yet clear why. Reverting this before too many animals turn red. Discussion: https://postgr.es/m/CAApHDvr9i6T5=iAwQCxFDgMsthr_obVxgwBaEJkC8KUH6yM3Hw@mail.gmail.com
Diffstat (limited to 'src/backend/utils/cache')
-rw-r--r--src/backend/utils/cache/relcache.c21
-rw-r--r--src/backend/utils/cache/typcache.c13
2 files changed, 6 insertions, 28 deletions
diff --git a/src/backend/utils/cache/relcache.c b/src/backend/utils/cache/relcache.c
index e230450d2c3..d0892cee24d 100644
--- a/src/backend/utils/cache/relcache.c
+++ b/src/backend/utils/cache/relcache.c
@@ -585,8 +585,6 @@ RelationBuildTupleDesc(Relation relation)
attp,
ATTRIBUTE_FIXED_PART_SIZE);
- populate_compact_attribute(relation->rd_att, attnum - 1);
-
/* Update constraint/default info */
if (attp->attnotnull)
constr->has_not_null = true;
@@ -676,12 +674,12 @@ RelationBuildTupleDesc(Relation relation)
#endif
/*
- * We can easily set the attcacheoff value for the first attribute: it
- * must be zero. This eliminates the need for special cases for attnum=1
- * that used to exist in fastgetattr() and index_getattr().
+ * However, we can easily set the attcacheoff value for the first
+ * attribute: it must be zero. This eliminates the need for special cases
+ * for attnum=1 that used to exist in fastgetattr() and index_getattr().
*/
if (RelationGetNumberOfAttributes(relation) > 0)
- TupleDescCompactAttr(relation->rd_att, 0)->attcacheoff = 0;
+ TupleDescAttr(relation->rd_att, 0)->attcacheoff = 0;
/*
* Set up constraint/default info
@@ -1967,12 +1965,10 @@ formrdesc(const char *relationName, Oid relationReltype,
has_not_null |= attrs[i].attnotnull;
/* make sure attcacheoff is valid */
TupleDescAttr(relation->rd_att, i)->attcacheoff = -1;
-
- populate_compact_attribute(relation->rd_att, i);
}
/* initialize first attribute's attcacheoff, cf RelationBuildTupleDesc */
- TupleDescCompactAttr(relation->rd_att, 0)->attcacheoff = 0;
+ TupleDescAttr(relation->rd_att, 0)->attcacheoff = 0;
/* mark not-null status */
if (has_not_null)
@@ -3583,7 +3579,6 @@ RelationBuildLocalRelation(const char *relname,
datt->attgenerated = satt->attgenerated;
datt->attnotnull = satt->attnotnull;
has_not_null |= satt->attnotnull;
- populate_compact_attribute(rel->rd_att, i);
}
if (has_not_null)
@@ -4404,12 +4399,10 @@ BuildHardcodedDescriptor(int natts, const FormData_pg_attribute *attrs)
memcpy(TupleDescAttr(result, i), &attrs[i], ATTRIBUTE_FIXED_PART_SIZE);
/* make sure attcacheoff is valid */
TupleDescAttr(result, i)->attcacheoff = -1;
-
- populate_compact_attribute(result, i);
}
/* initialize first attribute's attcacheoff, cf RelationBuildTupleDesc */
- TupleDescCompactAttr(result, 0)->attcacheoff = 0;
+ TupleDescAttr(result, 0)->attcacheoff = 0;
/* Note: we don't bother to set up a TupleConstr entry */
@@ -6173,8 +6166,6 @@ load_relcache_init_file(bool shared)
goto read_failed;
has_not_null |= attr->attnotnull;
-
- populate_compact_attribute(rel->rd_att, i);
}
/* next read the access method specific field */
diff --git a/src/backend/utils/cache/typcache.c b/src/backend/utils/cache/typcache.c
index 8ce32a475f0..6590cbe5c67 100644
--- a/src/backend/utils/cache/typcache.c
+++ b/src/backend/utils/cache/typcache.c
@@ -241,18 +241,12 @@ shared_record_table_compare(const void *a, const void *b, size_t size,
TupleDesc t2;
if (k1->shared)
- {
t1 = (TupleDesc) dsa_get_address(area, k1->u.shared_tupdesc);
- t1->attrs = TupleDescAttrAddress(t1);
- }
else
t1 = k1->u.local_tupdesc;
if (k2->shared)
- {
t2 = (TupleDesc) dsa_get_address(area, k2->u.shared_tupdesc);
- t2->attrs = TupleDescAttrAddress(t2);
- }
else
t2 = k2->u.local_tupdesc;
@@ -270,10 +264,7 @@ shared_record_table_hash(const void *a, size_t size, void *arg)
TupleDesc t;
if (k->shared)
- {
t = (TupleDesc) dsa_get_address(area, k->u.shared_tupdesc);
- t->attrs = TupleDescAttrAddress(t);
- }
else
t = k->u.local_tupdesc;
@@ -1876,7 +1867,6 @@ lookup_rowtype_tupdesc_internal(Oid type_id, int32 typmod, bool noError)
tupdesc = (TupleDesc)
dsa_get_address(CurrentSession->area,
entry->shared_tupdesc);
- tupdesc->attrs = TupleDescAttrAddress(tupdesc);
Assert(typmod == tupdesc->tdtypmod);
/* We may need to extend the local RecordCacheArray. */
@@ -2963,7 +2953,6 @@ find_or_make_matching_shared_tupledesc(TupleDesc tupdesc)
result = (TupleDesc)
dsa_get_address(CurrentSession->area,
record_table_entry->key.u.shared_tupdesc);
- result->attrs = TupleDescAttrAddress(result);
Assert(result->tdrefcount == -1);
return result;
@@ -3027,7 +3016,6 @@ find_or_make_matching_shared_tupledesc(TupleDesc tupdesc)
result = (TupleDesc)
dsa_get_address(CurrentSession->area,
record_table_entry->key.u.shared_tupdesc);
- result->attrs = TupleDescAttrAddress(result);
Assert(result->tdrefcount == -1);
return result;
@@ -3040,7 +3028,6 @@ find_or_make_matching_shared_tupledesc(TupleDesc tupdesc)
record_table_entry);
result = (TupleDesc)
dsa_get_address(CurrentSession->area, shared_dp);
- result->attrs = TupleDescAttrAddress(result);
Assert(result->tdrefcount == -1);
return result;