rzo1 opened a new pull request, #242: URL: https://github.com/apache/openjpa/pull/242
https://issues.apache.org/jira/browse/OPENJPA-3036 MySQL rejects a bulk UPDATE or DELETE whose WHERE has a subquery reading the target table (error 1093), e.g. the TCK `Client.subquery` statement `UPDATE PRODUCT_TABLE t0 INNER JOIN PRODUCT_DETAILS t2 ... SET ... WHERE EXISTS (SELECT ... FROM PRODUCT_TABLE t1 ...)`. - New dictionary property `AllowsBulkTargetInSubselect` (default true, false on MySQL). - When it is false and the statement has subselects, the UPDATE/DELETE keeps its form and only the WHERE is rewritten to `t0.ID IN (SELECT * FROM (SELECT t0.ID FROM ... WHERE <original>) s)`, `(a, b) IN (...)` for composite keys. MySQL materializes the derived table first, so the subquery sees the state before the update. - Other databases generate the same SQL as before. MariaDB lifted the restriction in 10.3 and is unchanged. `TestBulkUpdateSubqueryOnTarget` (simple, secondary table, joined inheritance, composite key, parameters in SET and subquery). Fails with 1093 on MySQL 8.4 without the fix; passes on MySQL 8.4, MariaDB 11.8, Derby and H2. Full suite passes on Derby and H2. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
