From: | Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> |
---|---|
To: | Gavin Sherry <swm(at)linuxworld(dot)com(dot)au> |
Cc: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: Temporary Views |
Date: | 2002-08-13 15:08:58 |
Message-ID: | 200208131508.g7DF8xb06818@candle.pha.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
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, pretty simple.
> * Require view using temporary tables to be temporary views
>
> This is the non-trivial part. If you are creating a view on just a
> temporary table there's no problem. But what happens when do the
> following?
>
> CREATE VIEW abc AS select * from tab1,tab2,temp_tab3 ...
>
> SQL99 avoids this with syntax rule 6 of 11.21 <view definition>
>
> No <table reference> generally contained in the <query expression> shall
> identify any declared local temporary table.
>
> There are a few ways it could be implemented:
>
> 1) SQL99
> 2) Views whose <query epression> contains one or more <table references>
> to temporary tables are created as temporary views
> 3) Views whose <query epression> contains one or more <table references>
> to temporary tables must be explicitly include the TEMP[ORARY] syntax.
The idea is that if the temp table goes away, we don't want the view
continuing to exist. I think if there are any temp tables in the view,
the view _has_ to be specified by the user as temporary, or we throw an
error telling them it has to be temporary.
--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2002-08-13 15:11:23 | Re: Temporary Views |
Previous Message | Tom Lane | 2002-08-13 15:04:38 | Re: [GENERAL] Linux Largefile Support In Postgresql RPMS |