Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d9I0O-0002nW-NU for pgsql-hackers@arkaria.postgresql.org; Fri, 12 May 2017 21:21:44 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1d9I0O-0005pW-0v for pgsql-hackers@arkaria.postgresql.org; Fri, 12 May 2017 21:21:44 +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.84_2) (envelope-from ) id 1d9Hyr-0002ox-Kf for pgsql-hackers@postgresql.org; Fri, 12 May 2017 21:20:09 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1d9Hyo-0004br-PZ for pgsql-hackers@postgresql.org; Fri, 12 May 2017 21:20:08 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id v4CLK4vr030338; Fri, 12 May 2017 17:20:04 -0400 From: Tom Lane To: Alvaro Herrera cc: Simon Riggs , Andrew Dunstan , Tomas Vondra , PostgreSQL-development , Dean Rasheed Subject: Re: WITH clause in CREATE STATISTICS In-reply-to: <20170512204800.iqt2uwyx3c32j45r@alvherre.pgsql> References: <20170512204800.iqt2uwyx3c32j45r@alvherre.pgsql> Comments: In-reply-to Alvaro Herrera message dated "Fri, 12 May 2017 17:48:01 -0300" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <30336.1494624004.1@sss.pgh.pa.us> Date: Fri, 12 May 2017 17:20:04 -0400 Message-ID: <30337.1494624004@sss.pgh.pa.us> X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org Alvaro Herrera writes: > Tom Lane wrote: >> Although I've not done anything about it here, I'm not happy about the >> handling of dependencies for stats objects. > Here are two patches regarding handling of dependencies. Oh, sorry --- I already pushed something about this. > The first one > implements your first suggestion: add a NORMAL dependency on each > column, and do away with RemoveStatisticsExt. This works well and > should uncontroversial. No, I wanted an AUTO dependency there, for exactly the reason you mention: > If we only do this, then DROP TABLE needs to say CASCADE if there's a > statistics object in the table. I don't think we really want that, do we? A stats object can't be of any value if the underlying table is gone. Perhaps that calculus would change for cross-table stats but I don't see why. > This seems pointless to me, so the > second patch throws in an additional dependency on the table as a whole, > AUTO this time, so that if the table is dropped, the statistics goes > away without requiring cascade. There is no point in forcing CASCADE > for this case, ISTM. This works well too, but I admit there might be > resistance to doing it. OTOH this is how CREATE INDEX works. Uh, no it isn't. Indexes have auto dependencies on the individual columns they index, and *not* on the table as a whole. regards, tom lane -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers