</para></entry>
</row>
- <row>
- <entry role="catalog_table_entry"><para role="column_definition">
- <structfield>attcacheoff</structfield> <type>int4</type>
- </para>
- <para>
- Always -1 in storage, but when loaded into a row descriptor
- in memory this might be updated to cache the offset of the attribute
- within the row
- </para></entry>
- </row>
-
<row>
<entry role="catalog_table_entry"><para role="column_definition">
<structfield>atttypmod</structfield> <type>int4</type>
memcpy(dstAtt, srcAtt, ATTRIBUTE_FIXED_PART_SIZE);
- /*
- * Aside from updating the attno, we'd better reset attcacheoff.
- *
- * XXX Actually, to be entirely safe we'd need to reset the attcacheoff of
- * all following columns in dst as well. Current usage scenarios don't
- * require that though, because all following columns will get initialized
- * by other uses of this function or TupleDescInitEntry. So we cheat a
- * bit to avoid a useless O(N^2) penalty.
- */
dstAtt->attnum = dstAttno;
- dstAtt->attcacheoff = -1;
/* since we're not copying constraints or defaults, clear these */
dstAtt->attnotnull = false;
* them (since atttypid will be zero for all dropped columns) and in
* general it seems safer to check them always.
*
- * attcacheoff must NOT be checked since it's possibly not set in both
- * copies. We also intentionally ignore atthasmissing, since that's
- * not very relevant in tupdescs, which lack the attmissingval field.
+ * We intentionally ignore atthasmissing, since that's not very
+ * relevant in tupdescs, which lack the attmissingval field.
*/
if (strcmp(NameStr(attr1->attname), NameStr(attr2->attname)) != 0)
return false;
else if (attributeName != NameStr(att->attname))
namestrcpy(&(att->attname), attributeName);
- att->attcacheoff = -1;
att->atttypmod = typmod;
att->attnum = attributeNumber;
Assert(attributeName != NULL);
namestrcpy(&(att->attname), attributeName);
- att->attcacheoff = -1;
att->atttypmod = typmod;
att->attnum = attributeNumber;
if (OidIsValid(attrtypes[attnum]->attcollation))
attrtypes[attnum]->attcollation = C_COLLATION_OID;
- attrtypes[attnum]->attcacheoff = -1;
attrtypes[attnum]->atttypmod = -1;
attrtypes[attnum]->attislocal = true;
.atttypid = TIDOID,
.attlen = sizeof(ItemPointerData),
.attnum = SelfItemPointerAttributeNumber,
- .attcacheoff = -1,
.atttypmod = -1,
.attbyval = false,
.attalign = TYPALIGN_SHORT,
.atttypid = XIDOID,
.attlen = sizeof(TransactionId),
.attnum = MinTransactionIdAttributeNumber,
- .attcacheoff = -1,
.atttypmod = -1,
.attbyval = true,
.attalign = TYPALIGN_INT,
.atttypid = CIDOID,
.attlen = sizeof(CommandId),
.attnum = MinCommandIdAttributeNumber,
- .attcacheoff = -1,
.atttypmod = -1,
.attbyval = true,
.attalign = TYPALIGN_INT,
.atttypid = XIDOID,
.attlen = sizeof(TransactionId),
.attnum = MaxTransactionIdAttributeNumber,
- .attcacheoff = -1,
.atttypmod = -1,
.attbyval = true,
.attalign = TYPALIGN_INT,
.atttypid = CIDOID,
.attlen = sizeof(CommandId),
.attnum = MaxCommandIdAttributeNumber,
- .attcacheoff = -1,
.atttypmod = -1,
.attbyval = true,
.attalign = TYPALIGN_INT,
.atttypid = OIDOID,
.attlen = sizeof(Oid),
.attnum = TableOidAttributeNumber,
- .attcacheoff = -1,
.atttypmod = -1,
.attbyval = true,
.attalign = TYPALIGN_INT,
* Construct and insert a set of tuples in pg_attribute.
*
* Caller has already opened and locked pg_attribute. tupdesc contains the
- * attributes to insert. attcacheoff is always initialized to -1.
- * tupdesc_extra supplies the values for certain variable-length/nullable
- * pg_attribute fields and must contain the same number of elements as tupdesc
- * or be NULL. The other variable-length fields of pg_attribute are always
- * initialized to null values.
+ * attributes to insert. tupdesc_extra supplies the values for certain
+ * variable-length/nullable pg_attribute fields and must contain the same
+ * number of elements as tupdesc or be NULL. The other variable-length fields
+ * of pg_attribute are always initialized to null values.
*
* indstate is the index state for CatalogTupleInsertWithInfo. It can be
* passed as NULL, in which case we'll fetch the necessary info. (Don't do
slot[slotCount]->tts_values[Anum_pg_attribute_atttypid - 1] = ObjectIdGetDatum(attrs->atttypid);
slot[slotCount]->tts_values[Anum_pg_attribute_attlen - 1] = Int16GetDatum(attrs->attlen);
slot[slotCount]->tts_values[Anum_pg_attribute_attnum - 1] = Int16GetDatum(attrs->attnum);
- slot[slotCount]->tts_values[Anum_pg_attribute_attcacheoff - 1] = Int32GetDatum(-1);
slot[slotCount]->tts_values[Anum_pg_attribute_atttypmod - 1] = Int32GetDatum(attrs->atttypmod);
slot[slotCount]->tts_values[Anum_pg_attribute_attndims - 1] = Int16GetDatum(attrs->attndims);
slot[slotCount]->tts_values[Anum_pg_attribute_attbyval - 1] = BoolGetDatum(attrs->attbyval);
MemSet(to, 0, ATTRIBUTE_FIXED_PART_SIZE);
to->attnum = i + 1;
- to->attcacheoff = -1;
to->attislocal = true;
to->attcollation = (i < numkeyatts) ? collationIds[i] : InvalidOid;
elog(ERROR, "pg_attribute catalog is missing %d attribute(s) for relation OID %u",
need, RelationGetRelid(relation));
- /*
- * The attcacheoff values we read from pg_attribute should all be -1
- * ("unknown"). Verify this if assert checking is on.
- */
-#ifdef USE_ASSERT_CHECKING
- {
- int i;
-
- for (i = 0; i < RelationGetNumberOfAttributes(relation); i++)
- Assert(TupleDescAttr(relation->rd_att, i)->attcacheoff == -1);
- }
-#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
&attrs[i],
ATTRIBUTE_FIXED_PART_SIZE);
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);
}
for (i = 0; i < natts; i++)
{
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);
}
*/
/* yyyymmddN */
-#define CATALOG_VERSION_NO 202412191
+#define CATALOG_VERSION_NO 202412201
#endif
*/
int16 attnum;
- /*
- * fastgetattr() uses attcacheoff to cache byte offsets of attributes in
- * heap tuples. The value actually stored in pg_attribute (-1) indicates
- * no cached value. But when we copy these tuples into a tuple
- * descriptor, we may then update attcacheoff in the copies. This speeds
- * up the attribute walking process.
- */
- int32 attcacheoff BKI_DEFAULT(-1);
-
/*
* atttypmod records type-specific data supplied at table creation time
* (for example, the max length of a varchar field). It is passed to
SELECT a1.attrelid, a1.attname
FROM pg_attribute as a1
WHERE a1.attrelid = 0 OR a1.atttypid = 0 OR a1.attnum = 0 OR
- a1.attcacheoff != -1 OR a1.attinhcount < 0 OR
- (a1.attinhcount = 0 AND NOT a1.attislocal);
+ a1.attinhcount < 0 OR (a1.attinhcount = 0 AND NOT a1.attislocal);
attrelid | attname
----------+---------
(0 rows)
SELECT a1.attrelid, a1.attname
FROM pg_attribute as a1
WHERE a1.attrelid = 0 OR a1.atttypid = 0 OR a1.attnum = 0 OR
- a1.attcacheoff != -1 OR a1.attinhcount < 0 OR
- (a1.attinhcount = 0 AND NOT a1.attislocal);
+ a1.attinhcount < 0 OR (a1.attinhcount = 0 AND NOT a1.attislocal);
-- Cross-check attnum against parent relation