Skip to content

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

Description

@hijackworld

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions