eclipse-ee4j / eclipselink

Eclipselink project
https://eclipse.dev/eclipselink/
Other
199 stars 169 forks source link

No way to execute a query with literal question mark in it #836

Open jaroslawr opened 4 years ago

jaroslawr commented 4 years ago

? is intepreted by JPQL to bind parameters, but PostgreSQL has operators for JSONB that use a literal question mark (?, ?|, ?&) and there does not seem to be an obvious documented way to pass through a '?' so that EclipseLink does not try to interpret it and passes it through to the database, in particular with native queries and with the sql() function. Documentation in both cases does not mention any way of escaping the question mark to prevent it from being interpreted by eclipselink:

https://www.eclipse.org/eclipselink/documentation/2.4/concepts/queries005.htm https://www.eclipse.org/eclipselink/documentation/2.4/jpa/extensions/j_sql.htm

pvarga88 commented 1 year ago

I have also run into this. I have raised PR #1935 as a suggested fix to use ?? as an escape mechanism, similar to how two single quotes ('') are used to escape a single quote (')