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

Fragments.whereAndOpt in 1.0.0 RC3 and RC4 trouble #1909

Closed
DenisNovac opened this issue Aug 29, 2023 · 1 comment · Fixed by #1912
Closed

Fragments.whereAndOpt in 1.0.0 RC3 and RC4 trouble #1909

DenisNovac opened this issue Aug 29, 2023 · 1 comment · Fixed by #1912
Milestone

Comments

@DenisNovac
Copy link

I have following query:

    sql"""SELECT TOP($l) * FROM journal ${Fragments.whereAndOpt(
        userSql,
        fromSql,
        toSql
      )} ORDER BY ts $orderSql"""

In logger i see it constructs SQL SELECT TOP(?) * FROM journal WHERE ts >= ?AND ts <= ? ORDER BY ts ASC. There is no space before "AND" so i get error Must declare the scalar variable "@P1AND". Same query works fine in 1.0.0-RC2.

@jatcwang jatcwang modified the milestone: 1.0-RC5 Aug 29, 2023
@jatcwang
Copy link
Collaborator

Ah sorry that slipped through because we mostly assume the use of fr (which adds a space at the end of each fragment) https://tpolecat.github.io/doobie/docs/08-Fragments.html#whitespace-handling

But seems like sql interpolator is popular too (equivalent to fr0) so I think we should ensure it works for it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants