aboutsummaryrefslogtreecommitdiff
path: root/src/backend/access/common/heaptuple.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2006-07-03 22:45:41 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2006-07-03 22:45:41 +0000
commitb7b78d24f7fc8d621af40b2e404b6a3f3420e89e (patch)
treeda6b05ca5779ad812557b5d4cd38be79bf524825 /src/backend/access/common/heaptuple.c
parentfeed07350b63e32ba2fbe50181df7d40ca2ee33e (diff)
downloadpostgresql-b7b78d24f7fc8d621af40b2e404b6a3f3420e89e.tar.gz
postgresql-b7b78d24f7fc8d621af40b2e404b6a3f3420e89e.zip
Code review for FILLFACTOR patch. Change WITH grammar as per earlier
discussion (including making def_arg allow reserved words), add missed opt_definition for UNIQUE case. Put the reloptions support code in a less random place (I chose to make a new file access/common/reloptions.c). Eliminate header inclusion creep. Make the index options functions safely user-callable (seems like client apps might like to be able to test validity of options before trying to make an index). Reduce overhead for normal case with no options by allowing rd_options to be NULL. Fix some unmaintainably klugy code, including getting rid of Natts_pg_class_fixed at long last. Some stylistic cleanup too, and pay attention to keeping comments in sync with code. Documentation still needs work, though I did fix the omissions in catalogs.sgml and indexam.sgml.
Diffstat (limited to 'src/backend/access/common/heaptuple.c')
-rw-r--r--src/backend/access/common/heaptuple.c58
1 files changed, 3 insertions, 55 deletions
diff --git a/src/backend/access/common/heaptuple.c b/src/backend/access/common/heaptuple.c
index edd90c8a56f..70e8fd948dd 100644
--- a/src/backend/access/common/heaptuple.c
+++ b/src/backend/access/common/heaptuple.c
@@ -16,7 +16,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/access/common/heaptuple.c,v 1.108 2006/07/02 02:23:18 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/access/common/heaptuple.c,v 1.109 2006/07/03 22:45:36 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -1694,9 +1694,8 @@ minimal_tuple_from_heap_tuple(HeapTuple htup)
* presumed to contain no null fields and no varlena fields.
*
* This routine is really only useful for certain system tables that are
- * known to be fixed-width and null-free. It is used in some places for
- * pg_class, but that is a gross hack (it only works because relacl can
- * be omitted from the tuple entirely in those places).
+ * known to be fixed-width and null-free. Currently it is only used for
+ * pg_attribute tuples.
* ----------------
*/
HeapTuple
@@ -1738,54 +1737,3 @@ heap_addheader(int natts, /* max domain index */
return tuple;
}
-
-/*
- * build_class_tuple
- *
- * XXX Natts_pg_class_fixed is a hack - see pg_class.h
- */
-HeapTuple
-build_class_tuple(Form_pg_class pgclass, ArrayType *options)
-{
- HeapTuple tuple;
- HeapTupleHeader td;
- Form_pg_class data; /* contents of tuple */
- Size len;
- Size size;
- int hoff;
-
- /* size of pg_class tuple with options */
- if (options)
- size = offsetof(FormData_pg_class, reloptions) + VARATT_SIZE(options);
- else
- size = CLASS_TUPLE_SIZE;
-
- /* header needs no null bitmap */
- hoff = offsetof(HeapTupleHeaderData, t_bits);
- hoff += sizeof(Oid);
- hoff = MAXALIGN(hoff);
- len = hoff + size;
-
- tuple = (HeapTuple) palloc0(HEAPTUPLESIZE + len);
- tuple->t_data = td = (HeapTupleHeader) ((char *) tuple + HEAPTUPLESIZE);
-
- tuple->t_len = len;
- ItemPointerSetInvalid(&(tuple->t_self));
- tuple->t_tableOid = InvalidOid;
-
- /* we don't bother to fill the Datum fields */
-
- td->t_natts = Natts_pg_class_fixed;
- td->t_hoff = hoff;
- td->t_infomask = HEAP_HASOID;
-
- data = (Form_pg_class) ((char *) td + hoff);
- memcpy(data, pgclass, CLASS_TUPLE_SIZE);
- if (options)
- {
- td->t_natts++;
- memcpy(data->reloptions, options, VARATT_SIZE(options));
- }
-
- return tuple;
-}