forked from sqldelight/sqldelight
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix 5330 add Postgresql ILIKE operator (sqldelight#5333)
* override binary_like_operator Add `ILIKE` to `binary_like_operator` Postgresql doesn't use `GLOB | REGEXP | MATCH` keywords It would require rewriting the mixin just to add `ILIKE` Add like and ilike patterns to regex_match_operator regex_match_operator is ordered by shortest matching characters first as the parser gets confused * Add tests fixture test integration tests
- Loading branch information
Showing
4 changed files
with
89 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
dialects/postgresql/src/testFixtures/resources/fixtures_postgresql/like-operators/Test.s
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
CREATE TABLE Test ( | ||
txt TEXT NOT NULL | ||
); | ||
|
||
SELECT * FROM Test WHERE txt LIKE 'testing%'; | ||
|
||
SELECT * FROM Test WHERE txt ILIKE 'test%'; | ||
|
||
SELECT * FROM Test WHERE txt ~~ 'testin%'; | ||
|
||
SELECT * FROM Test WHERE txt ~~* '%esting%'; | ||
|
||
SELECT txt !~~ 'testing%' FROM Test; | ||
|
||
SELECT txt !~~* 'testing%' FROM Test; | ||
|
||
SELECT txt ILIKE 'test%' FROM Test; |
24 changes: 24 additions & 0 deletions
24
...gration-postgresql/src/main/sqldelight/app/cash/sqldelight/postgresql/integration/Like.sq
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
CREATE TABLE Test_Like ( | ||
txt TEXT NOT NULL | ||
); | ||
|
||
insert: | ||
INSERT INTO Test_Like (txt) VALUES(?); | ||
|
||
selectWhereLike: | ||
SELECT * FROM Test_Like WHERE txt LIKE ?; | ||
|
||
selectWhereILike: | ||
SELECT * FROM Test_Like WHERE txt ILIKE ?; | ||
|
||
selectWhereLikeRegex: | ||
SELECT * FROM Test_Like WHERE txt ~~ 'testin%'; | ||
|
||
selectWhereILikeRegex: | ||
SELECT * FROM Test_Like WHERE txt ~~* '%esting%'; | ||
|
||
selectLikeRegex: | ||
SELECT txt ~~ 'testing%', txt !~~ 'testing%' FROM Test_Like; | ||
|
||
selectILikeRegex: | ||
SELECT txt ~~* 'testing%', txt !~~* 'testing%' FROM Test_Like; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters