Overview of data types
RisingWave supports the following data types:
Type | Aliases | Description | Value |
---|---|---|---|
boolean | bool | Logical Boolean. It follows a three-valued logic system (true, false, or null). | true, false, or null |
smallint | Two-byte integer | Range: -32768 to 32767 | |
integer | int | Four-byte integer | Range: -2147483648 to 2147483647 |
bigint | Eight-byte integer | Range: -9223372036854775808 to 9223372036854775807 | |
numeric | decimal | Exact numeric. We do not support specifying precision and scale as of now. | Range: 28 decimal-digit precision. Note that the range is significantly smaller than that in PostgreSQL. |
real | Single precision floating-point number (4 bytes) | Range: 6 decimal digits precision | |
double precision | double | Double precision floating-point number (8 bytes) | Range: 15 decimal digits precision |
character varying | varchar, string | Variable-length character string. We do not support specifying the maximum length as of now. | Example: 'Hello World!' |
bytea | Binary strings. RisingWave only supports the hex formats for input and output; the escape format is not supported yet. | Syntax: ' \x binary_string ' Example: '\xDe00BeEf' | |
date | Calendar date (year, month, day) | Example: date '2022-04-08' | |
time without time zone | time | Time of day (no time zone) | Example: time '18:20:49' |
timestamp without time zone | timestamp | Date and time (no time zone) | Example: '2022-03-13 01:00:00'::timestamp |
timestamp with time zone | timestamptz | Timestamp with time zone. The 'Z' stands for UTC (Coordinated Universal Time). Timestamptz values are stored in UTC. When sinking downstream, timestamptz is represented in i64 with a resolution of microseconds. | Example: '2022-03-13 01:00:00Z'::timestamptz |
interval | Time span. Input in string format. Units include: second/seconds/s, minute/minutes/min/m, hour/hours/hr/h, day/days/d, month/months/mon, and year/years/yr/y. Units smaller than second can only be specified in a numerical format. | Examples: interval '4 hour' → 04:00:00 interval '3 day' → 3 days 00:00:00 interval '04:00:00.1234' → 04:00:00.1234 | |
struct | A struct is a column that contains nested data. For syntax and examples, see Struct. | ||
array | An array is an ordered list of zero or more elements that share the same data type including the array type. For syntax and examples, see Array. | ||
JSONB | A (binary) JSON value that ignores semantically-insignificant whitespaces or order of object keys. For syntax and examples, see JSONB. |
note
Scientific notation (e.g., 1e6, 1.25e5, and 1e-4) is supported in SELECT and INSERT statements.
Casting
For details about data type casting, see Casting.