-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Incorrect behavior of cs. @> in daterange #1563
Comments
Docs definitely need clarification. The Workaround: # in sql
select * from mytable WHERE validity @> '[2020-07-21,2020-07-21]';
# in postgrest
curl 'localhost:3000/mytable?validity=cs.\[2020-07-21,2020-07-21\]' Not ideal to duplicate the value, but it should work. |
Should we parse the Seems possible. If no It's kind of related to the proposal in #1569 (comment). We may have to think if we should offer these facilities for better UX. |
I confirm Steve's solution cs.[date,date] above works, is it planned to add the single date syntax of some kind |
Hm, I'm not sure about that. This seems to only work for a very special case - i.e. if your column in I recently had to do a lot of things around filtering for dates.. and no matter what, you'll need to invest a bit of time to understand it as an API user. I don't think we can make this easy magically. |
Environment
Description of issue
I have a daterange field (eg validity) and am trying to get if current_date is in the daterange.
As per postgrest documentation , we need to use: cs - contains e.g. ?tags=cs.{example, new}
Two issues are noticed:
(Steps to reproduce: Include a minimal SQL definition plus how you make the request to PostgREST and the response body)
In pg the following select works correctly:
select * from mytable WHERE validity @> '2020-07-21'::date;
or
select * from mytable WHERE validity @> current_date;
Whereas, with postgrest it works only on cs.[from_date, to_date].
The text was updated successfully, but these errors were encountered: