What is the second argument to the array_length () function?

Postgresql 9.4 has functions for the array. One of them is array_length(anyarray, int). He gets two arguments.

What is the second argument? In all examples, it matters 1. But nowhere does it say what it is.

+4
source share
1 answer

This is the size of the array.

Consider an example with a 3 × 2 2D array:

array_length(array[[1, 2], [3, 4], [5, 6]], 1) ---> 3
array_length(array[[1, 2], [3, 4], [5, 6]], 2) ---> 2

The size of the first dimension is 3; the size of the second dimension is 2.

+7
source

Source: https://habr.com/ru/post/1620749/


All Articles