[pgpool-hackers: 3732] Re: problem when getting function name

Hou, Zhijie houzj.fnst at cn.fujitsu.com
Fri Jul 24 19:02:45 JST 2020


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.

Best regards,
houzj









-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0005-Update-006-test.sh.patch
Type: application/octet-stream
Size: 2140 bytes
Desc: 0005-Update-006-test.sh.patch
URL: <http://www.sraoss.jp/pipermail/pgpool-hackers/attachments/20200724/56945718/attachment-0008.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0006-Update-001-test.sh.patch
Type: application/octet-stream
Size: 2421 bytes
Desc: 0006-Update-001-test.sh.patch
URL: <http://www.sraoss.jp/pipermail/pgpool-hackers/attachments/20200724/56945718/attachment-0009.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0007-Update-en-loadbalance.sgml.patch
Type: application/octet-stream
Size: 2407 bytes
Desc: 0007-Update-en-loadbalance.sgml.patch
URL: <http://www.sraoss.jp/pipermail/pgpool-hackers/attachments/20200724/56945718/attachment-0010.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0008-Update-ja-loadbalance.sgml.patch
Type: application/octet-stream
Size: 2785 bytes
Desc: 0008-Update-ja-loadbalance.sgml.patch
URL: <http://www.sraoss.jp/pipermail/pgpool-hackers/attachments/20200724/56945718/attachment-0011.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Update-pool_relcache.c.patch
Type: application/octet-stream
Size: 5337 bytes
Desc: 0001-Update-pool_relcache.c.patch
URL: <http://www.sraoss.jp/pipermail/pgpool-hackers/attachments/20200724/56945718/attachment-0012.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-Update-pool_select_walker.c.patch
Type: application/octet-stream
Size: 6738 bytes
Desc: 0002-Update-pool_select_walker.c.patch
URL: <http://www.sraoss.jp/pipermail/pgpool-hackers/attachments/20200724/56945718/attachment-0013.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0003-Update-pool_select_walker.h.patch
Type: application/octet-stream
Size: 1050 bytes
Desc: 0003-Update-pool_select_walker.h.patch
URL: <http://www.sraoss.jp/pipermail/pgpool-hackers/attachments/20200724/56945718/attachment-0014.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0004-Update-pool_relcache.h.patch
Type: application/octet-stream
Size: 864 bytes
Desc: 0004-Update-pool_relcache.h.patch
URL: <http://www.sraoss.jp/pipermail/pgpool-hackers/attachments/20200724/56945718/attachment-0015.obj>


More information about the pgpool-hackers mailing list