Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1ZxNgY-0000I1-Vz for pgsql-bugs@arkaria.postgresql.org; Fri, 13 Nov 2015 23:23:15 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1ZxNgY-0002BJ-DK for pgsql-bugs@arkaria.postgresql.org; Fri, 13 Nov 2015 23:23:14 +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) (envelope-from ) id 1ZxNgX-0002B9-Tr for pgsql-bugs@postgresql.org; Fri, 13 Nov 2015 23:23:14 +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) (envelope-from ) id 1ZxNgV-0001Tw-Lm for pgsql-bugs@postgresql.org; Fri, 13 Nov 2015 23:23:12 +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 tADNN9SM009033; Fri, 13 Nov 2015 18:23:09 -0500 From: Tom Lane To: needthistool@gmail.com cc: pgsql-bugs@postgresql.org Subject: Re: BUG #13775: CREATE RULE documentation seems to be wrong under ON SELECT TO DO INSTEAD SELECT In-reply-to: <20151113210800.615.72954@wrigleys.postgresql.org> References: <20151113210800.615.72954@wrigleys.postgresql.org> Comments: In-reply-to needthistool@gmail.com message dated "Fri, 13 Nov 2015 21:08:00 +0000" Date: Fri, 13 Nov 2015 18:23:09 -0500 Message-ID: <9032.1447456989@sss.pgh.pa.us> X-Pg-Spam-Score: -2.2 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org needthistool@gmail.com writes: >> From the docs: > "Thus, an ON SELECT rule **effectively** turns the table into a view, whose > visible contents are the rows returned by the rule's SELECT command **rather > than whatever had been stored in the table** (if anything). It is > **considered better style** to write a CREATE VIEW command than to create a > real table and define an ON SELECT rule for it." {'**' emphases added} I don't see anything particularly wrong with those statements... > It does > not appear possible to shadow a table with an alternate selection-clause > which makes the real contents of the table appear different in some way (for > instance, adding a default sorting or if one wasn't specified or such). I don't see anything in the docs that suggests that that's supported, either. The only reason creating an ON SELECT rule is still supported at all is that (1) that used to be how pg_dump dumped views, and (2) that's still how pg_dump dumps views in some corner cases involving circular dependencies. We could get rid of (2); but in view of the need for backwards compatibility with old dump files, it's hard to see when we could drop the syntax entirely, so nobody's bothered. In the meantime, though, there is no expectation that we'd ever support ON SELECT rules that weren't a weird spelling of CREATE VIEW, and I don't see anything in the documentation that suggests differently. regards, tom lane -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs