PostgreSQL ARRAY_DIMS() function
ARRAY_DIMS() function
The ARRAY_DIMS() function in PostgreSQL provides a text representation of an array's dimensions. This function is useful for understanding the shape and size of an array, especially for multi-dimensional arrays, by detailing the range of indices for each dimension.
Uses of the PostgreSQL ARRAY_DIMS() Function
- Determine Array Shape: Obtain a textual description of an array’s dimensions.
- Analyze Multi-Dimensional Arrays: Understand the index ranges and structure of complex arrays.
- Validate Array Structure: Ensure the array conforms to expected dimensional constraints.
- Support Debugging: Assist in debugging array-related issues by revealing dimension information.
Syntax:
array_dims(anyarray)
Return Type:
text
PostgreSQL Version: 9.3
Example: PostgreSQL ARRAY_DIMS() function
Code:
SELECT array_dims(ARRAY[[2,2,4], [5,3,6]]);
Sample Output:
array_dims ------------ [1:2][1:3] (1 row)
Previous: ARRAY_NDIMS function
Next: ARRAY_FILL functionn
It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.
https://w3resource.com/PostgreSQL/postgresql_array_dims-function.php
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics