alex-tan / postgrest-client

Construct postgrest requests in Elm
MIT License
24 stars 3 forks source link

lt, lte, gt, and gte operators should not quote operand #4

Open maca opened 3 years ago

maca commented 3 years ago

Hi @alex-tan,

Thanks for the package :)

I am not able to generate valid queries with comparison operators when attempting to apply to double column, since they are quoted:

http://localhost:3000/songs?duration=lt.%2212.5%22 yields

{"hint":null,"details":null,"code":"22P02","message":"invalid input syntax for type double precision: \"\"12.5\"\""}

I believe that for comparison variants stringifyClause : Operator -> String should use stringifyUnquoted instead of stringifyQuoted

https://github.com/alex-tan/postgrest-client/blob/2.1.1/src/Postgrest/Internal/Params.elm#L268-L278

I can resort to using value function, but it's not ideal.

alex-tan commented 2 years ago

@maca can you provide the code you're using to construct that query? It looks like you might be using P.string. I'm noticing now that there's no option to create a Value from a float, since I didn't have the need for that before.