SQL DATA TYPES
Oxla 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 Oxla:
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’ |
JSON | A value in JSON standard format | variable_name JSON |
ARRAY | An array of a specific data type | '{value1, value2, value3}'::data_type[] |
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.