PostgreSQL Data Types

Last Updated : 23 Sep, 2026

PostgreSQL provides a wide range of data types that define the kind of data that can be stored in table columns. They help maintain data accuracy, integrity and consistency.

  • Improve data accuracy and maintain data integrity.
  • Support advanced data types such as JSON, arrays and user-defined types for application-specific needs.

Numeric Type

These types are used for storing numerical data. PostgreSQL provides various numeric types, including:

NameDescriptionRange
smallint2-byte integer-32,768 to 32,767
integer4-byte integer-2,147,483,648 to 2,147,483,647
bigint8-byte integer-9,223,372,036,854,775,808 to 9,223,372,036,854,775,807
decimal(p,s)Exact numeric value with precision and scale-10³⁸ + 1 to 10³⁸ - 1
numeric(p,s)Exact numeric value with precision and scale-10³⁸ + 1 to 10³⁸ - 1
real4-byte floating-point numberApprox. -3.4 × 10³⁸ to 3.4 × 10³⁸
double precision8-byte floating-point numberApprox. -1.8 × 10³⁰⁸ to 1.8 × 10³⁰⁸
serialAuto-incrementing integerSame as integer
bigserialAuto-incrementing large integerSame as bigint

Monetary Type

Here’s a detailed overview of the monetary types available in PostgreSQL, presented in a tabular format:

NameDescriptionRange
moneyFixed-point type used for storing currency values.-2,147,483,648.00 to 2,147,483,647.00

Character Types

Here’s a detailed overview of the character types available in PostgreSQL, presented in a tabular format:

NameDescriptionRange
char(n)Fixed-length character type.1 to 8,000
varchar(n)Variable-length character type with a maximum length of n.1 to 8,000
textVariable-length character type with no specific length limit.No limit

Binary Types

Binary types in PostgreSQL are used to store raw binary data. The bytea type is specifically designed for this purpose, allowing you to store byte arrays for applications that need to manage non-text data, such as images, audio and other multimedia files.

NameDescriptionRange
byteaStores binary data as a byte array.No limit

Date/Time Types

PostgreSQL provides several date and time types to handle temporal data effectively. These types are essential for applications that require accurate time tracking, such as event scheduling, logging and historical data analysis.

NameDescriptionRange
dateStores calendar dates.4713 BC to 5874897 AD
timeStores time of day.00:00:00 to 24:00:00
timestampStores date and time without time zone.4713 BC to 5874897 AD
timestamptzStores date and time with time zone.4713 BC to 5874897 AD
intervalRepresents a span of time.-178,000 to 178,000 years

Boolean Types

Boolean types in PostgreSQL store truth values which can be either true or false. The boolean type is simple yet powerful for conditional checks and decision-making in applications.

NameDescriptionRange
booleanStores true, false or NULL values.true, false, NULL

Enumerated Types

Enumerated types (enums) allow us to define a data type with a static, ordered set of values. This is useful for situations where a column must contain one of a limited set of predefined values enhancing data integrity and readability.

NameDescriptionRange
enumUser-defined type with a fixed set of values.User-defined values

Geometric Types

Geometric types in PostgreSQL are used to store two-dimensional geometric data. These types are ideal for applications involving spatial data, such as geographic information systems (GIS), computer graphics and geometric modeling.

NameDescriptionRange
pointRepresents a point in 2D space.(x, y)
lineRepresents an infinite line.line(x, y)
lsegRepresents a line segment.Two points
boxRepresents a rectangular box.Two points
pathRepresents an open or closed path.Multiple points
polygonRepresents a polygon.Multiple points
circleRepresents a circle with center and radius.(center, radius)

Other (Special Purpose) Data Types

PostgreSQL also provides several special-purpose data types that are used for modern applications, networking and document-based data.

NameDescriptionRange
UUIDStores 128-bit universally unique identifiers.128-bit
JSONStores JSON data as text.Variable
JSONBStores JSON data in binary-optimized format.Variable
INETStores IPv4 or IPv6 addresses.IPv4/IPv6
CIDRStores network blocks.IPv4/IPv6 network
MACADDRStores MAC addresses.6 bytes
TSVECTORStores full-text search documents.Variable
Comment

Explore