Uploaded image for project: 'Cassandra'
  1. Cassandra
  2. CASSANDRA-6075

The token function should allow column identifiers in the correct order only

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Low
    • Resolution: Fixed
    • 2.0.11, 2.1.1
    • Legacy/CQL
    • Cassandra 1.2.9

    • Low

    Description

      Given the following table:

      CREATE TABLE t1 (a int, b text, PRIMARY KEY ((a, b)));
      

      The following request returns an error in cqlsh as literal arguments order is incorrect:

      SELECT * FROM t1 WHERE token(a, b) > token('s', 1);
      Bad Request: Type error: 's' cannot be passed as argument 0 of function token of type int
      

      But surprisingly if we provide the column identifier arguments in the wrong order no error is returned:

      SELECT * FROM t1 WHERE token(a, b) > token(1, 'a'); // correct order is valid
      SELECT * FROM t1 WHERE token(b, a) > token(1, 'a'); // incorrect order is valid as well
      

      Attachments

        1. 6075-fix-v2.txt
          4 kB
          Aleksey Yeschenko
        2. CASSANDRA-2.1-6075-PART2.txt
          4 kB
          Benjamin Lerer
        3. CASSANDRA-2.0-6075-PART2.txt
          5 kB
          Benjamin Lerer
        4. CASSANDRA-2.1-6075.txt
          5 kB
          Benjamin Lerer
        5. CASSANDRA-6075.txt
          8 kB
          Benjamin Lerer

        Activity

          People

            blerer Benjamin Lerer
            mfiguiere Michaël Figuière
            Benjamin Lerer
            Tom Hobbs
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: