Re: Temporary views
От | Bruce Momjian |
---|---|
Тема | Re: Temporary views |
Дата | |
Msg-id | 200402130230.i1D2Usv12366@candle.pha.pa.us обсуждение исходный текст |
Ответ на | Re: Temporary views (Tom Lane <tgl@sss.pgh.pa.us>) |
Список | pgsql-general |
Tom Lane wrote: > Christopher Browne <cbbrowne@acm.org> writes: > >> Whether it's worth the trouble is another question. What's the > >> use-case? > > > It's where you create a temporary table to store some results, but > > then want to create a view on top of that, because that makes some > > funky self-join more convenient. > > > I found myself wanting this very thing last night when generating a > > report. (Believe it or not!) > > Hmm. Interestingly enough, you can do that right now (in 7.3 or later): > > regression=# create temp table foo as select * from int8_tbl; > SELECT > regression=# create view v as select * from foo; > CREATE VIEW > regression=# \c - > You are now connected to database "regression". > regression=# \dv v > No matching relations found. > > The view goes away at backend exit because it has a dependency on foo. > > Whether this is really desirable or not, I'm not sure. It would > probably be better if you'd had to say "create temp table v", just > to avoid surprises. TODO has: * Have views on temporary tables exist in the temporary namespace One thing we don't have is the ability to create a temp view on a real table, which we don't support right now. I have added this to TODO: * Allow temporary views on non-temporary tables -- 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, Pennsylvania 19073
В списке pgsql-general по дате отправления: