Combining array slicing and indexing causes incorrect/confusing results - Mailing list pgsql-bugs

From Jelte Fennema-Nio
Subject Combining array slicing and indexing causes incorrect/confusing results
Date
Msg-id CAGECzQR+CUuHDYOooGO5y87nRJnw_sjOvPVBUt7pmg2vopgc7w@mail.gmail.com
Whole thread Raw
Responses Re: Combining array slicing and indexing causes incorrect/confusing results
List pgsql-bugs
Due to the way SubscriptingRef works there's no way for it to describe
a subscript sequence that both does a slice and a regular index in the
same SubscriptingRef. This results into weird behaviour like the
following:

> select ('{1, 2, 3, 4}'::int[])[1:4][2];
 int4
──────
 {}
(1 row)

It's possible to get the expected result by adding some additional parenthesis

> select (('{1, 2, 3, 4}'::int[])[1:4])[2];
 int4
──────
    2
(1 row)



pgsql-bugs by date:

Previous
From: PG Bug reporting form
Date:
Subject: BUG #18782: Inconsistent behaviour with triggers and row level security - depends on prior number of inserts
Next
From: Tom Lane
Date:
Subject: Re: Combining array slicing and indexing causes incorrect/confusing results