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

SqlAdvisor: automatically quote identifiers that look like SQL keywords

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.17.0
    • Fix Version/s: 1.18.0
    • Component/s: core
    • Labels:
      None

      Description

      Case for SqlAdvisorTest:

        @Test @WithLex(Lex.JAVA) public void testAdviceExpression() {
          String sql;
          sql = "select s.`count`+s.co^ from (select 1 `count` from emp) s";
          assertComplete(sql, "COLUMN(count)\n", "co",
              ImmutableMap.of("COLUMN(count)", "`count`"));
        }
      

      It should automatically quote the suggested column name count since otherwise it is confused with count keyword.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                julianhyde Julian Hyde
                Reporter:
                vladimirsitnikov Vladimir Sitnikov
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: