db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rick Hillegas (JIRA)" <j...@apache.org>
Subject [jira] Updated: (DERBY-4146) Cannot insert row when a generated column references an identity column
Date Tue, 07 Apr 2009 19:38:13 GMT

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

Rick Hillegas updated DERBY-4146:

    Attachment: derby-4146-01-aa-addColumnDescriptor.diff

Attaching derby-4146-01-aa-addColumnDescriptor.diff. This fixes the bug.

I compared the bound trees for the following queries. The first query failed and the second

   insert into t_4146 values ( default, default )
   insert into t_4146 (c1, c2) values ( default, default )

On the second query, the generated result column had more information, viz., it was bound
to a column descriptor. For the first query, the column descriptor was being bound for identity
columns (but not generated columns) in ResultColumnList.forbidOverrides(). The fix was to
bind a column descriptor there for generated columns as well.

So far no-one has offered a different interpretation of the SQL Standard. If the tests run
cleanly, I intend to commit this patch unless someone objects to my interpretation.

Touches the following files:

M      java/engine/org/apache/derby/impl/sql/compile/ResultColumnList.java

Fix as described above.

M      java/testing/org/apache/derbyTesting/functionTests/tests/lang/GeneratedColumnsTest.java

Added regression tests for this bug.

> Cannot insert row when a generated column references an identity column
> -----------------------------------------------------------------------
>                 Key: DERBY-4146
>                 URL: https://issues.apache.org/jira/browse/DERBY-4146
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions:
>            Reporter: Knut Anders Hatlen
>         Attachments: derby-4146-01-aa-addColumnDescriptor.diff
> ij> create table t (c1 int generated always as identity, c2 generated always as (c1));
> 0 rows inserted/updated/deleted
> ij> insert into t values (default, default);
> ERROR 23502: Column 'C2'  cannot accept a NULL value.
> Preferably, this should work. Alternatively, if it is not supposed to work, it should
fail when the table is created and the error message should state that a generated column
is not allowed to reference an identity column.

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

View raw message