Richard Zowalla created OPENJPA-3056:
----------------------------------------
Summary: Bulk DELETE with a subquery on the target table fails on
MariaDB before 11.1 (error 1093)
Key: OPENJPA-3056
URL: https://issues.apache.org/jira/browse/OPENJPA-3056
Project: OpenJPA
Issue Type: Bug
Reporter: Richard Zowalla
Assignee: Richard Zowalla
Fix For: 4.2.0
## Description
On MariaDB 10.11, a bulk delete whose WHERE clause has a subquery reading the
same table fails:
```
Table 't0' is specified twice, both as a target for 'DELETE' and as a separate
source for data [code=1093]
DELETE t0 FROM BSQ_ITEM t0 WHERE (t0.quantity < (SELECT MAX(t1.quantity) FROM
BSQ_ITEM t1))
```
MariaDB before 11.1 rejects this multi-table DELETE form. 11.1 and later accept
it. `MariaDBDictionary` never set `allowsBulkTargetInSubselect`, the switch
added in OPENJPA-3036, so the derived-table workaround is never used. As a
result, `TestBulkUpdateSubqueryOnTarget` fails in the Databases workflow on
MariaDB 10.11.
## Proposed fix
Set `allowsBulkTargetInSubselect = false` in
`MariaDBDictionary.connectedConfiguration` when the server version is below
11.1, so the keys are matched in a derived table as on MySQL.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)