Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jeBEV-0004Oq-0Q for pgsql-bugs@arkaria.postgresql.org; Thu, 28 May 2020 05:37:35 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jeBES-0005Ih-S5 for pgsql-bugs@arkaria.postgresql.org; Thu, 28 May 2020 05:37:32 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jeBES-0005FA-J8 for pgsql-bugs@lists.postgresql.org; Thu, 28 May 2020 05:37:32 +0000 Received: from mail-pf1-x442.google.com ([2607:f8b0:4864:20::442]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jeBEL-0004jb-6p for pgsql-bugs@lists.postgresql.org; Thu, 28 May 2020 05:37:31 +0000 Received: by mail-pf1-x442.google.com with SMTP id n18so12931347pfa.2 for ; Wed, 27 May 2020 22:37:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:message-id:to:subject:from:in-reply-to:references:user-agent :mime-version:content-transfer-encoding; bh=W/GzIlEsyiwiOLzT79FrTWOZIAWdJBdYafklRBwE+fg=; b=Jqu/JYCaO6uENOWTVRvWEuM0EQU9pWja9XjZ5Vu9zzE6ppXd+xeAy5foTu4WSBBIBW C3IgwwxCjX+NXwHz7BZJrFXthl5wZ8XxzEYCXq96VbraG3UfQRAU1uySR+P3G9mU/+HI qYMUyiArX/u5xtkTUx3dAbUtLGdzFbziyK6TimTSnCyZb81bC0beiKTfc6EgHfub7J7t qN7nHHvb4xvQlADMzZ9xmK5BreyUCEDhb0wKW6MqIrIdoo3sUQXh/35yRFyZzcb2S95e meg5PRff85HLay8NAAvT0SdreBBPyhYCVbBo1LrTBEpaj0Z8LWSGQTE7LxvWDUwkot5P 8Oqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:message-id:to:subject:from:in-reply-to :references:user-agent:mime-version:content-transfer-encoding; bh=W/GzIlEsyiwiOLzT79FrTWOZIAWdJBdYafklRBwE+fg=; b=V70r7cvVH6LKUfbcLVXhAgVyE+tKtg8zXsQUohRuI1xH0jNrI3wAo9/uHaK3lSm/mP KZMdgXGC1LNIb70brHvioS1kGDtjatoT9IQstQcGsZUeX8vTpssac47RzfGe+meUZTMg 31W1RtG/fG8CXKenMz2+NHrrcOiFqHo8glid7FGW5xu/FEqMrYzhidkKzAmqNkrl2B8m K1HZkBG5vv9gh1Qg1mBnXAVmzQeH7SXboM+A189MvFhRAJYez3iRn8kzhbZpi+ncZ+1s nVR3WcWxqc2a9dzCY10YaEPKpG6Elu2ybXKglyLqMQWY85qkAkSkVA5TDI9FP19zL0GY M+ig== X-Gm-Message-State: AOAM530fFwJi/3AuoGFQq8ubJAE5aMzzdqpdhNA8v1eCR55tXHK6v0vK f1VUhzJVA6TNWbW/a2Molbs= X-Google-Smtp-Source: ABdhPJzuZITaPlqLOYoLnN3Aa426+mnToTRNa6uYRKsaelnu4jVFFOLlpuR4Twg+RUf1NFySrYY9nw== X-Received: by 2002:aa7:8d8a:: with SMTP id i10mr1348714pfr.193.1590644242792; Wed, 27 May 2020 22:37:22 -0700 (PDT) Received: from localhost (ag027197.dynamic.ppp.asahi-net.or.jp. [157.107.27.197]) by smtp.gmail.com with ESMTPSA id b23sm3364406pgs.33.2020.05.27.22.37.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 May 2020 22:37:22 -0700 (PDT) Date: Thu, 28 May 2020 14:37:19 +0900 (JST) Message-Id: <20200528.143719.558400145265465616.horikyota.ntt@gmail.com> To: radist.nt@gmail.com, pgsql-bugs@lists.postgresql.org Subject: Re: BUG #16467: XX000 fun From: Kyotaro Horiguchi In-Reply-To: <16467-12cd2b5cdb4f90c5@postgresql.org> References: <16467-12cd2b5cdb4f90c5@postgresql.org> User-Agent: Mew version 6.8 on Emacs 26.1 Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk At Wed, 27 May 2020 22:09:09 +0000, PG Bug reporting form 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 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