Strange issue with RPC function returning the same result after calling it more than 5 times (instead of random entry) #1919
-
I have defined an RPC function in Postgres:
When I call this function inside psql, I can repeatedly call it without problems:
But when I call this function through Postgrest, it works 5 times in a row (getting a random entry), and then it always returns the SAME result:
Is there some mechanism in Postgrest where this could happen, e.g. a result cache or something? If I wait for one or two minutes, the random response works again. Thanks for a hint into the right direction. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
The
Try |
Beta Was this translation helpful? Give feedback.
-
THANK YOU for the quick response, very helpful. |
Beta Was this translation helpful? Give feedback.
The
IMMUTABLE
is probably the issue here, as it leads Postgres to make wrong optimizations. From https://www.postgresql.org/docs/13/sql-createfunction.html:Try
VOLATILE
?