Unsuccessful attempt to query in a date range using cd (<@) #1860
-
Environment
Description of issueI am trying to replicate this query:
But I cannot get PostgREST to cast the operand, I've tried the following:
This is the response:
|
Beta Was this translation helpful? Give feedback.
Replies: 4 comments
-
Hey @maca,
Have you tried urlencoding the brackets? The request should be like: GET http://localhost:3000/songs?released=cd.%5B1994-02-01,2022-03-01%5D Also, what's the type of the |
Beta Was this translation helpful? Give feedback.
-
Thank you @steve-chavez :) The column is a
Is there any way to cast the operand I've tried url encoding but the result is the same:
|
Beta Was this translation helpful? Give feedback.
-
Ah, I see why the error now. It's not possible to cast a filter, but you can create a computed column and do the casting inside, as suggested here. Additionally, for this case I think you can just use the
|
Beta Was this translation helpful? Give feedback.
-
Thank for all! I had to adjust the range -- should be equivalent to the <@ operation -- then through the API Change lte. and gte. Example question database from asterisk - >> GET /astercdr?calldate=gte.2022-05-07&calldate=lte.2022-05-10&select=src,duration,calldate |
Beta Was this translation helpful? Give feedback.
Ah, I see why the error now. It's not possible to cast a filter, but you can create a computed column and do the casting inside, as suggested here.
Additionally, for this case I think you can just use the
lte
andgte
operators.