Skip to content

Strange issue with RPC function returning the same result after calling it more than 5 times (instead of random entry) #1919

Answered by monacoremo
lukey78 asked this question in Q&A
Discussion options

You must be logged in to vote

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:

IMMUTABLE indicates that the function cannot modify the database and always returns the same result when given the same argument values

Try VOLATILE?

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by steve-chavez
Comment options

You must be logged in to vote
0 replies
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
Converted from issue

This discussion was converted from issue #1918 on August 18, 2021 12:13.