[pgpool-hackers: 3734] Re: problem when getting function name
Tatsuo Ishii
ishii at sraoss.co.jp
Fri Jul 24 20:50:26 JST 2020
Hi Zhijie,
> Hi Ishii san,
>
>>> Personlly, I usually use the following sql to to determine whether a
>>> function appearing in a query is immutable
>>>
>>> " SELECT count(*) FROM pg_catalog.pg_proc AS p, pg_catalog.pg_namespace as n
>>> WHERE p.proname = '%s<function_name>'
>>> AND n.oid = p.pronamespace
>>> AND n.nspname = '%s<schema_name>'
>>> AND p.provolatile = 'i'"
>
>>Looks good. If we want to be more rigorous, we should consider the function args but in practice no one wants to mix immutable and non->immutable functions having different arguments (overloading). So I think this is enough.
>
> I tried to split "schema.funcname" and put them into sql here, but I found the function "remove_quotes_and_schema_from_relname(char *)" can not get correct functionname, when schemaname include dots (such as "schema.name").
>
> So I try to copy postgres's function 'SplitIdentifierString' which can split str correctly, and I let remove_quotes_and_schema_from_relname to call SplitIdentifierString inside it.
>
> Besides, I add some regression test in 006-memcache for function check, and made a patch.
Thanks. I will look into this.
Best regards,
--
Tatsuo Ishii
SRA OSS, Inc. Japan
English: http://www.sraoss.co.jp/index_en.php
Japanese:http://www.sraoss.co.jp
More information about the pgpool-hackers
mailing list