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

upsert with adder support is not consistent with numbers and strings in LWT

    XMLWordPrintableJSON

Details

    Description

      In 4.1 UPDATE name = name + offset support got extended to numbers and strings (not just counters) but the behavior isn’t consistent

      Number: throws a error due to Int32Type.add(null, 42) failing
      String: returns the non-null updated values

      What Postgres does is keeps the value null

      postgres=# create table x (pk int PRIMARY KEY, a int, b text);
      CREATE TABLE
      postgres=# insert into x (pk, a, b) values(0, null, null);
      INSERT 0 1
      postgres=# UPDATE x SET a = a + 1 WHERE pk = 0;
      UPDATE 1
      postgres=# select * from x;
       pk | a | b
      ----+---+---
        0 |   |
      (1 row)
      postgres=# UPDATE x SET b = b + 'one' WHERE pk = 0;
      ERROR:  operator does not exist: text + unknown
      LINE 1: UPDATE x SET b = b + 'one' WHERE pk = 0;
                                 ^
      HINT:  No operator matches the given name and argument types. You might need to add explicit type casts.
      postgres=# UPDATE x SET b = b + CAST('one' as text) WHERE pk = 0;
      ERROR:  operator does not exist: text + text
      LINE 1: UPDATE x SET b = b + CAST('one' as text) WHERE pk = 0;
                                 ^
      HINT:  No operator matches the given name and argument types. You might need to add explicit type casts.
      

      Attachments

        Issue Links

          Activity

            People

              dcapwell David Capwell
              dcapwell David Capwell
              David Capwell
              Benedict Elliott Smith, Caleb Rackliffe
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 40m
                  40m