Function array_position_start

Source
fn array_position_start(
    array: ListRef<'_>,
    element: Option<ScalarRefImpl<'_>>,
    start: Option<i32>,
) -> Result<Option<i32>>
Expand description

Returns the subscript of the first occurrence of the second argument in the array, or NULL if it’s not present. The search begins at the third argument.

Examples:

statement error
select array_position(array[1, null, 2, null], null, false);

statement error
select array_position(array[1, null, 2, null], null, null::int);

query II
select v, array_position(array[1, null, 2, null], null, v) from generate_series(-1, 5) as t(v);
----
-1    2
 0    2
 1    2
 2    2
 3    4
 4    4
 5 NULL