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 1uRXXT-00D6lK-Nk for pgsql-hackers@arkaria.postgresql.org; Tue, 17 Jun 2025 14:43:51 +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 1uRXXQ-00AKCe-8g for pgsql-hackers@arkaria.postgresql.org; Tue, 17 Jun 2025 14:43:48 +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 1uRXXP-00AKCW-Vf for pgsql-hackers@lists.postgresql.org; Tue, 17 Jun 2025 14:43:48 +0000 Received: from fout-a4-smtp.messagingengine.com ([103.168.172.147]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1uRXXO-002Yrm-0L for pgsql-hackers@postgresql.org; Tue, 17 Jun 2025 14:43:48 +0000 Received: from phl-compute-09.internal (phl-compute-09.phl.internal [10.202.2.49]) by mailfout.phl.internal (Postfix) with ESMTP id 7CAC71380461; Tue, 17 Jun 2025 10:43:43 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-09.internal (MEProxy); Tue, 17 Jun 2025 10:43:43 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=anarazel.de; h= cc:cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm1; t=1750171423; x=1750257823; bh=CORRrgfKQ5 PFcM4B7J5BuLiroFiQDtRQ6mvUzxktX+w=; b=kp2Xv+3S6E8fhJkn5en9BZeWvh 4sf2Aqtmosl3rsN0BWcrBELv7nKfPnIhl0pFMtgr9SBwoL3OprTi2kNjPmEOvh8o 0wGIIYPWXdCNHxwC17F0e+NP5RHUyI2KIcmeZxKGvNthx07JDNc+yxWSy/QoIwtq wNWFm2Ems8Y2oeM/v4p/5rZm517jfU5UO3STnQ6J8F2zL9b7YIG9NlHlTllmjv2b qP+15IWKhm6yIimq5J7pcZ13MNtIbcJdH8eDkKuV0+ewFogRChfJjvGeVTc3xq4k PK3EP3f0Xmn9AnbkUfEqvy+rLnCeosFHeqsZAGGe5SJ418JsMXIKFKQD12cQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t= 1750171423; x=1750257823; bh=CORRrgfKQ5PFcM4B7J5BuLiroFiQDtRQ6mv UzxktX+w=; b=hPH/KiA4u18vZp8qKJem1ujMlmvCAeKuVMwYty5TWArygMFjjEk 1GFpSxOs0RwcKykIjD7IKvq9bxuz1duhCDBNcKf4QQB3qleFXqb3Qks3mzu3jWas ZnzVFwpbZ6lN31mKDw+nHB6ngC0kG3ndc4xOVBifEBF4hVXwBLsnZoVgWUNnQUvK VAQnOPSazwfIqnw6SuYC/wD/c/i1WJIIcSonYwK/Aq9XqC8dOhJ8F9IL5s5pHkMk MR0nG0CK8v9rx3L4XoKB+tenZgWGWziiAVFqMJ2fUZGxj5wNqj1HPBpImkrydyru ZWqavZKzTKMIMLZJ0RB1XcnqGQOrUK6wt6A== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtddvgdeghecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdpuffr tefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnth hsucdlqddutddtmdenucfjughrpeffhffvvefukfhfgggtuggjsehttdfstddttddvnecu hfhrohhmpeetnhgurhgvshcuhfhrvghunhguuceorghnughrvghssegrnhgrrhgriigvlh druggvqeenucggtffrrghtthgvrhhnpeetvdevvdetleeuleejlefhlefgvdffgefhleej lefgtdduvedvkeevgeeggfeiieenucffohhmrghinheptghirhhruhhsqdgtihdrtghomh enucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrnhgu rhgvshesrghnrghrrgiivghlrdguvgdpnhgspghrtghpthhtohepvddpmhhouggvpehsmh htphhouhhtpdhrtghpthhtohepphhgshhqlhdqhhgrtghkvghrshesphhoshhtghhrvghs qhhlrdhorhhgpdhrtghpthhtohepnhgrghgrthgrsehsrhgrohhsshdrtghordhjph X-ME-Proxy: Feedback-ID: id4a34324:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 17 Jun 2025 10:43:42 -0400 (EDT) Date: Tue, 17 Jun 2025 10:43:41 -0400 From: Andres Freund To: Yugo Nagata Cc: pgsql-hackers@postgresql.org Subject: Re: Allow to collect statistics on virtual generated columns Message-ID: References: <20250422181006.dd6f9d1d81299f5b2ad55e1a@sraoss.co.jp> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20250422181006.dd6f9d1d81299f5b2ad55e1a@sraoss.co.jp> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, On 2025-04-22 18:10:06 +0900, Yugo Nagata wrote: > With your feedback, I would like to progress or rework the patch. Right now the tests seem to always fail: https://cirrus-ci.com/github/postgresql-cfbot/postgresql/cf%2F5714 Fails e.g. with: https://api.cirrus-ci.com/v1/artifact/task/5921189782093824/testrun/build/testrun/regress/regress/regression.diffs diff -U3 /tmp/cirrus-ci-build/src/test/regress/expected/stats_ext.out /tmp/cirrus-ci-build/build/testrun/regress/regress/results/stats_ext.out --- /tmp/cirrus-ci-build/src/test/regress/expected/stats_ext.out 2025-05-26 00:59:01.813042000 +0000 +++ /tmp/cirrus-ci-build/build/testrun/regress/regress/results/stats_ext.out 2025-05-26 01:02:20.350387000 +0000 @@ -56,7 +56,6 @@ ERROR: unrecognized statistics kind "unrecognized" -- incorrect expressions CREATE STATISTICS tst ON (y) FROM ext_stats_test; -- single column reference -ERROR: extended statistics require at least 2 columns CREATE STATISTICS tst ON y + z FROM ext_stats_test; -- missing parentheses ERROR: syntax error at or near "+" LINE 1: CREATE STATISTICS tst ON y + z FROM ext_stats_test; @@ -69,25 +68,24 @@ -- statistics on virtual generated column not allowed CREATE TABLE ext_stats_test1 (x int, y int, z int GENERATED ALWAYS AS (x+y) VIRTUAL, w xid); CREATE STATISTICS tst on z from ext_stats_test1; -ERROR: statistics creation on virtual generated columns is not supported CREATE STATISTICS tst on (z) from ext_stats_test1; -ERROR: statistics creation on virtual generated columns is not supported +ERROR: statistics object "tst" already exists CREATE STATISTICS tst on (z+1) from ext_stats_test1; -ERROR: statistics creation on virtual generated columns is not supported +ERROR: statistics object "tst" already exists CREATE STATISTICS tst (ndistinct) ON z from ext_stats_test1; -ERROR: statistics creation on virtual generated columns is not supported +ERROR: statistics object "tst" already exists -- statistics on system column not allowed CREATE STATISTICS tst on tableoid from ext_stats_test1; -ERROR: statistics creation on system columns is not supported +ERROR: statistics object "tst" already exists CREATE STATISTICS tst on (tableoid) from ext_stats_test1; -ERROR: statistics creation on system columns is not supported +ERROR: statistics object "tst" already exists CREATE STATISTICS tst on (tableoid::int+1) from ext_stats_test1; -ERROR: statistics creation on system columns is not supported +ERROR: statistics object "tst" already exists CREATE STATISTICS tst (ndistinct) ON xmin from ext_stats_test1; -ERROR: statistics creation on system columns is not supported +ERROR: statistics object "tst" already exists -- statistics without a less-than operator not supported CREATE STATISTICS tst (ndistinct) ON w from ext_stats_test1; -ERROR: column "w" cannot be used in statistics because its type xid has no default btree operator class +ERROR: statistics object "tst" already exists DROP TABLE ext_stats_test1; -- Ensure stats are dropped sanely, and test IF NOT EXISTS while at it CREATE TABLE ab1 (a INTEGER, b INTEGER, c INTEGER); Greetings, Andres