Discussion:
Postgres Syntax Support, Not Similar
Samir Faci
2018-09-25 18:58:56 UTC
Permalink
I have a use case where I need to use something along these lines.


lower(USERS.USER_NAME) NOT SIMILAR TO '%(pattern1|pattern2|pattern3)%'

the only way I have figured on how to do this right now is.


dsl.select(....).and("lower(UI.PRINCIPAL.USER_NAME) NOT SIMILAR TO
'%(pattern1|pattern2|pattern3)%'");


I was wondering if there was a native supported Jooq API I should be
invoking instead?
--
Thank you
Samir Faci
https://keybase.io/csgeek
--
You received this message because you are subscribed to the Google Groups "jOOQ User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jooq-user+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Lukas Eder
2018-09-26 07:49:00 UTC
Permalink
Hi Samir,

Thanks for your message. That feature request is on the roadmap:
https://github.com/jOOQ/jOOQ/issues/1725

The workaround is to use plain SQL as you did. Or you can use the almost
identical Field.likeRegex() (whose POSIX regex syntax is a bit different
from the "similar to" regex syntax):
https://www.jooq.org/javadoc/latest/org/jooq/Field.html#likeRegex-java.lang.String-

Thanks,
Lukas
Post by Samir Faci
I have a use case where I need to use something along these lines.
lower(USERS.USER_NAME) NOT SIMILAR TO '%(pattern1|pattern2|pattern3)%'
the only way I have figured on how to do this right now is.
dsl.select(....).and("lower(UI.PRINCIPAL.USER_NAME) NOT SIMILAR TO
'%(pattern1|pattern2|pattern3)%'");
I was wondering if there was a native supported Jooq API I should be
invoking instead?
--
Thank you
Samir Faci
https://keybase.io/csgeek
--
You received this message because you are subscribed to the Google Groups
"jOOQ User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "jOOQ User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jooq-user+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Samir Faci
2018-09-28 21:46:40 UTC
Permalink
Thanks Lukas,

I'll keep an eye out on that issue. Thank you for the alternative
suggestion as well.
Post by Lukas Eder
Hi Samir,
https://github.com/jOOQ/jOOQ/issues/1725
The workaround is to use plain SQL as you did. Or you can use the almost
identical Field.likeRegex() (whose POSIX regex syntax is a bit different
https://www.jooq.org/javadoc/latest/org/jooq/Field.html#likeRegex-java.lang.String-
Thanks,
Lukas
Post by Samir Faci
I have a use case where I need to use something along these lines.
lower(USERS.USER_NAME) NOT SIMILAR TO '%(pattern1|pattern2|pattern3)%'
the only way I have figured on how to do this right now is.
dsl.select(....).and("lower(UI.PRINCIPAL.USER_NAME) NOT SIMILAR TO
'%(pattern1|pattern2|pattern3)%'");
I was wondering if there was a native supported Jooq API I should be
invoking instead?
--
Thank you
Samir Faci
https://keybase.io/csgeek
--
You received this message because you are subscribed to the Google Groups
"jOOQ User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups
"jOOQ User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an
For more options, visit https://groups.google.com/d/optout.
--
Thank you
Samir Faci
https://keybase.io/csgeek
--
You received this message because you are subscribed to the Google Groups "jOOQ User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jooq-user+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...