go-mysql-server icon indicating copy to clipboard operation
go-mysql-server copied to clipboard

Support row and column aliases in INSERT ON DUPLICATE KEY UPDATE

Open Hydrocharged opened this issue 4 years ago • 0 comments

Given the following example queries:

INSERT INTO t1 (a,b,c) VALUES (1,2,3),(4,5,6) AS new ON DUPLICATE KEY UPDATE c = new.a+new.b;
INSERT INTO t1 (a,b,c) VALUES (1,2,3),(4,5,6) AS new(m,n,p) ON DUPLICATE KEY UPDATE c = m+n;
INSERT INTO t1 SET a=1,b=2,c=3 AS new ON DUPLICATE KEY UPDATE c = new.a+new.b;
INSERT INTO t1 SET a=1,b=2,c=3 AS new(m,n,p) ON DUPLICATE KEY UPDATE c = m+n;

We currently do not support the AS new portion, which are the aliases.

Reference: https://dev.mysql.com/doc/refman/8.0/en/insert-on-duplicate.html

Hydrocharged avatar Jan 25 '21 10:01 Hydrocharged