Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1ffDTt-0004GX-UO for pgsql-hackers@arkaria.postgresql.org; Tue, 17 Jul 2018 00:04:42 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1ffDTs-0003JR-CH for pgsql-hackers@arkaria.postgresql.org; Tue, 17 Jul 2018 00:04:40 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1ffDTs-0003JJ-1a for pgsql-hackers@lists.postgresql.org; Tue, 17 Jul 2018 00:04:40 +0000 Received: from mail-qk0-x242.google.com ([2607:f8b0:400d:c09::242]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1ffDTp-0005kl-3w for pgsql-hackers@postgresql.org; Tue, 17 Jul 2018 00:04:38 +0000 Received: by mail-qk0-x242.google.com with SMTP id d22-v6so21437608qkc.8 for ; Mon, 16 Jul 2018 17:04:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=8OAxuiYV8pAGpWiPOiaa6ywXyOxNL1EMInfzoabmVes=; b=RO9U7OKAJbCnBvwscZxXdKhO3MRrtmLhzYBWxbMBbt2E+okehV7hvO+mjb7N/A+7MZ 9I5fUamFny7C2jtk7/ccyyIFRXZjYDdKD67r/b1NQeAtDBb1/LA0Pw3DyNOmuU8To5U2 B2ylE6+dUZS8w+CusX1k+ecYDyiaSQREFGBzkggg+oLjbrqPNr0FWjeS2mkpGQWTrTko Qs9ukaR/yK/H8wipLa6X4edOSZiNrr8G9VqMXEMS8YjWf1hr10IVVMkUpQNQddE2A/ym GYvGe0oKa7yZQeI9ZfMLRmGxwDe2zAz9PRS9PqZzat+FaNpH1cDtwMgsZ/G8xOcsrmq8 5LKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=8OAxuiYV8pAGpWiPOiaa6ywXyOxNL1EMInfzoabmVes=; b=jzu8pZgWcCWaDdVUlNzdIVk6ZfHmluBU2f/fhJ2otzbhUxNMmDRVMXL0OB9TPouX6Y 13tZKTxE66dHqgW/QUi1rhJqW7ZexgZkqRQ5y1nu6jKgkAkpf2heG1PX/Rqhk/LjMxl+ s04+xhL38D/l9pVsaAs4lP20QuVj7gxCSP48Qbw/3tCuJ8eBD2+qoP+Jc+UiSlQEiLkP 3PeLnzo3f3krmc6nSqkZidqHZkUZIACPkq+hVE9G/9Qzu5f5FmF3jH/kTmlIO118QdGP CBiXZhP1pYT15I++pEbtmUtvA+M3/pZxGtiTcWXvGWCgGCvPQjIYSWmhQLcAtSqq3jOA SG1Q== X-Gm-Message-State: AOUpUlGE223VEJQFINV9QRhMWx6I7tKEOi93kgSi1pCkbKEdO9Rm1uRo iJs7CZwq/z96vkvqgFbT5f3R1A== X-Google-Smtp-Source: AAOMgpexVvz1tFIfiRZe/nCdweetDLh/5ud6iRaC+rEDy4sbh3RXN7VXWZC+5WsuAAzw5Mru3xPMBw== X-Received: by 2002:a37:9b03:: with SMTP id d3-v6mr15652830qke.122.1531785876253; Mon, 16 Jul 2018 17:04:36 -0700 (PDT) Received: from alvin.alvh.no-ip.org ([201.186.80.49]) by smtp.gmail.com with ESMTPSA id u36-v6sm1862134qtb.27.2018.07.16.17.04.35 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 Jul 2018 17:04:35 -0700 (PDT) Received: by alvin.alvh.no-ip.org (Postfix, from userid 1000) id 1800C7EA; Mon, 16 Jul 2018 20:04:34 -0400 (-04) Date: Mon, 16 Jul 2018 20:04:34 -0400 From: Alvaro Herrera To: Yugo Nagata Cc: pgsql-hackers@postgresql.org, Teodor Sigaev , Alexander Korotkov Subject: Re: Fix error message when trying to alter statistics on included column Message-ID: <20180717000433.ljup6n5mgxlgmeev@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20180628182803.e4632d5a.nagata@sraoss.co.jp> User-Agent: NeoMutt/20170306-137-4415bd-dirty (1.8.0) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2018-Jun-28, Yugo Nagata wrote: > According to the error message, it is not allowed to alter statistics on > included column because this is "non-expression column". > > postgres=# create table test (i int, d int); > CREATE TABLE > postgres=# create index idx on test(i) include (d); > CREATE INDEX > postgres=# alter index idx alter column 2 set statistics 10; > ERROR: cannot alter statistics on non-expression column "d" of index "idx" > HINT: Alter statistics on table column instead. > > However, I think this should be forbidded in that this is not a key column > but a included column. Even if we decide to support expressions in included > columns in future, it is meaningless to do this because any statistics on > included column is never used by the planner. I agree with this reasoning, so I pushed this patch. Thanks! I added a couple of lines in the regress file for this feature also. Teodor, Alexander, now would be the time to express dissent :-) -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services