You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Danny Chan (JIRA)" <ji...@apache.org> on 2019/07/22 01:26:00 UTC

[jira] [Resolved] (CALCITE-3201) SqlValidator throws exception for sql insert target table with virtual columns

     [ https://issues.apache.org/jira/browse/CALCITE-3201?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Danny Chan resolved CALCITE-3201.
---------------------------------
    Resolution: Fixed

Fixed in [9c11efb|https://github.com/apache/calcite/commit/9c11efb5aae075f473d7cbfefbac99af1ef31553]!

> SqlValidator throws exception for sql insert target table with virtual columns
> ------------------------------------------------------------------------------
>
>                 Key: CALCITE-3201
>                 URL: https://issues.apache.org/jira/browse/CALCITE-3201
>             Project: Calcite
>          Issue Type: Improvement
>          Components: core
>    Affects Versions: 1.20.0
>            Reporter: Danny Chan
>            Assignee: Danny Chan
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 1.21.0
>
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> Now if we have a target table with schema:
> {code:sql}
> t1
> : - a int not null
>   - b bigint STORED
>   - c varchar VIRTUAL
> {code}
> and validate a query like:
> {code:sql}
> insert into t1 select a from t1;
> {code}
> 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:
> {code:sql}
> 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);
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)