Skip to content

can i use DATE_PART() Function with postgrest? #3912

Discussion options

You must be logged in to vote

There is no way to pass the date_part function call via API.

Your options:

  • create computed fields for "month" and "day" (of the date of birth) and do the part for "now" on the client-side, then query something like dob_month=eq.2&dob_day=eq.14.
  • You should be able to put your query into a view as well.
  • Use an RPC.

I'm using an RPC function (which I’d like to avoid whenever possible)

What is bad about an RPC in this case?

For "on this day", you probably don't need any mutations like POST, PUT, PATCH or DELETE on the endpoint. So an RPC seems like a perfect fit to me.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@MohammedFaragallah
Comment options

Answer selected by MohammedFaragallah
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants