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

SqlValidator throws exception for sql insert target table with virtual columns

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.20.0
    • Fix Version/s: 1.21.0
    • Component/s: core

      Description

      Now if we have a target table with schema:

      t1
      : - a int not null
        - b bigint STORED
        - c varchar VIRTUAL
      

      and validate a query like:

      insert into t1 select a from t1;
      

      It would throw exception because the target table fields count is 3 but the query is 1,
      actually the table t1 columns b and c have strategy that we can not insert into, so we better
      ignore these columns when do validation.

      The following query in SQLSERVER-2017 passed:

      create table t(
        a int,
        b int,
        c as a+2
      );
      
      --  insert into t values(1, 2, 3) fails with non-equal schema fields count.
      insert into t values(1, 2);
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                danny0405 Danny Chen
                Reporter:
                danny0405 Danny Chen
              • Votes:
                0 Vote for this issue
                Watchers:
                2 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 - 20m
                  20m