diff options
| author | Andres Freund | 2017-08-20 18:19:12 +0000 |
|---|---|---|
| committer | Andres Freund | 2017-08-20 18:19:12 +0000 |
| commit | c6293249dc178f52dd508c3e6ff353af41c90b58 (patch) | |
| tree | 4e78d6b3f690222102f2bf3c3df6695504d335b0 /src/include/access | |
| parent | 2cd70845240087da205695baedab6412342d1dbe (diff) | |
Partially flatten struct tupleDesc so that it can be used in DSM.
TupleDesc's attributes were already stored in contiguous memory after the
struct. Go one step further and get rid of the array of pointers to
attributes so that they can be stored in shared memory mapped at different
addresses in each backend. This won't work for TupleDescs with contraints
and defaults, since those point to other objects, but for many purposes
only attributes are needed.
Author: Thomas Munro
Reviewed-By: Andres Freund
Discussion: https://postgr.es/m/CAEepm=0ZtQ-SpsgCyzzYpsXS6e=kZWqk3g5Ygn3MDV7A8dabUA@mail.gmail.com
Diffstat (limited to 'src/include/access')
| -rw-r--r-- | src/include/access/tupdesc.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/include/access/tupdesc.h b/src/include/access/tupdesc.h index 31b77a08fae..39fd59686a7 100644 --- a/src/include/access/tupdesc.h +++ b/src/include/access/tupdesc.h @@ -71,17 +71,17 @@ typedef struct tupleConstr typedef struct tupleDesc { 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; /* 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 */ int tdrefcount; /* reference count, or -1 if not counting */ + TupleConstr *constr; /* constraints, or NULL if none */ + /* attrs[N] is the description of Attribute Number N+1 */ + FormData_pg_attribute attrs[FLEXIBLE_ARRAY_MEMBER]; } *TupleDesc; /* Accessor for the i'th attribute of tupdesc. */ -#define TupleDescAttr(tupdesc, i) ((tupdesc)->attrs[(i)]) +#define TupleDescAttr(tupdesc, i) (&(tupdesc)->attrs[(i)]) extern TupleDesc CreateTemplateTupleDesc(int natts, bool hasoid); |
