diff options
| author | Tom Lane | 2005-03-07 04:42:17 +0000 |
|---|---|---|
| committer | Tom Lane | 2005-03-07 04:42:17 +0000 |
| commit | a52b4fb1313cbd367d765a2a8704a63709cbbd5d (patch) | |
| tree | 8638ca814a9e96e1873cd77070d2ef6238cd461c /src/include/access | |
| parent | e3d7de6b995a33ee5b6205c6e4fd4078b103af45 (diff) | |
Adjust creation/destruction of TupleDesc data structure to reduce the
number of palloc calls. This has a salutory impact on plpgsql operations
with record variables (which create and destroy tupdescs constantly)
and probably helps a bit in some other cases too.
Diffstat (limited to 'src/include/access')
| -rw-r--r-- | src/include/access/tupdesc.h | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/src/include/access/tupdesc.h b/src/include/access/tupdesc.h index 8ffb2e70c85..f9b89ed253c 100644 --- a/src/include/access/tupdesc.h +++ b/src/include/access/tupdesc.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/access/tupdesc.h,v 1.46 2004/12/31 22:03:21 pgsql Exp $ + * $PostgreSQL: pgsql/src/include/access/tupdesc.h,v 1.47 2005/03/07 04:42:17 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -42,13 +42,17 @@ typedef struct tupleConstr } TupleConstr; /* - * This structure contains all information (i.e. from Classes - * pg_attribute, pg_attrdef, pg_constraint) for the structure of a tuple. + * This struct is passed around within the backend to describe the structure + * of tuples. For tuples coming from on-disk relations, the information is + * collected from the pg_attribute, pg_attrdef, and pg_constraint catalogs. + * Transient row types (such as the result of a join query) have anonymous + * TupleDesc structs that generally omit any constraint info; therefore the + * structure is designed to let the constraints be omitted efficiently. * * Note that only user attributes, not system attributes, are mentioned in * TupleDesc; with the exception that tdhasoid indicates if OID is present. * - * If the tuple is known to correspond to a named rowtype (such as a table's + * If the tupdesc is known to correspond to a named rowtype (such as a table's * rowtype) then tdtypeid identifies that type and tdtypmod is -1. Otherwise * tdtypeid is RECORDOID, and tdtypmod can be either -1 for a fully anonymous * row type, or a value >= 0 to allow the rowtype to be looked up in the @@ -56,13 +60,13 @@ typedef struct tupleConstr */ typedef struct tupleDesc { - int natts; /* Number of attributes in the tuple */ + int natts; /* number of attributes in the tuple */ Form_pg_attribute *attrs; - /* attrs[N] is a pointer to the description of Attribute Number N+1. */ - TupleConstr *constr; + /* attrs[N] is a pointer to the description of Attribute Number N+1 */ + TupleConstr *constr; /* constraints, or NULL if none */ Oid tdtypeid; /* composite type ID for tuple type */ int32 tdtypmod; /* typmod for tuple type */ - bool tdhasoid; /* Tuple has oid attribute in its header */ + bool tdhasoid; /* tuple has oid attribute in its header */ } *TupleDesc; |
