Doobie gave us nearly immediately:
[error] Cannot construct a parameter vector of the following type: [error] [error] Boolean(true) :: shapeless.HNil [error] [error] Because one or more types therein (disregarding HNil) does not have a Put [error] instance in scope. Try them one by one in the REPL or in your code: [error] [error] scala> Put[Foo] [error] [error] and find the one that has no instance, then construct one as needed. Refer to [error] Chapter 12 of the book of doobie for more information.Studying chapter 12 did not help. Here is the query that caused the issue:
sql"select one_col, two_col from TABLE where flag = ${true} "It turns out that Doobie (actually Shapeless) does not handle properly the inlined
true
literal.
What is needed is just to extract it to separate value:
val flag = true sql"select one_col, two_col from TABLE where flag = ${flag} "That resolves the problem. It would also work if we added type annotation:
sql"select one_col, two_col from TABLE where flag = ${true: Boolean} "It's up to you which way you prefer.