Skip to content

JB01 — Use ->> when comparing a JSONB value to text

Group: JSONB · Auto-fixable: yes

The -> operator returns jsonb, so comparing it to a text literal never matches. Use ->> to extract the value as text for the comparison.

bad: WHERE resource->'name' = 'Ann'
good: WHERE resource->>'name' = 'Ann'

Disable this rule in banshee.toml:

[lint]
exclude = ["JB01"]

Or silence one line with -- noqa: JB01. See Linting.