Overview
While creating a table, you need to specify a data type for each column to define what kind of data you want to store. This section will look into the various data types supported in Oxla. Now, let’s get an overview of each data type:
Data Type | Definition | Format |
---|---|---|
BOOL | Boolean value. | True or False . |
TEXT | UTF8 encoded string with Unicode support. | ‘text’ |
DATE | Date value. | YYYY-MM-DD |
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 |
TIME | Time values without any date information. | HH:MM:SS[.SSSSSS] |
JSON | A value in JSON standard format. | variable_name JSON |
INTERVAL | Encodes a span of time | year-month (YYYY-MM); day-time (DD HH:MM:SS) |
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) |
Overflow Risks
When performing operations on numeric or temporal types, please be aware that 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 (e.g. AVG()
), where the result does not fit the result type. Using larger data types such as BIGINT
can help mitigate overflow risks.
Casting Considerations
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. Please verify input ranges to prevent unintended data loss.