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

JDBC adapter sometimes adds unnecessary parentheses around SELECT in INSERT

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Trivial
    • Resolution: Fixed
    • None
    • 1.33.0
    • None

    Description

      Add a case in RelToSqlConverterTest:

      // code placeholder
      @Test void testInsertValueWithDynamicParams() {
        final String sql = "insert into \"DEPT\" values (?,?,?)";
        final String expected = ""
            + "INSERT INTO \"SCOTT\".\"DEPT\" (\"DEPTNO\", \"DNAME\", \"LOC\")\n"
            + "SELECT ? AS \"DEPTNO\", ? AS \"DNAME\", ? AS \"LOC\"\n"
            + "FROM (VALUES (0)) AS \"t\" (\"ZERO\")";
        sql(sql)
            .schema(CalciteAssert.SchemaSpec.JDBC_SCOTT)
            .ok(expected);
      }

      will fail, because actual sql is with parentheses, maybe it's all right with parentheses, but the behavior is different from Union operator, you can see testInsertValuesWithDynamicParams in RelToSqlConverterTest class.

      Attachments

        Issue Links

          Activity

            People

              4wei Mou Wu
              4wei Mou Wu
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 1h 20m
                  1h 20m