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 1uryWs-00FVcQ-ST for pgsql-hackers@arkaria.postgresql.org; Fri, 29 Aug 2025 12:48:32 +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 1uryWr-009b6H-0y for pgsql-hackers@arkaria.postgresql.org; Fri, 29 Aug 2025 12:48:29 +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 1uryWq-009b69-G7 for pgsql-hackers@lists.postgresql.org; Fri, 29 Aug 2025 12:48:29 +0000 Received: from fout-a5-smtp.messagingengine.com ([103.168.172.148]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1uryWo-002VKf-1K for pgsql-hackers@postgresql.org; Fri, 29 Aug 2025 12:48:28 +0000 Received: from phl-compute-05.internal (phl-compute-05.internal [10.202.2.45]) by mailfout.phl.internal (Postfix) with ESMTP id 7D644EC047D; Fri, 29 Aug 2025 08:48:24 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-05.internal (MEProxy); Fri, 29 Aug 2025 08:48:24 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kurilemu.de; h= cc:cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :reply-to:subject:subject:to:to; s=fm2; t=1756471704; x= 1756558104; bh=sfLep42zKvheR2BqlXUHj+VMvBWnfGb5oqlFsXEMdzY=; b=O vP7eaaak5lMbxsU1lshqX683nWbhmQM6VDGRP5twwM46EJXQQDHpkXzkhGeEK8U9 Y5Ilvd6knf1pEjfVjampBVE5+Kptx1gQwPkhbk7xifs+ILwBIXBtFCV9w+sOguac UYPrZrrr81J50sI1xMIXY5JFpDekeg7/PhHuyxMrWEd6X96gHIBuZeakLo75ICIz Arv50B5OlRqhdvqGGK7f/vgtSAt1FMAJcKm3+7ZxOk9G9i66MIXlIVNdsu5Dbgqu zWpokEKLxi9pXQy1UfQZsjG2HJ2cbaqB2a1wIVOfaDa4+aj+79SyGrruFVXXkG+w 6HB8y+7tudjebKmPrZZEg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :reply-to:subject:subject:to:to:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; t=1756471704; x=1756558104; bh=s fLep42zKvheR2BqlXUHj+VMvBWnfGb5oqlFsXEMdzY=; b=PQqnqGvjY+JpGp8rB VL9vLckyHcN/b1dCJOmAGVjzfBUICD3sk54keo3CR++vToZj6jkcgmej0fFCJD09 kAyUNL6WiclzTP/fY5upyEMd74+rblZ3KW4GWbxsNXEqRa0vbMRTCVlOqnwTczVy UCbgT2cD73epH6+OL46IZADxiCJamDndrHrUmVewr3XJmhJe4Z/9IhfNTgEGyD1s hflj6XmwbBZKyGg5+gVOVDtT/aOZTXwUZON9+T5gNTM+mk7rsRpV9arCnr8OmIjs vJhi74PZpUnV4BnSTYgbqAtRq+hReEPY+lz9R8ihC1oSYVetKvF37YkPCNPSJQIV 5xmXQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdefgddukeefleduucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhepfffhvfevuffkgggtugfgjgesthekredttddtjeenucfhrhhomheplmhlvhgrrhho ucfjvghrrhgvrhgruceorghlvhhhvghrrhgvsehkuhhrihhlvghmuhdruggvqeenucggtf frrghtthgvrhhnpeefgeevkeetjefhueekgffhffekiefhueeljeeiffetteettdffkeek leejjefhudenucffohhmrghinhepphhoshhtghhrvghsqhhlrdhorhhgpdgvnhhtvghrph hrihhsvggusgdrtghomhenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgr ihhlfhhrohhmpegrlhhvhhgvrhhrvgeskhhurhhilhgvmhhurdguvgdpnhgspghrtghpth htohepgedpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepjhhirghnrdhunhhivhgv rhhsrghlihhthiesghhmrghilhdrtghomhdprhgtphhtthhopehrvghshhhkvghkihhrih hllhesghhmrghilhdrtghomhdprhgtphhtthhopehpghhsqhhlqdhhrggtkhgvrhhssehp ohhsthhgrhgvshhqlhdrohhrghdprhgtphhtthhopehtghhlsehsshhsrdhpghhhrdhprg druhhs X-ME-Proxy: Feedback-ID: ie3de48e3:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 29 Aug 2025 08:48:24 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kurilemu.de; s=schmee; t=1756471701; bh=xufoRUr+tTtvEJ48Af6/WdHS2C64XJ0dbX8cmWjTuOQ=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=Pa2qhlyn/Y88Xym2qCfzJifM45bmuoRf4sORAPDQHBLnBzHndLUKfk2rlRbbg43dj ox8qVCLZMd+vTuzdL5BAay4LSH5U8rAYwloNMReYDsq2hHyPbW7qbQd2Lc7uOLUI9A mSD/HxUVgYm7CRGMXg/YwHesmF0JgWKAcCRdlOuwiI/fvLsDiBBXbNB4XhJS+0cfF7 24ZGIOYySsS83xn6FxVYjOhA7oWuPXaJPSlEjlgN8ugLPSk6Rq4qFXb6oTk5x9E8uO mBrozjS6D4NkTPQB01cqwwMUMwKRNvR+g7hzfDTwIXqaBNDDmPvb1TMysIZaS0b5OD wUZcAjsZNYM4g== Received: by schmee.kurilemu.internal (Postfix, from userid 1000) id 53A3F90; Fri, 29 Aug 2025 14:48:21 +0200 (CEST) Date: Fri, 29 Aug 2025 14:48:21 +0200 From: =?utf-8?Q?=C3=81lvaro?= Herrera To: jian he Cc: Tom Lane , PostgreSQL-development , Kirill Reshke Subject: Re: misleading error message in ProcessUtilitySlow T_CreateStatsStmt Message-ID: <202508291248.qnqtditzyqm2@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2025-Aug-29, jian he wrote: > On Fri, Aug 29, 2025 at 5:46 AM Tom Lane wrote: > > WFM, although I think you could shorten it to "tables, materialized > > views, and foreign tables". We generally expect that partitioned > > tables are included when saying "tables", no? I'm not dead set on > > that either way, though. > > https://www.postgresql.org/docs/current/sql-copy.html > use "COPY TO can be used only with plain tables, not views, and does > not copy rows from child tables or child partitions" I'm inclined to think that we should only mention partitioned tables specifically when they for some reason deviate from what we do for regular tables, i.e., what Tom is saying. I don't think we've had an explicit, consistent rule for that thus far, so there may be places where we fail to follow it. Anyway, I have pushed the error message change. > > Alternatively, maybe the right fix is to move the parse-analysis > > work into CreateStatistics altogether. I think there is not a > > very good argument for ProcessUtilitySlow doing all that stuff. > > It's supposed to mainly just be a dispatching switch(), IMO. > > seems doable. > transformStatsStmt, CreateStatistics both used only twice, refactoring > arguments should be fine. > please check the attached POC, regress tests also added. Yeah, I like how this turned out. I found out this was introduced in commit a4d75c86bf15. -- Álvaro Herrera PostgreSQL Developer — https://www.EnterpriseDB.com/