aboutsummaryrefslogtreecommitdiff
path: root/doc/src
diff options
context:
space:
mode:
Diffstat (limited to 'doc/src')
-rw-r--r--doc/src/sgml/ref/create_rule.sgml25
-rw-r--r--doc/src/sgml/ref/create_view.sgml21
-rw-r--r--doc/src/sgml/release.sgml3
3 files changed, 36 insertions, 13 deletions
diff --git a/doc/src/sgml/ref/create_rule.sgml b/doc/src/sgml/ref/create_rule.sgml
index 86046359b4a..998d075a645 100644
--- a/doc/src/sgml/ref/create_rule.sgml
+++ b/doc/src/sgml/ref/create_rule.sgml
@@ -1,5 +1,5 @@
<!--
-$Header: /cvsroot/pgsql/doc/src/sgml/ref/create_rule.sgml,v 1.36 2002/05/18 15:44:47 petere Exp $
+$Header: /cvsroot/pgsql/doc/src/sgml/ref/create_rule.sgml,v 1.37 2002/09/02 20:04:39 tgl Exp $
PostgreSQL documentation
-->
@@ -21,17 +21,15 @@ PostgreSQL documentation
<date>2001-01-05</date>
</refsynopsisdivinfo>
<synopsis>
-CREATE RULE <replaceable class="parameter">name</replaceable> AS ON <replaceable class="parameter">event</replaceable>
+CREATE [ OR REPLACE ] RULE <replaceable class="parameter">name</replaceable> AS ON <replaceable class="parameter">event</replaceable>
TO <replaceable class="parameter">table</replaceable> [ WHERE <replaceable class="parameter">condition</replaceable> ]
DO [ INSTEAD ] <replaceable class="parameter">action</replaceable>
where <replaceable class="PARAMETER">action</replaceable> can be:
NOTHING
-|
-<replaceable class="parameter">query</replaceable>
-|
-( <replaceable class="parameter">query</replaceable> ; <replaceable class="parameter">query</replaceable> ... )
+| <replaceable class="parameter">query</replaceable>
+| ( <replaceable class="parameter">query</replaceable> ; <replaceable class="parameter">query</replaceable> ... )
</synopsis>
<refsect2 id="R2-SQL-CREATERULE-1">
@@ -76,9 +74,10 @@ NOTHING
<term><replaceable class="parameter">condition</replaceable></term>
<listitem>
<para>
- Any SQL conditional expression (returning <type>boolean</type>). The condition expression may not
+ Any SQL conditional expression (returning <type>boolean</type>).
+ The condition expression may not
refer to any tables except <literal>new</literal> and
- <literal>old</literal>.
+ <literal>old</literal>, and may not contain aggregate functions.
</para>
</listitem>
</varlistentry>
@@ -143,6 +142,14 @@ CREATE RULE
</title>
<para>
+ <command>CREATE RULE</command> defines a new rule applying to a specified
+ table or view.
+ <command>CREATE OR REPLACE RULE</command> will either create a
+ new rule, or replace an existing rule of the same name for the same
+ table.
+ </para>
+
+ <para>
The <productname>PostgreSQL</productname>
<firstterm>rule system</firstterm> allows one to define an
alternate action to be performed on inserts, updates, or deletions
@@ -318,7 +325,7 @@ UPDATE mytable SET name = 'foo' WHERE id = 42;
</title>
<para>
- <command>CREATE RULE</command> statement is a <productname>PostgreSQL</productname>
+ <command>CREATE RULE</command> is a <productname>PostgreSQL</productname>
language extension.
There is no <command>CREATE RULE</command> statement in <acronym>SQL92</acronym>.
</para>
diff --git a/doc/src/sgml/ref/create_view.sgml b/doc/src/sgml/ref/create_view.sgml
index aa7c869285f..1692f9f0f77 100644
--- a/doc/src/sgml/ref/create_view.sgml
+++ b/doc/src/sgml/ref/create_view.sgml
@@ -1,5 +1,5 @@
<!--
-$Header: /cvsroot/pgsql/doc/src/sgml/ref/create_view.sgml,v 1.18 2002/05/18 15:44:47 petere Exp $
+$Header: /cvsroot/pgsql/doc/src/sgml/ref/create_view.sgml,v 1.19 2002/09/02 20:04:39 tgl Exp $
PostgreSQL documentation
-->
@@ -21,7 +21,7 @@ PostgreSQL documentation
<date>2000-03-25</date>
</refsynopsisdivinfo>
<synopsis>
-CREATE VIEW <replaceable class="PARAMETER">view</replaceable> [ ( <replaceable
+CREATE [ OR REPLACE ] VIEW <replaceable class="PARAMETER">view</replaceable> [ ( <replaceable
class="PARAMETER">column name list</replaceable> ) ] AS SELECT <replaceable class="PARAMETER">query</replaceable>
</synopsis>
@@ -132,14 +132,22 @@ CREATE VIEW vista AS SELECT text 'Hello World'
<title>
Description
</title>
+
<para>
- <command>CREATE VIEW</command> will define a view of a query.
+ <command>CREATE VIEW</command> defines a view of a query.
The view is not physically materialized. Instead, a query
rewrite rule (an <literal>ON SELECT</> rule) is automatically generated to
support SELECT operations on views.
</para>
<para>
+ <command>CREATE OR REPLACE VIEW</command> is similar, but if a view
+ of the same name already exists, it is replaced. You can only replace
+ a view with a new query that generates the identical set of columns
+ (i.e., same column names and data types).
+ </para>
+
+ <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 one
@@ -206,6 +214,7 @@ SELECT * FROM kinds;
<title>
SQL92
</title>
+
<para>
SQL92 specifies some additional capabilities for the
<command>CREATE VIEW</command> statement:
@@ -253,6 +262,12 @@ CREATE VIEW <replaceable class="parameter">view</replaceable> [ <replaceable cla
</varlistentry>
</variablelist>
</para>
+
+ <para>
+ <command>CREATE OR REPLACE VIEW</command> is a
+ <productname>PostgreSQL</productname> language extension.
+ </para>
+
</refsect2>
</refsect1>
</refentry>
diff --git a/doc/src/sgml/release.sgml b/doc/src/sgml/release.sgml
index 3ba21bc1ab7..d0fc445380c 100644
--- a/doc/src/sgml/release.sgml
+++ b/doc/src/sgml/release.sgml
@@ -1,5 +1,5 @@
<!--
-$Header: /cvsroot/pgsql/doc/src/sgml/release.sgml,v 1.156 2002/08/30 22:18:05 tgl Exp $
+$Header: /cvsroot/pgsql/doc/src/sgml/release.sgml,v 1.157 2002/09/02 20:04:39 tgl Exp $
-->
<appendix id="release">
@@ -24,6 +24,7 @@ CDATA means the content is "SGML-free", so you can write without
worries about funny characters.
-->
<literallayout><![CDATA[
+CREATE OR REPLACE VIEW, CREATE OR REPLACE RULE are available
No-autocommit mode is available (set autocommit to off)
Substantial improvements in functionality for functions returning sets
Client libraries older than 6.3 no longer supported (version 0 protocol removed)