diff options
author | Neil Conway | 2005-02-02 06:36:02 +0000 |
---|---|---|
committer | Neil Conway | 2005-02-02 06:36:02 +0000 |
commit | 73f630500bcb3034f65dc5af6cb410b3221fe717 (patch) | |
tree | 7efa24efb97e3e0b2afef407eb6893185c067bdf /doc/src | |
parent | f94197ef35e3f7254acabdc3b8741b2b94e44d5c (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 'doc/src')
-rw-r--r-- | doc/src/sgml/ref/create_table.sgml | 14 | ||||
-rw-r--r-- | doc/src/sgml/ref/create_view.sgml | 47 |
2 files changed, 43 insertions, 18 deletions
diff --git a/doc/src/sgml/ref/create_table.sgml b/doc/src/sgml/ref/create_table.sgml index 192e64d69b5..191f29ccd4d 100644 --- a/doc/src/sgml/ref/create_table.sgml +++ b/doc/src/sgml/ref/create_table.sgml @@ -1,5 +1,5 @@ <!-- -$PostgreSQL: pgsql/doc/src/sgml/ref/create_table.sgml,v 1.91 2005/01/22 23:22:17 momjian Exp $ +$PostgreSQL: pgsql/doc/src/sgml/ref/create_table.sgml,v 1.92 2005/02/02 06:35:59 neilc Exp $ PostgreSQL documentation --> @@ -66,12 +66,12 @@ and <replaceable class="PARAMETER">table_constraint</replaceable> is: <para> If a schema name is given (for example, <literal>CREATE TABLE - myschema.mytable ...</>) then the table is created in the - specified schema. Otherwise it is created in the current schema. - Temporary tables exist in a special schema, so a schema name may not be - given when creating a temporary table. - The table name must be distinct from the name of any other table, - sequence, index, or view in the same schema. + myschema.mytable ...</>) then the table is created in the specified + schema. Otherwise it is created in the current schema. Temporary + tables exist in a special schema, so a schema name may not be given + when creating a temporary table. The name of the table must be + distinct from the name of any other table, sequence, index, or view + in the same schema. </para> <para> diff --git a/doc/src/sgml/ref/create_view.sgml b/doc/src/sgml/ref/create_view.sgml index 29578216918..8c18378dee6 100644 --- a/doc/src/sgml/ref/create_view.sgml +++ b/doc/src/sgml/ref/create_view.sgml @@ -1,5 +1,5 @@ <!-- -$PostgreSQL: pgsql/doc/src/sgml/ref/create_view.sgml,v 1.29 2005/01/04 00:39:53 tgl Exp $ +$PostgreSQL: pgsql/doc/src/sgml/ref/create_view.sgml,v 1.30 2005/02/02 06:35:59 neilc Exp $ PostgreSQL documentation --> @@ -20,7 +20,7 @@ PostgreSQL documentation <refsynopsisdiv> <synopsis> -CREATE [ OR REPLACE ] VIEW <replaceable class="PARAMETER">name</replaceable> [ ( <replaceable +CREATE [ OR REPLACE ] [ TEMP | TEMPORARY ] VIEW <replaceable class="PARAMETER">name</replaceable> [ ( <replaceable class="PARAMETER">column_name</replaceable> [, ...] ) ] AS <replaceable class="PARAMETER">query</replaceable> </synopsis> </refsynopsisdiv> @@ -43,10 +43,12 @@ class="PARAMETER">column_name</replaceable> [, ...] ) ] AS <replaceable class="P <para> If a schema name is given (for example, <literal>CREATE VIEW - myschema.myview ...</>) then the view is created in the - specified schema. Otherwise it is created in the current schema. - The view name must be distinct from the name of any other view, table, - sequence, or index in the same schema. + myschema.myview ...</>) then the view is created in the specified + schema. Otherwise it is created in the current schema. Temporary + views exist in a special schema, so a schema name may not be given + when creating a temporary view. The name of the view must be + distinct from the name of any other view, table, sequence, or index + in the same schema. </para> </refsect1> @@ -55,6 +57,28 @@ class="PARAMETER">column_name</replaceable> [, ...] ) ] AS <replaceable class="P <variablelist> <varlistentry> + <term><literal>TEMPORARY</> or <literal>TEMP</></term> + <listitem> + <para> + If specified, the view is created as a temporary view. + Temporary views are automatically dropped at the end of the + current session. Temporary views are automatically placed in the + current backend's local temporary schema, so it is illegal to + specify a schema-qualified name for a temporary view. Existing + permanent relations with the same name are not visible to the + current session while the temporary view exists, unless they are + referenced with schema-qualified names. + </para> + + <para> + If any of the base tables referenced by the view are temporary, + the view is created as a temporary view (whether + <literal>TEMPORARY</literal> is specified or not). + </para> + </listitem> + </varlistentry> + + <varlistentry> <term><replaceable class="parameter">name</replaceable></term> <listitem> <para> @@ -102,7 +126,8 @@ class="PARAMETER">column_name</replaceable> [, ...] ) ] AS <replaceable class="P </para> <para> - Use the <command>DROP VIEW</command> statement to drop views. + Use the <xref linkend="sql-dropview" endterm="sql-dropview-title"> + statement to drop views. </para> <para> @@ -153,7 +178,7 @@ CREATE VIEW comedies AS <synopsis> CREATE VIEW <replaceable class="parameter">name</replaceable> [ ( <replaceable class="parameter">column</replaceable> [, ...] ) ] AS query - [ WITH [ CASCADE | LOCAL ] CHECK OPTION ] + [ WITH [ CASCADED | LOCAL ] CHECK OPTION ] </synopsis> </para> @@ -184,12 +209,12 @@ CREATE VIEW <replaceable class="parameter">name</replaceable> [ ( <replaceable c </varlistentry> <varlistentry> - <term><literal>CASCADE</literal></term> + <term><literal>CASCADED</literal></term> <listitem> <para> Check for integrity on this view and on any dependent - view. <literal>CASCADE</> is assumed if neither - <literal>CASCADE</> nor <literal>LOCAL</> is specified. + view. <literal>CASCADED</> is assumed if neither + <literal>CASCADED</> nor <literal>LOCAL</> is specified. </para> </listitem> </varlistentry> |