Re: Temporary Views - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: Temporary Views
Date
Msg-id 200208132256.g7DMual27660@candle.pha.pa.us
Whole thread Raw
In response to Re: Temporary Views  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Temporary Views  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Tom Lane wrote:
> Bruce Momjian <pgman@candle.pha.pa.us> writes:
> > Does every other user see the view name
> 
> If he looks in the schema where the view is created, sure --- it's no
> different from any other non-temp table or view.
> 
> > ... on his temp table?
> 
> Um, are you thinking that a view V created to refer to user 1's temp
> table T would refer to some other user's temp table T if accessed by
> that other user?  That's not how it works.  The reference is absolute,
> ie, by OID.
> 
> > Can two
> > people create a view on a temp table at the same time?
> 
> Not the same name in the same schema, but this has nothing to do with
> what the views refer to; that's just a plain old name collision.
> 
> CREATE TEMP VIEW would be handy for avoiding name collisions if you want
> to use the same temp view name in different clients.  But it'd only hide
> the *name* of the view (by putting it in your private temp schema); it
> has nothing to do with access semantics.

Yes, I realize that, but when I create an index on a temp table, I can
create it even though someone else tries to do the same in another
session.  If these views on temp tables go away on session exit, and
can't be reliably accessed by other users, they should be in the temp
schema and therefore invisible to other users and to prevent name
conflicts.

--  Bruce Momjian                        |  http://candle.pha.pa.us pgman@candle.pha.pa.us               |  (610)
359-1001+  If your life is a hard drive,     |  13 Roberts Road +  Christ can be your backup.        |  Newtown Square,
Pennsylvania19073
 


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Temporary Views
Next
From: Emmanuel Charpentier
Date:
Subject: Possible enhancement : replace view ?