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.96) (envelope-from ) id 1vc5yh-0022Hy-2o for pgsql-hackers@arkaria.postgresql.org; Sat, 03 Jan 2026 18:03:52 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vc5yf-00DG6I-1n for pgsql-hackers@arkaria.postgresql.org; Sat, 03 Jan 2026 18:03:50 +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.96) (envelope-from ) id 1vc5yf-00DG69-0n for pgsql-hackers@lists.postgresql.org; Sat, 03 Jan 2026 18:03:50 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vc5yd-004Ha8-0l for pgsql-hackers@lists.postgresql.org; Sat, 03 Jan 2026 18:03:49 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 603I3ghH409109; Sat, 3 Jan 2026 13:03:42 -0500 From: Tom Lane To: Andreas Karlsson cc: Marcos Pegoraro , Pavel Stehule , jian he , PostgreSQL Hackers Subject: Re: not fully correct error message In-reply-to: <8fa16ea7-09a1-4ec2-b668-1e36d4c8ace4@proxel.se> References: <8fa16ea7-09a1-4ec2-b668-1e36d4c8ace4@proxel.se> Comments: In-reply-to Andreas Karlsson message dated "Sat, 03 Jan 2026 13:39:28 +0100" MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <409107.1767463422.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Sat, 03 Jan 2026 13:03:42 -0500 Message-ID: <409108.1767463422@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Andreas Karlsson writes: > On 1/3/26 1:22 PM, Marcos Pegoraro wrote: >> Em s=C3=A1b., 3 de jan. de 2026 =C3=A0s 03:35, Pavel Stehule = >> > escreveu: >>> here is a patch (with small regress test) >> An anonymous block doesn't accept vacuum too. >> Wouldn't it be better to specify what kind of block you are running = >> instead of function, procedure or anonymous block ? I don't think PreventInTransactionBlock has ready access to that information. > A potential third option would be to take your solution but to add a = > HINT about that it needs to run as a top-level statement outside any = > transactions, but I kinda liked how simple the original patch was. Yeah, I like just adding "or procedure" and calling it good. I do not think we need a regression test, either ... Poking around, I also found this: src/backend/commands/wait.c: errdetail("WAIT = FOR cannot be executed from a function or a procedure or within a transact= ion with an isolation level higher than READ COMMITTED.")); which is also not great grammar. What do you think of "WAIT FOR cannot be executed from a function or procedure, nor within a transaction with an isolation level higher than READ COMMITTED." ? regards, tom lane