Alexander Belyak created IGNITE-16884:
-----------------------------------------

             Summary: Wrong complex key type cast
                 Key: IGNITE-16884
                 URL: https://issues.apache.org/jira/browse/IGNITE-16884
             Project: Ignite
          Issue Type: Bug
          Components: sql
    Affects Versions: 2.12
            Reporter: Alexander Belyak


Can't select row by complex key (bigint, bigint, bigint) if prepared statement 
parameters contains (int, int, int).

For example:

create table customer3(c_id bigint, c2_id bigint, c3_id bigint, name 
varchar(20), primary key(c_id, c2_id, c3_id));

insert into customer3(c_id, c2_id, c3_id, name) values(1001, 1002, 1003, 
'name');
insert into customer3(c_id, c2_id, c3_id, name) values(2001, 2002, 2003, 
'name');

and

{color:#000000}PreparedStatement 
ps{color}=conn.prepareStatement({color:#067d17}"select * from customer3 where 
c_id = ? "{color});
{color:#000000}ps{color}.setInt({color:#1750eb}1{color}, 
{color:#1750eb}2001{color});

works well, but both
{code:java}
PreparedStatement ps=conn.prepareStatement("select * from customer3 where c_id 
= ? and c2_id = ?");
ps.setInt(1, 2001);
ps.setInt(2, 2002);{code}
and
{code:java}
 
PreparedStatement ps=conn.prepareStatement("select * from customer3 where c_id 
= ? and c2_id = ? and c3_id = ?");
ps.setInt(1, 2001);
ps.setInt(2, 2002);
ps.setInt(3, 2003);
{code}
 

will select 0 rows.
{code:java}
PreparedStatement ps=conn.prepareStatement("select * from customer3 where c_id 
= ? and c2_id = ? and c3_id = ?");
ps.setLong(1, 2001);
ps.setLong(2, 2002);
ps.setLong(3, 2003);{code}
works out.



--
This message was sent by Atlassian Jira
(v8.20.7#820007)

Reply via email to