You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by "Knut Anders Hatlen (JIRA)" <ji...@apache.org> on 2009/11/18 22:48:39 UTC

[jira] Created: (DERBY-4449) ArrayIndexOutOfBoundsException when inserting DEFAULT into unspecified column

ArrayIndexOutOfBoundsException when inserting DEFAULT into unspecified column
-----------------------------------------------------------------------------

                 Key: DERBY-4449
                 URL: https://issues.apache.org/jira/browse/DERBY-4449
             Project: Derby
          Issue Type: Bug
          Components: SQL
    Affects Versions: 10.5.3.0, 10.6.0.0
            Reporter: Knut Anders Hatlen


When inserting rows into a table, with just a subset of the table's columns in the target column list, an ArrayIndexOutOfBoundsException is raised if the table constructor contains the same number of columns as the target table, and the extra columns are specified as DEFAULT:

ij> create table t (a int, b int);
0 rows inserted/updated/deleted
ij> insert into t(a) values (1,default);
ERROR XJ001: Java exception: '1 >= 1: java.lang.ArrayIndexOutOfBoundsException'.

The insert statement should have failed with this error:

ERROR 42802: The number of values assigned is not the same as the number of specified or implied columns.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (DERBY-4449) ArrayIndexOutOfBoundsException when inserting DEFAULT into unspecified column

Posted by "Knut Anders Hatlen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-4449?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Knut Anders Hatlen updated DERBY-4449:
--------------------------------------

    Attachment: derby-4449-1a.diff

The attached patch adds a check of the array index and skips the look-up in the array if the index is out of range, so that the null check right below is triggered instead and makes the statement fail gracefully. It also adds a regression test case in InsertTest.

I've started the full regression test suite.

> ArrayIndexOutOfBoundsException when inserting DEFAULT into unspecified column
> -----------------------------------------------------------------------------
>
>                 Key: DERBY-4449
>                 URL: https://issues.apache.org/jira/browse/DERBY-4449
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.5.3.0, 10.6.1.0
>            Reporter: Knut Anders Hatlen
>            Assignee: Knut Anders Hatlen
>         Attachments: derby-4449-1a.diff
>
>
> When inserting rows into a table, with just a subset of the table's columns in the target column list, an ArrayIndexOutOfBoundsException is raised if the table constructor contains the same number of columns as the target table, and the extra columns are specified as DEFAULT:
> ij> create table t (a int, b int);
> 0 rows inserted/updated/deleted
> ij> insert into t(a) values (1,default);
> ERROR XJ001: Java exception: '1 >= 1: java.lang.ArrayIndexOutOfBoundsException'.
> The insert statement should have failed with this error:
> ERROR 42802: The number of values assigned is not the same as the number of specified or implied columns.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DERBY-4449) ArrayIndexOutOfBoundsException when inserting DEFAULT into unspecified column

Posted by "Lily Wei (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-4449?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12887553#action_12887553 ] 

Lily Wei commented on DERBY-4449:
---------------------------------

Will back port to 10.6

> ArrayIndexOutOfBoundsException when inserting DEFAULT into unspecified column
> -----------------------------------------------------------------------------
>
>                 Key: DERBY-4449
>                 URL: https://issues.apache.org/jira/browse/DERBY-4449
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.5.3.0, 10.6.1.0
>            Reporter: Knut Anders Hatlen
>            Assignee: Knut Anders Hatlen
>             Fix For: 10.5.3.1, 10.7.0.0
>
>         Attachments: derby-4449-10.5.diff, derby-4449-1a.diff
>
>
> When inserting rows into a table, with just a subset of the table's columns in the target column list, an ArrayIndexOutOfBoundsException is raised if the table constructor contains the same number of columns as the target table, and the extra columns are specified as DEFAULT:
> ij> create table t (a int, b int);
> 0 rows inserted/updated/deleted
> ij> insert into t(a) values (1,default);
> ERROR XJ001: Java exception: '1 >= 1: java.lang.ArrayIndexOutOfBoundsException'.
> The insert statement should have failed with this error:
> ERROR 42802: The number of values assigned is not the same as the number of specified or implied columns.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Reopened: (DERBY-4449) ArrayIndexOutOfBoundsException when inserting DEFAULT into unspecified column

Posted by "Kathey Marsden (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-4449?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Kathey Marsden reopened DERBY-4449:
-----------------------------------


> ArrayIndexOutOfBoundsException when inserting DEFAULT into unspecified column
> -----------------------------------------------------------------------------
>
>                 Key: DERBY-4449
>                 URL: https://issues.apache.org/jira/browse/DERBY-4449
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.5.3.0, 10.6.1.0
>            Reporter: Knut Anders Hatlen
>            Assignee: Knut Anders Hatlen
>             Fix For: 10.7.0.0
>
>         Attachments: derby-4449-1a.diff
>
>
> When inserting rows into a table, with just a subset of the table's columns in the target column list, an ArrayIndexOutOfBoundsException is raised if the table constructor contains the same number of columns as the target table, and the extra columns are specified as DEFAULT:
> ij> create table t (a int, b int);
> 0 rows inserted/updated/deleted
> ij> insert into t(a) values (1,default);
> ERROR XJ001: Java exception: '1 >= 1: java.lang.ArrayIndexOutOfBoundsException'.
> The insert statement should have failed with this error:
> ERROR 42802: The number of values assigned is not the same as the number of specified or implied columns.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (DERBY-4449) ArrayIndexOutOfBoundsException when inserting DEFAULT into unspecified column

Posted by "Knut Anders Hatlen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-4449?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Knut Anders Hatlen updated DERBY-4449:
--------------------------------------

    Fix Version/s: 10.7.0.0

Restoring fix version 10.7.0.0.
(This bug is now in the somewhat unusual state of being fixed in 10.7 and 10.5, but not in 10.6.)

> ArrayIndexOutOfBoundsException when inserting DEFAULT into unspecified column
> -----------------------------------------------------------------------------
>
>                 Key: DERBY-4449
>                 URL: https://issues.apache.org/jira/browse/DERBY-4449
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.5.3.0, 10.6.1.0
>            Reporter: Knut Anders Hatlen
>            Assignee: Knut Anders Hatlen
>             Fix For: 10.5.3.1, 10.7.0.0
>
>         Attachments: derby-4449-10.5.diff, derby-4449-1a.diff
>
>
> When inserting rows into a table, with just a subset of the table's columns in the target column list, an ArrayIndexOutOfBoundsException is raised if the table constructor contains the same number of columns as the target table, and the extra columns are specified as DEFAULT:
> ij> create table t (a int, b int);
> 0 rows inserted/updated/deleted
> ij> insert into t(a) values (1,default);
> ERROR XJ001: Java exception: '1 >= 1: java.lang.ArrayIndexOutOfBoundsException'.
> The insert statement should have failed with this error:
> ERROR 42802: The number of values assigned is not the same as the number of specified or implied columns.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (DERBY-4449) ArrayIndexOutOfBoundsException when inserting DEFAULT into unspecified column

Posted by "Knut Anders Hatlen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-4449?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Knut Anders Hatlen updated DERBY-4449:
--------------------------------------

    Issue & fix info: [Patch Available]

Regression tests ran cleanly.

> ArrayIndexOutOfBoundsException when inserting DEFAULT into unspecified column
> -----------------------------------------------------------------------------
>
>                 Key: DERBY-4449
>                 URL: https://issues.apache.org/jira/browse/DERBY-4449
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.5.3.0, 10.6.1.0
>            Reporter: Knut Anders Hatlen
>            Assignee: Knut Anders Hatlen
>         Attachments: derby-4449-1a.diff
>
>
> When inserting rows into a table, with just a subset of the table's columns in the target column list, an ArrayIndexOutOfBoundsException is raised if the table constructor contains the same number of columns as the target table, and the extra columns are specified as DEFAULT:
> ij> create table t (a int, b int);
> 0 rows inserted/updated/deleted
> ij> insert into t(a) values (1,default);
> ERROR XJ001: Java exception: '1 >= 1: java.lang.ArrayIndexOutOfBoundsException'.
> The insert statement should have failed with this error:
> ERROR 42802: The number of values assigned is not the same as the number of specified or implied columns.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (DERBY-4449) ArrayIndexOutOfBoundsException when inserting DEFAULT into unspecified column

Posted by "Lily Wei (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-4449?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Lily Wei reassigned DERBY-4449:
-------------------------------

    Assignee: Lily Wei  (was: Knut Anders Hatlen)

> ArrayIndexOutOfBoundsException when inserting DEFAULT into unspecified column
> -----------------------------------------------------------------------------
>
>                 Key: DERBY-4449
>                 URL: https://issues.apache.org/jira/browse/DERBY-4449
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.5.3.0, 10.6.1.0
>            Reporter: Knut Anders Hatlen
>            Assignee: Lily Wei
>             Fix For: 10.7.0.0
>
>         Attachments: derby-4449-1a.diff
>
>
> When inserting rows into a table, with just a subset of the table's columns in the target column list, an ArrayIndexOutOfBoundsException is raised if the table constructor contains the same number of columns as the target table, and the extra columns are specified as DEFAULT:
> ij> create table t (a int, b int);
> 0 rows inserted/updated/deleted
> ij> insert into t(a) values (1,default);
> ERROR XJ001: Java exception: '1 >= 1: java.lang.ArrayIndexOutOfBoundsException'.
> The insert statement should have failed with this error:
> ERROR 42802: The number of values assigned is not the same as the number of specified or implied columns.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Closed: (DERBY-4449) ArrayIndexOutOfBoundsException when inserting DEFAULT into unspecified column

Posted by "Knut Anders Hatlen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-4449?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Knut Anders Hatlen closed DERBY-4449.
-------------------------------------

    Issue & fix info:   (was: [Patch Available])
       Fix Version/s: 10.7.0.0
          Resolution: Fixed

Thanks, Bryan!
Committed revision 951366.

> ArrayIndexOutOfBoundsException when inserting DEFAULT into unspecified column
> -----------------------------------------------------------------------------
>
>                 Key: DERBY-4449
>                 URL: https://issues.apache.org/jira/browse/DERBY-4449
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.5.3.0, 10.6.1.0
>            Reporter: Knut Anders Hatlen
>            Assignee: Knut Anders Hatlen
>             Fix For: 10.7.0.0
>
>         Attachments: derby-4449-1a.diff
>
>
> When inserting rows into a table, with just a subset of the table's columns in the target column list, an ArrayIndexOutOfBoundsException is raised if the table constructor contains the same number of columns as the target table, and the extra columns are specified as DEFAULT:
> ij> create table t (a int, b int);
> 0 rows inserted/updated/deleted
> ij> insert into t(a) values (1,default);
> ERROR XJ001: Java exception: '1 >= 1: java.lang.ArrayIndexOutOfBoundsException'.
> The insert statement should have failed with this error:
> ERROR 42802: The number of values assigned is not the same as the number of specified or implied columns.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (DERBY-4449) ArrayIndexOutOfBoundsException when inserting DEFAULT into unspecified column

Posted by "Lily Wei (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-4449?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Lily Wei reassigned DERBY-4449:
-------------------------------

    Assignee: Knut Anders Hatlen  (was: Lily Wei)

> ArrayIndexOutOfBoundsException when inserting DEFAULT into unspecified column
> -----------------------------------------------------------------------------
>
>                 Key: DERBY-4449
>                 URL: https://issues.apache.org/jira/browse/DERBY-4449
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.5.3.0, 10.6.1.0
>            Reporter: Knut Anders Hatlen
>            Assignee: Knut Anders Hatlen
>             Fix For: 10.5.3.1
>
>         Attachments: derby-4449-10.5.diff, derby-4449-1a.diff
>
>
> When inserting rows into a table, with just a subset of the table's columns in the target column list, an ArrayIndexOutOfBoundsException is raised if the table constructor contains the same number of columns as the target table, and the extra columns are specified as DEFAULT:
> ij> create table t (a int, b int);
> 0 rows inserted/updated/deleted
> ij> insert into t(a) values (1,default);
> ERROR XJ001: Java exception: '1 >= 1: java.lang.ArrayIndexOutOfBoundsException'.
> The insert statement should have failed with this error:
> ERROR 42802: The number of values assigned is not the same as the number of specified or implied columns.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DERBY-4449) ArrayIndexOutOfBoundsException when inserting DEFAULT into unspecified column

Posted by "Lily Wei (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-4449?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12886460#action_12886460 ] 

Lily Wei commented on DERBY-4449:
---------------------------------

Will back port to 10.5

> ArrayIndexOutOfBoundsException when inserting DEFAULT into unspecified column
> -----------------------------------------------------------------------------
>
>                 Key: DERBY-4449
>                 URL: https://issues.apache.org/jira/browse/DERBY-4449
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.5.3.0, 10.6.1.0
>            Reporter: Knut Anders Hatlen
>            Assignee: Lily Wei
>             Fix For: 10.7.0.0
>
>         Attachments: derby-4449-1a.diff
>
>
> When inserting rows into a table, with just a subset of the table's columns in the target column list, an ArrayIndexOutOfBoundsException is raised if the table constructor contains the same number of columns as the target table, and the extra columns are specified as DEFAULT:
> ij> create table t (a int, b int);
> 0 rows inserted/updated/deleted
> ij> insert into t(a) values (1,default);
> ERROR XJ001: Java exception: '1 >= 1: java.lang.ArrayIndexOutOfBoundsException'.
> The insert statement should have failed with this error:
> ERROR 42802: The number of values assigned is not the same as the number of specified or implied columns.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (DERBY-4449) ArrayIndexOutOfBoundsException when inserting DEFAULT into unspecified column

Posted by "Knut Anders Hatlen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-4449?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Knut Anders Hatlen reassigned DERBY-4449:
-----------------------------------------

    Assignee: Knut Anders Hatlen

> ArrayIndexOutOfBoundsException when inserting DEFAULT into unspecified column
> -----------------------------------------------------------------------------
>
>                 Key: DERBY-4449
>                 URL: https://issues.apache.org/jira/browse/DERBY-4449
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.5.3.0, 10.6.1.0
>            Reporter: Knut Anders Hatlen
>            Assignee: Knut Anders Hatlen
>
> When inserting rows into a table, with just a subset of the table's columns in the target column list, an ArrayIndexOutOfBoundsException is raised if the table constructor contains the same number of columns as the target table, and the extra columns are specified as DEFAULT:
> ij> create table t (a int, b int);
> 0 rows inserted/updated/deleted
> ij> insert into t(a) values (1,default);
> ERROR XJ001: Java exception: '1 >= 1: java.lang.ArrayIndexOutOfBoundsException'.
> The insert statement should have failed with this error:
> ERROR 42802: The number of values assigned is not the same as the number of specified or implied columns.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DERBY-4449) ArrayIndexOutOfBoundsException when inserting DEFAULT into unspecified column

Posted by "Lily Wei (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-4449?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12886773#action_12886773 ] 

Lily Wei commented on DERBY-4449:
---------------------------------

derby-4449-10.5.diff passed suites.all and derbyall. It is ready to submit.

> ArrayIndexOutOfBoundsException when inserting DEFAULT into unspecified column
> -----------------------------------------------------------------------------
>
>                 Key: DERBY-4449
>                 URL: https://issues.apache.org/jira/browse/DERBY-4449
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.5.3.0, 10.6.1.0
>            Reporter: Knut Anders Hatlen
>            Assignee: Lily Wei
>             Fix For: 10.7.0.0
>
>         Attachments: derby-4449-10.5.diff, derby-4449-1a.diff
>
>
> When inserting rows into a table, with just a subset of the table's columns in the target column list, an ArrayIndexOutOfBoundsException is raised if the table constructor contains the same number of columns as the target table, and the extra columns are specified as DEFAULT:
> ij> create table t (a int, b int);
> 0 rows inserted/updated/deleted
> ij> insert into t(a) values (1,default);
> ERROR XJ001: Java exception: '1 >= 1: java.lang.ArrayIndexOutOfBoundsException'.
> The insert statement should have failed with this error:
> ERROR 42802: The number of values assigned is not the same as the number of specified or implied columns.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (DERBY-4449) ArrayIndexOutOfBoundsException when inserting DEFAULT into unspecified column

Posted by "Lily Wei (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-4449?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Lily Wei updated DERBY-4449:
----------------------------

    Attachment: derby-4449-10.6.diff

Attach back port to 10.6 (derby-4449-10.6.diff) suites.All and derbyall test suites are all fine. It is ready to submit to 10.6 port.

> ArrayIndexOutOfBoundsException when inserting DEFAULT into unspecified column
> -----------------------------------------------------------------------------
>
>                 Key: DERBY-4449
>                 URL: https://issues.apache.org/jira/browse/DERBY-4449
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.5.3.0, 10.6.1.0
>            Reporter: Knut Anders Hatlen
>            Assignee: Knut Anders Hatlen
>             Fix For: 10.5.3.1, 10.7.0.0
>
>         Attachments: derby-4449-10.5.diff, derby-4449-10.6.diff, derby-4449-1a.diff
>
>
> When inserting rows into a table, with just a subset of the table's columns in the target column list, an ArrayIndexOutOfBoundsException is raised if the table constructor contains the same number of columns as the target table, and the extra columns are specified as DEFAULT:
> ij> create table t (a int, b int);
> 0 rows inserted/updated/deleted
> ij> insert into t(a) values (1,default);
> ERROR XJ001: Java exception: '1 >= 1: java.lang.ArrayIndexOutOfBoundsException'.
> The insert statement should have failed with this error:
> ERROR 42802: The number of values assigned is not the same as the number of specified or implied columns.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DERBY-4449) ArrayIndexOutOfBoundsException when inserting DEFAULT into unspecified column

Posted by "Bryan Pendleton (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-4449?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12875101#action_12875101 ] 

Bryan Pendleton commented on DERBY-4449:
----------------------------------------

+1 to your proposed fix.


> ArrayIndexOutOfBoundsException when inserting DEFAULT into unspecified column
> -----------------------------------------------------------------------------
>
>                 Key: DERBY-4449
>                 URL: https://issues.apache.org/jira/browse/DERBY-4449
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.5.3.0, 10.6.1.0
>            Reporter: Knut Anders Hatlen
>            Assignee: Knut Anders Hatlen
>         Attachments: derby-4449-1a.diff
>
>
> When inserting rows into a table, with just a subset of the table's columns in the target column list, an ArrayIndexOutOfBoundsException is raised if the table constructor contains the same number of columns as the target table, and the extra columns are specified as DEFAULT:
> ij> create table t (a int, b int);
> 0 rows inserted/updated/deleted
> ij> insert into t(a) values (1,default);
> ERROR XJ001: Java exception: '1 >= 1: java.lang.ArrayIndexOutOfBoundsException'.
> The insert statement should have failed with this error:
> ERROR 42802: The number of values assigned is not the same as the number of specified or implied columns.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DERBY-4449) ArrayIndexOutOfBoundsException when inserting DEFAULT into unspecified column

Posted by "Knut Anders Hatlen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-4449?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12887682#action_12887682 ] 

Knut Anders Hatlen commented on DERBY-4449:
-------------------------------------------

Thanks Lily. Committed revision 963617.

> ArrayIndexOutOfBoundsException when inserting DEFAULT into unspecified column
> -----------------------------------------------------------------------------
>
>                 Key: DERBY-4449
>                 URL: https://issues.apache.org/jira/browse/DERBY-4449
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.5.3.0, 10.6.1.0
>            Reporter: Knut Anders Hatlen
>            Assignee: Knut Anders Hatlen
>             Fix For: 10.5.3.1, 10.7.0.0
>
>         Attachments: derby-4449-10.5.diff, derby-4449-10.6.diff, derby-4449-1a.diff
>
>
> When inserting rows into a table, with just a subset of the table's columns in the target column list, an ArrayIndexOutOfBoundsException is raised if the table constructor contains the same number of columns as the target table, and the extra columns are specified as DEFAULT:
> ij> create table t (a int, b int);
> 0 rows inserted/updated/deleted
> ij> insert into t(a) values (1,default);
> ERROR XJ001: Java exception: '1 >= 1: java.lang.ArrayIndexOutOfBoundsException'.
> The insert statement should have failed with this error:
> ERROR 42802: The number of values assigned is not the same as the number of specified or implied columns.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Closed: (DERBY-4449) ArrayIndexOutOfBoundsException when inserting DEFAULT into unspecified column

Posted by "Lily Wei (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-4449?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Lily Wei closed DERBY-4449.
---------------------------

    Fix Version/s: 10.5.3.1
                       (was: 10.7.0.0)
       Resolution: Fixed

finish backport to 10.5

> ArrayIndexOutOfBoundsException when inserting DEFAULT into unspecified column
> -----------------------------------------------------------------------------
>
>                 Key: DERBY-4449
>                 URL: https://issues.apache.org/jira/browse/DERBY-4449
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.5.3.0, 10.6.1.0
>            Reporter: Knut Anders Hatlen
>            Assignee: Knut Anders Hatlen
>             Fix For: 10.5.3.1
>
>         Attachments: derby-4449-10.5.diff, derby-4449-1a.diff
>
>
> When inserting rows into a table, with just a subset of the table's columns in the target column list, an ArrayIndexOutOfBoundsException is raised if the table constructor contains the same number of columns as the target table, and the extra columns are specified as DEFAULT:
> ij> create table t (a int, b int);
> 0 rows inserted/updated/deleted
> ij> insert into t(a) values (1,default);
> ERROR XJ001: Java exception: '1 >= 1: java.lang.ArrayIndexOutOfBoundsException'.
> The insert statement should have failed with this error:
> ERROR 42802: The number of values assigned is not the same as the number of specified or implied columns.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DERBY-4449) ArrayIndexOutOfBoundsException when inserting DEFAULT into unspecified column

Posted by "Knut Anders Hatlen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-4449?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12875011#action_12875011 ] 

Knut Anders Hatlen commented on DERBY-4449:
-------------------------------------------

Here's the failing code:

				// Get ColumnDescriptor by name or by position?
				ColumnDescriptor cd;
				if (tcl == null)
				{
					cd = ttd.getColumnDescriptor(index + 1);
				}
				else
				{
					ResultColumn trc = (ResultColumn) tcl.elementAt(index);
					cd = ttd.getColumnDescriptor(trc.getName());
				}

				// Too many RCs if no ColumnDescriptor
				if (cd == null)
				{
					throw StandardException.newException(SQLState.LANG_TOO_MANY_RESULT_COLUMNS, 
									ttd.getQualifiedName());
				}

The call to tcl.elementAt(index) is the one that raises the AIOOBE. Note that the code expects that there may be too many columns, and then getColumnDescriptor() should return null. But in the case where we have a target column list, we fail before we get to the point where getColumnDescriptor() is called.

I think it would be sufficient to check that the index is within range before calling elementAt() and set cd to null if it's not.

