Home » Programming » Databases » PostgreSQL Data Types Reference

PostgreSQL Data Types Reference

This article provides a reference for all of the built-in data types available in PostgreSQL databases.

PostgreSQL Data Types

Data TypeDescriptionExample
BooleanTRUE/FALSE Boolean valueTRUE
Character (CHAR)Fixed-length string of characters‘Hello there’
Character Varying (VARCHAR)Variable-length string of characters‘Hello there’
TextString of characters with unlimited length‘This text can be as long as you want it to be!’
SmallintInteger value ranging from -32768 to +3276756
Integer (INT)Integer value ranging from -2147483648 to +2147483647654321
BigintInteger value ranging from -9223372036854775808 to +922337203685477580799999999999
DecimalNumeric value with a fixed point/decimal place3.09
NumericVariable-precision numeric value3.1563
RealFloating point number (single-precision)3.14159
Double precisionFloating point number (double-precision)3.141592653589793
DateDate value‘2031-04-12’
TimeTime value’23:59:59′
TimestampCombined date and time value‘2031-04-12 23:59:59’
IntervalTime duration‘1 year 7 months’
UUIDUniversally unique identifier (UUID) version 4’00b64075-5882-4065-9918-e26339a00eba’
JSONJavaScript Object Notation (JSON) data‘{“product”: “Tomato”, “quantity”: 13}’
JSONBBinary format of JSON data that allows for faster indexing and querying‘{“product”: “Tomato”, “quantity”: 13}’
XMLXML document‘Tomato13’
ArrayArray of values of the same data type‘{1, 2, 3, 4}’
RangeRange of values of the same data type‘[1, 10]’
BitFixed-length bit stringB’1010′
Bit Varyingvariable-length bit stringB’1010′
BOXRectangular box defined by two points marking the top left and bottom right coordinates‘((0,0),(2,2))’
CIDRIPv4 or IPv6 network address‘’;
CIRCLECircle defined by center point and a radius‘((0,0), 9)’
LINEStraight line defined by two points‘((0,0), (9,9))’
LSEGLine segment defined by two points‘((0,0), (9,9))’
MACADDRMAC address (6-byte)’60:FA:61:8E:70:F7′
MACADDR8MAC address (8-byte)’60:FA:61:8E:70:F7:04:05′
MONEYCurrency/monetary amount with fixed-point/decimal precision‘245.45’
PATHGeometric path consisting of one or more line segments‘((0,0),(5,5),(9,9))’
POINTPoint on 2-dimensional plane‘(4, 7)’
POLYGONClosed shape consisting of three or more straight sidespolygon ‘((0,0),(0,1),(1,1),(1,0),(0,0))’
SMALLSERIALAuto-incrementing 2-byte integer with a value of 1 to 327673
SERIALAuto-incrementing 4-byte integer with a value of 1 to 2147483647834
BIGSERIALAuto-incrementing 8-byte integer with a value of 1 to 922337203685477580754675678678
BYTEAVariable-length binary data string‘\xDEADBEEF’

More PostgreSQL Data Types

These are the most common built-in PostgreSQL data types. You can also define custom data types, including composite and ENUM types.

You can also create custom or composite types, and enums

Photo of author
I'm Brad, and I'm nearing 20 years of experience with Linux. I've worked in just about every IT role there is before taking the leap into software development. Currently, I'm building desktop and web-based solutions with NodeJS and PHP hosted on Linux infrastructure. Visit my blog or find me on Twitter to see what I'm up to.

Leave a Comment