db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "mark boylan" <markboy...@hotmail.com>
Subject Derby fails inserting a join
Date Tue, 07 Mar 2006 20:18:16 GMT
Hi.

I've been having a problem inserting the result of a join into a table with 
a generated column. If I rephrase the join clause into a where clause, the 
problem goes away. And it only seems to happen if the target table has a 
generated column. Unfortunately, the join that I want to do in my 
application is pretty complex so I don't think I can rephrase it. But here's 
a very simplified example of what I'm talking about:

ij version 10.1
ij> connect 'jdbc:derby:test;create=true';
ij> create table source (
  source_id int not null primary key
);
0 rows inserted/updated/deleted
ij> insert into source values (0);
insert into source values (1);
insert into source values (2);
insert into source values (3);
insert into source values (4);
insert into source values (5);
insert into source values (6);
insert into source values (7);
insert into source values (8);
insert into source values (9);
1 row inserted/updated/deleted
ij> 1 row inserted/updated/deleted
ij> 1 row inserted/updated/deleted
ij> 1 row inserted/updated/deleted
ij> 1 row inserted/updated/deleted
ij> 1 row inserted/updated/deleted
ij> 1 row inserted/updated/deleted
ij> 1 row inserted/updated/deleted
ij> 1 row inserted/updated/deleted
ij> 1 row inserted/updated/deleted
ij> create table dest (
  dest_id int not null primary key
    generated always as identity,
  source_id_1 int not null,
  source_id_2 int not null
);
0 rows inserted/updated/deleted
ij> select s1.source_id, s2.source_id
from source as s1
join source as s2
on 1 = 1;
SOURCE_ID  |SOURCE_ID
-----------------------
0          |0
0          |1
0          |2
0          |3
0          |4
0          |5
0          |6
0          |7
0          |8
0          |9
1          |0
1          |1
1          |2
1          |3
1          |4
1          |5
1          |6
1          |7
1          |8
1          |9
2          |0
2          |1
2          |2
2          |3
2          |4
2          |5
2          |6
2          |7
2          |8
2          |9
3          |0
3          |1
3          |2
3          |3
3          |4
3          |5
3          |6
3          |7
3          |8
3          |9
4          |0
4          |1
4          |2
4          |3
4          |4
4          |5
4          |6
4          |7
4          |8
4          |9
5          |0
5          |1
5          |2
5          |3
5          |4
5          |5
5          |6
5          |7
5          |8
5          |9
6          |0
6          |1
6          |2
6          |3
6          |4
6          |5
6          |6
6          |7
6          |8
6          |9
7          |0
7          |1
7          |2
7          |3
7          |4
7          |5
7          |6
7          |7
7          |8
7          |9
8          |0
8          |1
8          |2
8          |3
8          |4
8          |5
8          |6
8          |7
8          |8
8          |9
9          |0
9          |1
9          |2
9          |3
9          |4
9          |5
9          |6
9          |7
9          |8
9          |9

100 rows selected
ij> insert into dest (source_id_1, source_id_2)
select s1.source_id, s2.source_id
from source as s1
join source as s2
on 1 = 1;

ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
ij>



Mime
View raw message