PostgreSQL Data Types

PostgreSQL column data types

Numeric Types

SMALLINT # 2 bytes, -32768 to 32767
INTEGER # 4 bytes, -2147483648 to 2147483647
BIGINT # 8 bytes, large integers
DECIMAL(10,2) # exact decimal
NUMERIC(10,2) # same as DECIMAL
REAL # 4 bytes, floating-point
DOUBLE PRECISION # 8 bytes, floating-point
SERIAL # auto-incrementing integer
BIGSERIAL # auto-incrementing bigint

Character Types

CHAR(10) # fixed-length string
VARCHAR(255) # variable-length string
TEXT # unlimited length string

Date/Time Types

DATE # date only (YYYY-MM-DD)
TIME # time only (HH:MM:SS)
TIMESTAMP # date and time
TIMESTAMPTZ # timestamp with timezone
INTERVAL # time interval

Boolean

BOOLEAN # true/false/null

UUID

UUID # universally unique identifier

JSON Types

JSON # JSON text
JSONB # binary JSON (faster, indexable)

Array Types

INTEGER[] # array of integers
TEXT[] # array of text

Network Types

INET # IPv4 or IPv6 address
CIDR # IPv4 or IPv6 network
MACADDR # MAC address