Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id B15A0B5DC10 for ; Thu, 15 Sep 2011 00:58:28 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 56912-04 for ; Thu, 15 Sep 2011 03:58:21 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.8.0-rc2 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by mail.postgresql.org (Postfix) with ESMTP id 9FB81B5DBCB for ; Thu, 15 Sep 2011 00:58:21 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id p8F3wF5w015557; Wed, 14 Sep 2011 23:58:15 -0400 (EDT) To: Robert Haas cc: Thom Brown , pgsql-bugs Subject: Re: Dropped index on table preventing rule creation In-reply-to: References: <28537.1315715201@sss.pgh.pa.us> <12987.1315949508@sss.pgh.pa.us> Comments: In-reply-to Robert Haas message dated "Wed, 14 Sep 2011 22:45:52 -0500" Date: Wed, 14 Sep 2011 23:58:15 -0400 Message-ID: <15556.1316059095@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.404 tagged_above=-5 required=5 tests=BAYES_00=-1.9, RP_MATCHES_RCVD=-0.504 X-Spam-Level: X-Archive-Number: 201109/85 X-Sequence-Number: 31102 Robert Haas writes: > I spent some more time looking at this tonight. I am wondering if > perhaps we should just get rid of relhasindex. -1, there is absolutely no reason to believe that's a good idea. > ... I think we could fix Thom's complaint by changing > DefineQueryRewrite() to call RelationGetIndexList() rather than > blindly believing relhasindex, which would be maybe a five line > code-change. We'd probably also want to change > SetRelationRuleStatus() to clear relhasindex, which would be one more > line of code. Yeah, that's about what it would take, but what I'm asking is why bother. The *only* case that we support here is turning a just-created, not-fooled-with table into a view, and I don't feel a need to promise that we will handle other cases (which are inevitably going to be poorly tested). See for example the adjacent relhassubclass test, which has got exactly the same issue. > One related thing that seems worth doing is ripping out relhaspkey, Having a hard time getting excited about that either ... regards, tom lane