disallow LOCK on a view - the Tom Lane remix

Started by Mark Hollomonover 25 years ago4 messageshackers
Jump to latest
#1Mark Hollomon
mhh@mindspring.com

Here is a patch against CVS (without my earlier patch)
to disallow

LOCK x

if x is a view.

It does not use the SPI interface.

--
Mark Hollomon
mhh@mindspring.com

Attachments:

lock.patchtext/plain; charset=us-asciiDownload+101-33
#2Alfred Perlstein
bright@wintelcom.net
In reply to: Mark Hollomon (#1)
Re: disallow LOCK on a view - the Tom Lane remix

* Mark Hollomon <mhh@mindspring.com> [000829 17:13] wrote:

On Tue, Aug 29, 2000 at 04:14:00PM -0700, Alfred Perlstein wrote:

Ok, I'm wondering if this patch will cause problems locking a table
that has had:

CREATE RULE "_RETfoo" AS ON SELECT TO foo DO INSTEAD SELECT * FROM foo1;

I need to be able to lock the table 'foo' exclusively while I swap
out the underlying rule to forward to another table.

Yes, it would. 'foo' would be seen as view.

Okay, this gives me a reason to to do it the hard way.

I will try to add a relisview attribute to pg_class.
That way, we can differentiate between tables with rules
and things created with 'CREATE VIEW'.

Hmmm... guess I'll need to change the definition of the pg_views
view as well.

Ok, thanks I appreciate you taking my situation into consideration.

thanks,
--
-Alfred Perlstein - [bright@wintelcom.net|alfred@freebsd.org]

#3Mark Hollomon
mhh@nortelnetworks.com
In reply to: Mark Hollomon (#1)
Re: disallow LOCK on a view - the Tom Lane remix

Tom Lane wrote:

BTW, this seems to be a counterexample for my prior suggestion that
pg_class should have a "relviewrule" OID column. If it did, you'd
have to update that field when doing something like the above.
Pain-in-the-neck factor looms large...

I was already considering the possiblity of a 'ALTER VIEW' command that
would effectively allow you do that.

CREATE VIEW bar as select * from foo1;
ALTER VIEW bar as select * from foo2;

It would update the "relviewrule" field.
--

Mark Hollomon
mhh@nortelnetworks.com
ESN 451-9008 (302)454-9008

#4Bruce Momjian
bruce@momjian.us
In reply to: Mark Hollomon (#1)
Re: [HACKERS] disallow LOCK on a view - the Tom Lane remix

OK, previous patch unapplied, and this patch was applied.

Here is a patch against CVS (without my earlier patch)
to disallow

LOCK x

if x is a view.

It does not use the SPI interface.

--
Mark Hollomon
mhh@mindspring.com

[ Attachment, skipping... ]

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026