sys.column
This view returns information about all of the columns in all of the tables in the database.
Column Name | Data Type | Description |
---|---|---|
table_id | bigint | The unique ID for the table. Tables in different schemas within the same database may have the same name, so you can use this ID to uniquely identify a table. |
column_id | integer | The ID for the column in the table: a positional number starting with 1 for the first named column. |
name | name | Name of the column. |
type | text | Data type of the column. |
nullable | boolean | A value of t means the column accepts null values. A value of f means that the column was defined with a NOT NULL constraint. |
distribution_key | integer | 1 if the column is the distribution key for the table; otherwise null . |
sort_key | integer | 1 if the column is the sort key for the table; otherwise null . |
partition_key | integer | 1 or greater if the column is a partitioning key for the table; otherwise null . |
cluster_key | integer | 1-4 if a column is a cluster key for the table; otherwise null . |
encrypted | boolean | A value of t means the column is encrypted; f means it is not encrypted. |
Examples
premdb=# select sct.name, scc.* from sys.column scc, sys.table sct
where scc.table_id=sct.table_id and sct.name='match'
order by column_id;
name | table_id | column_id | name | type | nullable | distribution_key | sort_key | partition_key | cluster_key | encrypted
-------+----------+-----------+----------+-----------------------------+----------+------------------+----------+---------------+-------------+-----------
match | 16414 | 1 | seasonid | smallint | t | 1 | [NULL] | [NULL] | [NULL] | f
match | 16414 | 2 | matchday | timestamp without time zone | t | [NULL] | [NULL] | [NULL] | [NULL] | f
match | 16414 | 3 | htid | smallint | t | [NULL] | [NULL] | [NULL] | [NULL] | f
match | 16414 | 4 | atid | smallint | t | [NULL] | [NULL] | [NULL] | [NULL] | f
match | 16414 | 5 | ftscore | character(3) | t | [NULL] | [NULL] | [NULL] | [NULL] | f
match | 16414 | 6 | htscore | character(3) | t | [NULL] | [NULL] | [NULL] | [NULL] | f
(6 rows)
Parent topic:System Views