[
https://issues.apache.org/jira/browse/DERBY-4451?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12781493#action_12781493
]
Dag H. Wanvik commented on DERBY-4451:
--------------------------------------
Thanks for looking at the patch, guys. Interestingly,
insert into t(x,y) select * from t union select * from t;
gives the ArrayIndexOutOfBoundsException, but this version:
ij(CONNECTION1)> insert into t(y,x) select * from t union select * from t;
ERROR 42XA3: You may not override the value of generated column 'Y'.
works as expected. I also see that the patch doesn't handle INTERSECT/EXCEPT
properly, but that's easily fixed by moving the mothod from UnionNode up to
SetOperatorNode. I'll spin a new verision when I have figured out the
ArrayIndexOutOfBoundsException case. Another thing is that thew new version
would silently remove the defaults in this case (DERBY-4426):
create table mytab (i int generated always as (j*2), j int);
insert into mytab values (default,1) union values (default,2);
wheres they should be flagged according to the discussion in DERBY-4426..
> ArrayIndexOutOfBoundsException or ASSERT FAILED when inserting generated
> columns out of order
> ---------------------------------------------------------------------------------------------
>
> Key: DERBY-4451
> URL: https://issues.apache.org/jira/browse/DERBY-4451
> Project: Derby
> Issue Type: Bug
> Components: SQL
> Affects Versions: 10.5.3.0, 10.6.0.0
> Reporter: Knut Anders Hatlen
> Assignee: Dag H. Wanvik
> Attachments: derby-4451.diff, derby-4451.stat, derby-4451b.diff,
> derby-4451b.stat
>
>
> I see this error when I specify the columns in a different order than in the
> table definition. It only fails if a multi-row table constructor is used.
> ij> create table t(a int, b generated always as (-a));
> 0 rows inserted/updated/deleted
> ij> insert into t(b,a) values (default,1);
> 1 row inserted/updated/deleted
> ij> insert into t(b,a) values (default,1), (default, 2);
> ERROR XJ001: Java exception: '1 >= 1:
> java.lang.ArrayIndexOutOfBoundsException'.
> And in a sane build:
> ij> insert into t(b,a) values (default,1),(default,2);
> ERROR XJ001: Java exception: 'ASSERT FAILED More columns in result column
> list than in base table: org.apache.derby.shared.common.sanity.AssertFailure'.
> This bug may be similar to DERBY-4448, but the stack trace is different, and
> DERBY-4448 does not raise an ASSERT FAILED in sane builds.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.