jsquery_in/out compatibility issue
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
I think inner parenthesis are not required for NOT. Committed fix to master branch. Please, check.