Data types
Casting
Certain data types can be cast to and from other types implicitly or explicitly.
- Implicitly cast to: Values can be automatically converted to the target type.
- Assigned to: Values can be automatically converted when inserted to a column of the target type.
- Explicitly cast to: Values can be converted to the target type using explicit Type casts.
From type | Implicitly cast to | Assigned to | Explicitly cast to |
---|---|---|---|
boolean | varchar | integer | |
smallint | integer bigint numeric real double rw_int256 | varchar | |
integer | bigint numeric real double rw_int256 | smallint | boolean |
bigint | numeric real double rw_int256 | smallint integer varchar | |
numeric | real double | smallint integer bigint varchar | |
real | double | smallint integer bigint numeric varchar | |
double | smallint integer bigint numeric real varchar | ||
varchar | boolean smallint integer bigint numeric real double date timestamp timestamp with time zone time interval bytea jsonb rw_int256 | ||
date | timestamp timestamp with time zone | varchar | |
timestamp | timestamp with time zone | varchar date time | |
timestamp with time zone | varchar date timestamp time | ||
time | interval | varchar | |
interval | varchar time | ||
bytea | varchar | ||
jsonb | boolean smallint integer bigint numeric real double | varchar | |
rw_int256 | varchar |
NOTE
Structs can be casted to structs explicitly or implicitly if the nested expressions and types can be casted.