Skip to content

Postgresql jsonb operator ?| erroneously detected as parameter bind marker #3907

@thomedw

Description

@thomedw

The following native query does not work in spring boot 3.4.3 and 3.5.0

select '["x", "c"]'::jsonb ?| array[:approvalStatus]::text[]

The following error is generated

Caused by: java.lang.IllegalArgumentException: Mixing of ? parameters and other forms like ?1 is not supported
	at org.springframework.data.jpa.repository.query.StringQuery$ParameterBindingParser.parseParameterBindingsOfQueryIntoBindingsAndReturnCleanedQuery(StringQuery.java:302)
	at org.springframework.data.jpa.repository.query.StringQuery.<init>(StringQuery.java:93)
	at org.springframework.data.jpa.repository.query.StringQuery.<init>(StringQuery.java:76)
	at org.springframework.data.jpa.repository.query.ExpressionBasedStringQuery.<init>(ExpressionBasedStringQuery.java:65)
	at org.springframework.data.jpa.repository.query.AbstractStringBasedJpaQuery.<init>(AbstractStringBasedJpaQuery.java:84)
	at org.springframework.data.jpa.repository.query.NativeJpaQuery.<init>(NativeJpaQuery.java:64)
	at org.springframework.data.jpa.repository.query.JpaQueryFactory.fromMethodWithQueryString(JpaQueryFactory.java:48)
	at org.springframework.data.jpa.repository.query.JpaQueryLookupStrategy$DeclaredQueryLookupStrategy.resolveQuery(JpaQueryLookupStrategy.java:174)

I have tried these escapes:

  1. \?|
  2. \\?|
  3. \\\?|
  4. \\\\?|
  5. ??|
  6. \?\?|
  7. \\?\\?|

Metadata

Metadata

Assignees

Labels

type: regressionA regression from a previous release

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions