pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: needthistool@gmail.com
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #13775: CREATE RULE documentation seems to be wrong under ON SELECT TO <table> DO INSTEAD SELECT
Date: Fri, 13 Nov 2015 18:23:09 -0500
Message-ID: <9032.1447456989@sss.pgh.pa.us> (raw)
In-Reply-To: <20151113210800.615.72954@wrigleys.postgresql.org>
References: <20151113210800.615.72954@wrigleys.postgresql.org>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

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



view thread (3+ messages)  latest in thread

Message-ID: <9032.1447456989@sss.pgh.pa.us>
Permalink:  ../9032.1447456989@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/9032.1447456989@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, needthistool@gmail.com
  Subject: Re: BUG #13775: CREATE RULE documentation seems to be wrong under ON SELECT TO <table> DO INSTEAD SELECT
  In-Reply-To: <9032.1447456989@sss.pgh.pa.us>
  References: <20151113210800.615.72954@wrigleys.postgresql.org> <9032.1447456989@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox