Given this table:
CREATE TABLE datasets.travel(path integer[], path_timediff double precision[]);
INSERT INTO datasets.travel
VALUES (array[50,49,49,49,49,50], array[NULL,438,12,496,17,435]);
I am looking for some kind of function or query in the PostgreSQL that for a given input array[49,50]
will find the matching consecutive index values in path
which is [5,6]
and the corresponding element in path_timediff
which is 435
in the example (array index 6
).
My ultimate purpose is to find all such occurrences of [49,50]
in path
and all the corresponding elements in path_timediff
. How can I do that?