db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Christian K. (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (DERBY-6777) MERGE INSERT on GENERATED key causes npe
Date Mon, 08 Dec 2014 15:48:13 GMT

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

Christian K. commented on DERBY-6777:
-------------------------------------

The documentation [1] states that "No list of inserted columns may mention identity columns"
but leaving out the identify column (which in my case is also generated) yields the same error.

In any case I would expect a meaningful error message instead of an internal error (NullPointerException),
as it is the case for "regular" SQL syntax errors.

[1] http://db.apache.org/derby/docs/10.11/ref/rrefsqljmerge.html

> MERGE INSERT on GENERATED key causes npe
> ----------------------------------------
>
>                 Key: DERBY-6777
>                 URL: https://issues.apache.org/jira/browse/DERBY-6777
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.11.1.1
>            Reporter: Alex Daniels
>
> To reproduce: merge 2 tables where the recipient has a generated pk and the source table
has at least 6 rows of data.  
> Example:
> {code:sql}
> CREATE TABLE COLTEST.TEMPDATA1 (id BIGINT not null primary key GENERATED BY DEFAULT AS
IDENTITY (START WITH 1, INCREMENT BY 1), DATA1 VARCHAR(1024) not null, DATA2 VARCHAR(50));
> CREATE TABLE COLTEST.TEMPDATA2 (DATA1 VARCHAR(50) not null, DATA2 VARCHAR(50));
> INSERT INTO COLTEST.TEMPDATA2 (DATA1, DATA2) VALUES ('rowA', 'Ad2'),('rowB', 'Bd2'),('rowC',
'Cd2'),('rowD', 'Dd2'),('rowE', 'Ed2'),('rowF', 'Fd2');
> MERGE INTO COLTEST.TEMPDATA1 M USING COLTEST.TEMPDATA2 AS U ON M.DATA1 = U.DATA1 
> WHEN NOT MATCHED THEN INSERT (DATA1, DATA2) VALUES (U.DATA1, U.DATA2);
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message