darold / pgFormatter

A PostgreSQL SQL syntax beautifier that can work as a console program or as a CGI. On-line demo site at http://sqlformat.darold.net/
PostgreSQL License
1.66k stars 100 forks source link

Fix support for the @? jsonb-jsonpath operator #310

Closed simonwhitaker closed 1 year ago

simonwhitaker commented 1 year ago

This operator wasn't supported (pg_format would render @? as @ ?, and although present in the test suite, the SQL in t/pg-test-files/expected/jsonb_jsonpath.sql was invalid:

psql (15.2, server 12.14)
Type "help" for help.

radical_db=> SELECT jsonb '1' @ ? '$ ? ((@ == "1") is unknown)';
ERROR:  operator does not exist: ? unknown
LINE 1: SELECT jsonb '1' @ ? '$ ? ((@ == "1") is unknown)';
                           ^
HINT:  No operator matches the given name and argument type. You might need to add an explicit type cast.
radical_db=> SELECT jsonb '1' @? '$ ? ((@ == "1") is unknown)';
 ?column?
----------
 t
(1 row)

radical_db=>