Re: [HACKERS] Temporary Views

2002-08-13 Thread Hannu Krosing
On Wed, 2002-08-14 at 08:32, Tom Lane wrote: > Gavin Sherry <[EMAIL PROTECTED]> writes: > > SQL99 is pretty clear about temporary tables, at least. > > It is ... and in fact the spec's notion of a temp table has nearly > nothing to do with ours. They contemplate a temp table as an abstract > tab

Re: [HACKERS] Temporary Views

2002-08-13 Thread Bruce Momjian
Tom Lane wrote: > Bruce Momjian <[EMAIL PROTECTED]> writes: > > so, added to TODO: > > * Have views on temporary tables exist in the temporary namespace > > TODO updated to remove mention of temporary views. > > That's *clearly* backwards. Ignoring our little argument, I think there > is no d

Re: [HACKERS] Temporary Views

2002-08-13 Thread Bruce Momjian
Tom Lane wrote: > Bruce Momjian <[EMAIL PROTECTED]> writes: > > so, added to TODO: > > * Have views on temporary tables exist in the temporary namespace > > TODO updated to remove mention of temporary views. > > That's *clearly* backwards. Ignoring our little argument, I think there > is no d

Re: [HACKERS] Temporary Views

2002-08-13 Thread Tom Lane
Bruce Momjian <[EMAIL PROTECTED]> writes: > so, added to TODO: > * Have views on temporary tables exist in the temporary namespace > TODO updated to remove mention of temporary views. That's *clearly* backwards. Ignoring our little argument, I think there is no denying that temp views as such

Re: [HACKERS] Temporary Views

2002-08-13 Thread Bruce Momjian
Tom Lane wrote: > Gavin Sherry <[EMAIL PROTECTED]> writes: > > SQL99 is pretty clear about temporary tables, at least. > > It is ... and in fact the spec's notion of a temp table has nearly > nothing to do with ours. They contemplate a temp table as an abstract > table schema, if you will, that

Re: [HACKERS] Temporary Views

2002-08-13 Thread Tom Lane
Gavin Sherry <[EMAIL PROTECTED]> writes: > SQL99 is pretty clear about temporary tables, at least. It is ... and in fact the spec's notion of a temp table has nearly nothing to do with ours. They contemplate a temp table as an abstract table schema, if you will, that gets instantiated locally wi

Re: [HACKERS] Temporary Views

2002-08-13 Thread Tom Lane
"Sander Steffann" <[EMAIL PROTECTED]> writes: > Now I am thinking about it, referential integrity also behaves funny with > temp tables. The following is allowed: >> create temp table a (x int primary key); >> create table b (y int references a(x)); It is? regression=# create temp table a (x in

Re: [HACKERS] Temporary Views

2002-08-13 Thread Bruce Momjian
Gavin Sherry wrote: > On Tue, 13 Aug 2002, Bruce Momjian wrote: > > > > > You want to hear something funny? When I see the standards quoted, I > > jump to the end to find out what the person says it really means. I > > find reading those standards painful. I am glad others are reading > > the

Re: [HACKERS] Temporary Views

2002-08-13 Thread Gavin Sherry
On Tue, 13 Aug 2002, Bruce Momjian wrote: > > You want to hear something funny? When I see the standards quoted, I > jump to the end to find out what the person says it really means. I > find reading those standards painful. I am glad others are reading > them. HAH! I did a degree in the hi

Re: [HACKERS] Temporary Views

2002-08-13 Thread Bruce Momjian
You want to hear something funny? When I see the standards quoted, I jump to the end to find out what the person says it really means. I find reading those standards painful. I am glad others are reading them. --- Gavin

Re: [HACKERS] Temporary Views

2002-08-13 Thread Gavin Sherry
On Tue, 13 Aug 2002, Tom Lane wrote: > Bruce Momjian <[EMAIL PROTECTED]> writes: > > My feeling is that either the view is temporary, fully, or it isn't. I > > don't see having it in the public namespace _and_ removing it on session > > exit as defensible. > > I disagree ... (and who said this

Re: [HACKERS] Temporary Views

2002-08-13 Thread Hannu Krosing
On Wed, 2002-08-14 at 04:12, Tom Lane wrote: > Bruce Momjian <[EMAIL PROTECTED]> writes: > > 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

Re: [HACKERS] Temporary Views

2002-08-13 Thread Tom Lane
Bruce Momjian <[EMAIL PROTECTED]> writes: > My feeling is that either the view is temporary, fully, or it isn't. I > don't see having it in the public namespace _and_ removing it on session > exit as defensible. I disagree ... (and who said this was necessarily the public namespace, anyway? Per

Re: [HACKERS] Temporary Views

2002-08-13 Thread Bruce Momjian
Tom Lane wrote: > Bruce Momjian <[EMAIL PROTECTED]> writes: > > 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 reliab

Re: [HACKERS] Temporary Views

2002-08-13 Thread Tom Lane
Bruce Momjian <[EMAIL PROTECTED]> writes: > 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

Re: [HACKERS] Temporary Views

2002-08-13 Thread Bruce Momjian
Tom Lane wrote: > Bruce Momjian <[EMAIL PROTECTED]> 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

Re: [HACKERS] Temporary Views

2002-08-13 Thread Tom Lane
Bruce Momjian <[EMAIL PROTECTED]> 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 tem

Re: [HACKERS] Temporary Views

2002-08-13 Thread Bruce Momjian
Tom Lane wrote: > Hannu Krosing <[EMAIL PROTECTED]> writes: > > It seems to be a broken view not security risk in 7.2.1 > > The implementation of temp tables has changed completely in CVS tip, > so experiments with 7.2 aren't very relevant. In CVS tip I believe > you *could* read the contents of

Re: [HACKERS] Temporary Views

2002-08-13 Thread Tom Lane
Hannu Krosing <[EMAIL PROTECTED]> writes: > It seems to be a broken view not security risk in 7.2.1 The implementation of temp tables has changed completely in CVS tip, so experiments with 7.2 aren't very relevant. In CVS tip I believe you *could* read the contents of someone else's temp table,

Re: [HACKERS] Temporary Views

2002-08-13 Thread Hannu Krosing
On Tue, 2002-08-13 at 21:50, Hannu Krosing wrote: > On Tue, 2002-08-13 at 20:43, Tom Lane wrote: > > Bruce Momjian <[EMAIL PROTECTED]> writes: > > > I can go either way on this. > > > > AFAICS "create temp view" would have some small advantage of keeping the > > view's name out of possibly-public

Re: [HACKERS] Temporary Views

2002-08-13 Thread Tom Lane
Hannu Krosing <[EMAIL PROTECTED]> writes: > We may have broken views again when "alter table drop column" gets done It is done, and we do not have broken views. regression=# create table t (f1 int, f2 int, f3 int); CREATE TABLE regression=# create view v as select f1,f2 from t; CREATE VIEW regre

Re: [HACKERS] Temporary Views

2002-08-13 Thread Hannu Krosing
On Wed, 2002-08-14 at 00:10, Rod Taylor wrote: > > > that TODO item was written before we had dependencies, and I think > > > it's obsolete. Basically the point of the TODO was to avoid > > > having broken views --- and we have solved that problem. > > > > We may have broken views again when "al

Re: [HACKERS] Temporary Views

2002-08-13 Thread Rod Taylor
> > that TODO item was written before we had dependencies, and I think > > it's obsolete. Basically the point of the TODO was to avoid > > having broken views --- and we have solved that problem. > > We may have broken views again when "alter table drop column" gets done Any view depending on a

Re: [HACKERS] Temporary Views

2002-08-13 Thread Hannu Krosing
On Tue, 2002-08-13 at 20:43, Tom Lane wrote: > Bruce Momjian <[EMAIL PROTECTED]> writes: > > I can go either way on this. > > AFAICS "create temp view" would have some small advantage of keeping the > view's name out of possibly-public permanent namespaces, so the step of > just adding the TEMP o

Re: [HACKERS] Temporary Views

2002-08-13 Thread Rod Taylor
On Tue, 2002-08-13 at 12:22, Tom Lane wrote: > Rod Taylor <[EMAIL PROTECTED]> writes: > > I was playing with this a while back (when I had initially added CASCADE > > to tables). I believe that in the event of a crash the temp tables are > > not removed until their next use. This means that stal

Re: [HACKERS] Temporary Views

2002-08-13 Thread Bruce Momjian
Tom Lane wrote: > Bruce Momjian <[EMAIL PROTECTED]> writes: > > What about indexes? Do indexes on temp tables exist in the temp > > namespace? > > Yes, a fortiori: any index exists in its table's namespace. Seems > pretty irrelevant to the point at hand, though. Just checking. So the index ex

Re: [HACKERS] Temporary Views

2002-08-13 Thread Tom Lane
Rod Taylor <[EMAIL PROTECTED]> writes: > I was playing with this a while back (when I had initially added CASCADE > to tables). I believe that in the event of a crash the temp tables are > not removed until their next use. This means that stale *real* items > may litter the system but the temp t

Re: [HACKERS] Temporary Views

2002-08-13 Thread Tom Lane
Bruce Momjian <[EMAIL PROTECTED]> writes: > What about indexes? Do indexes on temp tables exist in the temp > namespace? Yes, a fortiori: any index exists in its table's namespace. Seems pretty irrelevant to the point at hand, though. regards, tom lane

Re: [HACKERS] Temporary Views

2002-08-13 Thread Bruce Momjian
Tom Lane wrote: > Bruce Momjian <[EMAIL PROTECTED]> writes: > > I can go either way on this. > > AFAICS "create temp view" would have some small advantage of keeping the > view's name out of possibly-public permanent namespaces, so the step of > just adding the TEMP option to CREATE VIEW may be w

Re: [HACKERS] Temporary Views

2002-08-13 Thread Tom Lane
Bruce Momjian <[EMAIL PROTECTED]> writes: > I can go either way on this. AFAICS "create temp view" would have some small advantage of keeping the view's name out of possibly-public permanent namespaces, so the step of just adding the TEMP option to CREATE VIEW may be worth doing. The advantage i

Re: [HACKERS] Temporary Views

2002-08-13 Thread Bruce Momjian
Rod Taylor wrote: > On Tue, 2002-08-13 at 11:18, Bruce Momjian wrote: > > Tom Lane wrote: > > > Gavin Sherry <[EMAIL PROTECTED]> writes: > > > > I'm thinking that temporary views should be pretty trivial to > > > > implement. > > > > > > ... except not so trivial, per the rest of your note. > > >

Re: [HACKERS] Temporary Views

2002-08-13 Thread Rod Taylor
On Tue, 2002-08-13 at 11:18, Bruce Momjian wrote: > Tom Lane wrote: > > Gavin Sherry <[EMAIL PROTECTED]> writes: > > > I'm thinking that temporary views should be pretty trivial to > > > implement. > > > > ... except not so trivial, per the rest of your note. > > > > Do we actually need any such

Re: [HACKERS] Temporary Views

2002-08-13 Thread Rod Taylor
On Tue, 2002-08-13 at 11:11, Tom Lane wrote: > Gavin Sherry <[EMAIL PROTECTED]> writes: > > I'm thinking that temporary views should be pretty trivial to > > implement. > > ... except not so trivial, per the rest of your note. > > Do we actually need any such feature? Views on temp tables alrea

Re: [HACKERS] Temporary Views

2002-08-13 Thread Bruce Momjian
Tom Lane wrote: > Gavin Sherry <[EMAIL PROTECTED]> writes: > > I'm thinking that temporary views should be pretty trivial to > > implement. > > ... except not so trivial, per the rest of your note. > > Do we actually need any such feature? Views on temp tables already work > correctly in CVS ti

Re: [HACKERS] Temporary Views

2002-08-13 Thread Tom Lane
Gavin Sherry <[EMAIL PROTECTED]> writes: > I'm thinking that temporary views should be pretty trivial to > implement. ... except not so trivial, per the rest of your note. Do we actually need any such feature? Views on temp tables already work correctly in CVS tip: the implicit DROP CASCADE on

Re: [HACKERS] Temporary Views

2002-08-13 Thread Bruce Momjian
Gavin Sherry wrote: > Hi all, > > I'm thinking that temporary views should be pretty trivial to > implement. > > * Allow temporary views > > This should be as simple as modifying gram.y (to set > ViewStmt->view->istemp) and some logic in RemoveTempRelations() to remove > the view's rule Yep, p