Uploaded image for project: 'Calcite'
  1. Calcite
  2. CALCITE-1926

Function names are unparsed quoted while PostgreSQL can only handle unquoted function names

    XMLWordPrintableJSON

    Details

      Description

      While working on a Drill plugin, Calcite unparsed a JdbcRel node and produced the following PostgreSQL query

      SELECT "TEMP( Test)( 535799381)( 0)"
      FROM (SELECT "STRPOS"("str1", 'BI') = 1 AS "TEMP( Test)( 535799381)( 0)"
      FROM "TestV1"."Calcs") AS "t"
      GROUP BY "TEMP( Test)( 535799381)( 0)"
      

      The query fails due to a parsing exception, the reason is that the STRPOS function name is quoted using double quotes. I tried the query manually without quoting the function name and it executed successfully.

      I debugged through Calcite and found that the this method unparses the function name as a plain identifier which leads to the quoting of the function name if the dialect supports it.

      Drill uses Calcite v1.4 but as I compared it with the master branch, I found them identical.

      I haven't tried that with custom functions yet.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                mgelbana Mohamed Mohsen
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated: