Re: BUG #13775: CREATE RULE documentation seems to be wrong under ON SELECT TO <table> DO INSTEAD SELECT

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: needthistool(at)gmail(dot)com
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #13775: CREATE RULE documentation seems to be wrong under ON SELECT TO <table> DO INSTEAD SELECT
Date: 2015-11-13 23:23:09
Message-ID: 9032.1447456989@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

needthistool(at)gmail(dot)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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Bruce Momjian 2015-11-14 01:24:02 Re: BUG #13774: upgrade from 9.1 to 9.4 'succeeds' without enough disk space
Previous Message needthistool 2015-11-13 21:08:00 BUG #13775: CREATE RULE documentation seems to be wrong under ON SELECT TO <table> DO INSTEAD SELECT