can i use DATE_PART() Function with postgrest? #3912
-
I'm trying to build an "On This Day/Week/Month" feature. After some research, I found DATE_PART, but I'm not sure if I can use it with PostgREST. Right now, I'm using an RPC function (which I’d like to avoid whenever possible) with a query similar to this: SELECT *
FROM employees
WHERE date_part('month', date_of_birth) = date_part('month', NOW())
AND date_part('day', date_of_birth) = date_part('day', NOW()); Any suggestions? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
There is no way to pass the Your options:
What is bad about an RPC in this case? For "on this day", you probably don't need any mutations like |
Beta Was this translation helpful? Give feedback.
There is no way to pass the
date_part
function call via API.Your options:
dob_month=eq.2&dob_day=eq.14
.What is bad about an RPC in this case?
For "on this day", you probably don't need any mutations like
POST
,PUT
,PATCH
orDELETE
on the endpoint. So an RPC seems like a perfect fit to me.