Re: Revised Patch to allow multiple table locks in "Unison"

From: Fernando Nasser <fnasser(at)cygnus(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>, Neil Padgett <npadgett(at)redhat(dot)com>, "pgsql-patches(at)postgresql(dot)org" <pgsql-patches(at)postgresql(dot)org>
Subject: Re: Revised Patch to allow multiple table locks in "Unison"
Date: 2001-08-02 20:19:36
Message-ID: 3B69B5D8.4302DA4B@cygnus.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Tom Lane wrote:
>
> Fernando Nasser <fnasser(at)cygnus(dot)com> writes:
> > What about having the syntax
> > LOCK a,b,c;
> > now just as a shorthand for
> > LOCK a;
> > LOCK b;
> > LOCK c;
> > This would save typing and allow for Oracle compatibility.
>
> This seems fine to me (and in fact I thought we'd already agreed to it).
> Maybe some day we will get ambitious enough to make it do
> parallel-locking, but for now we can get 80% of what we want with 0.8%
> of the effort ;-)
>

Agreed.

> > I wonder how we handle
> > LOCK v;
> > where "v" is a view.
>
> regression=# create view v as select * from int4_tbl;
> CREATE
> regression=# lock table v;
> ERROR: LOCK TABLE: v is not a table
>
> > We should be locking all the base tables.
>
> I consider that debatable. It hard-wires a rather constricted idea
> of what the semantics of a view are.
>

I've only mentioned it because it is what Oracle does. It says explicitly
(in their documentation) that if "table" is "LOCK VIEW table" is actually
a view, all base tables necessary to compute that view are locked.

I guess the principle (for Oracle folks) was that, for the user, there should
be no distinction between a real table and a view. Thus, it should not matter
for the user if the thing that is being locked is a real table or if it
is actually being implemented as a view. Consider that it may have been
a table one day, but the DBA changed it into a view. So that SQL will
not work anymore and give the "ERROR: LOCK TABLE: v is not a table" message.
This violates the Data Independence notion.

--
Fernando Nasser
Red Hat - Toronto E-Mail: fnasser(at)redhat(dot)com
2323 Yonge Street, Suite #300
Toronto, Ontario M4P 2C9

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Hannu Krosing 2001-08-02 20:20:29 Re: OID wraparound: summary and proposal
Previous Message Neil Padgett 2001-08-02 20:11:51 Re: Revised Patch to allow multiple table locks in "Unison"

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2001-08-02 20:28:03 Re: Patch for Improved Syntax Error Reporting
Previous Message Neil Padgett 2001-08-02 20:11:51 Re: Revised Patch to allow multiple table locks in "Unison"