[pgpool-hackers: 3438] [Proposal] using volatility categories to determine whether a function is read only or not
ishii at sraoss.co.jp
Thu Sep 19 09:23:47 JST 2019
Currently we determine whether a function is read only or not by using
black_function_list/white_function_list. From the PostgreSQL manual
"37.7. Function Volatility Categories":
Any function with side-effects must be labeled VOLATILE, so
that calls to it cannot be optimized away. Even a function with
no side-effects needs to be labeled VOLATILE if its value can
change within a single query; some examples are random(),
So it seems just check the volatility property of a function is enough
to determine whether the function in question is a read only or not,
and thus we could eliminate the use of
black_function_list/white_function_list. As maintaining
black_function_list/white_function_list is a major headache for users,
I believe this change is good thing for them.
To implement this, we would invent new bool parameter something like
"auto_check_writing_function" and if it is true, check the volatility
property in the system catalog to determine whether a function is
going to write or not. If it's STABLE, or IMMUTABLE, we can assume the
function is read only.
If the parameter is off, we do the same thing as before: just
The reason why we want to give a choice to uses is, looking into the
system catalog gives overhead. Some users may dislike it.
Comments and suggestions are welcome.
SRA OSS, Inc. Japan
More information about the pgpool-hackers