|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #80311 jsonb operators not supported
Submitted: 2020-11-03 14:06 UTC Modified: 2020-11-03 14:20 UTC
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: boan at jfmedier dot dk Assigned:
Status: Verified Package: PDO PgSQL
PHP Version: 7.2.34 OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
Solve the problem:
22 - 9 = ?
Subscribe to this entry?

 [2020-11-03 14:06 UTC] boan at jfmedier dot dk
When trying to query a jsonb field in postgresql with the questionmark operator, we get error code 42601.

`$pdo->query("SELECT * FROM term_template tt WHERE (sites->0) ? 'site_id'");`

`"ERROR:  syntax error at or near "$1"
LINE 1: SELECT * FROM term_template tt WHERE (sites->0) $1 'site_id'..."`

See jsonb operators here:

The query works when executed within a database tool.

Test script:
Fixture data in DB "sites" column:

[{"site_id": ""}]


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2020-11-03 14:20 UTC]
-Status: Open +Status: Verified -Type: Bug +Type: Documentation Problem
 [2020-11-03 14:20 UTC]
This is expected behavior, because the question mark is considered
to be a placeholder.  As of PHP 7.4.0, it is possible to escape
the question mark by doubling it[1].

Changing this to doc problem, since apparently that escaping
mechanism is not yet documented in the manual proper[2].

[1] <>
[2] <>
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Thu Oct 28 14:03:33 2021 UTC