Overview
In Oxla, an array allows you to represent a collection of elements that have the same data type (any built-in data type can be used).Currently, the implementation is limited only to single-dimensional arrays
Array Type Declaration
An array type can be declared by appending square brackets to the data type of its elements:ARRAY keyword after the data type of the elements:
Array Values
You can create array literals by using theARRAY keyword and combining it with the array’s values enclosed in square brackets and separated by commas:
SELECT or INSERT INTO statements:
INSERT INTO statements with the VALUES clause:
In the example above, the double quotes which are a part of the JSON value are required to be escaped with a backslash, so that they are not mistaken with the double quote, which marks the end of the element
Accessing Arrays
You can retrieve a single element from an array using the array subscript operator. When it comes to array values indexing, the elements of an n-length array start at index1 and end at index n:
If the index exceeds the length of an array, the returned value will be
NULLlower_bound:upper_bound. The bounds can be omitted, in which case the slice is unbounded from a given side:
Limitations
Field Size Limit
In Oxla, the field size limit for variable-size types is 32MB and this limit applies to arrays as well. If a value exceeds the given limit, an error is returned:Unsupported SQL Clauses
Array columns cannot be used as the key columns inORDER BY, GROUP BY or JOIN operations. It is also impossible to use the array columns as a part of the index of a table. For all the operations mentioned above, an appropriate error message will be returned:
ORDER BY or JOIN operations, if the array column is not the key:
Unsupported SQL Statements
Specific SQL statements currently do not support arrays. These include:INSERT INTOwithSELECT: Arrays cannot be directly imported using anINSERT INTOwith aSELECTstatement. Instead, we encourage you to either use theCOPY FROM CSVcommand or theINSERT INTOstatement with theVALUESkeywordUPDATEandDELETE: Updating or deleting records from a table, which contains array columns is not supportedCOPY TO: Exporting data from array columns using theCOPY TOcommand is not availableCREATE INDEX: Index on a table cannot be created on an array column.