Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃巵 Use unique index for UPDATE and DELETE #1056

Open
BevanR opened this issue Mar 22, 2019 · 0 comments
Open

馃巵 Use unique index for UPDATE and DELETE #1056

BevanR opened this issue Mar 22, 2019 · 0 comments
Assignees
Labels
community/request Issues created by external users kind/new-feature This is a request for a completely new feature
Projects

Comments

@BevanR
Copy link

BevanR commented Mar 22, 2019

Feature request; Support UNIQUE INDEX columns in the WHERE clause for UPDATE and DELETE queries.

E.g. It would be nice if UPDATE mydata SET value = 'orange' WHERE id = ? worked in the following scenario;

cqlsh:tmp_unique_index> describe mydata

CREATE TABLE tmp_unique_index.mydata (
    org text,
    id uuid,
    value text,
    PRIMARY KEY (org, id)
) WITH CLUSTERING ORDER BY (id ASC)
    AND default_time_to_live = 0
    AND transactions = {'enabled': 'true'};
CREATE UNIQUE INDEX mydata_id_index ON tmp_unique_index.mydata (id) INCLUDE (org)
    WITH transactions = {'enabled': 'true'};

cqlsh:tmp_unique_index> select * from mydata;

 org  | id                                   | value
------+--------------------------------------+------------
 ogre | 2db15f5b-c8ab-4788-955e-14e32feaf218 |      apple
 ogre | 70b99c4e-1ab7-4d39-a1a6-027cd2225f14 | watermelon
 acme | 10602fdc-65fa-4bcb-b1bd-d5ad686cfca9 |      apple
 acme | 3398ef74-6014-4a3a-9bb4-0f3da54e3456 |     banana

(4 rows)
cqlsh:tmp_unique_index> UPDATE mydata SET value = 'orange' WHERE id = 70b99c4e-1ab7-4d39-a1a6-027cd2225f14;
SyntaxException: Query error: Invalid CQL Statement. Missing condition on key columns in WHERE clause
UPDATE mydata SET value = 'orange' WHERE id = 70b99c4e-1ab7-4d39-a1a6-027cd2225f14;
                                         ^^
 (error -12)
cqlsh:tmp_unique_index> UPDATE mydata SET value = 'orange' WHERE id = uuid();
SyntaxException: Query error: Invalid CQL Statement. Missing condition on key columns in WHERE clause
UPDATE mydata SET value = 'orange' WHERE id = uuid();
                                         ^^
 (error -12)

However what should happen in case of UPDATE mydata SET value = 'orange' WHERE id = uuid()?

@BevanR BevanR changed the title Use unique index for UPDATE and DELETE 馃巵 Use unique index for UPDATE and DELETE Mar 22, 2019
@rkarthik007 rkarthik007 added the kind/new-feature This is a request for a completely new feature label Mar 23, 2019
@rkarthik007 rkarthik007 added this to To Do in YCQL via automation Mar 23, 2019
@kmuthukk kmuthukk added the ycql label Mar 25, 2019
@rkarthik007 rkarthik007 removed the ycql label Jun 24, 2019
@yugabyte-ci yugabyte-ci added the community/request Issues created by external users label Jul 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community/request Issues created by external users kind/new-feature This is a request for a completely new feature
Projects
YCQL
  
To Do
Status: No status
Development

No branches or pull requests

5 participants