]> begriffs open source - ai-pg/blob - full-docs/txt/infoschema-columns.txt
Convert HTML docs to more streamlined TXT
[ai-pg] / full-docs / txt / infoschema-columns.txt
1
2 35.17. columns #
3
4    The view columns contains information about all table columns (or view
5    columns) in the database. System columns (ctid, etc.) are not included.
6    Only those columns are shown that the current user has access to (by
7    way of being the owner or having some privilege).
8
9    Table 35.15. columns Columns
10
11    Column Type
12
13    Description
14
15    table_catalog sql_identifier
16
17    Name of the database containing the table (always the current database)
18
19    table_schema sql_identifier
20
21    Name of the schema containing the table
22
23    table_name sql_identifier
24
25    Name of the table
26
27    column_name sql_identifier
28
29    Name of the column
30
31    ordinal_position cardinal_number
32
33    Ordinal position of the column within the table (count starts at 1)
34
35    column_default character_data
36
37    Default expression of the column
38
39    is_nullable yes_or_no
40
41    YES if the column is possibly nullable, NO if it is known not nullable.
42    A not-null constraint is one way a column can be known not nullable,
43    but there can be others.
44
45    data_type character_data
46
47    Data type of the column, if it is a built-in type, or ARRAY if it is
48    some array (in that case, see the view element_types), else
49    USER-DEFINED (in that case, the type is identified in udt_name and
50    associated columns). If the column is based on a domain, this column
51    refers to the type underlying the domain (and the domain is identified
52    in domain_name and associated columns).
53
54    character_maximum_length cardinal_number
55
56    If data_type identifies a character or bit string type, the declared
57    maximum length; null for all other data types or if no maximum length
58    was declared.
59
60    character_octet_length cardinal_number
61
62    If data_type identifies a character type, the maximum possible length
63    in octets (bytes) of a datum; null for all other data types. The
64    maximum octet length depends on the declared character maximum length
65    (see above) and the server encoding.
66
67    numeric_precision cardinal_number
68
69    If data_type identifies a numeric type, this column contains the
70    (declared or implicit) precision of the type for this column. The
71    precision indicates the number of significant digits. It can be
72    expressed in decimal (base 10) or binary (base 2) terms, as specified
73    in the column numeric_precision_radix. For all other data types, this
74    column is null.
75
76    numeric_precision_radix cardinal_number
77
78    If data_type identifies a numeric type, this column indicates in which
79    base the values in the columns numeric_precision and numeric_scale are
80    expressed. The value is either 2 or 10. For all other data types, this
81    column is null.
82
83    numeric_scale cardinal_number
84
85    If data_type identifies an exact numeric type, this column contains the
86    (declared or implicit) scale of the type for this column. The scale
87    indicates the number of significant digits to the right of the decimal
88    point. It can be expressed in decimal (base 10) or binary (base 2)
89    terms, as specified in the column numeric_precision_radix. For all
90    other data types, this column is null.
91
92    datetime_precision cardinal_number
93
94    If data_type identifies a date, time, timestamp, or interval type, this
95    column contains the (declared or implicit) fractional seconds precision
96    of the type for this column, that is, the number of decimal digits
97    maintained following the decimal point in the seconds value. For all
98    other data types, this column is null.
99
100    interval_type character_data
101
102    If data_type identifies an interval type, this column contains the
103    specification which fields the intervals include for this column, e.g.,
104    YEAR TO MONTH, DAY TO SECOND, etc. If no field restrictions were
105    specified (that is, the interval accepts all fields), and for all other
106    data types, this field is null.
107
108    interval_precision cardinal_number
109
110    Applies to a feature not available in PostgreSQL (see
111    datetime_precision for the fractional seconds precision of interval
112    type columns)
113
114    character_set_catalog sql_identifier
115
116    Applies to a feature not available in PostgreSQL
117
118    character_set_schema sql_identifier
119
120    Applies to a feature not available in PostgreSQL
121
122    character_set_name sql_identifier
123
124    Applies to a feature not available in PostgreSQL
125
126    collation_catalog sql_identifier
127
128    Name of the database containing the collation of the column (always the
129    current database), null if default or the data type of the column is
130    not collatable
131
132    collation_schema sql_identifier
133
134    Name of the schema containing the collation of the column, null if
135    default or the data type of the column is not collatable
136
137    collation_name sql_identifier
138
139    Name of the collation of the column, null if default or the data type
140    of the column is not collatable
141
142    domain_catalog sql_identifier
143
144    If the column has a domain type, the name of the database that the
145    domain is defined in (always the current database), else null.
146
147    domain_schema sql_identifier
148
149    If the column has a domain type, the name of the schema that the domain
150    is defined in, else null.
151
152    domain_name sql_identifier
153
154    If the column has a domain type, the name of the domain, else null.
155
156    udt_catalog sql_identifier
157
158    Name of the database that the column data type (the underlying type of
159    the domain, if applicable) is defined in (always the current database)
160
161    udt_schema sql_identifier
162
163    Name of the schema that the column data type (the underlying type of
164    the domain, if applicable) is defined in
165
166    udt_name sql_identifier
167
168    Name of the column data type (the underlying type of the domain, if
169    applicable)
170
171    scope_catalog sql_identifier
172
173    Applies to a feature not available in PostgreSQL
174
175    scope_schema sql_identifier
176
177    Applies to a feature not available in PostgreSQL
178
179    scope_name sql_identifier
180
181    Applies to a feature not available in PostgreSQL
182
183    maximum_cardinality cardinal_number
184
185    Always null, because arrays always have unlimited maximum cardinality
186    in PostgreSQL
187
188    dtd_identifier sql_identifier
189
190    An identifier of the data type descriptor of the column, unique among
191    the data type descriptors pertaining to the table. This is mainly
192    useful for joining with other instances of such identifiers. (The
193    specific format of the identifier is not defined and not guaranteed to
194    remain the same in future versions.)
195
196    is_self_referencing yes_or_no
197
198    Applies to a feature not available in PostgreSQL
199
200    is_identity yes_or_no
201
202    If the column is an identity column, then YES, else NO.
203
204    identity_generation character_data
205
206    If the column is an identity column, then ALWAYS or BY DEFAULT,
207    reflecting the definition of the column.
208
209    identity_start character_data
210
211    If the column is an identity column, then the start value of the
212    internal sequence, else null.
213
214    identity_increment character_data
215
216    If the column is an identity column, then the increment of the internal
217    sequence, else null.
218
219    identity_maximum character_data
220
221    If the column is an identity column, then the maximum value of the
222    internal sequence, else null.
223
224    identity_minimum character_data
225
226    If the column is an identity column, then the minimum value of the
227    internal sequence, else null.
228
229    identity_cycle yes_or_no
230
231    If the column is an identity column, then YES if the internal sequence
232    cycles or NO if it does not; otherwise null.
233
234    is_generated character_data
235
236    If the column is a generated column, then ALWAYS, else NEVER.
237
238    generation_expression character_data
239
240    If the column is a generated column, then the generation expression,
241    else null.
242
243    is_updatable yes_or_no
244
245    YES if the column is updatable, NO if not (Columns in base tables are
246    always updatable, columns in views not necessarily)
247
248    Since data types can be defined in a variety of ways in SQL, and
249    PostgreSQL contains additional ways to define data types, their
250    representation in the information schema can be somewhat difficult. The
251    column data_type is supposed to identify the underlying built-in type
252    of the column. In PostgreSQL, this means that the type is defined in
253    the system catalog schema pg_catalog. This column might be useful if
254    the application can handle the well-known built-in types specially (for
255    example, format the numeric types differently or use the data in the
256    precision columns). The columns udt_name, udt_schema, and udt_catalog
257    always identify the underlying data type of the column, even if the
258    column is based on a domain. (Since PostgreSQL treats built-in types
259    like user-defined types, built-in types appear here as well. This is an
260    extension of the SQL standard.) These columns should be used if an
261    application wants to process data differently according to the type,
262    because in that case it wouldn't matter if the column is really based
263    on a domain. If the column is based on a domain, the identity of the
264    domain is stored in the columns domain_name, domain_schema, and
265    domain_catalog. If you want to pair up columns with their associated
266    data types and treat domains as separate types, you could write
267    coalesce(domain_name, udt_name), etc.