diff --git a/doc/src/sgml/ref/create_view.sgml b/doc/src/sgml/ref/create_view.sgml index 4505290..e0fbe1e 100644 --- a/doc/src/sgml/ref/create_view.sgml +++ b/doc/src/sgml/ref/create_view.sgml @@ -440,7 +440,7 @@ CREATE VIEW pg_comedies AS CREATE VIEW comedies AS SELECT f.*, - country_code_to_name(f.country_code) AS country + country_code_to_name(f.country_code) AS country, (SELECT avg(r.rating) FROM user_ratings r WHERE r.film_id = f.id) AS avg_rating diff --git a/src/backend/rewrite/rewriteHandler.c b/src/backend/rewrite/rewriteHandler.c index 4c8c4f1..a35e63e 100644 --- a/src/backend/rewrite/rewriteHandler.c +++ b/src/backend/rewrite/rewriteHandler.c @@ -625,7 +625,7 @@ adjustJoinTreeList(Query *parsetree, bool removert, int rt_index) * table, but it's more convenient to do it here while we still have easy * access to the view's original RT index.) This is only necessary for * trigger-updatable views, for which the view remains the result relation of - * the query. For auto-updatable we must not do this, since it might add + * the query. For auto-updatable views we must not do this, since it might add * assignments to non-updatable view columns. For rule-updatable views it is * unnecessary extra work, since the query will be rewritten with a different * result relation which will be processed when we recurse via RewriteQuery. @@ -2102,7 +2102,7 @@ view_query_is_auto_updatable(Query *viewquery, bool security_barrier, /* - * view_cols_are_auto_updatable - test whether the all of the required columns + * view_cols_are_auto_updatable - test whether all of the required columns * of an auto-updatable view are actually updatable. Returns NULL (if all the * required columns can be updated) or a message string giving the reason that * they cannot be. @@ -2111,7 +2111,7 @@ view_query_is_auto_updatable(Query *viewquery, bool security_barrier, * assign to any non-updatable columns. * * Additionally it may be used to retrieve the set of updatable columns in the - * view or, if one or more of the required columns is not updatable, the name + * view, or if one or more of the required columns is not updatable, the name * of the first offending non-updatable column. * * The caller must have already verified that this is an auto-updatable view diff --git a/src/test/regress/expected/updatable_views.out b/src/test/regress/expected/updatable_views.out index e463b43..c725bba 100644 --- a/src/test/regress/expected/updatable_views.out +++ b/src/test/regress/expected/updatable_views.out @@ -30,7 +30,7 @@ CREATE VIEW ro_view20 AS SELECT * FROM seq; -- View based on a sequence CREATE VIEW ro_view21 AS SELECT a, b, generate_series(1, a) g FROM base_tbl; -- SRF in targetlist not supported SELECT table_name, is_insertable_into FROM information_schema.tables - WHERE table_name LIKE E'r_\_view%' + WHERE table_name LIKE E'r_\\_view%' ORDER BY table_name; table_name | is_insertable_into ------------+-------------------- @@ -59,7 +59,7 @@ SELECT table_name, is_insertable_into SELECT table_name, is_updatable, is_insertable_into FROM information_schema.views - WHERE table_name LIKE E'r_\_view%' + WHERE table_name LIKE E'r_\\_view%' ORDER BY table_name; table_name | is_updatable | is_insertable_into ------------+--------------+-------------------- @@ -88,7 +88,7 @@ SELECT table_name, is_updatable, is_insertable_into SELECT table_name, column_name, is_updatable FROM information_schema.columns - WHERE table_name LIKE E'r_\_view%' + WHERE table_name LIKE E'r_\\_view%' ORDER BY table_name, ordinal_position; table_name | column_name | is_updatable ------------+---------------+-------------- @@ -1222,7 +1222,7 @@ SELECT * FROM base_tbl ORDER BY a; SELECT table_name, is_insertable_into FROM information_schema.tables - WHERE table_name LIKE E'r_\_view%' + WHERE table_name LIKE E'r_\\_view%' ORDER BY table_name; table_name | is_insertable_into ------------+-------------------- @@ -1233,7 +1233,7 @@ SELECT table_name, is_insertable_into SELECT table_name, is_updatable, is_insertable_into FROM information_schema.views - WHERE table_name LIKE E'r_\_view%' + WHERE table_name LIKE E'r_\\_view%' ORDER BY table_name; table_name | is_updatable | is_insertable_into ------------+--------------+-------------------- @@ -1244,7 +1244,7 @@ SELECT table_name, is_updatable, is_insertable_into SELECT table_name, column_name, is_updatable FROM information_schema.columns - WHERE table_name LIKE E'r_\_view%' + WHERE table_name LIKE E'r_\\_view%' ORDER BY table_name, ordinal_position; table_name | column_name | is_updatable ------------+-------------+-------------- @@ -1553,7 +1553,7 @@ CREATE TABLE base_tbl (a int); CREATE VIEW rw_view1 AS SELECT * FROM base_tbl WITH CHECK OPTION; CREATE VIEW rw_view2 AS SELECT * FROM rw_view1 WHERE a > 0; CREATE VIEW rw_view3 AS SELECT * FROM rw_view2 WITH CHECK OPTION; -SELECT * FROM information_schema.views WHERE table_name LIKE E'rw\_view_' ORDER BY table_name; +SELECT * FROM information_schema.views WHERE table_name LIKE E'rw\\_view_' ORDER BY table_name; table_catalog | table_schema | table_name | view_definition | check_option | is_updatable | is_insertable_into | is_trigger_updatable | is_trigger_deletable | is_trigger_insertable_into ---------------+--------------+------------+---------------------------+--------------+--------------+--------------------+----------------------+----------------------+---------------------------- regression | public | rw_view1 | SELECT base_tbl.a +| CASCADED | YES | YES | NO | NO | NO diff --git a/src/test/regress/sql/updatable_views.sql b/src/test/regress/sql/updatable_views.sql index b7d9ba7..a77cf19 100644 --- a/src/test/regress/sql/updatable_views.sql +++ b/src/test/regress/sql/updatable_views.sql @@ -34,17 +34,17 @@ CREATE VIEW ro_view21 AS SELECT a, b, generate_series(1, a) g FROM base_tbl; -- SELECT table_name, is_insertable_into FROM information_schema.tables - WHERE table_name LIKE E'r_\_view%' + WHERE table_name LIKE E'r_\\_view%' ORDER BY table_name; SELECT table_name, is_updatable, is_insertable_into FROM information_schema.views - WHERE table_name LIKE E'r_\_view%' + WHERE table_name LIKE E'r_\\_view%' ORDER BY table_name; SELECT table_name, column_name, is_updatable FROM information_schema.columns - WHERE table_name LIKE E'r_\_view%' + WHERE table_name LIKE E'r_\\_view%' ORDER BY table_name, ordinal_position; -- Read-only views @@ -578,17 +578,17 @@ SELECT * FROM base_tbl ORDER BY a; SELECT table_name, is_insertable_into FROM information_schema.tables - WHERE table_name LIKE E'r_\_view%' + WHERE table_name LIKE E'r_\\_view%' ORDER BY table_name; SELECT table_name, is_updatable, is_insertable_into FROM information_schema.views - WHERE table_name LIKE E'r_\_view%' + WHERE table_name LIKE E'r_\\_view%' ORDER BY table_name; SELECT table_name, column_name, is_updatable FROM information_schema.columns - WHERE table_name LIKE E'r_\_view%' + WHERE table_name LIKE E'r_\\_view%' ORDER BY table_name, ordinal_position; SELECT events & 4 != 0 AS upd, @@ -699,7 +699,7 @@ CREATE TABLE base_tbl (a int); CREATE VIEW rw_view1 AS SELECT * FROM base_tbl WITH CHECK OPTION; CREATE VIEW rw_view2 AS SELECT * FROM rw_view1 WHERE a > 0; CREATE VIEW rw_view3 AS SELECT * FROM rw_view2 WITH CHECK OPTION; -SELECT * FROM information_schema.views WHERE table_name LIKE E'rw\_view_' ORDER BY table_name; +SELECT * FROM information_schema.views WHERE table_name LIKE E'rw\\_view_' ORDER BY table_name; INSERT INTO rw_view1 VALUES (-1); -- ok INSERT INTO rw_view1 VALUES (1); -- ok