[pgpool-hackers: 3757] Re: Using volatile property instead of black_function_list
Tatsuo Ishii
ishii at sraoss.co.jp
Fri Jul 31 20:41:47 JST 2020
Hi Hou, Zhijie,
> However, I found a bug in my old patch which will affect your patch.
>
> Currently, the sql is formatted in function function_volatile_property
> and will be formatted in pool_search_relcache again.
>
> If arg3 or arg2 contains '%s'(such as : create or REPLACE function "%s"(integer)),
> the second format will break the sql.
True. But same thing can be said to all other callers of
pool_search_relcache. no?
> So I try to add a formatted flag in sql comment to avoid this.
> A little change in your patch.
Unfortunately this will not work. If you do not allow snprintf in
pool_search_relcache, it could use wrong SQL. For example we have
following query when we call pool_create_relcache:
/*FORMATTED*/SELECT count(*) FROM pg_catalog.pg_proc AS p, pg_catalog.pg_namespace
AS n WHERE p.proname = '%s' AND n.oid = p.pronamespace AND n.nspname
= 'public' AND p.provolatile = 'v"
Next pool_search_relcache() may be called with
public.f1. pool_search_relcache() will find a cache entry for
public.%s and returns the result for public.f1.
Also my patch was wrong. Suppose we have below at the when relcache is
first created:
SELECT count(*) FROM pg_catalog.pg_proc AS p, pg_catalog.pg_namespace
AS n WHERE p.proname = 'f1' AND n.oid = p.pronamespace AND n.nspname =
'public' AND p.provolatile = 'v"
Next pool_search_relcache() may be called with
public.f2. pool_search_relcache() will find a cache entry for
public.f1 and returns the result for public.f2.
Let me think how to solve these problems.
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