PostgreSQL Source Code  git master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
pg_attribute.h File Reference
#include "catalog/genbki.h"
Include dependency graph for pg_attribute.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define AttributeRelationId   1249
 
#define AttributeRelation_Rowtype_Id   75
 
#define ATTRIBUTE_FIXED_PART_SIZE   (offsetof(FormData_pg_attribute,attcollation) + sizeof(Oid))
 
#define Natts_pg_attribute   21
 
#define Anum_pg_attribute_attrelid   1
 
#define Anum_pg_attribute_attname   2
 
#define Anum_pg_attribute_atttypid   3
 
#define Anum_pg_attribute_attstattarget   4
 
#define Anum_pg_attribute_attlen   5
 
#define Anum_pg_attribute_attnum   6
 
#define Anum_pg_attribute_attndims   7
 
#define Anum_pg_attribute_attcacheoff   8
 
#define Anum_pg_attribute_atttypmod   9
 
#define Anum_pg_attribute_attbyval   10
 
#define Anum_pg_attribute_attstorage   11
 
#define Anum_pg_attribute_attalign   12
 
#define Anum_pg_attribute_attnotnull   13
 
#define Anum_pg_attribute_atthasdef   14
 
#define Anum_pg_attribute_attisdropped   15
 
#define Anum_pg_attribute_attislocal   16
 
#define Anum_pg_attribute_attinhcount   17
 
#define Anum_pg_attribute_attcollation   18
 
#define Anum_pg_attribute_attacl   19
 
#define Anum_pg_attribute_attoptions   20
 
#define Anum_pg_attribute_attfdwoptions   21
 

Typedefs

typedef FormData_pg_attributeForm_pg_attribute
 

Functions

 CATALOG (pg_attribute, 1249) BKI_BOOTSTRAP BKI_WITHOUT_OIDS BKI_ROWTYPE_OID(75) BKI_SCHEMA_MACRO
 

Variables

 FormData_pg_attribute
 

Macro Definition Documentation

#define Anum_pg_attribute_attacl   19
#define Anum_pg_attribute_attalign   12

Definition at line 203 of file pg_attribute.h.

Referenced by InsertPgAttributeTuple().

#define Anum_pg_attribute_attbyval   10

Definition at line 201 of file pg_attribute.h.

Referenced by InsertPgAttributeTuple().

#define Anum_pg_attribute_attcacheoff   8

Definition at line 199 of file pg_attribute.h.

Referenced by InsertPgAttributeTuple().

#define Anum_pg_attribute_attcollation   18

Definition at line 209 of file pg_attribute.h.

Referenced by InsertPgAttributeTuple().

#define Anum_pg_attribute_attfdwoptions   21
#define Anum_pg_attribute_atthasdef   14

Definition at line 205 of file pg_attribute.h.

Referenced by InsertPgAttributeTuple().

#define Anum_pg_attribute_attinhcount   17

Definition at line 208 of file pg_attribute.h.

Referenced by InsertPgAttributeTuple().

#define Anum_pg_attribute_attisdropped   15

Definition at line 206 of file pg_attribute.h.

Referenced by InsertPgAttributeTuple().

#define Anum_pg_attribute_attislocal   16

Definition at line 207 of file pg_attribute.h.

Referenced by InsertPgAttributeTuple().

#define Anum_pg_attribute_attlen   5

Definition at line 196 of file pg_attribute.h.

Referenced by InsertPgAttributeTuple().

#define Anum_pg_attribute_attname   2

Definition at line 193 of file pg_attribute.h.

Referenced by InsertPgAttributeTuple().

#define Anum_pg_attribute_attndims   7

Definition at line 198 of file pg_attribute.h.

Referenced by InsertPgAttributeTuple().

#define Anum_pg_attribute_attnotnull   13

Definition at line 204 of file pg_attribute.h.

Referenced by InsertPgAttributeTuple().

#define Anum_pg_attribute_attnum   6
#define Anum_pg_attribute_attoptions   20

Definition at line 211 of file pg_attribute.h.

Referenced by ATExecSetOptions(), get_attribute_options(), and InsertPgAttributeTuple().

#define Anum_pg_attribute_attstattarget   4

Definition at line 195 of file pg_attribute.h.

Referenced by InsertPgAttributeTuple().

#define Anum_pg_attribute_attstorage   11

Definition at line 202 of file pg_attribute.h.

Referenced by InsertPgAttributeTuple().

#define Anum_pg_attribute_atttypid   3

Definition at line 194 of file pg_attribute.h.

Referenced by InsertPgAttributeTuple().

#define Anum_pg_attribute_atttypmod   9

Definition at line 200 of file pg_attribute.h.

Referenced by InsertPgAttributeTuple().

#define AttributeRelation_Rowtype_Id   75

Definition at line 34 of file pg_attribute.h.

Referenced by RelationCacheInitializePhase3().

Typedef Documentation

Function Documentation

CATALOG ( pg_attribute  ,
1249   
)

Definition at line 36 of file pg_attribute.h.

