📡 You're offline — showing cached content
New version available!
Quick Access
Tutorials PostgreSQL Essentials Data Types

Data Types

6 min read Quiz at the end
PostgreSQL supports rich types: INTEGER, TEXT, BOOLEAN, TIMESTAMPTZ, UUID, JSONB, and arrays. Always use TIMESTAMPTZ for dates to store time in UTC. TEXT is preferred over VARCHAR for most string columns.

Common PostgreSQL Data Types

TypeExample
INTEGER / BIGINT42
NUMERIC(10,2)9999.99
VARCHAR(255)'Alice'
TEXTlong strings
BOOLEANTRUE / FALSE
DATE2024-01-15
TIMESTAMP2024-01-15 10:30:00
UUIDgen_random_uuid()
JSONB{"key":"value"}
ARRAYARRAY[1,2,3]
Topic Quiz · 5 questions

Test your understanding before moving on

1. Which type stores timezone-aware dates and times?
💡 TIMESTAMPTZ stores timestamp with timezone — always preferred over TIMESTAMP.
2. Which type stores unlimited text?
💡 TEXT in PostgreSQL stores strings of unlimited length.
3. What is JSONB?
💡 JSONB stores JSON in a decomposed binary format that supports indexing.
4. Which numeric type has exact precision?
💡 NUMERIC(precision, scale) stores exact decimal values — ideal for money.
5. Which type auto-increments as a primary key?
💡 SERIAL is shorthand for a sequence-backed auto-incrementing integer.