summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
Diffstat (limited to 'doc')
-rw-r--r--doc/FAQ_DEV18
-rw-r--r--doc/src/sgml/advanced.sgml84
-rw-r--r--doc/src/sgml/catalogs.sgml4
-rw-r--r--doc/src/sgml/inherit.sgml89
-rw-r--r--doc/src/sgml/ref/alter_table.sgml24
-rw-r--r--doc/src/sgml/ref/create_table.sgml14
-rw-r--r--doc/src/sgml/ref/delete.sgml10
-rw-r--r--doc/src/sgml/ref/select.sgml11
-rw-r--r--doc/src/sgml/ref/set.sgml39
-rw-r--r--doc/src/sgml/ref/update.sgml10
-rw-r--r--doc/src/sgml/syntax.sgml9
11 files changed, 194 insertions, 118 deletions
diff --git a/doc/FAQ_DEV b/doc/FAQ_DEV
index 22ba1db46ea..e55d2c5ea6b 100644
--- a/doc/FAQ_DEV
+++ b/doc/FAQ_DEV
@@ -90,16 +90,14 @@ s
M-x set-variable tab-width
or
; Cmd to set tab stops &etc for working with PostgreSQL code
- (defun pgsql-mode ()
- "Set PostgreSQL C indenting conventions in current buffer."
- (interactive)
- (c-mode) ; necessary to make c-set
--offset local!
- (setq tab-width 4) ; already buffer-local
- ; (setq comment-column 48) ; already buffer-local
- (c-set-style "bsd")
- (c-set-offset 'case-label '+)
- )
+ (c-add-style "pgsql"
+ '("bsd"
+ (indent-tabs-mode . t)
+ (c-basic-offset . 4)
+ (tab-width . 4)
+ (c-offsets-alist .
+ ((case-label . +))))
+ t) ; t = set this mode on
and add this to your autoload list (modify file path in macro):
diff --git a/doc/src/sgml/advanced.sgml b/doc/src/sgml/advanced.sgml
index d7032f2a102..a76e4cc7800 100644
--- a/doc/src/sgml/advanced.sgml
+++ b/doc/src/sgml/advanced.sgml
@@ -1,5 +1,5 @@
<!--
-$Header: /cvsroot/pgsql/doc/src/sgml/advanced.sgml,v 1.12 2000/05/02 20:01:51 thomas Exp $
+$Header: /cvsroot/pgsql/doc/src/sgml/advanced.sgml,v 1.13 2000/06/09 01:43:55 momjian Exp $
-->
<chapter id="advanced">
@@ -35,7 +35,7 @@ CREATE TABLE cities (
CREATE TABLE capitals (
state char(2)
-) INHERITS (cities);
+) UNDER cities;
</programlisting>
In this case, an instance of capitals <firstterm>inherits</firstterm> all
@@ -60,14 +60,20 @@ CREATE TABLE capitals (
</para>
</note>
- For example, the following query finds
- all the cities that are situated at an attitude of 500ft or higher:
-
- <programlisting>
-SELECT name, altitude
- FROM cities
- WHERE altitude &gt; 500;
+ <para>
+ For example, the following query finds the names of all cities,
+ including state capitals, that are located at an altitude
+ over 500ft, the query is:
+
+ <programlisting>
+ SELECT c.name, c.altitude
+ FROM cities c
+ WHERE c.altitude > 500;
+ </programlisting>
+
+ which returns:
+ <programlisting>
+----------+----------+
|name | altitude |
+----------+----------+
@@ -75,23 +81,21 @@ SELECT name, altitude
+----------+----------+
|Mariposa | 1953 |
+----------+----------+
- </programlisting>
- </para>
+|Madison | 845 |
++----------+----------+
+ </programlisting>
+ </para>
- <para>
- On the other hand, to find the names of all cities,
- including state capitals, that are located at an altitude
- over 500ft, the query is:
+ <para>
+ On the other hand, the following query finds
+ all the cities, but not capital cities
+ that are situated at an attitude of 500ft or higher:
- <programlisting>
-SELECT c.name, c.altitude
- FROM cities* c
- WHERE c.altitude > 500;
- </programlisting>
+ <programlisting>
+ SELECT name, altitude
+ FROM ONLY cities
+ WHERE altitude &gt; 500;
- which returns:
-
- <programlisting>
+----------+----------+
|name | altitude |
+----------+----------+
@@ -99,18 +103,30 @@ SELECT c.name, c.altitude
+----------+----------+
|Mariposa | 1953 |
+----------+----------+
-|Madison | 845 |
-+----------+----------+
- </programlisting>
+ </programlisting>
+ </para>
- Here the "*" after cities indicates that the query should
- be run over cities and all classes below cities in the
- inheritance hierarchy. Many of the commands that we
- have already discussed (<command>SELECT</command>,
- <command>UPDATE</command> and <command>DELETE</command>)
- support this inheritance notation using "*" as do other commands like
- <command>ALTER</command>.
- </para>
+
+ Here the <quote>ONLY</quote> before cities indicates that the query should
+ be run over only cities and not classes below cities in the
+ inheritance hierarchy. Many of the commands that we
+ have already discussed -- <command>SELECT</command>,
+ <command>UPDATE</command> and <command>DELETE</command> --
+ support this <quote>ONLY</quote> notation.
+ </para>
+ <para>
+ Deprecated: In previous versions of postgres, the default was not to
+ get access to child classes. By experience this was found to be error
+ prone. Under the old syntax, to get the sub-classes you append "*"
+ to the table name. For example
+ <programlisting>
+ SELECT * from cities*;
+ </programlisting>
+ This old behaviour is still available by using a SET command...
+ <programlisting>
+ SET EXAMINE_SUBCLASS TO on;
+ </programlisting>
+ </para>
</sect1>
<sect1>
diff --git a/doc/src/sgml/catalogs.sgml b/doc/src/sgml/catalogs.sgml
index e0009a17c29..91cea30605f 100644
--- a/doc/src/sgml/catalogs.sgml
+++ b/doc/src/sgml/catalogs.sgml
@@ -1,6 +1,6 @@
.\" This is -*-nroff-*-
.\" XXX standard disclaimer belongs here....
-.\" $Header: /cvsroot/pgsql/doc/src/sgml/catalogs.sgml,v 2.5 2000/02/17 03:39:39 tgl Exp $
+.\" $Header: /cvsroot/pgsql/doc/src/sgml/catalogs.sgml,v 2.6 2000/06/09 01:43:56 momjian Exp $
.TH "SYSTEM CATALOGS" INTRO 03/13/94 PostgreSQL PostgreSQL
.SH "Section 7 - System Catalogs"
.de LS
@@ -191,6 +191,8 @@ pg_class
2=main memory */
int2vector relkey /* - unused */
oidvector relkeyop /* - unused */
+ bool relhassubclass /* does the class have a subclass?
+ */
aclitem relacl[1] /* access control lists */
.fi
.nf M
diff --git a/doc/src/sgml/inherit.sgml b/doc/src/sgml/inherit.sgml
index f50c4bb34dd..0fa3f79be38 100644
--- a/doc/src/sgml/inherit.sgml
+++ b/doc/src/sgml/inherit.sgml
@@ -1,5 +1,5 @@
<!--
-$Header: /cvsroot/pgsql/doc/src/sgml/Attic/inherit.sgml,v 1.7 2000/05/02 20:01:51 thomas Exp $
+$Header: /cvsroot/pgsql/doc/src/sgml/Attic/inherit.sgml,v 1.8 2000/06/09 01:43:56 momjian Exp $
-->
<chapter id="inherit">
@@ -17,9 +17,9 @@ CREATE TABLE cities (
altitude int -- (in ft)
);
-CREATE TABLE capitals (
+CREATE TABLE capitals UNDER cities (
state char(2)
-) INHERITS (cities);
+);
</programlisting>
In this case, an instance of capitals <firstterm>inherits</firstterm> all
@@ -41,50 +41,71 @@ CREATE TABLE capitals (
</para>
</note>
- For example, the following query finds
- all the cities that are situated at an attitude of 500ft or higher:
-
-<programlisting>
-SELECT name, altitude
- FROM cities
- WHERE altitude &gt; 500;
-
- name | altitude
------------+----------
- Las Vegas | 2174
- Mariposa | 1953
-(2 rows)
-</programlisting>
- </para>
-
<para>
- On the other hand, to find the names of all cities,
+ For example, the following query finds the names of all cities,
including state capitals, that are located at an altitude
over 500ft, the query is:
-<programlisting>
-SELECT c.name, c.altitude
- FROM cities* c
+ <programlisting>
+ SELECT c.name, c.altitude
+ FROM cities c
WHERE c.altitude > 500;
</programlisting>
which returns:
-<programlisting>
- name | altitude
------------+----------
- Las Vegas | 2174
- Mariposa | 1953
- Madison | 845
-</programlisting>
+ <programlisting>
++----------+----------+
+|name | altitude |
++----------+----------+
+|Las Vegas | 2174 |
++----------+----------+
+|Mariposa | 1953 |
++----------+----------+
+|Madison | 845 |
++----------+----------+
+ </programlisting>
+ </para>
+
+ <para>
+ On the other hand, the following query finds
+ all the cities, but not capital cities
+ that are situated at an attitude of 500ft or higher:
+
+ <programlisting>
+ SELECT name, altitude
+ FROM ONLY cities
+ WHERE altitude &gt; 500;
- Here the "*" after cities indicates that the query should
- be run over cities and all classes below cities in the
++----------+----------+
+|name | altitude |
++----------+----------+
+|Las Vegas | 2174 |
++----------+----------+
+|Mariposa | 1953 |
++----------+----------+
+ </programlisting>
+ </para>
+
+ Here the <quote>ONLY</quote> before cities indicates that the query should
+ be run over only cities and not classes below cities in the
inheritance hierarchy. Many of the commands that we
have already discussed -- <command>SELECT</command>,
<command>UPDATE</command> and <command>DELETE</command> --
- support this "*" notation, as do others, like
- <command>ALTER TABLE</command>.
+ support this <quote>ONLY</quote> notation.
+ </para>
+ <para>
+ Deprecated: In previous versions of postgres, the default was not to
+ get access to child classes. By experience this was found to be error
+ prone. Under the old syntax, to get the sub-classes you append "*"
+ to the table name. For example
+ <programlisting>
+ SELECT * from cities*;
+ </programlisting>
+ This old behaviour is still available by using a SET command...
+ <programlisting>
+ SET EXAMINE_SUBCLASS TO on;
+ </programlisting>
</para>
</chapter>
diff --git a/doc/src/sgml/ref/alter_table.sgml b/doc/src/sgml/ref/alter_table.sgml
index 8305f75d28e..91f08a7885c 100644
--- a/doc/src/sgml/ref/alter_table.sgml
+++ b/doc/src/sgml/ref/alter_table.sgml
@@ -1,5 +1,5 @@
<!--
-$Header: /cvsroot/pgsql/doc/src/sgml/ref/alter_table.sgml,v 1.12 2000/04/11 14:43:54 momjian Exp $
+$Header: /cvsroot/pgsql/doc/src/sgml/ref/alter_table.sgml,v 1.13 2000/06/09 01:43:57 momjian Exp $
Postgres documentation
-->
@@ -23,10 +23,10 @@ Postgres documentation
<date>1999-07-20</date>
</refsynopsisdivinfo>
<synopsis>
-ALTER TABLE <replaceable class="PARAMETER">table</replaceable> [ * ]
+ALTER TABLE [ ONLY ]<replaceable class="PARAMETER">table</replaceable> [ * ]
ADD [ COLUMN ] <replaceable class="PARAMETER">column</replaceable> <replaceable
class="PARAMETER">type</replaceable>
-ALTER TABLE <replaceable class="PARAMETER">table</replaceable> [ * ]
+ALTER TABLE [ ONLY ]<replaceable class="PARAMETER">table</replaceable> [ * ]
ALTER [ COLUMN ] <replaceable class="PARAMETER">column</replaceable> { SET DEFAULT <replaceable
class="PARAMETER">value</replaceable> | DROP DEFAULT }
ALTER TABLE <replaceable class="PARAMETER">table</replaceable> [ * ]
@@ -176,24 +176,6 @@ ALTER TABLE <replaceable class="PARAMETER">table</replaceable>
</para>
<para>
- <quote>*</quote> following a name of a table indicates that the statement
- should be run over that table and all tables below it in the
- inheritance hierarchy;
- by default, the attribute will not be added to or renamed in any of the subclasses.
-
- This should always be done when adding or modifying an attribute in a
- superclass. If it is not, queries on the inheritance hierarchy
- such as
-
- <programlisting>
-SELECT <replaceable>NewColumn</replaceable> FROM <replaceable>SuperClass</replaceable>*
- </programlisting>
-
- will not work because the subclasses will be missing an attribute
- found in the superclass.
- </para>
-
- <para>
In the current implementation, default and constraint clauses for the
new column will be ignored. You can use the <literal>SET DEFAULT</literal>
form of <command>ALTER TABLE</command> to set the default later.
diff --git a/doc/src/sgml/ref/create_table.sgml b/doc/src/sgml/ref/create_table.sgml
index 0e77618799f..ce113a3efe2 100644
--- a/doc/src/sgml/ref/create_table.sgml
+++ b/doc/src/sgml/ref/create_table.sgml
@@ -1,5 +1,5 @@
<!--
-$Header: /cvsroot/pgsql/doc/src/sgml/ref/create_table.sgml,v 1.29 2000/05/02 20:02:03 thomas Exp $
+$Header: /cvsroot/pgsql/doc/src/sgml/ref/create_table.sgml,v 1.30 2000/06/09 01:43:57 momjian Exp $
Postgres documentation
-->
@@ -31,7 +31,7 @@ CREATE [ TEMPORARY | TEMP ] TABLE <replaceable class="PARAMETER">table</replacea
[, PRIMARY KEY ( <replaceable class="PARAMETER">column</replaceable> [, ...] ) ]
[, CHECK ( <replaceable class="PARAMETER">condition</replaceable> ) ]
[, <replaceable>table_constraint_clause</replaceable> ]
- ) [ INHERITS ( <replaceable>inherited_table</replaceable> [, ...] ) ]
+ ) [ UNDER <replaceable>inherited_table</replaceable> [, ...] ]
</synopsis>
<refsect2 id="R2-SQL-CREATETABLE-1">
@@ -130,10 +130,10 @@ CREATE [ TEMPORARY | TEMP ] TABLE <replaceable class="PARAMETER">table</replacea
</varlistentry>
<varlistentry>
- <term>INHERITS <replaceable class="PARAMETER">inherited_table</replaceable></term>
+ <term>UNDER <replaceable class="PARAMETER">inherited_table</replaceable></term>
<listitem>
<para>
- The optional INHERITS clause specifies a collection of table
+ The optional UNDER clause specifies a collection of table
names from which this table automatically inherits all fields.
If any inherited field name appears more than once,
<productname>Postgres</productname>
@@ -229,7 +229,7 @@ ERROR: DEFAULT: type mismatched
</para>
<para>
- The optional INHERITS
+ The optional UNDER
clause specifies a collection of class names from which this class
automatically inherits all fields. If any inherited field name
appears more than once, Postgres reports an error. Postgres automatically
@@ -1838,8 +1838,8 @@ CREATE TABLE distributors (
Notes
</title>
<para>
- CREATE TABLE/INHERITS is a <productname>Postgres</productname>
- language extension.
+ CREATE TABLE/UNDER is defined by SQL3. Multiple inheritance is a
+ <productname>Postgres</productname> language extension.
</para>
</refsect2>
diff --git a/doc/src/sgml/ref/delete.sgml b/doc/src/sgml/ref/delete.sgml
index f53b87280df..82f29853b29 100644
--- a/doc/src/sgml/ref/delete.sgml
+++ b/doc/src/sgml/ref/delete.sgml
@@ -1,5 +1,5 @@
<!--
-$Header: /cvsroot/pgsql/doc/src/sgml/ref/delete.sgml,v 1.10 2000/03/26 18:32:27 petere Exp $
+$Header: /cvsroot/pgsql/doc/src/sgml/ref/delete.sgml,v 1.11 2000/06/09 01:44:00 momjian Exp $
Postgres documentation
-->
@@ -24,7 +24,7 @@ Postgres documentation
<date>1999-07-20</date>
</refsynopsisdivinfo>
<synopsis>
-DELETE FROM <replaceable class="PARAMETER">table</replaceable> [ WHERE <replaceable class="PARAMETER">condition</replaceable> ]
+DELETE FROM [ ONLY ] <replaceable class="PARAMETER">table</replaceable> [ WHERE <replaceable class="PARAMETER">condition</replaceable> ]
</synopsis>
<refsect2 id="R2-SQL-DELETE-1">
@@ -119,6 +119,12 @@ DELETE <replaceable class="parameter">count</replaceable>
</para>
<para>
+ By default DELETE will delete tuples in the table specified
+ and all its sub-classes. If you wish to only update the
+ specific table mentioned, you should use the ONLY clause.
+ </para>
+
+ <para>
You must have write access to the table in order to modify
it, as well as read access to any table whose values are
read in the <replaceable class="parameter">condition</replaceable>.
diff --git a/doc/src/sgml/ref/select.sgml b/doc/src/sgml/ref/select.sgml
index ab379f72f6a..8b21a3438d3 100644
--- a/doc/src/sgml/ref/select.sgml
+++ b/doc/src/sgml/ref/select.sgml
@@ -1,5 +1,5 @@
<!--
-$Header: /cvsroot/pgsql/doc/src/sgml/ref/select.sgml,v 1.28 2000/03/27 17:14:43 thomas Exp $
+$Header: /cvsroot/pgsql/doc/src/sgml/ref/select.sgml,v 1.29 2000/06/09 01:44:00 momjian Exp $
Postgres documentation
-->
@@ -25,7 +25,7 @@ Postgres documentation
SELECT [ ALL | DISTINCT [ ON ( <replaceable class="PARAMETER">expression</replaceable> [, ...] ) ] ]
<replaceable class="PARAMETER">expression</replaceable> [ AS <replaceable class="PARAMETER">name</replaceable> ] [, ...]
[ INTO [ TEMPORARY | TEMP ] [ TABLE ] <replaceable class="PARAMETER">new_table</replaceable> ]
- [ FROM <replaceable class="PARAMETER">table</replaceable> [ <replaceable class="PARAMETER">alias</replaceable> ] [, ...] ]
+ [ FROM [ ONLY ]<replaceable class="PARAMETER">table</replaceable> [ <replaceable class="PARAMETER">alias</replaceable> ] [, ...] ]
[ WHERE <replaceable class="PARAMETER">condition</replaceable> ]
[ GROUP BY <replaceable class="PARAMETER">column</replaceable> [, ...] ]
[ HAVING <replaceable class="PARAMETER">condition</replaceable> [, ...] ]
@@ -203,6 +203,13 @@ SELECT [ ALL | DISTINCT [ ON ( <replaceable class="PARAMETER">expression</replac
if WHERE is omitted, all rows are candidates.
(See <xref linkend="sql-where" endterm="sql-where-title">.)
</para>
+ <para>
+ <command>ONLY</command> will eliminate rows from subclasses of the table.
+ This was previously the default result, and getting subclasses was
+ obtained by appending <command>*</command> to the table name.
+ The old behaviour is available via the command
+ <command>SET EXAMINE_SUBCLASS TO 'on';</command>
+ </para>
<para>
<command>DISTINCT</command> will eliminate duplicate rows from the
diff --git a/doc/src/sgml/ref/set.sgml b/doc/src/sgml/ref/set.sgml
index 6640f015131..3d3884dd305 100644
--- a/doc/src/sgml/ref/set.sgml
+++ b/doc/src/sgml/ref/set.sgml
@@ -1,5 +1,9 @@
<!--
-$Header: /cvsroot/pgsql/doc/src/sgml/ref/set.sgml,v 1.43 2000/05/18 14:24:33 momjian Exp $
+<<<<<<< set.sgml
+$Header: /cvsroot/pgsql/doc/src/sgml/ref/set.sgml,v 1.44 2000/06/09 01:44:00 momjian Exp $
+=======
+$Header: /cvsroot/pgsql/doc/src/sgml/ref/set.sgml,v 1.44 2000/06/09 01:44:00 momjian Exp $
+>>>>>>> 1.43
Postgres documentation
-->
@@ -554,6 +558,39 @@ SELECT setseed(<replaceable>value</replaceable>);
</varlistentry>
<varlistentry>
+ <term>EXAMINE_SUBCLASS</term>
+ <listitem>
+ <para>
+ Changes the behaviour of SELECT so that it no longer automatically
+ examines sub-classes. (See SELECT). By default a SELECT on a table
+ will also return subclass tuples unless specifying ONLY tablename.
+ Setting this returns postgres to the traditional behaviour of
+ only returning subclasses when appending "*" to the tablename.
+ <variablelist>
+ <varlistentry>
+ <term>ON</term>
+ <listitem>
+ <para>
+ Returns SELECT to the behaviour of automatically returning
+ results from sub-classes.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>OFF</term>
+ <listitem>
+ <para>
+ Prevents SELECT from returning sub-classes unless the "*" follows the table name
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
<term>ENABLE_SEQSCAN</term>
<listitem>
<para>
diff --git a/doc/src/sgml/ref/update.sgml b/doc/src/sgml/ref/update.sgml
index ff668a6254f..85da5c1f2d2 100644
--- a/doc/src/sgml/ref/update.sgml
+++ b/doc/src/sgml/ref/update.sgml
@@ -1,5 +1,5 @@
<!--
-$Header: /cvsroot/pgsql/doc/src/sgml/ref/update.sgml,v 1.9 2000/04/11 05:39:15 thomas Exp $
+$Header: /cvsroot/pgsql/doc/src/sgml/ref/update.sgml,v 1.10 2000/06/09 01:44:00 momjian Exp $
Postgres documentation
-->
@@ -23,7 +23,7 @@ Postgres documentation
<date>1999-07-20</date>
</refsynopsisdivinfo>
<synopsis>
-UPDATE <replaceable class="PARAMETER">table</replaceable> SET <replaceable class="PARAMETER">col</replaceable> = <replaceable class="PARAMETER">expression</replaceable> [, ...]
+UPDATE [ ONLY ] <replaceable class="PARAMETER">table</replaceable> SET <replaceable class="PARAMETER">col</replaceable> = <replaceable class="PARAMETER">expression</replaceable> [, ...]
[ FROM <replaceable class="PARAMETER">fromlist</replaceable> ]
[ WHERE <replaceable class="PARAMETER">condition</replaceable> ]
</synopsis>
@@ -140,6 +140,12 @@ UPDATE <replaceable class="parameter">#</replaceable>
it, as well as read access to any table whose values are
mentioned in the WHERE condition.
</para>
+
+ <para>
+ By default UPDATE will update tuples in the table specified
+ and all its sub-classes. If you wish to only update the
+ specific table mentioned, you should use the ONLY clause.
+ </para>
</refsect1>
<refsect1 id="R1-SQL-UPDATE-2">
diff --git a/doc/src/sgml/syntax.sgml b/doc/src/sgml/syntax.sgml
index 7a7f75a875a..f07da189173 100644
--- a/doc/src/sgml/syntax.sgml
+++ b/doc/src/sgml/syntax.sgml
@@ -1,5 +1,5 @@
<!--
-$Header: /cvsroot/pgsql/doc/src/sgml/syntax.sgml,v 1.20 2000/05/02 20:01:53 thomas Exp $
+$Header: /cvsroot/pgsql/doc/src/sgml/syntax.sgml,v 1.21 2000/06/09 01:43:56 momjian Exp $
-->
<chapter id="syntax">
@@ -854,9 +854,10 @@ sqrt(emp.salary)
defines one or more instance variables to range over the class
indicated in <replaceable>class_reference</replaceable>.
One can also request
- the instance variable to range over all classes that are beneath the
- indicated class in the inheritance hierarchy by postpending the
- designator asterisk ("*").
+ the instance variable to range over only the specific class
+ and not those that are beneath the
+ indicated class in the inheritance hierarchy by specifying ONLY before
+ before the classname.
</para>
</sect2>
</sect1>