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

Tatsuo Ishii ishii at sraoss.co.jp
Mon Jul 20 20:12:31 JST 2020


> Sorry ,Forget to write the title
> 
> -----Original Message-----
> From: Hou, Zhijie
> Sent: Monday, July 20, 2020 4:03 PM
> To: pgpool-hackers at pgpool.net
> Subject: 
> 
> Hi pgpool hackers,
> 
> 1.when enabled memory query cache, if I call function like the following, the immutable function seems not to be recognized.
> 
> 	postgres=# select postgres.public.immutable_func();
> 
> 
> Currently in pgpool, The process of getting funcname is as follows:
> ----------------------------------------------------------------
> if (length == 1)	/* no schema qualification? */
> {
> 	fname = strVal(linitial(fcall->funcname));
> }
> else
> {
> 	fname = strVal(lsecond(fcall->funcname));	/* with schema
> 							 * qualification */
> }
> ----------------------------------------------------------------
> 
> If function call is in the form of "Catalogname.schemaname.funcname()",
> The function name is the third one in the list.
> 
> Since function name is always the last one in the list, I think we can use "llast(fcall->funcname)"
> to get the function name.
> What do you think?

Yes, you are right.

> 2.when investigating code, I found a TODO is related, and I tried to do it.
> 
> 	<<Allow to use schema qualifications in black_function_list and white_function_list>>
> 		Currently schema qualifications are silently ignored in these parameter.
> 
> See the attachment for the patch.

This patch itself looks correct. However I have a question.  Suppose
we have and f1() and public.f1() in the white list. If "SELECT f1()"
and "SELECT public.f1()" are sent from client, the result of "SELECT
f1()" and "SELECT public.f1()" are both (separately) cached. Am I
correct? Before we silently strip public.f1() to f1(), and "SELECT
public.f1()" will never be cached.

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