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

Danny Chan updated CALCITE-3201:
--------------------------------
    Description: 
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}

  was:
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); // insert into t values(1, 2, 3) fails with 
non-equal schema fields count.
{code}



> Skip validation for sql insert columns with column strategy that can not 
> insert into
> ------------------------------------------------------------------------------------
>
>                 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
>             Fix For: 1.21.0
>
>
> 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)

Reply via email to