w3resource

PostgreSQL ARRAY_LOWER() function

ARRAY_LOWER() function

The ARRAY_LOWER() function in PostgreSQL returns the lower bound of the specified dimension of an array. This function is essential for understanding the starting index of an array dimension, which can vary based on how the array was initialized.

Uses of the PostgreSQL ARRAY_LOWER() Function
  • Determine Lower Bound: Find the starting index of a specific array dimension.

  • Validate Array Indices: Ensure arrays conform to expected lower bound indices.

  • Analyze Array Structures: Understand the indexing scheme of multi-dimensional arrays.

  • Dynamic Query Adjustments: Adapt operations based on the lower bounds of array dimensions.

Syntax:

array_lower(anyarray, int)

Return Type

int

PostgreSQL Version: 9.3

Example: PostgreSQL ARRAY_LOWER() function

Code:

SELECT array_lower('[0:2]={1,2,3}'::int[], 1);

Sample Output:

 array_lower
-------------
           0
(1 row)

Previous: ARRAY_LENGTH function
Next: ARRAY_PREPEND function



Become a Patron!

Follow us on Facebook and Twitter for latest update.

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_lower-function.php