0

I create a table user(_key(user_id,type),user_id(int),type(string),name(string), and had row,(1,"2","Scott") , then I update the row values to (2,"2","admin").and then delete the row delete from user where user_id = 2 and type = "2",sql scripts executed successfully, but select * from user again, the row still there ,ignite version number 2.9.1.anybody has the issue.

  • 1
    Might want to paste your exact SQL statements so it's clear. Don't know how you changed the PK (user_id from 1 to 2). My 2.9.1 test: `> create table user (user_id int, type VARCHAR, name VARCHAR, PRIMARY key(user_id,type)); > INSERT INTO user (user_id, type, name) VALUES (1, '2', 'Scott'); > select * from user; | USER_ID | TYPE | NAME | | 1 | 2 | Scott | > update user set user_id=2, name='Admin' where user_id=1 and type='2';` **Error: SQL UPDATE can't modify key or its fields directly (state=42000,code=2003)** – Keith Gossage Apr 13 '22 at 04:16

1 Answers1

1

Ignite doesn't support a primary key modification. As result, you're not able to change the "user_id" value since it's a part of the PK. As a workaround, you can remove the existing row and insert a new one with the updated value.

Igor Belyakov
  • 788
  • 4
  • 9