mirror of
https://github.com/postgres/postgres.git
synced 2025-10-21 02:52:47 +03:00
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
This commit is contained in:
@@ -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);
|
||||
|
||||
|
Reference in New Issue
Block a user