Evgeny Stanilovsky created IGNITE-16529:
-------------------------------------------

             Summary: Sql. Merge command failed when trying to update PK column.
                 Key: IGNITE-16529
                 URL: https://issues.apache.org/jira/browse/IGNITE-16529
             Project: Ignite
          Issue Type: Improvement
          Components: sql
    Affects Versions: 3.0.0-alpha4
            Reporter: Evgeny Stanilovsky


If MATCHED section contains columns form PK or PK at all this command will fail 
on validation. We need to support this functionality or document it correctly 
if there is no plans for supporting it.

{noformat}
CREATE TABLE test1 (k1 int, k2 int, a int, b int, c varchar, CONSTRAINT PK 
PRIMARY KEY (k1, k2));
INSERT INTO test1 VALUES (111, 111, 0, 100, '0');
INSERT INTO test1 VALUES (222, 222, 1, 300, '1');

CREATE TABLE test2 (k1 int, k2 int, a int, b int, c varchar, CONSTRAINT PK 
PRIMARY KEY (k1, k2));
INSERT INTO test2 VALUES (333, 333, 0, 100, '');
INSERT INTO test2 VALUES (444, 444, 2, 200, null);

MERGE INTO test2 dst USING test1 src ON dst.a = src.a 
WHEN MATCHED THEN UPDATE SET b = src.b, k1 = src.k1 
WHEN NOT MATCHED THEN INSERT (k1, k2, a, b) VALUES (src.k1, src.k2, src.a, 
src.b)
{noformat}




--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to