Search code examples
postgrest

GET method erroneously working with volatile PostgREST RPC function?


According to the PostgREST v7.0.0 docs, the GET method should only work on RPC functions which are declared with STABLE or IMMUTABLE.

However I find that GETs to a function declared VOLATILE PARALLEL UNSAFE seems to work just fine.

Anyone know why?


Solution

  • This was corrected on the latest docs: https://postgrest.org/en/latest/api.html#immutable-and-stable-functions

    Basically, a VOLATILE function can be called with GET. However, it cannot modify the database because it will be executed on a read-only transaction(INSERT/UPDATE/DELETE will fail).