Doc #80311 [Com]: jsonb operators not supported

[email protected] ("info at towntasks dot com")
Newsgroups php.doc.bugs
Message-ID <[email protected]>
Edit report at https://bugs.php.net/bug.php?id=80311&edit=1

 ID:                 80311
 Comment by:         info at towntasks dot com
 Reported by:        boan at jfmedier dot dk
 Summary:            jsonb operators not supported
 Status:             Verified
 Type:               Documentation Problem
 Package:            PDO PgSQL
 PHP Version:        7.2.34
 Block user comment: N
 Private report:     N

 New Comment:

Hello, If you are searching short task or partime jobs, you can follow or visit to apply jobs
<a href="https://towntasks.com/">Town Task</a> 
<a href="https://towntasks.com/">Part Time Jobs </a> 
<a href="https://towntasks.com/">Short Tasks</a>


Previous Comments:
------------------------------------------------------------------------
[2020-11-03 14:20:45] [email protected]

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] <https://www.php.net/manual/en/migration74.new-features.php#migration74.new-features.pdo>
[2] <https://www.php.net/manual/en/pdo.prepared-statements.php>

------------------------------------------------------------------------
[2020-11-03 14:06:23] boan at jfmedier dot dk

Description:
------------
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: 

https://www.postgresql.org/docs/10/functions-json.html

The query works when executed within a database tool.

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

[{"site_id": "example.org"}]





------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=80311&edit=1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.