Skip to main content
Version: 2.0.0 (latest)

3.3.1. Columns

Columns are the smallest unit of a table and they define how data must be stored through their data types and additional attributes as shown in the image below.

ch3.column-dialog.general12345678910111213

General
#FieldGroup boxDescription
1TypeData type

This attribute handles the data type assigned to the column.

2LengthData type

Length, or number of characters or bits, for the types that accept one, like varchar(n) or bit(n). Disabled for the other types.

3PrecisionData type

Precision, for the types that accept it, like numeric(p, s), or the number of fractional digits of seconds for time and timestamp. Disabled for the other types.

4DimensionData type

Number of dimensions when the type is an array (type[]). 0 means that the type is not an array.

5FormatData type

Read-only preview of the data type as it is written in the SQL code, with length, precision, dimension and other modifiers applied.

6Default value

This field defines the default value for the column in case none is specified in an INSERT command. How it is filled depends on the option selected below: Expression, Sequence, or Identity.

7GeneratedDefault value

This option indicates that the column's default value is generated from other columns' values. For example, say we have a column called height_in that represents the height in inches and another generated column called height_cm that represents the height in centimeters. The value of height_cm can be easily computed from height_in by performing a simple conversion like height_in * 2.54.

8ExpressionDefault value

Use this option to set up a simple SQL expression as the default value, typed in the field above. When Generated is checked, the expression is used to generate the column's value.

9SequenceDefault value

This option is used to configure a default value for serial data types based on a sequence object. Once the sequence is selected, it is converted into an expression like nextval('seq'::regclass).

10Sequence (selector)Default value

The sequence of the model used as the default value when the option Sequence is selected. Use the buttons beside the field to pick or clear it.

11IdentityDefault value

This option is used to configure an identity column (introduced in PostgreSQL 10). In recent versions of PostgreSQL, it's also possible to tweak the sequence parameters associated with the identity column.

12Identity typeDefault value

The kind of identity column when the option Identity is selected: ALWAYS or BY DEFAULT.

13NOT NULLDefault value

Creates a NOT NULL constraint in the column.

References​

Generated columns
https://www.postgresql.org/docs/current/ddl-generated-columns.html