37 {
38  Oid attrelid; /* OID of relation containing this attribute */
39  NameData attname; /* name of attribute */
40 
41  /*
42  * atttypid is the OID of the instance in Catalog Class pg_type that
43  * defines the data type of this attribute (e.g. int4). Information in
44  * that instance is redundant with the attlen, attbyval, and attalign
45  * attributes of this instance, so they had better match or Postgres will
46  * fail.
47  */
48  Oid atttypid;
49 
50  /*
51  * attstattarget is the target number of statistics datapoints to collect
52  * during VACUUM ANALYZE of this column. A zero here indicates that we do
53  * not wish to collect any stats about this column. A "-1" here indicates
54  * that no value has been explicitly set for this column, so ANALYZE
55  * should use the default setting.
56  */
57  int32 attstattarget;
58 
59  /*
60  * attlen is a copy of the typlen field from pg_type for this attribute.
61  * See atttypid comments above.
62  */
63  int16 attlen;
64 
65  /*
66  * attnum is the "attribute number" for the attribute: A value that
67  * uniquely identifies this attribute within its class. For user
68  * attributes, Attribute numbers are greater than 0 and not greater than
69  * the number of attributes in the class. I.e. if the Class pg_class says
70  * that Class XYZ has 10 attributes, then the user attribute numbers in
71  * Class pg_attribute must be 1-10.
72  *
73  * System attributes have attribute numbers less than 0 that are unique
74  * within the class, but not constrained to any particular range.
75  *
76  * Note that (attnum - 1) is often used as the index to an array.
77  */
78  int16 attnum;
79 
80  /*
81  * attndims is the declared number of dimensions, if an array type,
82  * otherwise zero.
83  */
84  int32 attndims;
85 
86  /*
87  * fastgetattr() uses attcacheoff to cache byte offsets of attributes in
88  * heap tuples. The value actually stored in pg_attribute (-1) indicates
89  * no cached value. But when we copy these tuples into a tuple
90  * descriptor, we may then update attcacheoff in the copies. This speeds
91  * up the attribute walking process.
92  */
93  int32 attcacheoff;
94 
95  /*
96  * atttypmod records type-specific data supplied at table creation time
97  * (for example, the max length of a varchar field). It is passed to
98  * type-specific input and output functions as the third argument. The
99  * value will generally be -1 for types that do not need typmod.
100  */
101  int32 atttypmod;
102 
103  /*
104  * attbyval is a copy of the typbyval field from pg_type for this
105  * attribute. See atttypid comments above.
106  */
107  bool attbyval;
108 
109  /*----------
110  * attstorage tells for VARLENA attributes, what the heap access
111  * methods can do to it if a given tuple doesn't fit into a page.
112  * Possible values are
113  * 'p': Value must be stored plain always
114  * 'e': Value can be stored in "secondary" relation (if relation
115  * has one, see pg_class.reltoastrelid)
116  * 'm': Value can be stored compressed inline
117  * 'x': Value can be stored compressed inline or in "secondary"
118  * Note that 'm' fields can also be moved out to secondary storage,
119  * but only as a last resort ('e' and 'x' fields are moved first).
120  *----------
121  */
122  char attstorage;
123 
124  /*
125  * attalign is a copy of the typalign field from pg_type for this
126  * attribute. See atttypid comments above.
127  */
128  char attalign;
129 
130  /* This flag represents the "NOT NULL" constraint */
131  bool attnotnull;
132 
133  /* Has DEFAULT value or not */
134  bool atthasdef;
135 
136  /* Is dropped (ie, logically invisible) or not */
137  bool attisdropped;
138 
139  /*
140  * This flag specifies whether this column has ever had a local
141  * definition. It is set for normal non-inherited columns, but also for
142  * columns that are inherited from parents if also explicitly listed in
143  * CREATE TABLE INHERITS. It is also set when inheritance is removed from
144  * a table with ALTER TABLE NO INHERIT. If the flag is set, the column is
145  * not dropped by a parent's DROP COLUMN even if this causes the column's
146  * attinhcount to become zero.
147  */
148  bool attislocal;
149 
150  /* Number of times inherited from direct parent relation(s) */
151  int32 attinhcount;
152 
153  /* attribute's collation */
154  Oid attcollation;
155 
156 #ifdef CATALOG_VARLEN /* variable-length fields start here */
157  /* NOTE: The following fields are not present in tuple descriptors. */
158 
159  /* Column-level access permissions */
160  aclitem attacl[1];
161 
162  /* Column-level options */
163  text attoptions[1];
164 
165  /* Column-level FDW options */
166  text attfdwoptions[1];
167 #endif
signed short int16
Definition: c.h:228
unsigned int Oid
Definition: postgres_ext.h:31
signed int int32
Definition: c.h:229
Definition: c.h:469
FormData_pg_attribute
Definition: pg_attribute.h:168
Definition: c.h:415

Variable Documentation

FormData_pg_attribute

Definition at line 168 of file pg_attribute.h.

Referenced by AddNewAttributeTuples(), and ATExecAddColumn().