Skip to main content

Cloudberry Database Data Types

Cloudberry Database has a rich set of native data types available to users. This document shows some of the built-in data types. In addition to the types listed here, there are also some internally used data types, such as oid (object identifier), but those are not documented in this document.

The following data types are specified by SQL: bit, bit varying, boolean, character varying, varchar, character, char, date, double precision, integer, interval, numeric, decimal, real, smallint, time (with or without time zone), and timestamp (with or without time zone).

Each data type has an external representation determined by its input and output functions. Many of the built-in types have obvious external formats. However, several types are either unique to PostgreSQL (and Cloudberry Database), such as geometric paths, or have several possibilities for formats, such as the date and time types. Some of the input and output functions are not invertible. That is, the result of an output function may lose accuracy when compared to the original input.

NameAliasSizeRangeDescription
bigintint88 bytes-9223372036854775808 to 9223372036854775807Large range integer
bigserialserial88 bytes1 to 9223372036854775807Large auto-incrementing integer
bit [ (n) ]n bitsBit string constantFixed-length bit string
bit varying [ (n) ]varbitActual number of bitsBit string constantVariable-length bit string
booleanbool1 bytetrue/false, t/f, yes/no, y/n, 1/0Logical boolean (true/false)
box32 bytes((x1,y1),(x2,y2))Rectangular box in the plane, not allowed in distribution key columns.
bytea11 byte + binary stringSequence of octetsVariable-length binary string
character [ (n) ]char [ (n) ]1 byte + nStrings up to n characters in lengthFixed-length, blank padded
character varying [ (n) ]varchar [ (n) ]1 byte + string sizeStrings up to n characters in lengthVariable-length with limit
cidr12 or 24 bytesIPv4 and IPv6 networks
circle24 bytes<(x,y),r> (center and radius)Circle in the plane, not allowed in distribution key columns.
date4 bytes'4714-11-24 BC' - '999999-12-31 AD'Calendar date (year, month, day)
decimal [ (p, s) ]1numeric [ (p, s) ]variableNo limitUser-specified precision, exact
double precisionfloat88 bytes15 decimal digits precisionVariable-precision, inexact
inet12 or 24 bytesIPv4 and IPv6 hosts and networks
integerint44 bytes-2147483648 to +2147483647Usual choice for integer
interval [ fields ] [ (p) ]16 bytes-178000000 years to 178000000 yearsTime span
json1 byte + json sizejson of any lengthVariable unlimited length
jsonb1 byte + binary stringjson of any length in a decomposed binary formatVariable unlimited length
lseg32 bytes((x1,y1),(x2,y2))Line segment in the plane - not allowed in distribution key columns.
macaddr6 bytesMAC addresses
macaddr88 bytesMAC addresses (EUI-64 format)
money8 bytes-92233720368547758.08 to +92233720368547758.07Currency amount
path16+16n bytes[(x1,y1),...]Geometric path in the plane, not allowed in distribution key columns.
point16 bytes(x,y)Geometric point in the plane, not allowed in distribution key columns.
polygon40+16n bytes((x1,y1),...)Closed geometric path in the plane, not allowed in distribution key columns.
realfloat44 bytes6 decimal digits precisionVariable-precision, inexact
serialserial44 bytes1 to 2147483647Auto-incrementing integer
smallintint22 bytes-32768 to +32767Small range integer
text1 byte + string sizeStrings of any lengthVariable unlimited length
time [ (p) ] [ without time zone ]8 bytes00:00:00[.000000] - 24:00:00[.000000]Time of day only
time [ (p) ] with time zonetimetz12 bytes00:00:00+1559 - 24:00:00-1559Time of day only, with time zone
timestamp [ (p) ] [ without time zone ]8 bytes4713 BC - 294,276 ADBoth date and time
timestamp [ (p) ] with time zonetimestamptz8 bytes4713 BC - 294,276 ADBoth date and time, with time zone
uuid16 bytesUniversally Unique Identifiers according to RFC 4122, ISO/IEC 9834-8:2005
xml1 byte + XML sizeXML of any lengthVariable unlimited length
txid_snapshotUser-level transaction ID snapshot