Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 33CCFB5DC1D for ; Tue, 13 Sep 2011 18:32:03 -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 90441-08 for ; Tue, 13 Sep 2011 21:31:56 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by mail.postgresql.org (Postfix) with ESMTP id 202BBB5DC07 for ; Tue, 13 Sep 2011 18:31:55 -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 p8DLVmuT012988; Tue, 13 Sep 2011 17:31:48 -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> Comments: In-reply-to Robert Haas message dated "Tue, 13 Sep 2011 16:21:55 -0500" Date: Tue, 13 Sep 2011 17:31:48 -0400 Message-ID: <12987.1315949508@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/73 X-Sequence-Number: 31090 Robert Haas writes: > On Sep 10, 2011, at 11:26 PM, Tom Lane wrote: >> (IOW, rather than "fix" this I'd prefer to rip out the code altogether. >> But maybe we should wait a couple more years for that.) > IIRC, it's not dead code. I think you can still generate such a dump if you use CREATE OR REPLACE VIEW to manufacture a pair of mutually recursive views. Oh, yeah, I'd forgotten about that. In general that's pg_dump's strategy for breaking a circular dependency loop that involves a view. > Now we should probably disallow that, but we currently don't. Losing that particular case isn't problematic, but I'm not sure that that's the only possible circularity involving a view. One idea that comes to mind is create table foo (list-of-columns); create function foofunc () returns setof foo as ...; create rule .... as select * from foofunc(); This only saves somebody from citing the list of column types twice, so maybe we could blow off this case too; but who's to say there are not more-useful cases that would create circularities? regards, tom lane