Skip to content

mysql "upsert" with column aliases #259

@ortho

Description

@ortho

Is your feature request related to a problem? Please describe.

I wonder how to build query like this

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

Describe the solution you'd like
I'd like to have this ability because mysql deprecated SQL syntax like this

INSERT INTO t1 (a,b,c) VALUES (1,2,3),(4,5,6)
  ON DUPLICATE KEY UPDATE a = VALUES(a), b = VALUES(b), c=VALUES(c);

mysql manual says:

The use of VALUES() to refer to the new row and columns is deprecated beginning with MySQL 8.0.20, and is subject to removal in a future version of MySQL. Instead, use row and column aliases, as described in the next few paragraphs of this section.

Dialect

  • postgres
  • mysql
  • sqlite3

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions