Thread: pgsql: Remove logic for converting a table to a view.

pgsql: Remove logic for converting a table to a view.

From
Tom Lane
Date:
Remove logic for converting a table to a view.

Up to now we have allowed manual creation of an ON SELECT rule on
a table to convert it into a view.  That was never anything but a
horrid, error-prone hack though.  pg_dump used to rely on that
behavior to deal with cases involving circular dependencies,
where a dependency loop could be broken by separating the creation
of a view from installation of its ON SELECT rule.  However, we
changed pg_dump to use CREATE OR REPLACE VIEW for that in commit
d8c05aff5 (which was later back-patched as far as 9.4), so there's
not a good argument anymore for continuing to support the behavior.

The proximate reason for axing it now is that we found that the
new statistics code has failure modes associated with the relkind
change caused by this behavior.  We'll patch around that in v15,
but going forward it seems like a better idea to get rid of the
need to support relkind changes.

Discussion: https://postgr.es/m/CALDaNm2yXz+zOtv7y5zBd5WKT8O0Ld3YxikuU3dcyCvxF7gypA@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/b23cd185fd5410e5204683933f848d4583e34b35

Modified Files
--------------
doc/src/sgml/rules.sgml                            |  28 +--
src/backend/rewrite/rewriteDefine.c                | 189 ++-------------------
.../test_ddl_deparse/expected/create_rule.out      |   8 +-
.../modules/test_ddl_deparse/sql/create_rule.sql   |   8 +-
src/test/regress/expected/rowsecurity.out          |  22 ---
src/test/regress/expected/rules.out                |  46 +----
src/test/regress/sql/rowsecurity.sql               |  24 ---
src/test/regress/sql/rules.sql                     |  25 +--
8 files changed, 45 insertions(+), 305 deletions(-)