You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Sylvain Lebresne (JIRA)" <ji...@apache.org> on 2012/09/24 14:14:07 UTC

[jira] [Updated] (CASSANDRA-4709) (CQL3) Missing validation for IN queries on column not part of the PK

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

Sylvain Lebresne updated CASSANDRA-4709:
----------------------------------------

    Description: 
Copy-pasting from the original mail (http://mail-archives.apache.org/mod_mbox/cassandra-user/201209.mbox/%3C20120922185826.GO6205@pslp2%3E):
{noformat}
[cqlsh 2.2.0 | Cassandra 1.1.5 | CQL spec 3.0.0 | Thrift protocol 19.32.0]
Use HELP for help.
cqlsh> 
cqlsh> create keyspace xpl1 WITH strategy_class ='SimpleStrategy' and strategy_options:replication_factor=1;
cqlsh> use xpl1;
cqlsh:xpl1> create table t1 (pk varchar primary key, col1 varchar, col2 varchar);
cqlsh:xpl1> create index t1_c1 on t1(col1);
cqlsh:xpl1> create index t1_c2 on t1(col2);
cqlsh:xpl1> insert into t1  (pk, col1, col2) values ('pk1','foo1','bar1');
cqlsh:xpl1> insert into t1  (pk, col1, col2) values ('pk1a','foo1','bar1');
cqlsh:xpl1> insert into t1  (pk, col1, col2) values ('pk1b','foo1','bar1');
cqlsh:xpl1> insert into t1  (pk, col1, col2) values ('pk1c','foo1','bar1');
cqlsh:xpl1> insert into t1  (pk, col1, col2) values ('pk2','foo2','bar2');
cqlsh:xpl1> insert into t1  (pk, col1, col2) values ('pk3','foo3','bar3');
cqlsh:xpl1> select * from t1 where col2='bar1';
 pk   | col1 | col2
------+------+------
 pk1b | foo1 | bar1
  pk1 | foo1 | bar1
 pk1a | foo1 | bar1
 pk1c | foo1 | bar1

cqlsh:xpl1> select * from t1 where col2 in ('bar1', 'bar2') ;
cqlsh:xpl1> 
{noformat}

We should either make that last query work or refuse the query but returning nothing is wrong.

  was:
Copy-pasting from the original mail (http://mail-archives.apache.org/mod_mbox/cassandra-user/201209.mbox/%3C20120922185826.GO6205@pslp2%3E):
{noformat}
[cqlsh 2.2.0 | Cassandra 1.1.5 | CQL spec 3.0.0 | Thrift protocol 19.32.0]
Use HELP for help.
cqlsh> 
cqlsh> create keyspace xpl1 WITH strategy_class ='SimpleStrategy' and strategy_options:replication_factor=1;
cqlsh> use xpl1;
cqlsh:xpl1> create table t1 (pk varchar primary key, col1 varchar, col2 varchar);
cqlsh:xpl1> create index t1_c1 on t1(col1);
cqlsh:xpl1> create index t1_c2 on t1(col2);
cqlsh:xpl1> insert into t1  (pk, col1, col2) values ('pk1','foo1','bar1');
cqlsh:xpl1> insert into t1  (pk, col1, col2) values ('pk1a','foo1','bar1');
cqlsh:xpl1> insert into t1  (pk, col1, col2) values ('pk1b','foo1','bar1');
cqlsh:xpl1> insert into t1  (pk, col1, col2) values ('pk1c','foo1','bar1');
cqlsh:xpl1> insert into t1  (pk, col1, col2) values ('pk2','foo2','bar2');
cqlsh:xpl1> insert into t1  (pk, col1, col2) values ('pk3','foo3','bar3');
cqlsh:xpl1> select * from t1 where col2='bar1';
 pk   | col1 | col2
------+------+------
 pk1b | foo1 | bar1
  pk1 | foo1 | bar1
 pk1a | foo1 | bar1
 pk1c | foo1 | bar1

cqlsh:xpl1> select * from t1 where col2 in ('bar1', 'bar2') ;
cqlsh:xpl1> 
{noformat}

We should refuse the last query (first because col2 is not indexed, but even if it was, we should either make it work or refuse the query but returning nothing is wrong).

    
> (CQL3) Missing validation for IN queries on column not part of the PK
> ---------------------------------------------------------------------
>
>                 Key: CASSANDRA-4709
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-4709
>             Project: Cassandra
>          Issue Type: Bug
>    Affects Versions: 1.1.5
>            Reporter: Sylvain Lebresne
>            Assignee: Sylvain Lebresne
>            Priority: Minor
>
> Copy-pasting from the original mail (http://mail-archives.apache.org/mod_mbox/cassandra-user/201209.mbox/%3C20120922185826.GO6205@pslp2%3E):
> {noformat}
> [cqlsh 2.2.0 | Cassandra 1.1.5 | CQL spec 3.0.0 | Thrift protocol 19.32.0]
> Use HELP for help.
> cqlsh> 
> cqlsh> create keyspace xpl1 WITH strategy_class ='SimpleStrategy' and strategy_options:replication_factor=1;
> cqlsh> use xpl1;
> cqlsh:xpl1> create table t1 (pk varchar primary key, col1 varchar, col2 varchar);
> cqlsh:xpl1> create index t1_c1 on t1(col1);
> cqlsh:xpl1> create index t1_c2 on t1(col2);
> cqlsh:xpl1> insert into t1  (pk, col1, col2) values ('pk1','foo1','bar1');
> cqlsh:xpl1> insert into t1  (pk, col1, col2) values ('pk1a','foo1','bar1');
> cqlsh:xpl1> insert into t1  (pk, col1, col2) values ('pk1b','foo1','bar1');
> cqlsh:xpl1> insert into t1  (pk, col1, col2) values ('pk1c','foo1','bar1');
> cqlsh:xpl1> insert into t1  (pk, col1, col2) values ('pk2','foo2','bar2');
> cqlsh:xpl1> insert into t1  (pk, col1, col2) values ('pk3','foo3','bar3');
> cqlsh:xpl1> select * from t1 where col2='bar1';
>  pk   | col1 | col2
> ------+------+------
>  pk1b | foo1 | bar1
>   pk1 | foo1 | bar1
>  pk1a | foo1 | bar1
>  pk1c | foo1 | bar1
> cqlsh:xpl1> select * from t1 where col2 in ('bar1', 'bar2') ;
> cqlsh:xpl1> 
> {noformat}
> We should either make that last query work or refuse the query but returning nothing is wrong.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira