I have a function that I think is defined as volatile
, but I now know I want it stable
.
How can I check the function volatility (volatile
, stable
, immutable
) of a certain function?
When a function is defined as volatile
, can I change the volatility to stable
by using a create or replace function
query? Or does the function needs to be dropped and created again but this time as stable
?
create or replace function my_function()
returns int as $$
select a
from my_table
order by 1
limit 1
$$ language sql stable;
I checked the documentation for this, but it doesn't mention changing volatility.