db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alex Daniels (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (DERBY-6777) MERGE INSERT on GENERATED key causes npe
Date Mon, 01 Dec 2014 09:47:12 GMT

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

Alex Daniels updated DERBY-6777:
--------------------------------
    Description: 
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}


  was:
To reproduce: merge 2 tables where the recipient has a generated pk and the source table has
at least 6 rows of data.  

Example:

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);




> 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