You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "David Capwell (Jira)" <ji...@apache.org> on 2022/09/06 23:52:00 UTC

[jira] [Commented] (CASSANDRA-17857) upsert with adder support is not consistent with numbers and strings in LWT

    [ https://issues.apache.org/jira/browse/CASSANDRA-17857?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17601058#comment-17601058 ] 

David Capwell commented on CASSANDRA-17857:
-------------------------------------------

Starting commit

CI Results (pending):
||Branch||Source||Circle CI||Jenkins||
|cassandra-4.1|[branch|https://github.com/dcapwell/cassandra/tree/commit_remote_branch/CASSANDRA-17857-cassandra-4.1-775F48E8-A826-462C-85E2-BC3DC41DF7DF]|[build|https://app.circleci.com/pipelines/github/dcapwell/cassandra?branch=commit_remote_branch%2FCASSANDRA-17857-cassandra-4.1-775F48E8-A826-462C-85E2-BC3DC41DF7DF]|[build|https://ci-cassandra.apache.org/job/Cassandra-devbranch/1908/]|
|trunk|[branch|https://github.com/dcapwell/cassandra/tree/commit_remote_branch/CASSANDRA-17857-trunk-775F48E8-A826-462C-85E2-BC3DC41DF7DF]|[build|https://app.circleci.com/pipelines/github/dcapwell/cassandra?branch=commit_remote_branch%2FCASSANDRA-17857-trunk-775F48E8-A826-462C-85E2-BC3DC41DF7DF]|[build|https://ci-cassandra.apache.org/job/Cassandra-devbranch/1909/]|


> upsert with adder support is not consistent with numbers and strings in LWT
> ---------------------------------------------------------------------------
>
>                 Key: CASSANDRA-17857
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-17857
>             Project: Cassandra
>          Issue Type: Bug
>          Components: CQL/Semantics, Feature/Lightweight Transactions
>            Reporter: David Capwell
>            Assignee: David Capwell
>            Priority: Normal
>             Fix For: 4.1.x
>
>          Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> 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
> {code}
> 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.
> {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org