Repository navigation
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adjusts RSQL predicate building so textual operators (LIKE/ILIKE/ICASE and negations) keep the raw RSQL argument as text and cast the expression side to String, fixing failures when applying textual operators to non-String fields (notably UUID) and ensuring PostgreSQL generates cast(column as varchar) like ?-style SQL.
Changes:
- Preserve raw (string) RSQL arguments for textual operators instead of converting them to the attribute Java type.
- Cast expressions to
Stringwhen buildingLIKE/ILIKE/ICASEpredicates (including JSON-path string comparisons). - Add test coverage for UUID
like/ilikebehavior (H2 + PostgreSQL) and for the operator-invariant.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| rsql-jpa/src/main/java/io/github/perplexhub/rsql/RSQLJPAPredicateConverter.java | Preserve textual arguments for textual operators; cast expressions to String for textual predicates. |
| rsql-jpa/src/test/java/io/github/perplexhub/rsql/RSQLJPASupportTest.java | Adds H2-backed tests for UUID fields with textual operators. |
| rsql-jpa/src/test/java/io/github/perplexhub/rsql/RSQLJPASupportPostgresJsonTest.java | Adds PostgreSQL regression test for UUID LIKE on UUID column; extends cleanup logic. |
| rsql-jpa/src/test/java/io/github/perplexhub/rsql/RSQLJPAPredicateConverterTest.java | Adds unit test for the textual-argument-preservation operator set. |
| rsql-common/src/test/resources/import_user.sql | Seeds external_id values needed for UUID textual-operator tests. |
| rsql-common/src/test/java/io/github/perplexhub/rsql/model/User.java | Adds externalId UUID field to the test User entity. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| private void clear() { | ||
| userRepository.deleteAll(); | ||
| userRepository.flush(); | ||
| repository.deleteAll(); | ||
| repository.flush(); | ||
| entityWithJsonbRepository.deleteAll(); | ||
| entityWithJsonbRepository.flush(); | ||
| } |
There was a problem hiding this comment.
Thanks, good catch. I updated the cleanup to clear JsonbEntity and AnotherJsonbEntity as well, deleting EntityWithJsonb first to respect the relation. RSQLJPASupportPostgresJsonTest passes locally: 242 tests, 0 failures.
fd98234 to
a405ec1
Compare
Hi @perplexhub, @nstdio,
While using the lib on UUID fields, we ran into an issue with
=ilike=on UUID attributes.There are actually two related failure modes:
externalId=ilike='AAAAAAAA'fails with aConversionException: Failed to convert ... to java.util.UUID type;LIKEdirectly to a UUID column, which raisesPSQLException: ERROR: operator does not exist: uuid ~~ text.This PR keeps the RSQL argument as text for textual operators, and casts the expression side to text when building
LIKE/ILIKE/ICASEpredicates. With Hibernate/PostgreSQL this now produces the expected SQL shape:I kept the patch narrow and added coverage for:
like,notlike,icase,ilike,inotlike;likecase.mvn clean verifyis green locally.Do you see any potential breaking change with this behavior, especially for existing non-String fields using textual operators?