[ 
https://issues.apache.org/jira/browse/CASSANDRA-20632?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Jon Haddad updated CASSANDRA-20632:
-----------------------------------
    Description: 
It looks like we don't correctly parse table.field in UPDATE and DELETE of 
transactions.

https://the-asf.slack.com/archives/C0459N9R5C6/p1745537893201929

{noformat}
create KEYSPACE demo WITH replication = {'class': 'SimpleStrategy', 
'replication_factor': 1};
USE demo;


CREATE TABLE base (
name text primary key,
city text
) with transactional_mode = 'full';

CREATE TABLE mv (
city text,
name text,
primary key (city, name)
) with transactional_mode = 'full';


BEGIN TRANSACTION
INSERT INTO base (name, city) VALUES ('jon', 'los angeles');
INSERT INTO mv (city, name) VALUES ('los angeles', 'jon');
COMMIT TRANSACTION;

BEGIN TRANSACTION
    LET old = (SELECT city from base WHERE name = 'jon');
    select old.city;
    UPDATE base SET city = 'san diego' WHERE name = 'jon';
    DELETE FROM mv WHERE city = old.city AND name = 'jon';
    INSERT INTO mv (city, name) values ('san diego', 'jon');
COMMIT TRANSACTION;
{noformat}

Fails with:

{noformat}
SyntaxException: line 5:41 no viable alternative at input 'AND' (...FROM mv 
WHERE city = [old].city...)
{noformat}


  was:
It looks like we don't correctly parse table.field in UPDATE and DELETE of 
transactions.

https://the-asf.slack.com/archives/C0459N9R5C6/p1745537893201929

{noformat}
create KEYSPACE demo WITH replication = {'class': 'SimpleStrategy', 
'replication_factor': 1};
USE demo;


CREATE TABLE base (
name text primary key,
city text
) with transactional_mode = 'full';

CREATE TABLE mv (
city text,
name text,
primary key (city, name)
) with transactional_mode = 'full';


BEGIN TRANSACTION
INSERT INTO base (name, city) VALUES ('jon', 'los angeles');
INSERT INTO mv (city, name) VALUES ('los angeles', 'jon');
COMMIT TRANSACTION;

BEGIN TRANSACTION
    LET old = (SELECT city from base WHERE name = 'jon');
    select old.city;
    UPDATE base SET city = 'san diego' WHERE name = 'jon';
    DELETE FROM mv WHERE city = old.city AND name = 'jon';
    INSERT INTO mv WHERE city = 'san diego' AND name = 'jon';
COMMIT TRANSACTION;
{noformat}

Fails with:

{noformat}
SyntaxException: line 5:41 no viable alternative at input 'AND' (...FROM mv 
WHERE city = [old].city...)
{noformat}



> Parser failure when trying to update or delete a row in a transaction
> ---------------------------------------------------------------------
>
>                 Key: CASSANDRA-20632
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-20632
>             Project: Apache Cassandra
>          Issue Type: Bug
>            Reporter: Jon Haddad
>            Priority: Normal
>
> It looks like we don't correctly parse table.field in UPDATE and DELETE of 
> transactions.
> https://the-asf.slack.com/archives/C0459N9R5C6/p1745537893201929
> {noformat}
> create KEYSPACE demo WITH replication = {'class': 'SimpleStrategy', 
> 'replication_factor': 1};
> USE demo;
> CREATE TABLE base (
> name text primary key,
> city text
> ) with transactional_mode = 'full';
> CREATE TABLE mv (
> city text,
> name text,
> primary key (city, name)
> ) with transactional_mode = 'full';
> BEGIN TRANSACTION
> INSERT INTO base (name, city) VALUES ('jon', 'los angeles');
> INSERT INTO mv (city, name) VALUES ('los angeles', 'jon');
> COMMIT TRANSACTION;
> BEGIN TRANSACTION
>     LET old = (SELECT city from base WHERE name = 'jon');
>     select old.city;
>     UPDATE base SET city = 'san diego' WHERE name = 'jon';
>     DELETE FROM mv WHERE city = old.city AND name = 'jon';
>     INSERT INTO mv (city, name) values ('san diego', 'jon');
> COMMIT TRANSACTION;
> {noformat}
> Fails with:
> {noformat}
> SyntaxException: line 5:41 no viable alternative at input 'AND' (...FROM mv 
> WHERE city = [old].city...)
> {noformat}



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

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

Reply via email to