Re: Temporary views - Mailing list pgsql-general

From Christopher Browne
Subject Re: Temporary views
Date
Msg-id m3bro593i2.fsf@wolfe.cbbrowne.com
Whole thread Raw
In response to Temporary views  (Martijn van Oosterhout <kleptog@svana.org>)
Responses Re: Temporary views
List pgsql-general
The world rejoiced as tgl@sss.pgh.pa.us (Tom Lane) wrote:
> Martijn van Oosterhout <kleptog@svana.org> writes:
>> Currently you can create temporary tables that are deleted at the
>> end of the session. But how about temporary views? It's just a
>> table with a rule so I don't imagine it would be terribly
>> difficult. Are there any issues I havn't thought of?
>
>> While we're at it, what about temporary functions?
>
> AFAICS, anything created in the temp schema will get zapped at
> backend shutdown.  (It would be a good idea to rename
> RemoveTempRelations and related functions in namespace.c if they are
> going to be used to zap other sorts of objects, but they will work
> as-is.)
>
> So this is doable with just a Small Matter of Programming to pass
> the is-temp flag through from the grammar to wherever the object
> gets created.
>
> 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!)
--
"cbbrowne","@","ntlug.org"
http://www3.sympatico.ca/cbbrowne/spreadsheets.html
"It seems that perfection is attained not when nothing is left to add,
but when nothing is left to be taken away."
-- Antoine de Saint-Exupery.

pgsql-general by date:

Previous
From: Christopher Browne
Date:
Subject: Re: DB cache size strategies
Next
From: Jan Wieck
Date:
Subject: Re: I want to use postresql for this app, but...