Re: BUG #16467: XX000 fun

From: Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>
To: radist(dot)nt(at)gmail(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #16467: XX000 fun
Date: 2020-05-28 05:37:19
Message-ID: 20200528.143719.558400145265465616.horikyota.ntt@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

At Wed, 27 May 2020 22:09:09 +0000, PG Bug reporting form <noreply(at)postgresql(dot)org> wrote in
> Steps to reproduce:
> 1. open two connections (#1 and #2)
> 2. in connection #1 run script 0
> 3. in connection #1 run script 1
> 4. in connection #2 start transaction and run query: select
> textXX000.testXX000(public.textXX000_internal('iteration #'), 1);
> 5. in connection #1 run script 1 again
> 6. in connection #2 start savepoint and run query: select
> textXX000.testXX000(public.textXX000_internal('iteration #'), 2);
> 7. in connection #2 rollback to savepoint and run query: select
> textXX000.testXX000(public.textXX000_internal('iteration #'), 3);

This boils down to the following.

S1. CREATE FUNCTION i() RETURNS int AS $$ SELECT count(*) FROM pg_class; $$ LANGUAGE SQL;
S1. CREATE FUNCTION o(int) RETURNS real AS $$ BEGIN RETURN $1::real; END; $$ LANGUAGE PLPGSQL;

S2. BEGIN;
S2. SELECT o(0);
S1. DROP FUNCTION o(int);
S1. CREATE FUNCTION o(int) ..;
S2. SELECT o(i());
ERROR: cache lookup failed for function <oid of previous o()>

This happens in preprocess_targetlist becase of a stale OID for o() in
FuncExpr.

While processing arguments in simplify_function under
preprocess_expression, cache invalidation happenes while planning i().
So the funcid of the processing FuncExpr gets stale. The stale procid
fires the error in preprocess_targetlist.

I'm not sure what to do for this, though..

regards.

--
Kyotaro Horiguchi
NTT Open Source Software Center

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message PG Bug reporting form 2020-05-28 06:39:34 BUG #16468: Doc: release note 13, missing GUC enable_groupingsets_hash_disk
Previous Message Tom Lane 2020-05-28 00:21:26 Re: Explicit deterministic COLLATE fails with pattern matching operations on column with non-deterministic collation