Uploaded image for project: 'Derby'
  1. Derby
  2. DERBY-5972

Grammar doesn't accept OR operator without parentheses

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 10.10.1.1
    • 10.8.3.3, 10.9.2.2, 10.10.1.1
    • SQL
    • None

    Description

      The grammar doesn't accept the OR operator without parentheses in some constructs.

      For example, in a select list:

      ij> create table t(b1 boolean, b2 boolean);
      0 rows inserted/updated/deleted
      ij> select b1 or b2 from t;
      ERROR 42X01: Syntax error: Encountered "or" at line 1, column 11. (errorCode = 30000)
      Issue the 'help' command for general information on IJ command syntax.
      Any unrecognized commands are treated as potential SQL commands and executed directly.
      Consult your DBMS server reference documentation for details of the SQL syntax supported by your server.

      However, it does not fail if OR is replaced by AND, or if parentheses are used around the OR expression:

      ij> select (b1 or b2) from t;
      1


      0 rows selected
      ij> select b1 and b2 from t;
      1


      0 rows selected

      Similar behaviour is seen in VALUES statements:

      ij> values true or false;
      ERROR 42X01: Syntax error: Encountered "or" at line 1, column 13. (errorCode = 30000)
      Issue the 'help' command for general information on IJ command syntax.
      Any unrecognized commands are treated as potential SQL commands and executed directly.
      Consult your DBMS server reference documentation for details of the SQL syntax supported by your server.
      ij> values (true or false);
      1


      true

      1 row selected
      ij> values true and false;
      1


      false

      1 row selected

      Attachments

        1. d5972-1a.diff
          6 kB
          Knut Anders Hatlen

        Issue Links

          Activity

            People

              knutanders Knut Anders Hatlen
              knutanders Knut Anders Hatlen
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: