Uploaded image for project: 'Phoenix'
  1. Phoenix
  2. PHOENIX-836

Cast syntax is not in line with standard SQL

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • None
    • None
    • None

    Description

      It seems the cast syntax in Phoenix is not in line with SQL-92/99 (1), as well as other common SQL databases (2 & 3).

      A typical cast statement in SQL is written as

      SELECT CAST(ID AS INTEGER) FROM MYTAB;
      

      but this leads to a parse error in Phoenix. Instead, Phoenix expects cast statements to be written as follows (I believe the parentheses are optional here)

      SELECT (CAST ID AS INTEGER) FROM MYTAB;
      

      (1) http://savage.net.au/SQL/sql-99.bnf.html#cast%20specification
      (2) http://docs.oracle.com/javadb/10.8.2.2/ref/rrefsqlj33562.html
      (3) http://dev.mysql.com/doc/refman/5.0/en/cast-functions.html#function_cast

      Attachments

        1. PHOENIX-836.patch
          4 kB
          Gabriel Reid
        2. PHOENIX-836.2.patch
          4 kB
          Gabriel Reid

        Activity

          People

            Unassigned Unassigned
            gabriel.reid Gabriel Reid
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: