db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dag H. Wanvik (JIRA)" <j...@apache.org>
Subject [jira] Commented: (DERBY-4419) NullPointerException with INSERT INTO ... from UNION and generated columns
Date Tue, 27 Oct 2009 03:00:59 GMT

    [ https://issues.apache.org/jira/browse/DERBY-4419?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12770364#action_12770364
] 

Dag H. Wanvik commented on DERBY-4419:
--------------------------------------

This one threw me off at first:

/* Skip over generated columns */
- if (resultColumn.isGenerated())
+ if (resultColumn.isGenerated() || resultColumn.isAutoincrementGenerated()) 

In view of Knut's find, DERBY-4425, it seems that "generated column" in the code quoted means
something else. Perhaps the term is overloaded in the code, which is unfortunate, and may
lead to other issues later.
Cf this code fragment later in the same class:

    defaultInfo.isGeneratedColumn()

which is the test for *real* "generated column" in the SQL sense. From 4.14.8:

"A generated column is one whose values are determined by evaluation of a generation
expression.."

So, the ResultColumn method "isGenerated" means something else, i.e. column synthesized by
Derby for various purposes (cf calls to markGenerated in UpdateNode/DeleteNode vs. GroupByNode/WindowResultSetNode).

> NullPointerException with INSERT INTO ... from UNION and generated columns
> --------------------------------------------------------------------------
>
>                 Key: DERBY-4419
>                 URL: https://issues.apache.org/jira/browse/DERBY-4419
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.3.1.4, 10.4.1.3, 10.5.1.1, 10.5.3.0, 10.6.0.0
>            Reporter: Knut Anders Hatlen
>            Assignee: Bryan Pendleton
>         Attachments: addASimpleTest.diff, npe.sql
>
>
> The following sequence of statements works on 10.2.2.0 and earlier, and raises a NullPointerException
with 10.3.1.4 and later:
> ij> create table t1(x int);
> 0 rows inserted/updated/deleted
> ij> insert into t1 values 1,2;
> 2 rows inserted/updated/deleted
> ij> create table t2(x int);
> 0 rows inserted/updated/deleted
> ij> insert into t2 values 2,3;
> 2 rows inserted/updated/deleted
> ij> create table t3(x int, y int generated always as identity);
> 0 rows inserted/updated/deleted
> ij> insert into t3(x) select * from t1 union select * from t2;
> ERROR XJ001: Java exception: ': java.lang.NullPointerException'.

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


Mime
View raw message