Can a partial index on a jsonb column use ->> without casting in PostgreSQL 12?
0 reputation · 13 Feb 2026, 00:04 UTC
The goal is to determine whether PostgreSQL 12 allows a partial index on a jsonb column that is defined using the ->> operator without an explicit cast.
In PostgreSQL 11 a cast to text is required, while 12 accepts the operator directly, but the planner may still choose a sequential scan if the predicate includes a cast, resulting in suboptimal performance.
Does PostgreSQL 12 permit a partial index on a jsonb column using ->> without explicit casting? Will the planner use that index for queries that filter on ->>?