You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
devslash-paul
changed the title
Duplicate Key with AS alias to reference
Duplicate Key with AS alias to reference prior rows in the initial (in|up)sert statement
Jul 2, 2021
lukaseder
changed the title
Duplicate Key with AS alias to reference prior rows in the initial (in|up)sert statement
Add support for MySQL 8.0.19 INSERT .. VALUES .. AS .. ON DUPLICATE KEY UPDATE
Jul 2, 2021
Thanks a lot for your message and for pointing out the new feature and the deprecation of the old one. I've closed #11882 as "won't fix", then.
We currently don't support this syntax. You'll have to use an ExecuteListener to patch your generated SQL for now. From what I understand, you can always do that, irrespective of the presence of an ON DUPLICATE KEY UPDATE clause, so this seems to work:
createtablet (i int);
insert into t values (1) as new;
insert into t values (2),(3) as new;
I guess the syntax only works for INSERT .. VALUES, not for INSERT .. SELECT. It's not strictly needed in the latter case, as aliasing columns is possible with INSERT .. SELECT (though aliasing tables isn't)
👍 makes sense. For now the deprecation has been noted but there's no timeline on removal of VALUES. See you in 5 years when it turns out they do remove it 🚀
Your question:
Does Jooq currently have a way to support MySQL 8.0.19's
as
syntax for values, for duplicate key update.An example of valid SQL can be seen in this link
The prior way using
VALUES
as mentioned in #11882 | #2134 is deprecated in the latest MySQL release.Versions:
The text was updated successfully, but these errors were encountered: