aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/cache/relcache.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/utils/cache/relcache.c')
-rw-r--r--src/backend/utils/cache/relcache.c50
1 files changed, 49 insertions, 1 deletions
diff --git a/src/backend/utils/cache/relcache.c b/src/backend/utils/cache/relcache.c
index 2f4697a39b8..e4551d4c604 100644
--- a/src/backend/utils/cache/relcache.c
+++ b/src/backend/utils/cache/relcache.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/cache/relcache.c,v 1.117 2000/11/30 08:46:24 vadim Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/cache/relcache.c,v 1.118 2000/11/30 18:38:46 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -630,6 +630,32 @@ build_tupdesc_seq(RelationBuildDescInfo buildinfo,
heap_endscan(pg_attribute_scan);
heap_close(pg_attribute_desc, AccessShareLock);
+ /* ----------------
+ * The attcacheoff values we read from pg_attribute should all be -1
+ * ("unknown"). Verify this if assert checking is on. They will be
+ * computed when and if needed during tuple access.
+ * ----------------
+ */
+#ifdef USE_ASSERT_CHECKING
+ {
+ int i;
+
+ for (i = 0; i < relation->rd_rel->relnatts; i++)
+ {
+ Assert(relation->rd_att->attrs[i]->attcacheoff == -1);
+ }
+ }
+#endif
+
+ /* ----------------
+ * 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().
+ * ----------------
+ */
+ relation->rd_att->attrs[0]->attcacheoff = 0;
+
SetConstrOfRelation(relation, constr, ndef, attrdef);
}
@@ -715,6 +741,28 @@ build_tupdesc_ind(RelationBuildDescInfo buildinfo,
heap_close(attrel, AccessShareLock);
+ /* ----------------
+ * The attcacheoff values we read from pg_attribute should all be -1
+ * ("unknown"). Verify this if assert checking is on. They will be
+ * computed when and if needed during tuple access.
+ * ----------------
+ */
+#ifdef USE_ASSERT_CHECKING
+ for (i = 0; i < relation->rd_rel->relnatts; i++)
+ {
+ Assert(relation->rd_att->attrs[i]->attcacheoff == -1);
+ }
+#endif
+
+ /* ----------------
+ * 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().
+ * ----------------
+ */
+ relation->rd_att->attrs[0]->attcacheoff = 0;
+
SetConstrOfRelation(relation, constr, ndef, attrdef);
}