Skip to main content

PostgreSQL Data Types

PostgreSQL offers a wide range of data types to accommodate various data storage needs. Here's a breakdown of some common types:

NameAliasesDescription
bigintint8Signed eight-byte integer
bigserialserial8Autoincrementing eight-byte integer
bit [ (n) ]Fixed-length bit string
bit varying [ (n) ]varbit [ (n) ]Variable-length bit string
booleanboolLogical Boolean (true/false)
boxRectangular box on a plane
byteaBinary data (“byte array”)
character [ (n) ]char [ (n) ]Fixed-length character string
character varying [ (n) ]varchar [ (n) ]Variable-length character string
cidrIPv4 or IPv6 network address
circleCircle on a plane
dateCalendar date (year, month, day)
double precisionfloat8Double precision floating-point number (8 bytes)
inetIPv4 or IPv6 host address
integerint, int4Signed four-byte integer
interval [ fields ] [ (p) ]Time span
jsonTextual JSON data
jsonbBinary JSON data, decomposed
lineInfinite line on a plane
lsegLine segment on a plane
macaddrMAC (Media Access Control) address
macaddr8MAC (Media Access Control) address (EUI-64 format)
moneyCurrency amount
numeric [ (p, s) ]decimal [ (p, s) ]Exact numeric of selectable precision
pathGeometric path on a plane
pg_lsnPostgreSQL Log Sequence Number
pg_snapshotUser-level transaction ID snapshot
pointGeometric point on a plane
polygonClosed geometric path on a plane
realfloat4Single precision floating-point number (4 bytes)
smallintint2Signed two-byte integer
smallserialserial2Autoincrementing two-byte integer
serialserial4Autoincrementing four-byte integer
textVariable-length character string
time [ (p) ] [ without time zone ]Time of day (no time zone)
time [ (p) ] with time zonetimetzTime of day, including time zone
timestamp [ (p) ] [ without time zone ]Date and time (no time zone)
timestamp [ (p) ] with time zonetimestamptzDate and time, including time zone
tsqueryText search query
tsvectorText search document
txid_snapshotUser-level transaction ID snapshot (deprecated; see pg_snapshot)
uuidUniversally unique identifier
xmlXML data

For more details on PostgreSQL data types, refer to the official PostgreSQL documentation.