- Categories:
Semi-structured and structured data functions (Array/Object)
ARRAY_APPEND¶
Returns an array containing all elements from the source array as well as the new element. The new element is located at the end of the array.
- See also:
Syntax¶
Arguments¶
arrayThe source array.
new_elementThe element to be appended. The type of the element depends on the type of the array:
If
arrayis a semi-structured array, the element can be of almost any data type. The data type can be different from the data type(s) of the existing elements in the array.If
arrayis a structured array, the type of the new element must be coercible to the type of the array.
Returns¶
The data type of the returned value is ARRAY.
When you pass a structured array to the function, the function returns a structured array of the same type.
If the source array is NULL, the function returns NULL.
Examples¶
The examples use the following table with an ARRAY column:
Add an element of the same type to the array:
Query the table to see the new element added to the array:
Add an element of a different type to the array:
Query the table to see the new element added to the array and the data type of each element in the array: