[ 
https://issues.apache.org/jira/browse/OPENJPA-3056?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18136664#comment-18136664
 ] 

ASF subversion and git services commented on OPENJPA-3056:
----------------------------------------------------------

Commit 184068f6a033fb65fe655e678d5fee03ee5cd635 in openjpa's branch 
refs/heads/OPENJPA-3056 from Richard Zowalla
[ https://gitbox.apache.org/repos/asf?p=openjpa.git;h=184068f6a ]

[OPENJPA-3056] Match bulk delete keys in a derived table on MariaDB before 11.1

MariaDB before 11.1 rejects a multi-table DELETE whose subquery reads the
target table (error 1093). Set AllowsBulkTargetInSubselect to false there,
so the keys are matched in a derived table as on MySQL (OPENJPA-3036).


> 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
>            Priority: Major
>             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)

Reply via email to