Re: [HACKERS] [PATCH] Lockable views

2017-10-26 Thread Robert Haas
On Wed, Oct 11, 2017 at 11:36 AM, Yugo Nagata wrote: > In the attached patch, only automatically-updatable views that do not have > INSTEAD OF rules or INSTEAD OF triggers are lockable. It is assumed that > those views definition have only one base-relation. When an

Re: [HACKERS] [PATCH] Lockable views

2017-10-16 Thread Tatsuo Ishii
> I'm a bit confused. What is difference between tables and functions > in a subquery with regard to view locking? I think also none view queries > using a subquery do not care about the changes of tables in the > subquery while executing the query. I might be misnderstanding > the problem you

Re: [HACKERS] [PATCH] Lockable views

2017-10-16 Thread Yugo Nagata
On Mon, 16 Oct 2017 10:07:48 +0900 (JST) Tatsuo Ishii wrote: > >> >> test=# CREATE VIEW v3 AS SELECT count(*) FROM v1; > >> >> CREATE VIEW > >> >> test=# BEGIN; > >> >> BEGIN > >> >> test=# LOCK TABLE v3; > >> >> ERROR: cannot lock view "v3" > >> >> DETAIL: Views that

Re: [HACKERS] [PATCH] Lockable views

2017-10-15 Thread Tatsuo Ishii
>> >> test=# CREATE VIEW v3 AS SELECT count(*) FROM v1; >> >> CREATE VIEW >> >> test=# BEGIN; >> >> BEGIN >> >> test=# LOCK TABLE v3; >> >> ERROR: cannot lock view "v3" >> >> DETAIL: Views that return aggregate functions are not automatically >> >> updatable. >> > >> > It would be nice if the

Re: [HACKERS] [PATCH] Lockable views

2017-10-13 Thread Yugo Nagata
On Thu, 12 Oct 2017 13:11:45 +0900 (JST) Tatsuo Ishii wrote: > >> test=# CREATE VIEW v3 AS SELECT count(*) FROM v1; > >> CREATE VIEW > >> test=# BEGIN; > >> BEGIN > >> test=# LOCK TABLE v3; > >> ERROR: cannot lock view "v3" > >> DETAIL: Views that return aggregate functions

Re: [HACKERS] [PATCH] Lockable views

2017-10-11 Thread Tatsuo Ishii
>> test=# CREATE VIEW v3 AS SELECT count(*) FROM v1; >> CREATE VIEW >> test=# BEGIN; >> BEGIN >> test=# LOCK TABLE v3; >> ERROR: cannot lock view "v3" >> DETAIL: Views that return aggregate functions are not automatically >> updatable. > > It would be nice if the message would be something

Re: [HACKERS] [PATCH] Lockable views

2017-10-11 Thread Tatsuo Ishii
> Hi, > > Attached is a patch to enable views to be locked. Nice. > PostgreSQL has supported automatically updatable views since 9.3, so we can > udpate simply defined views like regular tables. However, currently, > table-level locks on views are not supported. We can not execute LOCK TABLE >

[HACKERS] [PATCH] Lockable views

2017-10-11 Thread Yugo Nagata
Hi, Attached is a patch to enable views to be locked. PostgreSQL has supported automatically updatable views since 9.3, so we can udpate simply defined views like regular tables. However, currently, table-level locks on views are not supported. We can not execute LOCK TABLE for views, while we