Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
jsquery_in/out compatibility issue #21
Comments
I think inner parenthesis are not required for NOT. Committed fix to master branch. Please, check. |
Hello,
While experimenting with jsquery, I encountered the following problem:
contrib_regression=# select 'NOT similar_product_ids.#: (NOT $ = "0440180295")'::jsquery::text::jsquery;
ERROR: bad jsquery representation
DETAIL: syntax error, unexpected NOT_P at or near " "
So, jsquery_in() fails to parse back the output generated by jsquery_out().
The problem seems to be with the jsquery_out(), which fails to add parenthesis around the expression:
contrib_regression=# select 'NOT similar_product_ids.#: (NOT $ = "0440180295")'::jsquery::text;
text
NOT ("similar_product_ids".#:NOT ($ = "0440180295"))
(1 row)
AFAICS jsquery_in() expects a parenthesis around the inner expression starting with 'NOT'. FWIW the attached patch fixes the problem for me, but I'm not sure if we should fix jsquery_out() or teach jsquery_in() to accept the above format.
Thanks,
Pavan
jsquery_in_out.txt