typelevel / doobie

Functional JDBC layer for Scala.
MIT License
2.16k stars 355 forks source link

prepared statements with colon not working #1719

Open cfurst opened 2 years ago

cfurst commented 2 years ago

Hello, I'm basically trying to match parts of dates using text comparisons. Like so:

Select * from table where text(timestamptzfield) LIKE '%20:36%'

It works in PgAdmin, and the expected rows are returned. However when I try it with doobie using a fr clause like so:

fr"text(timestamptzfield) LIKE ${s"%$searchValue%"}"

where searchValue = "20:36", no rows are returned.

I've debugged as much as I could, and it looks like it's working, I see the right strings, but it's returning no values form the postgreSQL db.

This works without a colon so If I use, say, searchValue = 20 the proper rows are returned. Any help would be appreciated.

Thanks!

jatcwang commented 2 years ago

Hmm yeah that's weird. Don't think Doobie is involved here. Can you try using raw JDBC to reproduce this issue?

cfurst commented 2 years ago

Thanks for the quick reply.

Will try to reproduce. Thank you.