Skip to content

TRUE and FALSE in WHERE clause are parsed as columns #926

@sivaraam

Description

@sivaraam

Describe the bug

Boolean values in WHERE clause are identified as columns rather than being identified as primitive values like numbers.

To Reproduce

Steps to reproduce the behavior:

  1. Example SQL
SELECT * FROM tableA WHERE true
  1. Parsing this SQL using JSqlParser with this statements
    public static void main(String[] args) throws JSQLParserException {
        Select sel = (Select) CCJSqlParserUtil.parse("SELECT * FROM tableA WHERE true");
        PlainSelect plainSelect = (PlainSelect) sel.getSelectBody();
        System.out.println(plainSelect.getWhere() instanceof Column);
    }

Expected behavior

Prints false as true in the WHERE clause is not supposed to be considered as a column name.

Actual behavior

Prints true.

System

  • Database you are using: PostgreSQL
  • Java Version: 11.0.3
  • JSqlParser version: 3.1

Metadata

Metadata

Assignees

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