pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
To: radist.nt@gmail.com
To: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #16467: XX000 fun
Date: Thu, 28 May 2020 14:37:19 +0900 (JST)
Message-ID: <20200528.143719.558400145265465616.horikyota.ntt@gmail.com> (raw)
In-Reply-To: <16467-12cd2b5cdb4f90c5@postgresql.org>
References: <16467-12cd2b5cdb4f90c5@postgresql.org>

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





view thread (2+ messages)

Message-ID: <20200528.143719.558400145265465616.horikyota.ntt@gmail.com>
Permalink:  ../20200528.143719.558400145265465616.horikyota.ntt@gmail.com/
Also on:    postgresql.org/message-id/20200528.143719.558400145265465616.horikyota.ntt@gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: horikyota.ntt@gmail.com, radist.nt@gmail.com
  Subject: Re: BUG #16467: XX000 fun
  In-Reply-To: <20200528.143719.558400145265465616.horikyota.ntt@gmail.com>
  References: <16467-12cd2b5cdb4f90c5@postgresql.org> <20200528.143719.558400145265465616.horikyota.ntt@gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox