pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
7.1.1 Lock Problems on Views
3+ messages / 2 participants
[nested] [flat]

* 7.1.1 Lock Problems on Views
@ 2001-05-31 15:33 Brian Powell <brian@owlscreech.com>
  2001-05-31 16:42 ` Re: 7.1.1 Lock Problems on Views Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 3+ messages in thread

From: Brian Powell @ 2001-05-31 15:33 UTC (permalink / raw)
  To: pgsql-sql

Greetings,

I am investigating whether our application will run on 7.1.1 (from 
7.0.3), and our client software only accesses the database through views 
for security and convenience.

In our client app, we lock our table before doing something to it.  
Fortunately, in 7.0.3, a view looked like a table and we could perform:

lock v_whatever in share row exclusive mode;

However, in 7.1.1, it comes back and tells me that:

ERROR:  LOCK TABLE: v_whatever is not a table

The HUGE advantage in 7.0.3 was that we could present our db through 
views and the client didn't have to know.

I tried to put the lock statements into the rule of each view when the 
rule does the actual work, such as:

create rule v_whatever_insert as on insert to v_whatever
   do instead (
     lock whatever in share row exclusive mode;
     insert into whatever (blah) values (new.blah);
   );

However, the view won't be created, it claims there is a syntax error.

So, with 7.1.1, how can I create views and lock the data when modifying 
the table?

Thanks,

--Brian



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: 7.1.1 Lock Problems on Views
  2001-05-31 15:33 7.1.1 Lock Problems on Views Brian Powell <brian@owlscreech.com>
@ 2001-05-31 16:42 ` Tom Lane <tgl@sss.pgh.pa.us>
  2001-05-31 17:06   ` Re: 7.1.1 Lock Problems on Views Brian Powell <brian@owlscreech.com>
  0 siblings, 1 reply; 3+ messages in thread

From: Tom Lane @ 2001-05-31 16:42 UTC (permalink / raw)
  To: Brian Powell <brian@owlscreech.com>; +Cc: pgsql-sql

Brian Powell <brian@owlscreech.com> writes:
> In our client app, we lock our table before doing something to it.  

Why don't you redesign the app to not use table-level locks?
An MVCC-aware app should have little or no need for table-level
locking.

Locking views strikes me as a pretty fragile, if not outright broken,
approach anyway --- a lock on a view would only protect you against
other users of the same view, not against other users accessing the
same underlying tables through different views.

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: 7.1.1 Lock Problems on Views
  2001-05-31 15:33 7.1.1 Lock Problems on Views Brian Powell <brian@owlscreech.com>
  2001-05-31 16:42 ` Re: 7.1.1 Lock Problems on Views Tom Lane <tgl@sss.pgh.pa.us>
@ 2001-05-31 17:06   ` Brian Powell <brian@owlscreech.com>
  0 siblings, 0 replies; 3+ messages in thread

From: Brian Powell @ 2001-05-31 17:06 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-sql


On Thursday, May 31, 2001, at 10:42 AM, Tom Lane wrote:

> Why don't you redesign the app to not use table-level locks?
> An MVCC-aware app should have little or no need for table-level
> locking.
>

Thanks, I'll read up on MVCC in the docs.  While digging around, I came 
across the MVCC and it was the first I have heard of it (I haven't been 
reading up on the new features of 7.1)...

--Brian



^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2001-05-31 17:06 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2001-05-31 15:33 7.1.1 Lock Problems on Views Brian Powell <brian@owlscreech.com>
2001-05-31 16:42 ` Tom Lane <tgl@sss.pgh.pa.us>
2001-05-31 17:06   ` Brian Powell <brian@owlscreech.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox