Received: from sss.pgh.pa.us ([192.204.191.242]) by postgresql.org (8.11.3/8.11.4) with ESMTP id f982ran74325 for ; Sun, 7 Oct 2001 22:53:36 -0400 (EDT) (envelope-from tgl@sss.pgh.pa.us) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.11.4/8.11.4) with ESMTP id f982rCI26447; Sun, 7 Oct 2001 22:53:12 -0400 (EDT) To: Peter Eisentraut cc: Bruce Momjian , Tomasz Myrta , pgsql-sql@postgresql.org Subject: Re: temporary views In-reply-to: References: Comments: In-reply-to Peter Eisentraut message dated "Sun, 07 Oct 2001 19:54:06 +0200" Date: Sun, 07 Oct 2001 22:53:11 -0400 Message-ID: <26444.1002509591@sss.pgh.pa.us> From: Tom Lane X-Archive-Number: 200110/105 X-Sequence-Number: 5060 Peter Eisentraut writes: > Bruce Momjian writes: >> * Allow views on temporary tables to behave as temporary views > I don't think this is a good idea. Especially since our temp tables are > allowed to shadow persistent tables, it would not be obvious whether the > view you're creating with any given statement will become persistent or > temporary. > I think an explicit CREATE TEMPORARY VIEW command would be fair and safe, > but until that is done we should probably concentrate on the SQL standard > behaviour. I agree with Peter on this --- CREATE TEMP VIEW seems like a fine idea, but allowing views to be implicitly made temporary sounds like a good way to shoot yourself in the foot. ISTM a plain CREATE VIEW should always create a permanent object, and therefore should error out if it refers to any temp tables. However, there are some interesting implications here for the recurring issue of how plpgsql functions ought to interact with temp tables. We've generally thought of the current behavior as a simple shortcoming of plpgsql's query caching logic, and no doubt it is --- but what *should* the behavior be? Can a long-lived function validly refer to short-lived tables? If so, what should the semantics be, exactly? regards, tom lane