![Data types [YSQL] Data types [YSQL]](/images/section_icons/api/subsection.png)
Data types
This page documents the preview version (v2.23). Preview includes features under active development and is for development and testing only. For production, use the stable version (v2024.1). To learn more, see Versioning.
The following table lists the primitive and compound data types in YSQL.
Data type | Alias | Description |
---|---|---|
array |
One-dimensional or multidimensional rectilinear array of any data type payload | |
bigint |
int8 |
Signed eight-byte integer |
bigserial |
serial8 |
Autoincrementing eight-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 on a plane | |
date |
Calendar date (year, month, day) | |
double precision |
float8 |
Double precision floating-point number (8 bytes) |
inet 1 |
IPv4 or IPv6 host address | |
integer |
int , int4 |
Signed four-byte integer |
interval [ fields ] [ (p) ] |
Time span | |
json 1 |
Textual JSON data | |
jsonb 1 |
Binary JSON data, decomposed | |
line 1 |
Infinite line on a plane | |
lseg 1 |
Line segment on a plane | |
macaddr 1 |
Media Access Control (MAC) address | |
macaddr8 1 |
Media Access Control (MAC) address (EUI-64 format) | |
money |
Currency amount | |
numeric [ (p, s) ] |
decimal [ (p, s) ] |
Exact fixed-point numeric |
path 1 |
Geometric path on a plane | |
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 two-byte integer |
int4range |
integer range |
|
int8range |
bigint range |
|
numrange |
numeric range |
|
tsrange |
timestamp without time zone range |
|
tstzrange |
timestamp with time zone range |
|
daterange |
date range |
|
smallserial |
serial2 |
Autoincrementing two-byte integer |
serial |
serial4 |
Autoincrementing four-byte integer |
text |
Variable-length character string | |
time [ (p) ] [ without time zone ] |
Time of day (no time zone) | |
time [ (p) ] with time zone |
timetz |
Time of day, including time zone |
timestamp [ (p) ] [ without time zone ] |
Date and time (no time zone) | |
timestamp [ (p) ] with time zone |
timestamptz |
Date and time, including time zone |
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.