
Data types
Attention
This page documents an earlier version. Go to the latest (v2.3) version.The following table lists the primitive types in YSQL.
Data type | Alias | Description |
---|---|---|
BIGINT |
INT8 |
Signed 8-byte integer |
BIGSERIAL |
SERIAL8 |
Autoincrement 8-byte integer |
BIT [(n)] 1 |
Fixed-length bit string | |
BIT VARYING [(n)] 1 |
VARBIT [(n)] |
Variable-length bit string |
BOOLEAN |
BOOL |
Logical boolean (true/false) |
BOX 1 |
Rectangular box | |
BYTEA |
Binary data | |
CHARACTER [(n)] |
CHAR [(n)] |
Fixed-length character string |
CHARACTER VARYING [(n)] |
VARCHAR [(n)] |
Variable-length character string |
CIDR 1 |
IPv4 or IPv6 network address | |
CIRCLE 1 |
Circle | |
DATE |
Date (year, month, day) | |
DOUBLE PRECISION |
FLOAT8 |
Floating-point number (8 bytes) |
INET 1 |
IPv4 or IPv6 host address | |
INTEGER |
INT , INT4 |
Signed 4-byte integer |
INTERVAL [fields] [(p)] |
Time span | |
JSON 1 |
Textual JSON data | |
JSONB |
Binary JSON data | |
LINE 1 |
Infinite line | |
LSEG 1 |
Line segment | |
MACADDR 1 |
MAC address | |
MACADDR8 1 |
MAC address (EUI-64 format) | |
MONEY |
Currency amount | |
NUMERIC [(p, s)] |
DECIMAL [(p, s)] |
Exact fixed-point numeric |
PATH 1 |
Geometric path | |
PG_LSN 1 |
Log Sequence Number | |
POINT 1 |
Geometric point | |
POLYGON 1 |
Closed geometric path | |
REAL |
FLOAT4 |
Floating-point number (4 bytes) |
SMALLINT |
INT2 |
Signed 2-byte integer |
SMALLSERIAL |
SERIAL2 |
Autoincrement 2-byte integer |
SERIAL |
SERIAL4 |
Autoincrement 4-byte integer |
TEXT |
Variable-length character string | |
TIME [(p)] [WITHOUT TIME ZONE] |
Time of day | |
TIME [(p)] WITH TIME ZONE |
TIMETZ |
Time of day |
TIMESTAMP [(p)] [WITHOUT TIME ZONE] |
Date and time | |
TIMESTAMP [(p)] WITH TIME ZONE |
TIMESTAMPTZ |
Date and time |
TSQUERY 1 |
Text search query | |
TSVECTOR 1 |
Text search document | |
TXID_SNAPSHOT 1 |
Transaction ID snapshot | |
UUID |
Universally unique identifier | |
XML 2 |
XML data |
1 Table columns of this type cannot be part of an INDEX
KEY
.
2 Under development.