SYSCOLUMNS
The syscolumns system catalog table describes each column in the database.
One row exists for each column that is defined in a table or view.
Column | Type | Explanation |
---|---|---|
colname | VARCHAR(128) | Column name |
tabid | INTEGER | Identifying code of table containing the column |
colno | SMALLINT | Column number The system sequentially assigns this (from left to right within each table). |
coltype | SMALLINT | Code indicating the data type of the column:
|
collength | Any of the following data types:
|
The value depends on the data type of the column. For some data types, the value is the column length (in bytes). See Storing Column Length for more information. |
colmin | INTEGER | Minimum column length (in bytes) |
colmax | INTEGER | Maximum column length (in bytes) |
extended_id | INTEGER | Data type code, from the sysxtdtypes table, of the data type specified in the coltype column |
seclabelid | INTEGER | The label ID of the security label associated with the column if it is a protected column. NULL otherwise. |
colattr | SMALLINT |
|
- 1 In DB-Access, an offset value of 256 is always added to these coltype codes because DB-Access sets SERIAL, SERIAL8, and BIGSERIAL columns to NOT NULL.
- 2 The built-in opaque data types do not have a unique coltype value. They are distinguished by the extended_id column in the SYSXTDTYPES system catalog table.
- 3 DISTINCT OF VARCHAR(128).
A composite index on tabid and colno allows only unique values.
The coltype codes can be incremented by bitmaps showing the following features of the column.
Bit Value | Significance When Bit Is Set |
---|---|
0x0100 | NULL values are not allowed |
0x0200 | Value is from a host variable |
0x0400 | Float-to-decimal for networked database server |
0x0800 | DISTINCT data type |
0x1000 | Named ROW type |
0x2000 | DISTINCT type from LVARCHAR base type |
0x4000 | DISTINCT type from BOOLEAN base type |
0x8000 | Collection is processed on client system |
For example, the coltype value 4118
for
named row types is the decimal representation of the hexadecimal value 0x1016
,
which is the same as the hexadecimal coltype value for an unnamed
row type (0x016
), with the named-row-type bit set.
The file $INFORMIXDIR/incl/esql/sqltypes.h contains
additional information about syscolumns.coltype codes.
The following table lists the coltype values for the built-in opaque data types:
NOT NULL constraints
Similarly,
the coltype value is incremented by 256
if
the column does not allow NULL values. To determine the data type
for such columns, subtract 256
from the value and
evaluate the remainder, based on the possible coltype values.
For example, if the coltype value is 262
,
subtracting 256
leaves a remainder of 6
,
indicating that the column has a SERIAL data type.
Storing the column data type
The database server stores the coltype value as bitmap, as listed in SYSCOLUMNS.