Cloud

SQL Data Types

Redpanda SQL supports a wide range of data types, each designed to handle specific types of data efficiently.

The following table summarizes the data types supported by Redpanda SQL:

Data Type Definition Format

int

32-bit signed integer

one or more digits “0” to “9”

bigint

64-bit signed integer

large numeric/decimal value

real

32-bit floating point number

float(n)

double precision

64-bit floating point number

decimal(p, s)

timestamp without time zone

Time and date values without a time zone

YYYY-MM-DD [HH:MM:SS[.SSSSSS]]

timestamp with time zone

Date and time values, including the time zone information

YYYY-MM-DD HH:MM:SS.SSSSSS+TZ

date

Date value

YYYY-MM-DD

time

Time values without any date information

HH:MM:SS[.SSSSSS]

interval

Encodes a span of time

year-month (YYYY-MM); day-time (DD HH:MM:SS)

bool

Boolean value

True or False

text

UTF8 encoded string with Unicode support

‘text’

bytea

Arbitrary binary data (raw bytes)

'\xDEADBEEF' or '\336\255'

json

A value in JSON standard format

variable_name JSON

array

An array of a specific data type

'{value1, value2, value3}'::data_type[]

row

A composite value containing fields of different types

ROW(value1, value2, …​)

geometry

A spatial data type for planar (Cartesian) point values

GEOMETRY 'POINT(x y)'

geography

A spatial data type for geodetic (spherical) point values using WGS84

GEOGRAPHY 'POINT(lon lat)'

When performing operations on numeric or temporal types, overflows can lead to undefined behavior, resulting in unexpected values or errors. Ensure input values are within the allowed range for each numeric type to prevent overflows. This can occur during arithmetic operations or function execution (for example, avg()), where the result does not fit the result type. Using larger data types such as bigint can help mitigate overflow risks.

Explicit casting between types can cause data loss due to altered precision or magnitude, such as truncating fractional seconds in time or silently clipping out-of-range values. Verify input ranges to prevent unintended data loss.