Re: [HACKERS] Updatable view columns

2013-10-19 Thread Dean Rasheed
On 18 October 2013 15:43, Robert Haas robertmh...@gmail.com wrote:

 Committed.


Excellent. Thank you!
And thank you Marko for your thorough review.

Regards,
Dean


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] Updatable view columns

2013-10-18 Thread Robert Haas
On Tue, Sep 17, 2013 at 6:16 PM, Marko Tiikkaja ma...@joh.to wrote:
 On 2013-09-17 12:53, Dean Rasheed wrote:

 Thanks for the review. Those changes all look sensible to me.

 Here's an updated patch incorporating all your fixes, and rebased to
 apply without offsets.


 Looks good to me.  Marking this one ready for committer.

Committed.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] Updatable view columns

2013-09-17 Thread Marko Tiikkaja

On 2013-09-17 12:53, Dean Rasheed wrote:

Thanks for the review. Those changes all look sensible to me.

Here's an updated patch incorporating all your fixes, and rebased to
apply without offsets.


Looks good to me.  Marking this one ready for committer.


Regards,
Marko Tiikkaja


--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] Updatable view columns

2013-09-16 Thread Marko Tiikkaja

Hi Dean,

First of all, thanks for working on this!

The patch compiles and applies fine (though with offsets).  The feature 
is in the SQL standard, and further improves an existing feature.


Some stuff I've spotted and fixed in the attached patch (hope you don't 
mind, thought it'd be easier to just fix these rather than describing 
them in email):

   - Some typos I've spotted in some of the comments
   - Fixed escaping of _ in regression tests

Other than these, the patch looks good to me.  Will wait for your 
thoughts and an updated patch before marking ready for committer.



Regards,
Marko Tiikkaja
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
 programlisting
 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 
 

Re: [HACKERS] Updatable view columns

2013-08-21 Thread Peter Eisentraut
On Mon, 2013-08-12 at 15:27 +0100, Dean Rasheed wrote:
 Attached is a work-in-progress patch to extend auto-updatable views to
 support views containing a mix of updatable and non-updatable columns.
 This is basically the columns part of SQL Feature T111, Updatable
 joins, unions, and columns. 

This patch needs to be rebased.



-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers