Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for ilike in postgresql #65

Closed
kunjee17 opened this issue Aug 24, 2022 · 17 comments
Closed

Support for ilike in postgresql #65

kunjee17 opened this issue Aug 24, 2022 · 17 comments

Comments

@kunjee17
Copy link

Just like like there is something called ilike which is cooperation but case insensitive. It would be great if you can support that as well along side like

if you are Ok. I can give merge request.

@Dzoukr
Copy link
Owner

Dzoukr commented Aug 24, 2022

Hi my friend! I am for any improvement, but just thinking about how it would work with existing code - ilike is unknown for other DBs, isn't it?

@kunjee17
Copy link
Author

@Dzoukr you might be right. It is supported by Postgresql and MSSQL but not by others. So, it is all up to you if you like to put it there or not. Else I ll just fall back to good old dapper.

@Dzoukr
Copy link
Owner

Dzoukr commented Aug 25, 2022

I am just thinking about how to do it. It's always tricky to put something "only-somewhere-supported" into generic library. 🤔

@kunjee17
Copy link
Author

@Dzoukr you can give a skip if you want. It's all good. I totally understand to keep things simple.

@kunjee17
Copy link
Author

@Dzoukr just let me know. It is just once case where client wants that ilike should be there for comparison. Basically comparison should be case insensitive. If it can't be added with non-generic fashion then I ll close the issue.

@JordanMarr
Copy link
Contributor

I think the way to do it would be to create Provider specific modules.
For ex, MSSQL.ilike and Postgres.ilike.
They could go next to the other filter functions:

let like<'P> (prop: 'P) (pattern: string) = true

That way they wouldn’t be accidentally used for a Provider that doesn’t support them. Also, each provider’s name could vary if necessary. (For example, ms sql doesn’t refer to it as ilike.)

@Dzoukr
Copy link
Owner

Dzoukr commented Aug 26, 2022

I think the way to do it would be to create Provider specific modules.

Hmmm... That seems to be the way. But we would have to add another case here anyway, wouldn't we?

@kunjee17
Copy link
Author

@Dzoukr yes we need to . That's why I told I can give quick PR. but as you said problem is. Postgresql and MSSQL are the only supporting that. So, how you bypass that here for eg. MySQL

| Like _ -> withField "LIKE"
.

We can surely ignore ilike for like if that is Ok. Then we can surely add iLike support.

@JordanMarr
Copy link
Contributor

ay. But we would have to add another case here anyway, wouldn't we?

Even easier would be to change it to this:

    | Like of caseInsensitive: bool * pattern: string

@JordanMarr
Copy link
Contributor

JordanMarr commented Aug 26, 2022

One thing that it is a little confusing to me:
I thought that SQL Server LIKE defaulted to be case insensitive, but apparently it is based on the column:
https://stackoverflow.com/questions/14962419/is-the-like-operator-case-sensitive-with-sql-server

So I guess in terms of defaults, it would actually be inaccurate to say that SQL Server defaults to one or the other since it's not really controlled at that level.

This makes me think that your original idea of creating a separate DU case might be the better approach:

    | Like of string
    | ILike of string
module PostgresqlExtensions
 let ilike<'P> (prop: 'P) (pattern: string) = true 

@Dzoukr
Copy link
Owner

Dzoukr commented Aug 26, 2022

I thought that SQL Server LIKE defaulted to be case insensitive, but apparently it is based on the column:

In such a case it's out of library control, so I wouldn't bother... 😄

@JordanMarr
Copy link
Contributor

JordanMarr commented Aug 26, 2022

Yeah, it's an edge case for sure. It makes me feel indifferent to adding it.
Maybe a manual query is the way in this case (pardon the pun).

@Dzoukr
Copy link
Owner

Dzoukr commented Aug 26, 2022

Maybe a manual query is the way in this case (pardon the pun).

Yeah, I have the same feeling right now. It would be the first provider-specific thing on syntax level and I still find it somehow "dirty" (cannot explain why, just gut feeling)...

@kunjee17
Copy link
Author

I guess I agree with gentlemen here. @Dzoukr please do honor to close this issue.

@Dzoukr
Copy link
Owner

Dzoukr commented Aug 26, 2022

🤣 Honor to close the issue... God I love this community 😄 ❤️

@Dzoukr
Copy link
Owner

Dzoukr commented Nov 4, 2022

Adding this for v4 now

Dzoukr added a commit that referenced this issue Nov 4, 2022
Dzoukr added a commit that referenced this issue Nov 7, 2022
* Restructuring solution for v4

* Restructure MySQL

* Fixing MSSQL + bump to .NET6

* MSSQL Select tests

* MSSQL delete tests

* MSSQL insert tests

* MSSQL Issues tests

* MSSQL update tests

* MSSQL Aggregates Tests

* MySQL tests

* Adding PostgreSQL tests

* Support for OPTION(RECOMPILE) #70

* Support for ilike in postgresql #65

* Releasing v4
@Dzoukr
Copy link
Owner

Dzoukr commented Nov 7, 2022

Now available in version 4

@Dzoukr Dzoukr closed this as completed Nov 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants