PostgreSQL ? operator for jsonb in Write SQL

Hi all, i am having trouble writing ‘?’ key exist operator for jsonb SQL query on Metabase Write SQL.

The query is like

SELECT metadata ? ‘key1’ FROM table1
ORDER BY inserted_at DESC
LIMIT 10

but metabase return error like

No value specified for parameter 1.

I am suspecting that ‘?’ is readed as parameterized SQL here, is there a way to write these ‘?’ query?

thanks

Hi @calvin_sadewa
You are seeing this issue:
https://github.com/metabase/metabase/issues/1964 - upvote by clicking :+1: on the first post
You can use double question marks instead, like
SELECT metadata ?? 'key1' FROM table1

1 Like

Thanks @flamber, it’s working with ??!