Advanced Data Types · PostgreSQL
Ch 2 · PostgreSQL Data Types — card 1 of 4.
Explore PostgreSQL unique data types: arrays, JSON, UUID, and custom types. PostgreSQL goes well beyond standard SQL here. An array column holds several values at once, JSONB stores JSON in a fast, searchable binary form, UUID gives IDs that are unique everywhere, and CREATE TYPE lets you define an enum with a fixed list of allowed values. Together they let one table store flexible data neatly.
- Use PostgreSQL-specific data types
- Work with arrays and JSON
- Create custom enum types
PostgreSQL offers rich data types beyond standard SQL.
PostgreSQL arrays store multiple values in one column. JSONB stores binary JSON with indexing support. UUID provides globally unique IDs. Custom enums restrict values to a defined set.
- TEXT[] for arrays, ANY() to search
- JSONB > JSON (faster, indexable)
- -> returns JSON, ->> returns text
- CREATE TYPE for custom enums