rzo1 opened a new pull request, #208:
URL: https://github.com/apache/openjpa/pull/208

   A JPQL `LIKE` whose pattern contains a backslash matched only on Derby: 
`TestEJBQLCondExpression.testLikeExpr` fails on H2, PostgreSQL, MySQL and 
MariaDB on master. Jakarta Persistence defines `ESCAPE` as optional and never 
makes backslash an escape by default, so the pattern should mean the same 
everywhere, and Derby is the database that happened to agree; the others apply 
their own default escape to a pattern the query never asked to be escaped.
   
   OpenJPA now states the absence of an escape character explicitly through the 
new `searchStringNoEscape` dictionary property, written after `ESCAPE` when the 
query supplied none. The default `` works on H2 and PostgreSQL; MySQL and 
MariaDB override it to `CHAR(0)`, because measurement showed MySQL honours 
`ESCAPE ` only in its default `sql_mode` while MariaDB (11.4 and 11.8) accepts 
the clause and silently keeps its backslash escape, and both servers reject it 
outright under `NO_BACKSLASH_ESCAPES` — whereas `CHAR(0)` gives exact no-escape 
semantics on both servers in both modes. The clause does not depend on the 
pattern value, so it is prepared-query-cache safe, and a query-supplied 
`ESCAPE` is untouched. Review also found that a query-supplied *empty* `ESCAPE 
` was passed through verbatim, which Derby rejects as "the escape string must 
be exactly one character"; that is now guarded and the in-memory path agrees.
   
   Verified per database on the final commit (JPQL package plus 
`TestQueryEscapeCharacters`, 202 tests): Derby, H2, MySQL 8.0 and MariaDB 11.8 
all clean; PostgreSQL 11 has one unrelated failure, 
`TestEJBQLFunction.testExtractHourFromLocalTime`, which also fails on master 
with the same container and drifts between runs. Both settings are documented 
in the reference guide and the behaviour change is release-noted.


-- 
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]

Reply via email to