Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tsycE-007KDh-Mm for pgsql-hackers@arkaria.postgresql.org; Fri, 14 Mar 2025 06:33:55 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1tsycD-00GyXr-9D for pgsql-hackers@arkaria.postgresql.org; Fri, 14 Mar 2025 06:33:53 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tsycC-00GyT6-Oq for pgsql-hackers@lists.postgresql.org; Fri, 14 Mar 2025 06:33:52 +0000 Received: from mail.postgrespro.ru ([93.174.132.70]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1tsyc9-002mza-0v for pgsql-hackers@lists.postgresql.org; Fri, 14 Mar 2025 06:33:52 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mx2023; t=1741934028; bh=YJCZa41aowPNvQJD+wFOyv/LBWcHm3yjgBGZs0OyIgs=; h=Date:From:To:Cc:Subject:In-Reply-To:References:Message-ID:From; b=BHJDYAi9q5CcF+sd5NC9AcVWTrBl8f5ofrannyzPg+MwaqLAlbTa0uZMu7yfx6t1D cd+NIn0Afcw0RviFpCkRIPrJIERtr5XcLvMtfavX10d8kYu5mCnpH4K0/SA7VRhNe3 DbnR6xXXq05+nJJX4sJi58to+bRg/W8WP8uWpktDc1lIV9XyZuWFs5rhaZisGQ8YsS ReJ4UkVrqhmY8piAOzi3jK+0EIdKvBnfDutWGnrQoqZK6wva4jNu/HSisRTJFJ9Kfz bjtLLx+iRz3hwZxy9YmNM+xRd8SO2QZH9FiFWO1hyyG7Y6+/6CkFVrO9YSwdIvcsIu E0yrmcafqbVXA== Received: from mail.postgrespro.ru (webmail-slave-mstn.l.postgrespro.ru [192.168.2.28]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (Client did not present a certificate) (Authenticated sender: a.pyhalov@postgrespro.ru) by mail.postgrespro.ru (Postfix/587) with ESMTPSA id C781660F87; Fri, 14 Mar 2025 09:33:48 +0300 (MSK) MIME-Version: 1.0 Date: Fri, 14 Mar 2025 09:33:48 +0300 From: Alexander Pyhalov To: Tom Lane Cc: Pavel Stehule , Alexander Korotkov , pgsql-hackers@lists.postgresql.org, Ronan Dunklau Subject: Re: SQLFunctionCache and generic plans In-Reply-To: <2827970.1741890560@sss.pgh.pa.us> References: <8216639.NyiUUSuA9g@aivenlaptop> <3084885.1675783797@sss.pgh.pa.us> <758251661a3e8760ff52dd5c672a7505@postgrespro.ru> <30f02ca545915627905fbe3f23d93ec1@postgrespro.ru> <2275997.1737138456@sss.pgh.pa.us> <51ebc5f3b846ce279b75ac4f5e5ac33f@postgrespro.ru> <401652.1738598448@sss.pgh.pa.us> <445556.1738612687@sss.pgh.pa.us> <464677.1738620525@sss.pgh.pa.us> <1fc18af56d5fb27bf3e153ffaa2ed70d@postgrespro.ru> <2615770.1740688857@sss.pgh.pa.us> <448c63cf9b4f917c01802309b9c29eb9@postgrespro.ru> <2827970.1741890560@sss.pgh.pa.us> Message-ID: <337e011069b6831e063bfa346f49bb46@postgrespro.ru> X-Sender: a.pyhalov@postgrespro.ru Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-KSMG-AntiPhishing: NotDetected X-KSMG-AntiSpam-Interceptor-Info: not scanned X-KSMG-AntiSpam-Status: not scanned, disabled by settings X-KSMG-AntiVirus: Kaspersky Secure Mail Gateway, version 2.1.0.7854, bases: 2025/03/14 00:21:00 #27769777 X-KSMG-AntiVirus-Status: NotDetected, skipped X-KSMG-LinksScanning: not scanned, disabled by settings X-KSMG-Message-Action: skipped X-KSMG-Rule-ID: 1 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Tom Lane писал(а) 2025-03-13 21:29: > Pavel Stehule writes: >> Maybe interesting change is the change of error message context > >> QUERY: SELECT public.dep_req2() || ' req3b'. >> -CONTEXT: SQL function "dep_req3b" during startup >> +CONTEXT: SQL function "dep_req3b" statement 1 > > I'm not hugely excited about that given that it's just happening in > one case. It might be useful to understand exactly why it's changing, > but I doubt it's something we need to "fix". > > regards, tom lane Hi. What happens here that dep_req3b() was already cached and planned. But when another extension test_ext_req_schema2 is moved to another schema, plan is invalidated. Note that function is already planned, and error hppens not "during startup", but when we execute the first cached plan. Now when we are executing the first execution_state, init_execution_state() is called. RevalidateCachedQuery() tries to rewrite query and gets an error while fcache->planning_stmt_number is 1. So, it correctly reports that it's the first statement. Earlier this error was also called in init_execution_state() (in pg_analyze_and_rewrite_withcb()), but it was considered a startup error (as fcache->func_state) doesn't exist when error is thrown. -- Best regards, Alexander Pyhalov, Postgres Professional