summaryrefslogtreecommitdiff
path: root/src/backend/parser
diff options
context:
space:
mode:
authorNeil Conway <neilc@samurai.com>2005-02-02 06:36:02 +0000
committerNeil Conway <neilc@samurai.com>2005-02-02 06:36:02 +0000
commit73f630500bcb3034f65dc5af6cb410b3221fe717 (patch)
tree7efa24efb97e3e0b2afef407eb6893185c067bdf /src/backend/parser
parentf94197ef35e3f7254acabdc3b8741b2b94e44d5c (diff)
Add support for temporary views, including documentation and regression
tests. Contributed by Koju Iijima, review from Neil Conway, Gavin Sherry and Tom Lane. Also, fix error in description of WITH CHECK OPTION clause in the CREATE VIEW reference page: it should be "CASCADED", not "CASCADE".
Diffstat (limited to 'src/backend/parser')
-rw-r--r--src/backend/parser/gram.y25
1 files changed, 18 insertions, 7 deletions
diff --git a/src/backend/parser/gram.y b/src/backend/parser/gram.y
index 757a17e891b..69e70821970 100644
--- a/src/backend/parser/gram.y
+++ b/src/backend/parser/gram.y
@@ -11,7 +11,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/parser/gram.y,v 2.482 2005/01/27 03:17:59 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/parser/gram.y,v 2.483 2005/02/02 06:36:01 neilc Exp $
*
* HISTORY
* AUTHOR DATE MAJOR EVENT
@@ -4075,24 +4075,35 @@ transaction_mode_list_or_empty:
/*****************************************************************************
*
- * QUERY:
- * create view <viewname> '('target-list ')' AS <query>
+ * QUERY:
+ * CREATE [ OR REPLACE ] [ TEMP ] VIEW <viewname> '('target-list ')' AS <query>
*
*****************************************************************************/
-ViewStmt: CREATE opt_or_replace VIEW qualified_name opt_column_list
+ViewStmt: CREATE OptTemp VIEW qualified_name opt_column_list
AS SelectStmt
{
ViewStmt *n = makeNode(ViewStmt);
- n->replace = $2;
+ n->replace = false;
n->view = $4;
+ n->view->istemp = $2;
n->aliases = $5;
n->query = (Query *) $7;
- $$ = (Node *)n;
+ $$ = (Node *) n;
+ }
+ | CREATE OR REPLACE OptTemp VIEW qualified_name opt_column_list
+ AS SelectStmt
+ {
+ ViewStmt *n = makeNode(ViewStmt);
+ n->replace = true;
+ n->view = $6;
+ n->view->istemp = $4;
+ n->aliases = $7;
+ n->query = (Query *) $9;
+ $$ = (Node *) n;
}
;
-
/*****************************************************************************
*
* QUERY: