Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support references to UPDATE .. FROM tables from SET clause in dialects that don't support MERGE #16635

Open
11 tasks
lukaseder opened this issue May 3, 2024 · 0 comments

Comments

@lukaseder
Copy link
Member

lukaseder commented May 3, 2024

jOOQ 3.17 introduced emulation support for UPDATE .. FROM using MERGE:

jOOQ 3.20 added an additional type of emulation using the UPDATE .. ORDER BY .. LIMIT emulation, which is capable of emulating UPDATE .. FROM when no references to tables from the FROM clause are present in the SET clause:

This issue aims for adding emulation support also in the remaining cases for these dialects:

  • Access
  • ClickHouse
  • Firebird 2.5 (3.0 has MERGE)
  • MariaDB
  • MemSQL
  • MySQL
  • Redshift
  • SQL Data Warehouse
  • SQLite 3.30 and earlier (3.38 has UPDATE .. FROM)
  • Trino
  • YugabyteDB

The emulation might look something like this:

Original

UPDATE t
SET t.a = u.b
FROM u
WHERE t.i = u.i
AND t.j = 1

Emulation

UPDATE t
SET t.a = (SELECT u.b FROM u WHERE t.i = u.i)
AND t.j = 1

It's likely not a very trivial transformation.

@lukaseder lukaseder added this to the Version 3.20.0 milestone May 3, 2024
lukaseder added a commit that referenced this issue May 3, 2024
…g the same emulation as that for DML ORDER BY .. LIMIT

This includes:

- [#13412] Emulate UPDATE .. FROM with multiple tables or joins
- [#13425] Correctly emulate UPDATE .. FROM .. ORDER BY
- [#16631] Error when running DELETE .. USING .. LIMIT in MySQL
- [#16632] Wrong emulation of DELETE .. USING .. LIMIT where DELETE .. LIMIT is not natively supported
- [#16634] HANA UPDATE statement always repeats target table, even if unnecessary

This doesn't include:

- [#16635] Support references to UPDATE .. FROM tables from SET clause in dialects that don't support MERGE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant