JSqlParser icon indicating copy to clipboard operation
JSqlParser copied to clipboard

[BUG] JSQLParser Version : 5.1 RDBMS : PostgreSQL 10 mix the JSON and relational operators, it outputs the wrong AST and sql.

Open hijackworld opened this issue 9 months ago • 4 comments

Description:

  • When using a mix of JSON and relational operators, there is a priority error in the parsing results.
  • The new sql lost some blank spaces.

SQL Example:

  • Original SQL:

    select  *  from  t  where  js  #>>  '{a,b,1}' <> 'bar'
    
  • Error 1: In the AST, the filter likes this: js #>> ('{a,b,1}' <> 'bar') but what we need is: (js #>> '{a,b,1}') <> 'bar'

  • Error 2: JSQLParser generates the new sql:

     SELECT * FROM t WHERE js#>>'{a,b,1}' <> 'bar'
    

    but what we need is: SELECT * FROM t WHERE js #>> '{a,b,1}' <> 'bar' JSQLParser lost the blank spaces.

Software Information:

  • JSqlParser version: 5.1
  • Database: PostgreSQL

hijackworld avatar Feb 11 '25 10:02 hijackworld