You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Adam Holmberg (Jira)" <ji...@apache.org> on 2021/05/05 20:35:00 UTC
[jira] [Updated] (CASSANDRA-16643) ALTER TABLE: mixing counter and
non-counter columns in one table
[ https://issues.apache.org/jira/browse/CASSANDRA-16643?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Adam Holmberg updated CASSANDRA-16643:
--------------------------------------
Test and Documentation Plan: new unit test added
Status: Patch Available (was: In Progress)
I'm passing this along with python dtests blown up by something else. CI shows java unit and dtests in good shape.
> ALTER TABLE: mixing counter and non-counter columns in one table
> -----------------------------------------------------------------
>
> Key: CASSANDRA-16643
> URL: https://issues.apache.org/jira/browse/CASSANDRA-16643
> Project: Cassandra
> Issue Type: Bug
> Components: CQL/Semantics
> Reporter: Artem Chebotko
> Assignee: Adam Holmberg
> Priority: Normal
> Fix For: 4.0-rc2, 4.0
>
>
> {{CREATE TABLE}} does not allow mixing counter and non-counter columns in the same table. However, this can be done with {{ALTER TABLE}}:
> * {{ALTER TABLE}} can add non-counter columns to a table with counter columns;
> * {{ALTER TABLE}} can add counter columns to a table with non-counter columns.
> Tested in cassandra-4.0-rc1 (also in cassandra-4.0-beta2):
> {code:sql}
> CREATE TABLE test1 (
> id UUID,
> my_counter COUNTER,
> PRIMARY KEY ((id))
> );
> ALTER TABLE test1 ADD my_text TEXT;
> UPDATE test1
> SET my_counter = my_counter + 10,
> my_text = 'Test 1'
> WHERE id = 5069cc15-4300-4595-ae77-381c3af5dc5e;
> SELECT * FROM test1;
> id | my_counter | my_text
> --------------------------------------+------------+---------
> 5069cc15-4300-4595-ae77-381c3af5dc5e | 10 | Test 1
> {code}
>
> {code:sql}
> CREATE TABLE test2 (
> id UUID,
> my_text TEXT,
> PRIMARY KEY ((id))
> );
> ALTER TABLE test2 ADD my_counter COUNTER;
> UPDATE test2
> SET my_counter = my_counter + 20,
> my_text = 'Test 2'
> WHERE id = 5069cc15-4300-4595-ae77-381c3af5dc5e;
> SELECT * FROM test2;
> id | my_counter | my_text
> --------------------------------------+------------+---------
> 5069cc15-4300-4595-ae77-381c3af5dc5e | 20 | Test 2
> {code}
>
> {code:sql}
> CREATE TABLE test3 (
> id UUID,
> my_counter COUNTER,
> my_text TEXT,
> PRIMARY KEY ((id))
> );
> InvalidRequest: Error from server: code=2200 [Invalid query] message="Cannot mix counter and non counter columns in the same table"
> {code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org