Re: BUG #16467: XX000 fun - Mailing list pgsql-bugs

From Kyotaro Horiguchi
Subject Re: BUG #16467: XX000 fun
Date
Msg-id 20200528.143719.558400145265465616.horikyota.ntt@gmail.com
Whole thread Raw
In response to BUG #16467: XX000 fun  (PG Bug reporting form <noreply@postgresql.org>)
List pgsql-bugs
At Wed, 27 May 2020 22:09:09 +0000, PG Bug reporting form <noreply@postgresql.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



pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: Explicit deterministic COLLATE fails with pattern matching operations on column with non-deterministic collation
Next
From: PG Bug reporting form
Date:
Subject: BUG #16468: Doc: release note 13, missing GUC enable_groupingsets_hash_disk