> ArrayIndexOutOfBoundsException when inserting DEFAULT into unspecified column
> -----------------------------------------------------------------------------
>
>                 Key: DERBY-4449
>                 URL: https://issues.apache.org/jira/browse/DERBY-4449
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.5.3.0, 10.6.1.0
>            Reporter: Knut Anders Hatlen
>            Assignee: Knut Anders Hatlen
>
> When inserting rows into a table, with just a subset of the table's columns in the target column list, an ArrayIndexOutOfBoundsException is raised if the table constructor contains the same number of columns as the target table, and the extra columns are specified as DEFAULT:
> ij> create table t (a int, b int);
> 0 rows inserted/updated/deleted
> ij> insert into t(a) values (1,default);
> ERROR XJ001: Java exception: '1 >= 1: java.lang.ArrayIndexOutOfBoundsException'.
> The insert statement should have failed with this error:
> ERROR 42802: The number of values assigned is not the same as the number of specified or implied columns.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (DERBY-4449) ArrayIndexOutOfBoundsException when inserting DEFAULT into unspecified column

Posted by "Lily Wei (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-4449?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Lily Wei updated DERBY-4449:
----------------------------

    Attachment: derby-4449-10.5.diff

derby-4449-10.5.diff is the patch for back port to 10.5

> ArrayIndexOutOfBoundsException when inserting DEFAULT into unspecified column
> -----------------------------------------------------------------------------
>
>                 Key: DERBY-4449
>                 URL: https://issues.apache.org/jira/browse/DERBY-4449
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.5.3.0, 10.6.1.0
>            Reporter: Knut Anders Hatlen
>            Assignee: Lily Wei
>             Fix For: 10.7.0.0
>
>         Attachments: derby-4449-10.5.diff, derby-4449-1a.diff
>
>
> When inserting rows into a table, with just a subset of the table's columns in the target column list, an ArrayIndexOutOfBoundsException is raised if the table constructor contains the same number of columns as the target table, and the extra columns are specified as DEFAULT:
> ij> create table t (a int, b int);
> 0 rows inserted/updated/deleted
> ij> insert into t(a) values (1,default);
> ERROR XJ001: Java exception: '1 >= 1: java.lang.ArrayIndexOutOfBoundsException'.
> The insert statement should have failed with this error:
> ERROR 42802: The number of values assigned is not the same as the number of specified or implied columns.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DERBY-4449) ArrayIndexOutOfBoundsException when inserting DEFAULT into unspecified column

Posted by "Knut Anders Hatlen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-4449?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12875007#action_12875007 ] 

Knut Anders Hatlen commented on DERBY-4449:
-------------------------------------------

42X06 may be a better error than 42802, based on this script:

ij> create table t(x int);
0 rows inserted/updated/deleted
ij> insert into t values (default, default);
ERROR 42X06: Too many result columns specified for table '"APP"."T"'.
ij> insert into t(x) values (default, default);
ERROR XJ001: Java exception: '1 >= 1: java.lang.ArrayIndexOutOfBoundsException'.

> ArrayIndexOutOfBoundsException when inserting DEFAULT into unspecified column
> -----------------------------------------------------------------------------
>
>                 Key: DERBY-4449
>                 URL: https://issues.apache.org/jira/browse/DERBY-4449
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.5.3.0, 10.6.1.0
>            Reporter: Knut Anders Hatlen
>            Assignee: Knut Anders Hatlen
>
> When inserting rows into a table, with just a subset of the table's columns in the target column list, an ArrayIndexOutOfBoundsException is raised if the table constructor contains the same number of columns as the target table, and the extra columns are specified as DEFAULT:
> ij> create table t (a int, b int);
> 0 rows inserted/updated/deleted
> ij> insert into t(a) values (1,default);
> ERROR XJ001: Java exception: '1 >= 1: java.lang.ArrayIndexOutOfBoundsException'.
> The insert statement should have failed with this error:
> ERROR 42802: The number of values assigned is not the same as the number of specified or implied columns.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.