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

Don't allow changing the primary key from int to varint

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Urgent
    • Resolution: Duplicate
    • None
    • Legacy/Core
    • None
    • Critical

    Description

      Simply put :

      cqlsh> create table foo (id int primary key, value text);
      [some inserts]
      cqlsh> select * from foo where id in (1, 128, 256, 65535, 65536, 16777215, 16777216, 2147483647);
      
       id         | value
      ------------+-------
                1 |  test
              128 |  test
              256 |  test
            65535 |  test
            65536 |  test
         16777215 |  test
         16777216 |  test
       2147483647 |  test
      
      (8 rows)
      cqlsh> alter table foo alter id TYPE varint;
      cqlsh> select * from foo where id in (1, 128, 256, 65535, 65536, 16777215, 16777216, 2147483647);
      
       id         | value
      ------------+-------
         16777215 |  test
         16777216 |  test
       2147483647 |  test
      
      (3 rows)
      cqlsh> select * from foo;
      
       id         | value
      ------------+-------
              128 |  test
         16777216 |  test
                1 |  test
       2147483647 |  test
         16777215 |  test
              256 |  test
            65535 |  test
            65536 |  test
      

      This could really ruin someone's day...

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              tvdw Tom van der Woerdt
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: