<Quote>[*]</Quote> following a name of a table indicates that statement
should be run over that table and all tables below it in the
inheritance hierarchy.
- The PostgreSQL User's Guide has further
+ The <citetitle>PostgreSQL User's Guide</citetitle> has further
information on inheritance.
<PARA>
<LISTITEM>
<PARA>
Causes the system to check for
- duplicate values when the index is created (if data
+ duplicate values in the table when the index is created (if data
already exist) and each time data is added. Attempts to
insert or update non-duplicate data will generate an
error.
<PARA>
the name of the access method which is to be used for
the index. The default access method is BTREE.
- Postgres provides three access methods for secondary indices:
+ Postgres provides three access methods for secondary indexes:
<variablelist>
<varlistentry>
<term>BTREE</term>
Description
</TITLE>
<PARA>
- This command constructs an index
+ <command>CREATE INDEX</command> constructs an index
<replaceable class="parameter">index_name</replaceable>.
on the specified
<replaceable class="parameter">table</replaceable>.
<tip>
<para>
-Indices are primarily used to enhance database performance.
+Indexes are primarily used to enhance database performance.
But inappropriate use will result in slower performance.
</tip>
on the result of a user-defined function
<replaceable class="parameter">func_name</replaceable> applied
to one or more attributes of a single class. These functional
- indices can be used to obtain fast access to data
+ indexes can be used to obtain fast access to data
based on operators that would normally require some
transformation to apply them to the base data.
</para>
</TITLE>
<PARA>
Currently, only the BTREE access method supports multi-column
- indices. Up to 7 keys may be specified.
+ indexes. Up to 7 keys may be specified.
</PARA>
<para>
Use <command>DROP INDEX</command>
<PARA>
<function> TRUSTED</function> specifies that the call handler for
the language is safe; that is, it offers an unprivileged user
- no functionality to get around access restrictions. If
+ no functionality to bypass access restrictions. If
this keyword is omitted when registering the language,
- only users with the PostgreSQL superuser privilege can use
+ only users with the <productname>Postgres</productname>
+superuser privilege can use
this language to create new functions
(like the 'C' language).
</PARA>
The name of the new procedural language.
The language name is case insensitive. A procedural
language cannot override one of the built-in languages of
- PostgreSQL.
+ <productname>Postgres</productname>.
</PARA>
</LISTITEM>
</VARLISTENTRY>
<VARLISTENTRY>
<TERM>
- <replaceable class="parameter">call_handler</replaceable>
+ HANDLER <replaceable class="parameter">call_handler</replaceable>
</TERM>
<LISTITEM>
<PARA>
- The argument for <function>HANDLER</function> is the name
+ <replaceable class="parameter">call_handler</replaceable> is the name
of a previously
registered function that will be called to execute the PL
procedures.
inserted in the <literal>LANCOMPILER</literal> attribute
of the new
<filename>pg_language</filename> entry. At present,
- PostgreSQL doesn't use
+ <productname>Postgres</productname> does not use
this attribute in any way.
</PARA>
</LISTITEM>
SQL92
</TITLE>
<PARA>
- There is no <command>CREATE LANGUAGE</command> statement in SQL92.
+ There is no <command>CREATE LANGUAGE</command> statement in
+ <acronym>SQL92</acronym>.
</PARA>
</refsect2>
</refsect1>
<REFSYNOPSISDIV>
<REFSYNOPSISDIVINFO>
- <DATE>1998-04-15</DATE>
+ <DATE>1998-09-11</DATE>
</REFSYNOPSISDIVINFO>
<SYNOPSIS>
- CREATE TABLE <REPLACEABLE CLASS="PARAMETER">table</REPLACEABLE> (
- <REPLACEABLE CLASS="PARAMETER">column</REPLACEABLE> <REPLACEABLE CLASS="PARAMETER">type</REPLACEABLE> [DEFAULT <REPLACEABLE CLASS="PARAMETER">value</REPLACEABLE>] [CONSTRAINT <REPLACEABLE CLASS="PARAMETER">column_constraint</REPLACEABLE>] [, ...]
- [, <REPLACEABLE CLASS="PARAMETER">column</REPLACEABLE> ...]
- [, CONSTRAINT <REPLACEABLE CLASS="PARAMETER">table_constraint</REPLACEABLE>]
- ) [INHERITS ( <REPLACEABLE CLASS="PARAMETER">inherited_table</REPLACEABLE> [, ...] )]
+CREATE TABLE <REPLACEABLE CLASS="PARAMETER">table</REPLACEABLE> (
+ <REPLACEABLE CLASS="PARAMETER">column</REPLACEABLE> <REPLACEABLE CLASS="PARAMETER">type</REPLACEABLE> [ DEFAULT <REPLACEABLE CLASS="PARAMETER">value</REPLACEABLE> | <REPLACEABLE>column_constraint_clause</REPLACEABLE> | PRIMARY KEY } [ ... ] ]
+ [, ... ]
+ [, PRIMARY KEY ( <REPLACEABLE CLASS="PARAMETER">column</REPLACEABLE> [, ...] ) ]
+ [, <REPLACEABLE>table_constraint_clause</REPLACEABLE> ]
+ ) [ INHERITS ( <REPLACEABLE>inherited_table</REPLACEABLE> [, ...] ) ]
</SYNOPSIS>
<REFSECT2 ID="R2-SQL-CREATETABLE-1">
<REFSECT2INFO>
- <DATE>1998-04-15</DATE>
+ <DATE>1998-09-11</DATE>
</REFSECT2INFO>
<TITLE>
Inputs
</TITLE>
<PARA>
- </PARA>
<VARIABLELIST>
<VARLISTENTRY>
</TERM>
<LISTITEM>
<PARA>
- The type of the column.
- (Refer to the <ProductName>Postgres</ProductName> User's Guide for
- further information about data types).
+ The type of the column. This may include array specifiers.
+ Refer to the <citetitle>PostgreSQL User's Guide</citetitle> for
+ further information about data types and arrays.
</PARA>
</LISTITEM>
</VARLISTENTRY>
<VARLISTENTRY>
<TERM>
- <REPLACEABLE CLASS="PARAMETER">value</REPLACEABLE>
+ DEFAULT <REPLACEABLE CLASS="PARAMETER">value</REPLACEABLE>
</TERM>
<LISTITEM>
<PARA>
<VARLISTENTRY>
<TERM>
- <REPLACEABLE CLASS="PARAMETER">inherited_table</REPLACEABLE>
+ <REPLACEABLE>column_constraint_clause</REPLACEABLE>
</TERM>
<LISTITEM>
<PARA>
- The optional INHERITS clause specifies a collection of table
- names from which this table automatically inherits all fields.
- If any inherited field name appears more than once, PostgreSQL
- reports an error. PostgreSQL automatically allows the created
- table to inherit functions on tables above it in the inheritance
- hierarchy. Inheritance of functions is done according
- to the conventions of the Common Lisp Object System (CLOS).
+ The optional column constraint clause specifies a list of integrity
+ constraints which new or updated entries must satisfy for
+ an insert or update operation to succeed. Each constraint
+ must evaluate to a boolean expression. Although <acronym>SQL92</acronym>
+requires the <REPLACEABLE CLASS="PARAMETER">column_constraint_clause</REPLACEABLE>
+ to refer to that column only, <ProductName>Postgres</ProductName>
+ allows multiple columns
+ to be referenced within a single column constraint.
+ See the column constraint clause for more information.
</PARA>
</LISTITEM>
</VARLISTENTRY>
-
+
<VARLISTENTRY>
<TERM>
- <REPLACEABLE CLASS="PARAMETER">column_constraint</REPLACEABLE>
- <REPLACEABLE CLASS="PARAMETER">table_constraint</REPLACEABLE>
+ <REPLACEABLE>table_constraint_clause</REPLACEABLE>
</TERM>
<LISTITEM>
<PARA>
- The optional CONSTRAINT clause specifies a list of integrity
+ The optional table CONSTRAINT clause specifies a list of integrity
constraints which new or updated entries must satisfy for
an insert or update operation to succeed. Each constraint
must evaluate to a boolean expression. Multiple columns
may be referenced within a single constraint.
- See CONSTRAINT clause for more information.
+ See the table constraint clause for more information.
</PARA>
</LISTITEM>
</VARLISTENTRY>
+
+ <VARLISTENTRY>
+ <TERM>
+ INHERITS <REPLACEABLE CLASS="PARAMETER">inherited_table</REPLACEABLE>
+ </TERM>
+ <LISTITEM>
+ <PARA>
+ The optional INHERITS 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>
+ reports an error.
+ <productname>Postgres</productname> automatically allows the created
+ table to inherit functions on tables above it in the inheritance
+ hierarchy.
+<note>
+<title>Aside</title>
+<para>
+ Inheritance of functions is done according
+ to the conventions of the Common Lisp Object System (CLOS).
+</note>
+ </PARA>
+ </LISTITEM>
+ </VARLISTENTRY>
+
</VARIABLELIST>
<REFSECT2 ID="R2-SQL-CREATETABLE-2">
<REFSECT2INFO>
- <DATE>1998-04-15</DATE>
+ <DATE>1998-09-11</DATE>
</REFSECT2INFO>
<TITLE>
Outputs
Message returned if table creation failed.
This is usually accompanied by some descriptive text, such as:
<ProgramListing>
- amcreate: "<replaceable class="parameter">table</replaceable>" relation already exists
+amcreate: "<replaceable class="parameter">table</replaceable>" relation already exists
</ProgramListing>
which occurs at runtime, if the table specified already exists
in the database.
</PARA>
</LISTITEM>
</VARLISTENTRY>
+
+ <VARLISTENTRY>
+ <TERM>
+ <ReturnValue>ERROR: DEFAULT: type mismatched</ReturnValue>
+ </TERM>
+ <LISTITEM>
+ <PARA>
+ if data type of default value doesn't match the
+ column definition's data type.
+ </PARA>
+ </LISTITEM>
+ </VARLISTENTRY>
+
</VARIABLELIST>
</PARA>
</LISTITEM>
<REFSECT1 ID="R1-SQL-CREATETABLE-1">
<REFSECT1INFO>
- <DATE>1998-04-15</DATE>
+ <DATE>1998-09-11</DATE>
</REFSECT1INFO>
<TITLE>
Description
</TITLE>
<PARA>
- CREATE TABLE will enter a new table into the current data
+ <command>CREATE TABLE</command> will enter a new table into the current data
base. The table will be "owned" by the user issuing the
command.
a system catalog table.
</PARA>
- <REFSECT2 ID="R2-SQL-DEFAULTCLAUSE-1">
- <REFSECT2INFO>
- <DATE>1998-04-15</DATE>
- </REFSECT2INFO>
+
+ <REFSECT1 ID="R1-SQL-DEFAULTCLAUSE-1">
+ <REFSECT1INFO>
+ <DATE>1998-09-11</DATE>
+ </REFSECT1INFO>
<TITLE>
- DEFAULT clause
+ DEFAULT Clause
</TITLE>
<PARA>
<SYNOPSIS>
- DEFAULT <REPLACEABLE CLASS="PARAMETER">value</REPLACEABLE>
+DEFAULT <REPLACEABLE CLASS="PARAMETER">value</REPLACEABLE>
</SYNOPSIS>
- <PARA>
- The DEFAULT clause assigns a default data value to a column.
- </PARA>
- <VARIABLELIST>
- <VARLISTENTRY>
- <TERM>
- </TERM>
- <LISTITEM>
- <PARA>
+
+ <REFSECT2 ID="R2-SQL-DEFAULTCLAUSE-1">
+ <REFSECT2INFO>
+ <DATE>1998-09-11</DATE>
+ </REFSECT2INFO>
+ <TITLE>
+ Inputs
+ </TITLE>
+ <PARA>
<VARIABLELIST>
<VARLISTENTRY>
<TERM>
- <ReturnValue><replaceable class="parameter">value</replaceable></ReturnValue>
+ <replaceable class="parameter">value</replaceable>
</TERM>
<LISTITEM>
<PARA>
- The possible values for expression are:
+ The possible values for the default value expression are:
<itemizedlist>
<listitem>
<simpara>
</listitem>
</VARLISTENTRY>
- <VARLISTENTRY>
- <TERM>
- <ReturnValue>ERROR: DEFAULT: type mismatched</ReturnValue>
- </TERM>
- <LISTITEM>
- <PARA>
- if data type of default value doesn't match the
- column definition's data type.
- </PARA>
- </LISTITEM>
- </VARLISTENTRY>
</variablelist>
- <PARA>
+ <REFSECT2 ID="R2-SQL-DEFAULTCLAUSE-2">
+ <REFSECT2INFO>
+ <DATE>1998-09-11</DATE>
+ </REFSECT2INFO>
+ <TITLE>
+ Outputs
+ </TITLE>
+ <PARA>
+
+ <REFSECT2 ID="R2-SQL-DEFAULTCLAUSE-3">
+ <REFSECT2INFO>
+ <DATE>1998-09-11</DATE>
+ </REFSECT2INFO>
+ <TITLE>
+ Description
+ </TITLE>
+ <PARA>
The DEFAULT clause assigns a default data value to a column
(via a column definition in the CREATE TABLE statement).
The data type of a default value must match the column definition's
is the value of the specified function at the time of the INSERT.
</PARA>
<PARA>
- There are two types of niladic functions:<variablelist>
+ There are two types of niladic functions:
+<variablelist>
<varlistentry>
<term>niladic USER</term>
<listitem>
</listitem>
</varlistentry>
</variablelist>
- </LISTITEM>
- </VARLISTENTRY>
- </VARIABLELIST>
- </REFSECT2>
-
- <REFSECT2 ID="R2-SQL-NOTNULL-1">
+
+<para>
+In the current release (v6.4), <productname>Postgres</productname>
+evaluates all default expressions at the time the table is defined.
+Hence, functions which are "non-cacheable" such as
+ <function>CURRENT_TIMESTAMP</function> may not produce the desired
+effect. For the particular case of date/time types, one can work
+around this behavior by using
+<quote>
+DEFAULT TEXT 'now'
+</quote>
+instead of
+<quote>
+DEFAULT 'now'
+</quote>
+or
+<quote>
+DEFAULT CURRENT_TIMESTAMP
+</quote>.
+This forces <productname>Postgres</productname> to consider the constant a string
+type and then to convert the value to <type>timestamp</type> at runtime.
+
+ <REFSECT2 ID="R2-SQL-DEFAULTCLAUSE-4">
<REFSECT2INFO>
- <DATE>1998-04-15</DATE>
+ <DATE>1998-09-11</DATE>
</REFSECT2INFO>
<TITLE>
- NOT NULL constraint
+ Usage
+ </TITLE>
+ <PARA>
+ To assign a constant value as the default for the
+ columns <literal>did</literal> and <literal>number</literal>,
+ and a string literal to the column <literal>did</literal>:
+
+ <ProgramListing>
+CREATE TABLE video_sales (
+ did VARCHAR(40) DEFAULT 'luso films',
+ number INTEGER DEFAULT 0,
+ total CASH DEFAULT '$0.0'
+);
+ </ProgramListing>
+
+ <PARA>
+ To assign an existing sequence
+ as the default for the column <literal>did</literal>,
+ and a literal to the column <literal>name</literal>:
+
+ <ProgramListing>
+CREATE TABLE distributors (
+ did DECIMAL(3) DEFAULT NEXTVAL('serial'),
+ name VARCHAR(40) DEFAULT 'luso films'
+);
+ </ProgramListing>
+
+ </REFSECT1>
+
+ <REFSECT1 ID="R1-SQL-COLUMNCONSTRAINT-1">
+ <REFSECT1INFO>
+ <DATE>1998-09-11</DATE>
+ </REFSECT1INFO>
+ <TITLE>
+ Column CONSTRAINT Clause
</TITLE>
+ <para>
<SYNOPSIS>
- [ CONSTRAINT <replaceable class="parameter">name</replaceable> ] NOT NULL
+[ CONSTRAINT <replaceable class="parameter">name</replaceable> ] { NOT NULL | UNIQUE | PRIMARY KEY | CHECK <replaceable class="parameter">constraint</replaceable> } [, ...]
</SYNOPSIS>
+
+ <REFSECT2 ID="R2-SQL-COLUMNCONSTRAINT-1">
+ <REFSECT2INFO>
+ <DATE>1998-09-11</DATE>
+ </REFSECT2INFO>
+ <TITLE>
+ Inputs
+ </TITLE>
<PARA>
- The NOT NULL constraint specifies a rule that a column may
- contain only non-null values.
- </PARA>
- <PARA>
- The NOT NULL constraint is a column constraint.
- </PARA>
- <VARIABLELIST>
+ <VARIABLELIST>
+ <VARLISTENTRY>
+ <TERM>
+ <replaceable class="parameter">name</replaceable>
+ </TERM>
+ <LISTITEM>
+ <PARA>
+ An arbitrary name given to the integrity constraint.
+If <replaceable class="parameter">name</replaceable> is not specified,
+ it is generated from the table and column names,
+which should ensure uniqueness for
+ <replaceable class="parameter">name</replaceable>.
+ </PARA>
+ </LISTITEM>
+ </VARLISTENTRY>
+
<VARLISTENTRY>
<TERM>
+ NOT NULL
</TERM>
<LISTITEM>
<PARA>
- <VARIABLELIST>
+The column is not allowed to contain NULL values.
+This is equivalent to the column constraint
+ CHECK (<REPLACEABLE CLASS="PARAMETER">column</REPLACEABLE> NOT NULL).
+ </PARA>
+ </LISTITEM>
+ </VARLISTENTRY>
+
+ <VARLISTENTRY>
+ <TERM>
+ UNIQUE
+ </TERM>
+ <LISTITEM>
+ <PARA>
+The column must have unique values. In <ProductName>Postgres</ProductName>
+this is enforced by an implicit creation of a unique index on the table.
+ </PARA>
+ </LISTITEM>
+ </VARLISTENTRY>
+
+ <VARLISTENTRY>
+ <TERM>
+ PRIMARY KEY
+ </TERM>
+ <LISTITEM>
+ <PARA>
+ This column is a primary key, which implies that uniqueness is
+enforced by the system and that other tables may rely on this column
+as a unique identifier for rows.
+ See PRIMARY KEY for more information.
+ </PARA>
+ </LISTITEM>
+ </VARLISTENTRY>
+
<VARLISTENTRY>
<TERM>
- <ReturnValue><replaceable class="parameter">name</replaceable></ReturnValue>
+ <replaceable class="parameter">constraint</replaceable>
</TERM>
<LISTITEM>
<PARA>
- The optional name of a constraint.
+ The definition of the constraint.
</PARA>
</LISTITEM>
</VARLISTENTRY>
- </variablelist>
- </LISTITEM>
- </VARLISTENTRY>
- </VARIABLELIST>
-
+ </VARIABLELIST>
+
+ <REFSECT2 ID="R2-SQL-COLUMNCONSTRAINT-2">
+ <REFSECT2INFO>
+ <DATE>1998-09-11</DATE>
+ </REFSECT2INFO>
+ <TITLE>
+ Description
+ </TITLE>
+ <para>
+ A Constraint is a named rule: an SQL object which helps define
+ valid sets of values by putting limits on the results of INSERT,
+ UPDATE or DELETE operations performed on a Base Table.
+ </para>
+ <para>
+ There are two ways to define integrity constraints:
+ table constraints, covered later, and column constraints, covered here.
+ </para>
+ <para>
+ A column constraint is an integrity constraint defined as part
+ of a column definition, and logically becomes a table
+ constraint as soon as it is created. The column
+ constraints available are:
+ <simplelist columns="1">
+ <member>PRIMARY KEY</member>
+ <member>REFERENCES</member>
+ <member>UNIQUE</member>
+ <member>CHECK</member>
+ <member>NOT NULL</member>
+ </simplelist></para>
+ <note>
+ <para>
+ <productname>Postgres</productname> does not yet
+(at release 6.4) support
+ REFERENCES integrity constraints. The parser
+accepts the REFERENCES syntax but ignores the clause.
+ </para>
+ </note>
+
+ <REFSECT2 ID="R2-SQL-NOTNULL-1">
+ <REFSECT2INFO>
+ <DATE>1998-09-11</DATE>
+ </REFSECT2INFO>
+ <TITLE>
+ NOT NULL Constraint
+ </TITLE>
+ <SYNOPSIS>
+[ CONSTRAINT <replaceable class="parameter">name</replaceable> ] NOT NULL
+ </SYNOPSIS>
+ <PARA>
+ The NOT NULL constraint specifies a rule that a column may
+ contain only non-null values.
+ </PARA>
+ <PARA>
+ The NOT NULL constraint is a column constraint only, and not allowed
+as a table constraint.
+ </PARA>
+
<REFSECT3 ID="R3-SQL-NOTNULL-1">
<REFSECT3INFO>
- <DATE>1998-04-15</DATE>
+ <DATE>1998-09-11</DATE>
</REFSECT3INFO>
<TITLE>
Outputs
<VARIABLELIST>
<VARLISTENTRY>
<TERM>
+<replaceable>status</replaceable>
</TERM>
<LISTITEM>
<PARA>
</LISTITEM>
</VARLISTENTRY>
</VARIABLELIST>
+
+ <REFSECT3 ID="R3-SQL-NOTNULL-2">
+ <REFSECT3INFO>
+ <DATE>1998-09-11</DATE>
+ </REFSECT3INFO>
+ <TITLE>
+Description
+</title>
+<para>
+
+ <REFSECT3 ID="R3-SQL-NOTNULL-3">
+ <REFSECT3INFO>
+ <DATE>1998-09-11</DATE>
+ </REFSECT3INFO>
+ <TITLE>
+Usage
+</title>
+
+ <PARA>
+ Define two NOT NULL column constraints on the table
+ <classname>distributors</classname>,
+one of which being a named constraint:
+ </PARA>
+ <ProgramListing>
+CREATE TABLE distributors (
+ did DECIMAL(3) CONSTRAINT no_null NOT NULL,
+ name VARCHAR(40) NOT NULL
+);
+ </ProgramListing>
+
+ <REFSECT2 ID="R2-SQL-UNIQUECLAUSE-1">
+ <REFSECT2INFO>
+ <DATE>1998-09-11</DATE>
+ </REFSECT2INFO>
+ <TITLE>
+ UNIQUE Constraint
+ </TITLE>
+ <synopsis>
+[ CONSTRAINT <replaceable class="parameter">name</replaceable> ] UNIQUE
+ </SYNOPSIS>
+
+ <refsect3>
+ <title>Inputs</title>
+<para>
+ <variablelist>
+ <varlistentry>
+ <term>
+ CONSTRAINT <replaceable class="parameter">name</replaceable>
+ </term>
+ <listitem>
+ <para>
+ An arbitrary label given to a constraint.
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </refsect3>
+
+ <refsect3>
+ <title>Outputs</title>
+ <PARA>
+ <VARIABLELIST>
+ <VARLISTENTRY>
+ <TERM>
+<replaceable>status</replaceable>
+ </TERM>
+ <LISTITEM>
+ <PARA>
+ <VARIABLELIST>
+ <VARLISTENTRY>
+ <TERM>
+<returnvalue>ERROR: Cannot insert a duplicate key into a unique index.</returnvalue>
+ </term>
+ <listitem>
+ <para>
+ This error occurs at runtime if one tries to insert a
+ duplicate value into a column.
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist></para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </refsect3>
+
+ <refsect3>
+ <title>
+Description
+ </title>
+
+ <PARA>
+ The UNIQUE constraint specifies a rule that a group of one or
+ more distinct columns of a table may contain only unique values.
+ </para>
+ <para>
+ The column definitions of the specified columns do not have to
+ include a NOT NULL constraint to be included in a UNIQUE
+ constraint. Having more than one null value in a column without a
+ NOT NULL constraint, does not violate a UNIQUE constraint.
+(This deviates from the <acronym>SQL92</acronym> definition, but
+is a more sensible convention. See the section on compatibility
+for more details.).
+ </PARA>
+ <PARA>
+ Each UNIQUE column constraint must name a column that is
+ different from the set of columns named by any other UNIQUE or
+ PRIMARY KEY constraint defined for the table.
+ </PARA>
+ <Note>
+ <Para>
+ <productname>Postgres</productname> automatically creates a unique
+ index for each UNIQUE constraint, to assure
+ data integrity. See CREATE INDEX for more information.
+ </Para>
+ </Note>
+
+ <REFSECT3 ID="R3-SQL-UNIQUECLAUSE-3">
+ <TITLE>
+Usage
+</title>
+
+ <PARA>
+ Defines a UNIQUE column constraint for the table distributors.
+ UNIQUE column constraints can only be defined on one column
+ of the table:
+ <ProgramListing>
+ CREATE TABLE distributors (
+ did DECIMAL(3),
+ name VARCHAR(40) UNIQUE
+ );
+ </ProgramListing>
+which is equivalent to the following specified as a table constraint:
+ <ProgramListing>
+CREATE TABLE distributors (
+ did DECIMAL(3),
+ name VARCHAR(40),
+ UNIQUE(name)
+);
+ </ProgramListing>
+
+ <REFSECT2 ID="R2-SQL-CHECK-1">
+ <REFSECT2INFO>
+ <DATE>1998-09-11</DATE>
+ </REFSECT2INFO>
+<title>
+The CHECK Constraint
+</title>
+ <SYNOPSIS>
+[ CONSTRAINT <replaceable class="parameter">name</replaceable> ] CHECK ( <replaceable>condition</replaceable> [, ...] )
+ </SYNOPSIS>
+ <refsect3 id="R3-SQL-CHECK-1">
+ <title>Inputs</title>
+ <PARA>
+ <VARIABLELIST>
+ <VARLISTENTRY>
+ <TERM>
+ <ReturnValue><replaceable class="parameter">name</replaceable></ReturnValue>
+ </TERM>
+ <LISTITEM>
+ <PARA>
+ An arbitrary name given to a constraint.
+ </PARA>
+ </LISTITEM>
+ </VARLISTENTRY>
+ <VARLISTENTRY>
+ <TERM>
+ <replaceable>condition</replaceable>
+ </TERM>
+ <LISTITEM>
+ <PARA>
+ Any valid conditional expression evaluating to a boolean result.
+ </PARA>
+ </LISTITEM>
+ </VARLISTENTRY>
+ </variablelist>
</REFSECT3>
+
+ <REFSECT3 ID="R3-SQL-CHECK-2">
+ <REFSECT3INFO>
+ <DATE>1998-09-11</DATE>
+ </REFSECT3INFO>
+ <TITLE>
+ Outputs
+ </TITLE>
+ <PARA>
+ <VARIABLELIST>
+ <VARLISTENTRY>
+ <TERM>
+<replaceable>status</replaceable>
+ </TERM>
+ <LISTITEM>
+ <PARA>
+
+ <VARIABLELIST>
+ <VARLISTENTRY>
+ <TERM>
+ <ReturnValue>
+ ERROR: ExecAppend: rejected due to CHECK constraint
+ "<replaceable class="parameter">table_column</replaceable>".
+ </ReturnValue>
+ </TERM>
+ <LISTITEM>
+ <PARA>
+ This error occurs at runtime if one tries to insert an illegal
+ value into a column subject to a CHECK constraint.
+ </PARA>
+ </LISTITEM>
+ </VARLISTENTRY>
+ </variablelist>
+ </LISTITEM>
+ </VARLISTENTRY>
+ </variablelist>
+ </REFSECT3>
+
+ <refsect3>
+ <title>Description</title>
+ <para>
+ The CHECK constraint specifies a restriction on allowed values
+within a column.
+ The CHECK constraint is also allowed as a table constraint.
+ </PARA>
+ <PARA>
+ The SQL92 CHECK column constraints can only be defined on, and
+ refer to, one column of the table. <productname>Postgres</productname>
+ does not have
+ this restriction.
+ </PARA>
+ </refsect3>
</REFSECT2>
- <REFSECT2 ID="R2-SQL-UNIQUECLAUSE-1">
+ <REFSECT2 ID="R2-SQL-PRIMARYKEY-1">
+ <REFSECT2INFO>
+ <DATE>1998-09-11</DATE>
+ </REFSECT2INFO>
+ <TITLE>
+ PRIMARY KEY Constraint
+ </TITLE>
+ <SYNOPSIS>
+[ CONSTRAINT <REPLACEABLE CLASS="PARAMETER">name</REPLACEABLE> ] PRIMARY KEY
+ </SYNOPSIS>
+
+ <refsect3>
+ <title>Inputs</title>
+ <PARA>
+ <VARIABLELIST>
+ <VARLISTENTRY>
+ <TERM>
+CONSTRAINT <REPLACEABLE CLASS="PARAMETER">name</REPLACEABLE>
+ </TERM>
+ <LISTITEM>
+ <PARA>
+ An arbitrary name for the constraint.
+ </PARA>
+ </LISTITEM>
+ </VARLISTENTRY>
+ </VARIABLELIST>
+ </para>
+ </refsect3>
+
+ <refsect3>
+ <title>Outputs</title>
+ <variablelist>
+ <varlistentry>
+ <term>
+<returnvalue>ERROR: Cannot insert a duplicate key into a unique index.</returnvalue>
+ </term>
+ <listitem>
+ <para>
+ This occurs at run-time if one tries to insert a duplicate value into
+ a column subject to a PRIMARY KEY constraint.
+ </PARA>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </refsect3>
+
+ <refsect3>
+ <title>Description</title>
+ <PARA>
+ The PRIMARY KEY column constraint specifies that a column of a table
+ may contain only unique
+ (non-duplicate), non-NULL values. The definition of
+ the specified column does not have to include an explicit NOT NULL
+ constraint to be included in a PRIMARY KEY constraint.
+ </PARA>
+ <PARA>
+ Only one PRIMARY KEY can be specified for a table.
+ </PARA>
+ </REFSECT3>
+
+ <REFSECT3 ID="R3-SQL-PRIMARYKEY-3">
+ <REFSECT3INFO>
+ <DATE>1998-09-11</DATE>
+ </REFSECT3INFO>
+ <TITLE>
+ Notes
+ </TITLE>
+ <PARA>
+ <productname>Postgres</productname> automatically creates
+ a unique index to assure
+ data integrity. (See CREATE INDEX statement)
+ </PARA>
+ <PARA>
+ The PRIMARY KEY constraint should name a set of columns that is
+ different from other sets of columns named by any UNIQUE constraint
+ defined for the same table, since it will result in duplication
+of equivalent indexes and unproductive additional runtime overhead.
+However, <productname>Postgres</productname> does not specifically
+disallow this.
+ </PARA>
+ </refsect3>
+
+ <REFSECT1 ID="R1-SQL-TABLECONSTRAINT-1">
+ <REFSECT1INFO>
+ <DATE>1998-09-11</DATE>
+ </REFSECT1INFO>
+ <TITLE>
+ Table CONSTRAINT Clause
+ </TITLE>
+ <para>
+ <SYNOPSIS>
+[ CONSTRAINT name ] { PRIMARY KEY | UNIQUE } ( <replaceable class="parameter">column</replaceable> [, ...] )
+[ CONSTRAINT name ] CHECK ( <replaceable>constraint</replaceable> )
+ </SYNOPSIS>
+ <PARA>
+
+ <REFSECT2 ID="R2-SQL-TABLECONSTRAINT-1">
+ <REFSECT2INFO>
+ <DATE>1998-09-11</DATE>
+ </REFSECT2INFO>
+<title>
+Inputs
+</title>
+
+<para>
+ <VARIABLELIST>
+ <VARLISTENTRY>
+ <TERM>
+ CONSTRAINT <replaceable class="parameter">name</replaceable>
+ </TERM>
+ <LISTITEM>
+ <PARA>
+ An arbitrary name given to an integrity constraint.
+ </PARA>
+ </LISTITEM>
+ </VARLISTENTRY>
+ <VARLISTENTRY>
+ <TERM>
+ <replaceable class="parameter">column</replaceable> [, ...]
+ </TERM>
+ <LISTITEM>
+ <PARA>
+ The column name(s) for which to define a unique index
+and, for PRIMARY KEY, a NOT NULL constraint.
+ </PARA>
+ </LISTITEM>
+ <VARLISTENTRY>
+ <TERM>
+ CHECK ( <replaceable class="parameter">constraint</replaceable> )
+ </TERM>
+ <LISTITEM>
+ <PARA>
+ A boolean expression to be evaluated as the constraint.
+ </PARA>
+ </LISTITEM>
+ </VARLISTENTRY>
+ </VARIABLELIST>
+
+ <REFSECT2 ID="R2-SQL-TABLECONSTRAINT-2">
+ <REFSECT2INFO>
+ <DATE>1998-09-11</DATE>
+ </REFSECT2INFO>
+<title>
+Outputs
+</title>
+
+<para>
+The possible outputs for the table constraint clause are the same
+as for the corresponding portions of the column constraint clause.
+
+ <REFSECT2 ID="R2-SQL-TABLECONSTRAINT-3">
+ <REFSECT2INFO>
+ <DATE>1998-09-11</DATE>
+ </REFSECT2INFO>
+<title>
+Description
+</title>
+
+ <para>
+ A table constraint is an integrity constraint defined on one or
+ more columns of a base table. The four variations of "Table
+ Constraint" are:
+ <simplelist columns="1">
+ <member>UNIQUE</member>
+ <member>CHECK</member>
+ <member>PRIMARY KEY</member>
+ <member>FOREIGN KEY</member>
+ </simplelist>
+ </para>
+ <note>
+ <para>
+ <productname>Postgres</productname> does not yet
+(as of version 6.4) support FOREIGN KEY
+integrity constraints. The parser understands the FOREIGN KEY syntax,
+but only prints a notice and otherwise ignores the clause.
+ Foreign keys may be partially emulated by triggers (See the CREATE TRIGGER
+ statement).
+ </para>
+ </note>
+
+ <REFSECT2 ID="R2-SQL-UNIQUECLAUSE-4">
<REFSECT2INFO>
- <DATE>1998-04-15</DATE>
+ <DATE>1998-09-11</DATE>
</REFSECT2INFO>
<TITLE>
- UNIQUE constraint
+ UNIQUE Constraint
</TITLE>
<para>
- Table Constraint definition
- </para>
- <synopsis>
- [ CONSTRAINT <replaceable class="parameter">name</replaceable> ] UNIQUE ( <replaceable class="parameter">column</replaceable> [, ...] )
- </SYNOPSIS>
- <para>
- Column Constraint definition
- </para>
<synopsis>
- [ CONSTRAINT <replaceable class="parameter">name</replaceable> ] UNIQUE
+[ CONSTRAINT <replaceable class="parameter">name</replaceable> ] UNIQUE ( <replaceable class="parameter">column</replaceable> [, ...] )
</SYNOPSIS>
<refsect3>
- <title>Parameters</title>
+ <title>Inputs</title>
<variablelist>
<varlistentry>
<term>
- <replaceable class="parameter">name</replaceable>
+ CONSTRAINT <replaceable class="parameter">name</replaceable>
</term>
<listitem>
<para>
<refsect3>
<title>Outputs</title>
<PARA>
- </PARA>
<VARIABLELIST>
<VARLISTENTRY>
<TERM>
+<replaceable>status</replaceable>
</TERM>
<LISTITEM>
<PARA>
</para>
</listitem>
</varlistentry>
- </variablelist></para>
+ </variablelist>
</listitem>
</varlistentry>
</variablelist>
</refsect3>
+
<refsect3>
- <title>Description</title>
+ <title>
+Description
+ </title>
+
<PARA>
The UNIQUE constraint specifies a rule that a group of one or
more distinct columns of a table may contain only unique values.
+The behavior of the UNIQUE table constraint is the same as that for column
+constraints, with the additional capability to span multiple columns.
</para>
<para>
- The column definitions of the specified columns do not have to
- include a NOT NULL constraint to be included in a UNIQUE
- constraint. Having more than one null value in a column without a
- NOT NULL constraint, does not violate a UNIQUE constraint.
- </PARA>
- <PARA>
- Each UNIQUE constraint must name a set of columns that is
- different from the set of columns named by any other UNIQUE or
- PRIMARY KEY constraint defined for the Table.
- </PARA>
- <Note>
- <Para>
- PostgreSQL automatically creates a unique index for each UNIQUE
- constraint, to assure
- data integrity. See CREATE INDEX for more information.
- </Para>
- </Note>
- </REFSECT2>
-
- <REFSECT2 ID="R2-SQL-CONSTRAINT-1">
- <REFSECT2INFO>
- <DATE>1998-04-15</DATE>
- </REFSECT2INFO>
+See the section on the UNIQUE column constraint for more details.
+
+ <REFSECT3 ID="R3-SQL-UNIQUECLAUSE-4">
<TITLE>
- CONSTRAINT clause
- </TITLE>
- <para>
- Table constraint definition
- </para>
- <SYNOPSIS>
- [ CONSTRAINT name ]
- { PRIMARY KEY constraint |
- UNIQUE constraint |
- CHECK constraint }
- </SYNOPSIS>
- <PARA>
- Column constraint definition
- </PARA>
- <SYNOPSIS>
- [ CONSTRAINT name ]
- { NOT NULL constraint |
- PRIMARY KEY constraint |
- UNIQUE constraint |
- CHECK constraint }
- </SYNOPSIS>
- <PARA>
- </PARA>
- <VARIABLELIST>
- <VARLISTENTRY>
- <TERM>
- </TERM>
- <LISTITEM>
- <PARA>
- <VARIABLELIST>
- <VARLISTENTRY>
- <TERM>
- <ReturnValue>
- <replaceable class="parameter">name</replaceable>
- </ReturnValue>
- </TERM>
- <LISTITEM>
- <PARA>
- An arbitrary name given to an integrity constraint.
- </PARA>
- </LISTITEM>
- </VARLISTENTRY>
- <VARLISTENTRY>
- <TERM>
- <ReturnValue>
- <replaceable class="parameter">constraint</replaceable>
- </ReturnValue>
- </TERM>
- <LISTITEM>
- <PARA>
- The definition of the constraint.
- </PARA>
- </LISTITEM>
- </VARLISTENTRY>
- </VARIABLELIST>
- </LISTITEM>
- </VARLISTENTRY>
- </VARIABLELIST>
- <para>
- A Constraint is a named rule: a SQL object which helps define
- valid sets of values by putting limits on the results of INSERT,
- UPDATE or DELETE operations performed on a Base table.
- </para>
- <para>
- There are two ways to define integrity constraints:
- Table constraint and Column constraint.
- </para>
- <para>
- A Table Constraint is an integrity Constraint defined on one or
- more Columns of a Base table. The four variations of "Table
- Constraint" are:
- <simplelist columns="1">
- <member>PRIMARY KEY</member>
- <member>FOREIGN KEY</member>
- <member>UNIQUE</member>
- <member>CHECK</member>
- </simplelist>
- </para>
- <para>
- A column constraint is an integrity constraint defined as part
- of a column definition, and logically becomes a table
- constraint as soon as it is created. The column
- constraints available are:
- <simplelist columns="1">
- <member>PRIMARY KEY</member>
- <member>REFERENCES</member>
- <member>UNIQUE</member>
- <member>CHECK</member>
- <member>NOT NULL</member>
- </simplelist></para>
- <note>
- <para>
- PostgreSQL does not yet (at release 6.3.2) support the FOREIGN KEY or
- REFERENCES integrity constraints, although the parser will accept them.
- Foreign keys may be partially emulated by triggers (See CREATE TRIGGER
- statement)
- </para>
- </note>
- <note>
- <para>
- PostgreSQL does not yet support either DOMAINs or ASSERTIONs.
- </para>
- </note>
-
- </REFSECT2>
-
- <REFSECT2 ID="R2-SQL-CHECK-1">
- <REFSECT2INFO>
- <DATE>1998-04-15</DATE>
- </REFSECT2INFO>
- <title>The CHECK constraint</title>
- <SYNOPSIS>
- [ CONSTRAINT name ] CHECK ( condition [, ...] )
- </SYNOPSIS>
- <refsect3 id="R3-SQL-CHECK-1">
- <title>Inputs</title>
- <PARA>
- <VARIABLELIST>
- <VARLISTENTRY>
- <TERM>
- <ReturnValue><replaceable class="parameter">name</replaceable></ReturnValue>
- </TERM>
- <LISTITEM>
- <PARA>
- An arbitrary name given to a constraint.
- </PARA>
- </LISTITEM>
- </VARLISTENTRY>
- <VARLISTENTRY>
- <TERM>
- <ReturnValue>condition</ReturnValue>
- </TERM>
- <LISTITEM>
- <PARA>
- Any valid conditional expression.
- </PARA>
- </LISTITEM>
- </VARLISTENTRY>
- </variablelist>
- </REFSECT3>
+Usage
+</title>
+
+ <PARA>
+ Define a UNIQUE table constraint for the table distributors:
+ <ProgramListing>
+CREATE TABLE distributors (
+ did DECIMAL(03),
+ name VARCHAR(40),
+ UNIQUE(name)
+);
+ </ProgramListing>
+
- <REFSECT3 ID="R3-SQL-CHECK-2">
- <REFSECT3INFO>
- <DATE>1998-04-15</DATE>
- </REFSECT3INFO>
- <TITLE>
- Outputs
- </TITLE>
- <PARA>
- <VARIABLELIST>
- <VARLISTENTRY>
- <TERM>
- <ReturnValue>
- ERROR: ExecAppend: rejected due to CHECK constraint
- "<replaceable class="parameter">table_column</replaceable>".
- </ReturnValue>
- </TERM>
- <LISTITEM>
- <PARA>
- This error occurs at runtime if one tries to insert an illegal
- value into a column subject to a CHECK constraint.
- </PARA>
- </LISTITEM>
- </VARLISTENTRY>
- </variablelist>
- </REFSECT3>
- <refsect3>
- <title>Description</title>
- <para>
- The CHECK constraint specifies a rule that a group of one or
- more columns of a table may contain only those values allowed by
- the rule.
- The CHECK constraint is either a table constraint or a column
- constraint.
- </PARA>
- <PARA>
- PostgreSQL automatically creates an unique index to assure
- data integrity (See CREATE INDEX statement).
- The SQL92 CHECK column constraints can only be defined on, and
- refer to, one column of the table. PostgreSQL does not have
- this restriction.
- </PARA>
- </refsect3>
</REFSECT2>
-
- <REFSECT2 ID="R2-SQL-PRIMARYKEY-1">
+
+ <REFSECT2 ID="R2-SQL-PRIMARYKEY-4">
<REFSECT2INFO>
- <DATE>1998-04-15</DATE>
+ <DATE>1998-09-11</DATE>
</REFSECT2INFO>
<TITLE>
- PRIMARY KEY clause
+ PRIMARY KEY Constraint
</TITLE>
- <PARA>
- Table constraint definition
- </PARA>
+<para>
<SYNOPSIS>
[ CONSTRAINT <REPLACEABLE CLASS="PARAMETER">name</REPLACEABLE> ] PRIMARY KEY ( <REPLACEABLE CLASS="PARAMETER">column</REPLACEABLE> [, ...] )
</SYNOPSIS>
- <PARA>
- Column constraint definition
- </PARA>
- <SYNOPSIS>
- [ CONSTRAINT <REPLACEABLE CLASS="PARAMETER">name</REPLACEABLE> ] PRIMARY KEY
- </SYNOPSIS>
<refsect3>
- <title>Parameters</title>
+ <title>Inputs</title>
<PARA>
<VARIABLELIST>
<VARLISTENTRY>
<TERM>
- <ReturnValue><REPLACEABLE CLASS="PARAMETER">name</REPLACEABLE></ReturnValue>
+CONSTRAINT <ReturnValue><REPLACEABLE CLASS="PARAMETER">name</REPLACEABLE></ReturnValue>
</TERM>
<LISTITEM>
<PARA>
</VARLISTENTRY>
<VARLISTENTRY>
<TERM>
- <ReturnValue><REPLACEABLE CLASS="PARAMETER">column</REPLACEABLE></ReturnValue>
+<REPLACEABLE CLASS="PARAMETER">column</REPLACEABLE> [, ...]
</TERM>
<LISTITEM>
<PARA>
- The name of a column in the table.
+ The names of one or more columns in the table.
</PARA>
</LISTITEM>
</VARLISTENTRY>
</VARIABLELIST>
</para>
</refsect3>
+
<refsect3>
<title>Outputs</title>
+ <variablelist>
+ <varlistentry>
+ <term>
+<replaceable>status</replaceable>
+</term>
+<listitem>
+<para>
<variablelist>
<varlistentry>
<term>ERROR: Cannot insert a duplicate key into a unique index.</term>
</PARA>
</listitem>
</varlistentry>
+ </variablelist>
+ </listitem>
+ </varlistentry>
</variablelist>
</refsect3>
+
<refsect3>
<title>Description</title>
<PARA>
The PRIMARY KEY constraint specifies a rule that a group of one
or more distinct columns of a table may contain only unique,
- (not duplicates), non-null values. The column definitions of
+ (non duplicate), non-null values. The column definitions of
the specified columns do not have to include a NOT NULL
- constraint to be included in a PRIMARY KEY constraint.
- </PARA>
- <PARA>
- A table's set of valid values may be constrained by only one
- PRIMARY KEY constraint at a time.
+ constraint to be included in a PRIMARY KEY constraint.
+
+The PRIMARY KEY table constraint is similar to that for column constraints,
+with the additional capability of encompassing multiple columns.
</PARA>
<PARA>
- The PRIMARY KEY constraint must name a set of columns that is
- different from the set of columns named by any UNIQUE constraint
- defined for the same table.
- </PARA>
+Refer to the section on the PRIMARY KEY column constraint for more
+information.
</REFSECT3>
- <REFSECT3 ID="R3-SQL-PRIMARYKEY-3">
- <REFSECT3INFO>
- <DATE>1998-04-15</DATE>
- </REFSECT3INFO>
- <TITLE>
- Notes
- </TITLE>
- <PARA>
- PostgreSQL automatically creates an unique index to assure
- data integrity. (See CREATE INDEX statement)
- </PARA>
- </refsect3>
-
</REFSECT2>
+
</refsect1>
<REFSECT1 ID="R1-SQL-CREATETABLE-2">
);
</ProgramListing>
- <PARA>
- Define two NOT NULL column constraints on the table distributors
- </PARA>
- <ProgramListing>
- CREATE TABLE distributors (
- did DECIMAL(3) CONSTRAINT no_null NOT NULL,
- name VARCHAR(40) NOT NULL
- );
- </ProgramListing>
-
<PARA>
Define a UNIQUE table constraint for the table films.
UNIQUE table constraints can be defined on one or more
);
</ProgramListing>
- <PARA>
- Defines a UNIQUE column constraint for the table distributors.
- UNIQUE column constraints can only be defined on one column
- of the table (the following two examples are equivalents).
- </PARA>
- <ProgramListing>
- CREATE TABLE distributors (
- did DECIMAL(03),
- name VARCHAR(40) UNIQUE,
- UNIQUE(name)
- );
- </ProgramListing>
-
- <ProgramListing>
- CREATE TABLE distributors (
- did DECIMAL(3),
- name VARCHAR(40) UNIQUE
- );
- </ProgramListing>
-
<PARA>
Define a CHECK column constraint.
</PARA>
<PARA>
Defines a PRIMARY KEY column constraint for table distributors.
PRIMARY KEY column constraints can only be defined on one column
- of the table (the following two examples are equivalents)
+ of the table (the following two examples are equivalent)
</PARA>
<ProgramListing>
CREATE TABLE distributors (
name VARCHAR(40)
);
</ProgramListing>
- <para>
- To assign a sequence as the default for the column did,
- and a literal to the column name
- </PARA>
-
- <ProgramListing>
- CREATE TABLE distributors (
- did DECIMAL(3) DEFAULT NEXTVAL('serial'),
- name VARCHAR(40) DEFAULT 'luso films'
- );
- </ProgramListing>
<REFSECT2 ID="R2-SQL-CREATETABLE-3">
<REFSECT2INFO>
- <DATE>1998-04-15</DATE>
+ <DATE>1998-09-11</DATE>
</REFSECT2INFO>
<TITLE>
Notes
</TITLE>
<PARA>
- CREATE TABLE/INHERITS is a PostgreSQL language extension.
+ CREATE TABLE/INHERITS is a <productname>Postgres</productname>
+ language extension.
</PARA>
</refsect2>
Compatibility
</TITLE>
<PARA>
- </PARA>
<REFSECT2 ID="R2-SQL-CREATETABLE-4">
<REFSECT2INFO>
- <DATE>1998-04-15</DATE>
+ <DATE>1998-09-11</DATE>
</REFSECT2INFO>
<TITLE>
SQL92
</TITLE>
<PARA>
- In addition to normal CREATE TABLE, SQL92 also defines a
+ In addition to the normal CREATE TABLE, SQL92 also defines a
CREATE TEMPORARY TABLE statement:
</PARA>
<synopsis>
) ON COMMIT DELETE ROWS
</programlisting>
<para>
-Temporary tables are not currently available in <productname>Postgres</productname>.
+Temporary tables are not currently available
+ in <productname>Postgres</productname>.
<tip>
<para>
- In the current release of <productname>Postgres</productname> (v6.4), to create a temporary
+ In the current release of <productname>Postgres</productname>
+ (v6.4), to create a temporary
table you must create and drop the table by explicit commands.
</tip>
<REFSECT3 ID="R3-SQL-UNIQUECLAUSE-1">
<REFSECT3INFO>
- <DATE>1998-04-15</DATE>
+ <DATE>1998-09-11</DATE>
</REFSECT3INFO>
<TITLE>
UNIQUE clause
<REFSECT3 ID="R3-SQL-NOTNULL-4">
<REFSECT3INFO>
- <DATE>1998-04-15</DATE>
+ <DATE>1998-09-11</DATE>
</REFSECT3INFO>
<TITLE>
NOT NULL clause
<REFSECT3 ID="R3-SQL-DEFAULTCLAUSE-1">
<REFSECT3INFO>
- <DATE>1998-04-15</DATE>
+ <DATE>1998-09-11</DATE>
</REFSECT3INFO>
<TITLE>
DEFAULT clause
<REFSECT3 ID="R3-SQL-CONSTRAINT-3">
<REFSECT3INFO>
- <DATE>1998-04-15</DATE>
+ <DATE>1998-09-11</DATE>
</REFSECT3INFO>
<TITLE>
CONSTRAINT clause
</TITLE>
<PARA>
- SQL92 specifies some additional capabilities for CONSTRAINTs,
+ SQL92 specifies some additional capabilities for constraints,
and also defines assertions and domain constraints.
- </PARA>
+ <note>
+ <para>
+ <productname>Postgres</productname> does not yet support
+either domains or assertions.
+ </para>
+ </note>
+
<PARA>
An assertion is a special type of integrity constraint and share
the same namespace as other constraints.
<REFSECT3 ID="R3-SQL-CHECK-4">
<REFSECT3INFO>
- <DATE>1998-04-15</DATE>
+ <DATE>1998-09-11</DATE>
</REFSECT3INFO>
<TITLE>
CHECK clause
<REFSECT3 ID="R3-SQL-PRIMARYKEY-1">
<REFSECT3INFO>
- <DATE>1998-04-15</DATE>
+ <DATE>1998-09-11</DATE>
</REFSECT3INFO>
<TITLE>
PRIMARY KEY clause
</REFPURPOSE>
<REFSYNOPSISDIV>
<REFSYNOPSISDIVINFO>
- <DATE>1998-04-15</DATE>
+ <DATE>1998-09-21</DATE>
</REFSYNOPSISDIVINFO>
<SYNOPSIS>
- CREATE TRIGGER <REPLACEABLE CLASS="PARAMETER">name</REPLACEABLE> { BEFORE | AFTER }
- { <REPLACEABLE CLASS="PARAMETER">event</REPLACEABLE> [OR ...] }
- ON <REPLACEABLE CLASS="PARAMETER">table</REPLACEABLE> FOR EACH { ROW | STATEMENT }
- EXECUTE PROCEDURE <REPLACEABLE CLASS="PARAMETER">funcname</REPLACEABLE> ( <REPLACEABLE CLASS="PARAMETER">arguments</REPLACEABLE> )
+CREATE TRIGGER <REPLACEABLE CLASS="PARAMETER">name</REPLACEABLE> { BEFORE | AFTER }
+ { <REPLACEABLE CLASS="PARAMETER">event</REPLACEABLE> [OR ...] }
+ ON <REPLACEABLE CLASS="PARAMETER">table</REPLACEABLE> FOR EACH { ROW | STATEMENT }
+ EXECUTE PROCEDURE <REPLACEABLE CLASS="PARAMETER">funcname</REPLACEABLE> ( <REPLACEABLE CLASS="PARAMETER">arguments</REPLACEABLE> )
</SYNOPSIS>
<REFSECT2 ID="R2-SQL-CREATETRIGGER-1">
<REFSECT2INFO>
- <DATE>1998-04-15</DATE>
+ <DATE>1998-09-21</DATE>
</REFSECT2INFO>
<TITLE>
Inputs
</TITLE>
<PARA>
</PARA>
- <VARIABLELIST>
- <VARLISTENTRY>
- <TERM>
- </TERM>
- <LISTITEM>
- <PARA>
<VARIABLELIST>
<VARLISTENTRY>
<TERM>
</LISTITEM>
</VARLISTENTRY>
</variablelist>
- </LISTITEM>
- </VARLISTENTRY>
- </VARIABLELIST>
</REFSECT2>
<REFSECT2 ID="R2-SQL-CREATETRIGGER-2">
<REFSECT2INFO>
- <DATE>1998-04-15</DATE>
+ <DATE>1998-09-21</DATE>
</REFSECT2INFO>
<TITLE>
Outputs
<VARIABLELIST>
<VARLISTENTRY>
<TERM>
+<replaceable>status</replaceable>
</TERM>
<LISTITEM>
<PARA>
<REFSECT1 ID="R1-SQL-CREATETRIGGER-1">
<REFSECT1INFO>
- <DATE>1998-04-15</DATE>
+ <DATE>1998-09-21</DATE>
</REFSECT1INFO>
<TITLE>
Description
</TITLE>
<PARA>
- CREATE TRIGGER will enter a new trigger into the current
+ <command>CREATE TRIGGER</command> will enter a new trigger into the current
data base. The trigger will be associated with the relation
<replaceable class="parameter">relname</replaceable> and will execute
the specified function <replaceable class="parameter">funcname</replaceable>.
</PARA>
- <PARA>
- Only the relation owner may create a trigger on this relation.
- </PARA>
- <PARA>
- At release 6.3.2, STATEMENT triggers are not implemented.
- </PARA>
<PARA>
The trigger can be specified to fire either before the
operation is attempted on a tuple (before constraints
skip the operation for the current tuple, or change the tuple
being inserted (for INSERT and UPDATE operations only). If
the trigger fires after the event, all changes, including the
- last INSERTion, UPDATE or DELETion, are "visible" to the trigger.
+ last insertion, update, or deletion, are "visible" to the trigger.
</PARA>
<PARA>
- Refer to the SPI and trigger programming guides for more
+ Refer to the chapters on SPI and Triggers in the
+<citetitle>PostgreSQL Programmer's Guide</citetitle> for more
information.
</PARA>
<REFSECT2 ID="R2-SQL-CREATETRIGGER-3">
<REFSECT2INFO>
- <DATE>1998-04-15</DATE>
+ <DATE>1998-09-21</DATE>
</REFSECT2INFO>
<TITLE>
Notes
</TITLE>
<PARA>
- CREATE TRIGGER statement is a PostgreSQL language extension.
+ <command>CREATE TRIGGER</command> is a <productname>Postgres</productname>
+ language extension.
</PARA>
+ <PARA>
+ Only the relation owner may create a trigger on this relation.
+ </PARA>
+ <PARA>
+ As of the current release (v6.4), STATEMENT triggers are not implemented.
+ </PARA>
<PARA>
- Refer to the DROP TRIGGER statement for information on how to
+ Refer to <command>DROP TRIGGER</command> for information on how to
remove triggers.
</PARA>
table before appending or updating a row in the table films:
</PARA>
<ProgramListing>
- CREATE TRIGGER if_dist_exists
- BEFORE INSERT OR UPDATE ON films FOR EACH ROW
- EXECUTE PROCEDURE check_primary_key ('did', 'distributors', 'did');
+CREATE TRIGGER if_dist_exists
+ BEFORE INSERT OR UPDATE ON films FOR EACH ROW
+ EXECUTE PROCEDURE check_primary_key ('did', 'distributors', 'did');
</ProgramListing>
<PARA>
Before cancelling a distributor or updating its code, remove every
reference to the table films:
</PARA>
<ProgramListing>
- CREATE TRIGGER if_film_exists
- BEFORE DELETE OR UPDATE ON distributors FOR EACH ROW
- EXECUTE PROCEDURE check_foreign_key (1, 'CASCADE', 'did', 'films', 'did');
+CREATE TRIGGER if_film_exists
+ BEFORE DELETE OR UPDATE ON distributors FOR EACH ROW
+ EXECUTE PROCEDURE check_foreign_key (1, 'CASCADE', 'did', 'films', 'did');
</ProgramListing>
</REFSECT1>
<REFSECT2 ID="R2-SQL-CREATETRIGGER-4">
<REFSECT2INFO>
- <DATE>1998-04-15</DATE>
+ <DATE>1998-09-21</DATE>
</REFSECT2INFO>
<TITLE>
SQL92
</TITLE>
<PARA>
- There is no CREATE TRIGGER statement in SQL92.
+ There is no <command>CREATE TRIGGER</command> in <acronym>SQL92</acronym>.
</PARA>
<PARA>
The second example above may also be done by using a FOREIGN KEY
constraint as in:
</PARA>
<ProgramListing>
- CREATE TABLE distributors (
- did DECIMAL(3),
- name VARCHAR(40),
- CONSTRAINT if_film_exists FOREIGN KEY(did) REFERENCES films
- ON UPDATE CASCADE ON DELETE CASCADE
- );
+CREATE TABLE distributors (
+ did DECIMAL(3),
+ name VARCHAR(40),
+ CONSTRAINT if_film_exists
+ FOREIGN KEY(did) REFERENCES films
+ ON UPDATE CASCADE ON DELETE CASCADE
+);
</ProgramListing>
<PARA>
- However, foreign keys are not yet implemented at version 6.3.2 of
- PostgreSQL.
+ However, foreign keys are not yet implemented (as of version 6.4) in
+ <productname>Postgres</productname>.
</PARA>
</REFENTRY>
</REFPURPOSE>
<REFSYNOPSISDIV>
<REFSYNOPSISDIVINFO>
- <DATE>1998-04-15</DATE>
+ <DATE>1998-09-21</DATE>
</REFSYNOPSISDIVINFO>
<SYNOPSIS>
- CREATE TYPE <replaceable class="parameter">typename</replaceable> (
- INTERNALLENGTH = (<replaceable class="parameter">internallength</replaceable> | VARIABLE)
- [, EXTERNALLENGTH = (<replaceable class="parameter">externallength</replaceable> | VARIABLE) ]
+CREATE TYPE <replaceable class="parameter">typename</replaceable> (
<comment>
Why are parentheses required around the length parameters?
</comment>
- , INPUT = <replaceable class="parameter">input_function</replaceable>
- , OUTPUT = <replaceable class="parameter">output_function</replaceable>
- [, ELEMENT = <replaceable class="parameter">element</replaceable>]
- [, DELIMITER = <replaceable class="parameter">delimiter</replaceable>]
- [, DEFAULT = "<replaceable class="parameter">default</replaceable>" ]
- [, SEND = <replaceable class="parameter">send_function</replaceable> ]
- [, RECEIVE = <replaceable class="parameter">receive_function</replaceable> ]
- [, PASSEDBYVALUE])
+ INPUT = <replaceable class="parameter">input_function</replaceable>
+ , OUTPUT = <replaceable class="parameter">output_function</replaceable>
+ , INTERNALLENGTH = (<replaceable class="parameter">internallength</replaceable> | VARIABLE)
+ [ , EXTERNALLENGTH = (<replaceable class="parameter">externallength</replaceable> | VARIABLE) ]
+ [ , ELEMENT = <replaceable class="parameter">element</replaceable> ]
+ [ , DELIMITER = <replaceable class="parameter">delimiter</replaceable> ]
+ [ , DEFAULT = "<replaceable class="parameter">default</replaceable>" ]
+ [ , SEND = <replaceable class="parameter">send_function</replaceable> ]
+ [ , RECEIVE = <replaceable class="parameter">receive_function</replaceable> ]
+ [ , PASSEDBYVALUE ]
+)
</SYNOPSIS>
<REFSECT2 ID="R2-SQL-CREATETYPE-1">
<REFSECT2INFO>
- <DATE>1998-04-15</DATE>
+ <DATE>1998-09-21</DATE>
</REFSECT2INFO>
<TITLE>
Inputs
</TITLE>
<PARA>
</PARA>
- <VARIABLELIST>
- <VARLISTENTRY>
- <TERM>
- </TERM>
- <LISTITEM>
- <PARA>
<VARIABLELIST>
<VARLISTENTRY>
<TERM>
- <ReturnValue>
<replaceable class="parameter">typename</replaceable>
- </ReturnValue>
</TERM>
<LISTITEM>
<PARA>
</VARLISTENTRY>
<VARLISTENTRY>
<TERM>
- <ReturnValue>
- <replaceable class="parameter">internallength</replaceable>
- </ReturnValue>
+INTERNALLENGTH <replaceable class="parameter">internallength</replaceable>
</TERM>
<LISTITEM>
<PARA>
</VARLISTENTRY>
<VARLISTENTRY>
<TERM>
- <ReturnValue>
- <replaceable class="parameter">externallength</replaceable>
- </ReturnValue>
+EXTERNALLENGTH <replaceable class="parameter">externallength</replaceable>
</TERM>
<LISTITEM>
<PARA>
</VARLISTENTRY>
<VARLISTENTRY>
<TERM>
- <ReturnValue>
- <replaceable class="parameter">input_function</replaceable>
- </ReturnValue>
+ INPUT <replaceable class="parameter">input_function</replaceable>
</TERM>
<LISTITEM>
<PARA>
</VARLISTENTRY>
<VARLISTENTRY>
<TERM>
- <ReturnValue>
- <replaceable class="parameter">output_function</replaceable>
- </ReturnValue>
+ OUTPUT <replaceable class="parameter">output_function</replaceable>
</TERM>
<LISTITEM>
<PARA>
</VARLISTENTRY>
<VARLISTENTRY>
<TERM>
- <ReturnValue>
<replaceable class="parameter">element</replaceable>
- </ReturnValue>
</TERM>
<LISTITEM>
<PARA>
</VARLISTENTRY>
<VARLISTENTRY>
<TERM>
- <ReturnValue>
<replaceable class="parameter">delimiter</replaceable>
- </ReturnValue>
</TERM>
<LISTITEM>
<PARA>
</VARLISTENTRY>
<VARLISTENTRY>
<TERM>
- <ReturnValue>
<replaceable class="parameter">default</replaceable
- ></ReturnValue>
</TERM>
<LISTITEM>
<PARA>
</VARLISTENTRY>
<VARLISTENTRY>
<TERM>
- <ReturnValue>
<replaceable class="parameter">send_function</replaceable>
- </ReturnValue>
</TERM>
<LISTITEM>
<PARA>
</VARLISTENTRY>
<VARLISTENTRY>
<TERM>
- <ReturnValue>
<replaceable class="parameter">receive_function</replaceable>
- </ReturnValue>
</TERM>
<LISTITEM>
<PARA>
</LISTITEM>
</VARLISTENTRY>
</variablelist>
- </LISTITEM>
- </VARLISTENTRY>
- </VARIABLELIST>
</REFSECT2>
<REFSECT2 ID="R2-SQL-CREATETYPE-2">
<REFSECT2INFO>
- <DATE>1998-04-15</DATE>
+ <DATE>1998-09-21</DATE>
</REFSECT2INFO>
<TITLE>
Outputs
<VARIABLELIST>
<VARLISTENTRY>
<TERM>
+<replaceable>status</replaceable>
</TERM>
<LISTITEM>
<PARA>
<REFSECT1 ID="R1-SQL-CREATETYPE-1">
<REFSECT1INFO>
- <DATE>1998-04-15</DATE>
+ <DATE>1998-09-21</DATE>
</REFSECT1INFO>
<TITLE>
Description
</refsect2>
<REFSECT2 ID="R2-SQL-CREATETYPE-3">
<REFSECT2INFO>
- <DATE>1998-04-15</DATE>
+ <DATE>1998-09-21</DATE>
</REFSECT2INFO>
<TITLE>
Notes
</TITLE>
<PARA>
- Refer to DROP TYPE statement to drop types.
+ Refer to <command>DROP TYPE</command> to remove an existing type.
</PARA>
<PARA>
- See also CREATE FUNCTION, CREATE OPERATOR and large_objects.</para>
+ See also <command>CREATE FUNCTION</command>,
+ <command>CREATE OPERATOR</command> and the chapter on Large Objects
+in the <citetitle>PostgreSQL Programmer's Guide</citetitle>.
+</para>
</REFSECT2>
</refsect1>
Compatibility
</TITLE>
<PARA>
- CREATE TYPE statement is a PostgreSQL language extension.
- </PARA>
<REFSECT2 ID="R2-SQL-CREATETYPE-4">
<REFSECT2INFO>
- <DATE>1998-04-15</DATE>
+ <DATE>1998-09-21</DATE>
</REFSECT2INFO>
<TITLE>
SQL3
</TITLE>
<PARA>
- CREATE TYPE is a SQL3 statement.
+ <command>CREATE TYPE</command> is an <acronym>SQL3</acronym> statement.
</PARA>
</REFSECT2>
</REFPURPOSE>
<REFSYNOPSISDIV>
<REFSYNOPSISDIVINFO>
- <DATE>1998-04-15</DATE>
+ <DATE>1998-09-21</DATE>
</REFSYNOPSISDIVINFO>
<SYNOPSIS>
-
- CREATE USER<REPLACEABLE CLASS="PARAMETER"> username</REPLACEABLE>
- [WITH PASSWORD <REPLACEABLE CLASS="PARAMETER">password</REPLACEABLE>]
- [CREATEDB | NOCREATEDB]
- [CREATEUSER | NOCREATEUSER]
- [IN GROUP <REPLACEABLE CLASS="PARAMETER">groupname</REPLACEABLE> [, ...] ]
- [VALID UNTIL '<REPLACEABLE CLASS="PARAMETER">abstime</REPLACEABLE>']
-
-
+CREATE USER<REPLACEABLE CLASS="PARAMETER"> username</REPLACEABLE>
+ [ WITH PASSWORD <REPLACEABLE CLASS="PARAMETER">password</REPLACEABLE> ]
+ [ CREATEDB | NOCREATEDB ]
+ [ CREATEUSER | NOCREATEUSER ]
+ [ IN GROUP <REPLACEABLE CLASS="PARAMETER">groupname</REPLACEABLE> [, ...] ]
+ [ VALID UNTIL '<REPLACEABLE CLASS="PARAMETER">abstime</REPLACEABLE>' ]
</SYNOPSIS>
<REFSECT2 ID="R2-SQL-CREATEUSER-1">
<REFSECT2INFO>
- <DATE>1998-04-15</DATE>
+ <DATE>1998-09-21</DATE>
</REFSECT2INFO>
<TITLE>
Inputs
</TITLE>
<PARA>
- </PARA>
- <VARIABLELIST>
- <VARLISTENTRY>
- <TERM>
- </TERM>
- <LISTITEM>
- <PARA>
<VARIABLELIST>
<VARLISTENTRY>
<TERM>
The WITH PASSWORD clause sets the user's password within
the "<filename>pg_shadow</filename>" table. For this reason,
<filename>"pg_shadow</filename>" is no
- longer accessible to the instance of PostgreSQL that the
- PostgreSQL user's password is initially set to NULL.
+ longer accessible to the instance of <productname>Postgres</productname> that the
+ <productname>Postgres</productname> user's password is initially set to NULL.
<comment>The text here has got garbled.</comment>
When a
user's password in the "<filename>pg_shadow</filename>"
authentication proceeds as it historically has (HBA,
PG_PASSWORD, etc). However, if a password is set for a
user, a new authentication system supplants any other
- configured for the PostgreSQL instance, and the password
+ configured for the <productname>Postgres</productname> instance, and the password
stored in the "<filename>pg_shadow</filename>" table is used
for authentication.
For more details on how this authentication system
<PARA>
These clauses determine whether a user will be permitted to
create new
- users in an instance of PostgreSQL.
+ users in an instance of <productname>Postgres</productname>.
Omitting this clause will set the user's value of this
attribute to be NOCREATEUSER.
</PARA>
<LISTITEM>
<PARA>
The VALID UNTIL clause sets an absolute time after which the
- user's PostgreSQL login is no longer valid. Please note that
+ user's <productname>Postgres</productname> login is no longer valid. Please note that
if a user does not have a password defined in the
"<filename>pg_shadow</filename>"
table, the valid until date will not be checked
</LISTITEM>
</VARLISTENTRY>
</variablelist>
- </LISTITEM>
- </VARLISTENTRY>
- </VARIABLELIST>
</REFSECT2>
<REFSECT2 ID="R2-SQL-CREATEUSER-2">
<REFSECT2INFO>
- <DATE>1998-04-15</DATE>
+ <DATE>1998-09-21</DATE>
</REFSECT2INFO>
<TITLE>
Outputs
<VARIABLELIST>
<VARLISTENTRY>
<TERM>
+<replaceable>status</replaceable>
</TERM>
<LISTITEM>
<PARA>
<REFSECT1 ID="R1-SQL-CREATEUSER-1">
<REFSECT1INFO>
- <DATE>1998-04-15</DATE>
+ <DATE>1998-09-21</DATE>
</REFSECT1INFO>
<TITLE>
Description
</TITLE>
<PARA>
- CREATE USER will add a new user to an instance of PostgreSQL.
+ CREATE USER will add a new user to an instance of
+<productname>Postgres</productname>.
</PARA>
<PARA>
The new user will be given a <filename>usesysid</filename> of:
'<command>SELECT MAX(usesysid) + 1 FROM pg_shadow</command>'.
This means that
- PostgreSQL users' <filename>usesysid</filename>s will not
+ <productname>Postgres</productname> users' <filename>usesysid</filename>s will not
correspond to their operating
system(OS) user ids. The exception to this rule is
the '<literal>postgres</literal>' user, whose OS user id
If you still want the
OS user id and the <filename>usesysid</filename> to match
for any given user,
- use the "createuser" script provided with the PostgreSQL
+ use the "createuser" script provided with the <productname>Postgres</productname>
distribution.
</PARA>
<REFSECT2 ID="R2-SQL-CREATEUSER-3">
<REFSECT2INFO>
- <DATE>1998-04-15</DATE>
+ <DATE>1998-09-21</DATE>
</REFSECT2INFO>
<TITLE>
Notes
</TITLE>
<PARA>
- CREATE USER statement is a PostgreSQL language extension.
+ CREATE USER statement is a <productname>Postgres</productname> language extension.
</PARA>
<para>
Use DROP USER or ALTER USER statements to remove or modify a user
<REFSECT2 ID="R2-SQL-CREATEUSER-4">
<REFSECT2INFO>
- <DATE>1998-04-15</DATE>
+ <DATE>1998-09-21</DATE>
</REFSECT2INFO>
<TITLE>
SQL92
</REFPURPOSE>
<REFSYNOPSISDIV>
<REFSYNOPSISDIVINFO>
- <DATE>1998-04-15</DATE>
+ <DATE>1998-09-21</DATE>
</REFSYNOPSISDIVINFO>
<SYNOPSIS>
- CREATE VIEW <REPLACEABLE CLASS="PARAMETER">view</REPLACEABLE>
- AS SELECT <REPLACEABLE CLASS="PARAMETER">query</REPLACEABLE>
+CREATE VIEW <REPLACEABLE CLASS="PARAMETER">view</REPLACEABLE>
+ AS SELECT <REPLACEABLE CLASS="PARAMETER">query</REPLACEABLE>
</SYNOPSIS>
<REFSECT2 ID="R2-SQL-CREATEVIEW-1">
<REFSECT2INFO>
- <DATE>1998-04-15</DATE>
+ <DATE>1998-09-21</DATE>
</REFSECT2INFO>
<TITLE>
Inputs
</TITLE>
<PARA>
- </PARA>
- <VARIABLELIST>
- <VARLISTENTRY>
- <TERM>
- </TERM>
- <LISTITEM>
- <PARA>
<VARIABLELIST>
<VARLISTENTRY>
<TERM>
</LISTITEM>
</VARLISTENTRY>
</variablelist>
- </LISTITEM>
- </VARLISTENTRY>
- </VARIABLELIST>
</REFSECT2>
<REFSECT2 ID="R2-SQL-CREATEVIEW-2">
<REFSECT2INFO>
- <DATE>1998-04-15</DATE>
+ <DATE>1998-09-21</DATE>
</REFSECT2INFO>
<TITLE>
Outputs
<VARIABLELIST>
<VARLISTENTRY>
<TERM>
+<replaceable>status</replaceable>
</TERM>
<LISTITEM>
<PARA>
<REFSECT1 ID="R1-SQL-CREATEVIEW-1">
<REFSECT1INFO>
- <DATE>1998-04-15</DATE>
+ <DATE>1998-09-21</DATE>
</REFSECT1INFO>
<TITLE>
Description
<REFSECT2 ID="R2-SQL-CREATEVIEW-3">
<REFSECT2INFO>
- <DATE>1998-04-15</DATE>
+ <DATE>1998-09-21</DATE>
</REFSECT2INFO>
<TITLE>
Notes
<REFSECT2 ID="R2-SQL-CREATEVIEW-4">
<REFSECT2INFO>
- <DATE>1998-04-15</DATE>
+ <DATE>1998-09-21</DATE>
</REFSECT2INFO>
<TITLE>
Bugs
Create a view consisting of all Comedy films:
</PARA>
<ProgramListing>
- CREATE VIEW kinds AS
- SELECT *
- FROM films
- WHERE kind = 'Comedy';
+CREATE VIEW kinds AS
+ SELECT *
+ FROM films
+ WHERE kind = 'Comedy';
- SELECT * FROM kinds;
+SELECT * FROM kinds;
- code |title |did| date_prod|kind |len
- -----+-------------------------+---+----------+----------+------
- UA502|Bananas |105|1971-07-13|Comedy | 01:22
- C_701|There's a Girl in my Soup|107|1970-06-11|Comedy | 01:36
+code |title |did| date_prod|kind |len
+-----+-------------------------+---+----------+----------+------
+UA502|Bananas |105|1971-07-13|Comedy | 01:22
+C_701|There's a Girl in my Soup|107|1970-06-11|Comedy | 01:36
</ProgramListing>
</REFSECT1>
<REFSECT2 ID="R2-SQL-CREATEVIEW-5">
<REFSECT2INFO>
- <DATE>1998-04-15</DATE>
+ <DATE>1998-09-21</DATE>
</REFSECT2INFO>
<TITLE>
SQL92
<PARA>
SQL92 specifies some additional capabilities for the CREATE VIEW statement:
</PARA>
- <programlisting>
- CREATE VIEW <replaceable class="parameter">view</replaceable> [ <replaceable class="parameter">column</replaceable> [, ...] ]
- AS SELECT <replaceable class="parameter">expression</replaceable> [AS <replaceable class="parameter">colname</replaceable>] [, ...]
- FROM <replaceable class="parameter">table</replaceable>
- [WHERE <replaceable class="parameter">condition</replaceable>]
- [ WITH [ CASCADE | LOCAL ] CHECK OPTION ]
- </programlisting>
+ <synopsis>
+CREATE VIEW <replaceable class="parameter">view</replaceable> [ <replaceable class="parameter">column</replaceable> [, ...] ]
+ AS SELECT <replaceable class="parameter">expression</replaceable> [AS <replaceable class="parameter">colname</replaceable>] [, ...]
+ FROM <replaceable class="parameter">table</replaceable>
+ [ WHERE <replaceable class="parameter">condition</replaceable> ]
+ [ WITH [ CASCADE | LOCAL ] CHECK OPTION ]
+ </synopsis>
<VARIABLELIST>
<VARLISTENTRY>
<VARIABLELIST>
<VARLISTENTRY>
<TERM>
- <ReturnValue>CHECK OPTION</ReturnValue>
+ CHECK OPTION
</TERM>
<LISTITEM>
<PARA> This option is to do with updatable views.
</VARLISTENTRY>
<VARLISTENTRY>
<TERM>
- <ReturnValue>LOCAL</ReturnValue>
+ LOCAL
</TERM>
<LISTITEM>
<PARA>
</VARLISTENTRY>
<VARLISTENTRY>
<TERM>
- <ReturnValue>CASCADE</ReturnValue>
+ CASCADE
</TERM>
<LISTITEM>
<PARA>
<productname>Postgres</productname>
does not have an explicit <command>OPEN cursor</command>
statement; a cursor is considered to be open when it is declared.
+
+<note>
+<para>
+In <acronym>SQL92</acronym> cursors are only available in
+embedded applications. <application>ecpg</application>, the
+embedded SQL preprocessor for <productname>Postgres</productname>,
+supports the <acronym>SQL92</acronym> conventions, including those
+involving DECLARE and OPEN statements.
+</note>
+
</PARA>
</REFSECT2>
</refsect1>
To declare a cursor:
</PARA>
<ProgramListing>
- DECLARE liahona CURSOR
- FOR SELECT * FROM films;
+DECLARE liahona CURSOR
+ FOR SELECT * FROM films;
</ProgramListing>
</REFSECT1>
</TITLE>
<PARA>
</PARA>
- <VARIABLELIST>
- <VARLISTENTRY>
- <TERM>
- </TERM>
- <LISTITEM>
- <PARA>
<VARIABLELIST>
<VARLISTENTRY>
<TERM>
- <ReturnValue><replaceable class="parameter">table</replaceable></ReturnValue>
+ <replaceable class="parameter">table</replaceable>
</TERM>
<LISTITEM>
<PARA>
</VARLISTENTRY>
<VARLISTENTRY>
<TERM>
- <ReturnValue><replaceable class="parameter">condition</replaceable></ReturnValue>
+ <replaceable class="parameter">condition</replaceable>
</TERM>
<LISTITEM>
<PARA>
</LISTITEM>
</VARLISTENTRY>
</variablelist>
- </LISTITEM>
- </VARLISTENTRY>
- </VARIABLELIST>
</REFSECT2>
<REFSECT2 ID="R2-SQL-DELETE-2">
<VARIABLELIST>
<VARLISTENTRY>
<TERM>
+<replaceable>status</replaceable>
</TERM>
<LISTITEM>
<PARA>
</PARA>
<PARA>
If <replaceable class="parameter">count</replaceable> is 0,
- no rows are deleted.
+ no rows were deleted.
</PARA>
</LISTITEM>
</VARLISTENTRY>
Remove all films but musicals:
</PARA>
<ProgramListing>
- DELETE FROM films WHERE kind <> 'Musical';
+DELETE FROM films WHERE kind <> 'Musical';
- SELECT * FROM films;
+SELECT * FROM films;
- code |title |did| date_prod|kind |len
- -----+-------------------------+---+----------+----------+------
- UA501|West Side Story |105|1961-01-03|Musical | 02:32
- TC901|The King and I |109|1956-08-11|Musical | 02:13
- WD101|Bed Knobs and Broomsticks|111| |Musical | 01:57
+code |title |did| date_prod|kind |len
+-----+-------------------------+---+----------+----------+------
+UA501|West Side Story |105|1961-01-03|Musical | 02:32
+TC901|The King and I |109|1956-08-11|Musical | 02:13
+WD101|Bed Knobs and Broomsticks|111| |Musical | 01:57
+(3 rows)
</ProgramListing>
<para>
- Clear the table films:
+ Clear the table <literal>films</literal>:
</para>
<programlisting>
- DELETE FROM films;
+DELETE FROM films;
- SELECT * FROM films;
- code|title|did|date_prod|kind|len
- ----+-----+---+---------+----+---
- (0 rows)
+SELECT * FROM films;
+code|title|did|date_prod|kind|len
+----+-----+---+---------+----+---
+(0 rows)
</programlisting>
</REFSECT1>
SQL92
</TITLE>
<PARA>
- SQL92 defines a different syntax for a positioned DELETE statement:
+ <acronym>SQL92</acronym> allows a positioned DELETE statement:
</PARA>
<synopsis>
- DELETE FROM <replaceable class="parameter">table</replaceable> WHERE CURRENT OF <replaceable class="parameter">cursor</replaceable>
+DELETE FROM <replaceable class="parameter">table</replaceable> WHERE CURRENT OF <replaceable class="parameter">cursor</replaceable>
</synopsis>
<para>
- where <replaceable class="parameter">cursor</replaceable> identifies an open cursor.</para>
+ where <replaceable class="parameter">cursor</replaceable> identifies an open cursor. Interactive cursors in <productname>Postgres</productname> are read-only.
+</para>
</refsect2>
</refsect1>
</REFENTRY>
<DATE>1998-04-15</DATE>
</REFSYNOPSISDIVINFO>
<SYNOPSIS>
- DROP AGGREGATE <REPLACEABLE CLASS="PARAMETER">name</REPLACEABLE> <REPLACEABLE CLASS="PARAMETER">type</REPLACEABLE>
+DROP AGGREGATE <REPLACEABLE CLASS="PARAMETER">name</REPLACEABLE> <REPLACEABLE CLASS="PARAMETER">type</REPLACEABLE>
</SYNOPSIS>
<REFSECT2 ID="R2-SQL-DROPAGGREGATE-1">
</TITLE>
<PARA>
</PARA>
- <VARIABLELIST>
- <VARLISTENTRY>
- <TERM>
- </TERM>
- <LISTITEM>
- <PARA>
<VARIABLELIST>
<VARLISTENTRY>
<TERM>
- <ReturnValue><replaceable class="parameter">name</replaceable></ReturnValue>
+ <replaceable class="parameter">name</replaceable>
</TERM>
<LISTITEM>
<PARA>
</VARLISTENTRY>
<VARLISTENTRY>
<TERM>
- <ReturnValue><replaceable class="parameter">type</replaceable></ReturnValue>
+ <replaceable class="parameter">type</replaceable>
</TERM>
<LISTITEM>
<PARA>
The type of an existing aggregate function.
- (Refer to PostgreSQL User's Guide chapter 4 for
+ (Refer to the <citetitle>PostgreSQL User's Guide</citetitle> for
further information about data types).
<comment>This should become a cross-reference rather than a
hard-coded chapter number</comment>
</LISTITEM>
</VARLISTENTRY>
</variablelist>
- </LISTITEM>
- </VARLISTENTRY>
- </VARIABLELIST>
</REFSECT2>
<REFSECT2 ID="R2-SQL-DROPAGGREGATE-2">
<VARIABLELIST>
<VARLISTENTRY>
<TERM>
+<replaceable>status</replaceable>
</TERM>
<LISTITEM>
<PARA>
</VARLISTENTRY>
<VARLISTENTRY>
<TERM>
- <ReturnValue>WARN RemoveAggregate: aggregate '<replaceable class="parameter">name</replaceable>' for 'type' does not exist</ReturnValue>
+ <ReturnValue>WARN RemoveAggregate: aggregate '<replaceable class="parameter">name</replaceable>' for '<replaceable class="parameter">type</replaceable>' does not exist</ReturnValue>
</TERM>
<LISTITEM>
<PARA>
Notes
</TITLE>
<PARA>
- The <command>DROP AGGREGATE</command> statement is a PostgreSQL
+ The <command>DROP AGGREGATE</command> statement is a
+<productname>Postgres</productname>
language extension.
</PARA>
<PARA>
<literal>int4</literal>:
</PARA>
<ProgramListing>
- DROP AGGREGATE myavg int4;
+DROP AGGREGATE myavg int4;
</ProgramListing>
</REFSECT1>
SQL92
</TITLE>
<PARA>
- There is no DROP AGGREGATE statement in SQL92.
+ There is no DROP AGGREGATE statement in <acronym>SQL92</acronym>.
</PARA>
</refsect2>
</refsect1>
<DATE>1998-04-15</DATE>
</REFSYNOPSISDIVINFO>
<SYNOPSIS>
- DROP DATABASE <REPLACEABLE CLASS="PARAMETER">name</REPLACEABLE>
+DROP DATABASE <REPLACEABLE CLASS="PARAMETER">name</REPLACEABLE>
</SYNOPSIS>
<REFSECT2 ID="R2-SQL-DROPDATABASE-1">
</TITLE>
<PARA>
</PARA>
- <VARIABLELIST>
- <VARLISTENTRY>
- <TERM>
- </TERM>
- <LISTITEM>
- <PARA>
<VARIABLELIST>
<VARLISTENTRY>
<TERM>
</LISTITEM>
</VARLISTENTRY>
</variablelist>
- </LISTITEM>
- </VARLISTENTRY>
- </VARIABLELIST>
</REFSECT2>
<REFSECT2 ID="R2-SQL-DROPDATABASE-2">
<VARIABLELIST>
<VARLISTENTRY>
<TERM>
+<replaceable>status</replaceable>
</TERM>
<LISTITEM>
<PARA>
</PARA>
</LISTITEM>
</VARLISTENTRY>
+ <VARLISTENTRY>
+ <TERM>
+ <ReturnValue>ERROR: destroydb cannot be executed on an open database</ReturnValue>
+ </TERM>
+ <LISTITEM>
+ <PARA>
+ This message occurs if the specified database does not exist.
+ </PARA>
+ </LISTITEM>
+ </VARLISTENTRY>
</variablelist>
</LISTITEM>
</VARLISTENTRY>
<TITLE>
Notes
</TITLE>
- <PARA>
- <warning>
+
+ <para>
+ DROP DATABASE statement is a <productname>Postgres</productname>
+ language extension.
+
+ <tip>
<para>
- This query should NOT be executed interactively.
- The <command>destroydb</command> script should be used instead.
+ This query cannot be executed while connected to the target
+database. It is usually preferable to use the
+ <command>destroydb</command> script instead.
</para>
- </warning>
- <comment>Some explanation would be desirable here!</comment>
- </PARA>
- <para>
- DROP DATABASE statement is a PostgreSQL language extension.
+ </tip>
+
</para>
<para>
Refer to the <command>CREATE DATABASE</command> statement for
SQL92
</TITLE>
<PARA>
- There is no DROP DATABASE statement in SQL92.
+ There is no <command>DROP DATABASE</command> in <acronym>SQL92</acronym>.
</PARA>
</refsect2>
</refsect1>
<DATE>1998-04-15</DATE>
</REFSYNOPSISDIVINFO>
<SYNOPSIS>
- DROP FUNCTION <replaceable class="parameter">name</replaceable> ( [<replaceable class="parameter">type</replaceable> [, ...]] )
+DROP FUNCTION <replaceable class="parameter">name</replaceable> ( [ <replaceable class="parameter">type</replaceable> [, ...] ] )
</SYNOPSIS>
<REFSECT2 ID="R2-SQL-DROPFUNCTION-1">
</TITLE>
<PARA>
</PARA>
- <VARIABLELIST>
- <VARLISTENTRY>
- <TERM>
- </TERM>
- <LISTITEM>
- <PARA>
<VARIABLELIST>
<VARLISTENTRY>
<TERM>
</LISTITEM>
</VARLISTENTRY>
</variablelist>
- </LISTITEM>
- </VARLISTENTRY>
- </VARIABLELIST>
</REFSECT2>
<REFSECT2 ID="R2-SQL-DROPFUNCTION-2">
<VARIABLELIST>
<VARLISTENTRY>
<TERM>
+<replaceable>status</replaceable>
</TERM>
<LISTITEM>
<PARA>
</VARLISTENTRY>
<VARLISTENTRY>
<TERM>
- <ReturnValue>
- WARN RemoveFunction: Function "<replaceable class="parameter">name</replaceable>" ("<replaceable class="parameter">types</replaceable>") does not exist</ReturnValue>
+ <ReturnValue>WARN RemoveFunction: Function "<replaceable class="parameter">name</replaceable>" ("<replaceable class="parameter">types</replaceable>") does not exist</ReturnValue>
</TERM>
<LISTITEM>
<PARA>
This message is given if the function specified does not
-exist into database.
+exist in the current database.
</PARA>
</LISTITEM>
</VARLISTENTRY>
Notes
</TITLE>
<PARA>
- Refer to the <citerefentry>
- <refentrytitle>
- CREATE FUNCTION</refentrytitle>
+ Refer to <citerefentry>
+<refentrytitle>
+CREATE FUNCTION
+</refentrytitle>
</citerefentry>
- statement to create aggregate functions.
+ to create aggregate functions.
</PARA>
</REFSECT2>
This command removes the square root function:
</PARA>
<ProgramListing>
- DROP FUNCTION sqrt(int4);
+DROP FUNCTION sqrt(int4);
</ProgramListing>
</REFSECT1>
<REFSECT1 ID="R1-SQL-DROPFUNCTION-3">
<TITLE>
Compatibility
</TITLE>
- <PARA
- >DROP FUNCTION statement is a PostgreSQL language extension.
+ <PARA>
+DROP FUNCTION is a <productname>Postgres</productname> language extension.
</PARA>
<REFSECT2 ID="R2-SQL-DROPFUNCTION-4">
SQL/PSM
</TITLE>
<PARA>
- The SQL/PSM DROP FUNCTION statement has the following syntax:
+SQL/PSM is a proposed standard to enable function extensibility.
+The SQL/PSM DROP FUNCTION statement has the following syntax:
<programlisting>
- DROP [ SPECIFIC ] FUNCTION <replaceable class="parameter">name</replaceable> { RESTRICT | CASCADE }</programlisting>
+DROP [ SPECIFIC ] FUNCTION <replaceable class="parameter">name</replaceable> { RESTRICT | CASCADE }</programlisting>
</PARA>
</refsect2>
</refsect1>
<DATE>1998-04-15</DATE>
</REFSYNOPSISDIVINFO>
<SYNOPSIS>
- DROP INDEX <REPLACEABLE CLASS="PARAMETER">index_name</REPLACEABLE>
+DROP INDEX <REPLACEABLE CLASS="PARAMETER">index_name</REPLACEABLE>
</SYNOPSIS>
<REFSECT2 ID="R2-SQL-DROPINDEX-1">
</TITLE>
<PARA>
</PARA>
- <VARIABLELIST>
- <VARLISTENTRY>
- <TERM>
- </TERM>
- <LISTITEM>
- <PARA>
<VARIABLELIST>
<VARLISTENTRY>
<TERM>
</LISTITEM>
</VARLISTENTRY>
</variablelist>
- </LISTITEM>
- </VARLISTENTRY>
- </VARIABLELIST>
</REFSECT2>
<REFSECT2 ID="R2-SQL-DROPINDEX-2">
<VARIABLELIST>
<VARLISTENTRY>
<TERM>
+<replaceable>status</replaceable>
</TERM>
<LISTITEM>
<PARA>
</TERM>
<LISTITEM>
<PARA>
- This message occurs if "<REPLACEABLE CLASS="PARAMETER">index_name</REPLACEABLE>"
+ This message occurs if <REPLACEABLE CLASS="PARAMETER">index_name</REPLACEABLE>
is not an index in the database.
</PARA>
</LISTITEM>
Notes
</TITLE>
<PARA>
- <command>DROP INDEX</command> is a PostgreSQL language extension.
+ <command>DROP INDEX</command> is a <productname>Postgres</productname>
+ language extension.
</PARA>
<PARA>
Refer to the <command>CREATE INDEX</command> statement for
- information on how to create indices.
+ information on how to create indexes.
</PARA>
</REFSECT2>
This command will remove the <literal>title_idx</literal> index:
</PARA>
<ProgramListing>
- DROP INDEX title_idx;
+DROP INDEX title_idx;
</ProgramListing>
</REFSECT1>
SQL92
</TITLE>
<PARA>
-SQL92 defines commands by which to access a generic relational database.
-Indices are an implementation-dependent feature and hence
-there is no <command>DROP INDEX</command> statement in SQL92.
+<acronym>SQL92</acronym> defines commands by which to access
+ a generic relational database.
+Indexes are an implementation-dependent feature and hence
+there are no index-specific commands or definitions in the
+<acronym>SQL92</acronym> language.
</PARA>
</refsect2>
</refsect1>
<DATE>1998-04-15</DATE>
</REFSYNOPSISDIVINFO>
<SYNOPSIS>
- DROP PROCEDURAL LANGUAGE '<REPLACEABLE CLASS="PARAMETER">langname</REPLACEABLE>'
+DROP PROCEDURAL LANGUAGE '<REPLACEABLE CLASS="PARAMETER">langname</REPLACEABLE>'
</SYNOPSIS>
<REFSECT2 ID="R2-SQL-DROPLANGUAGE-1">
</TITLE>
<PARA>
</PARA>
- <VARIABLELIST>
- <VARLISTENTRY>
- <TERM>
- </TERM>
- <LISTITEM>
- <PARA>
<VARIABLELIST>
<VARLISTENTRY>
<TERM>
- <ReturnValue><REPLACEABLE CLASS="PARAMETER">langname</REPLACEABLE></ReturnValue>
+ <REPLACEABLE CLASS="PARAMETER">langname</REPLACEABLE>
</TERM>
<LISTITEM>
<PARA>
</LISTITEM>
</VARLISTENTRY>
</variablelist>
- </LISTITEM>
- </VARLISTENTRY>
- </VARIABLELIST>
</REFSECT2>
<REFSECT2 ID="R2-SQL-DROPLANGUAGE-2">
<VARIABLELIST>
<VARLISTENTRY>
<TERM>
+<replaceable>status</replaceable>
</TERM>
<LISTITEM>
<PARA>
</TITLE>
<PARA>
<command>DROP PROCEDURAL LANGUAGE</command> will remove the definition
- of the previously registered procedural language with the name
+ of the previously registered procedural language having the name
'<replaceable class="parameter">langname</replaceable>'.
</PARA>
</TITLE>
<PARA>
The <command>DROP PROCEDURAL LANGUAGE</command> statement is
- a PostgreSQL language extension.
+ a <productname>Postgres</productname> language extension.
</PARA>
<PARA>
- Refer to the <command>CREATE PROCEDURAL LANGUAGE</command> statement
+ Refer to <command>CREATE PROCEDURAL LANGUAGE</command>
for information on how to create procedural languages.
</PARA>
</refsect2>
This command removes the PL/Sample language:
</PARA>
<ProgramListing>
- DROP PROCEDURAL LANGUAGE 'plsample'
+DROP PROCEDURAL LANGUAGE 'plsample'
</ProgramListing>
</REFSECT1>
SQL92
</TITLE>
<PARA>
- There is no DROP PROCEDURAL LANGUAGE statement in SQL92.
+ There is no <command>DROP PROCEDURAL LANGUAGE</command> in
+<acronym>SQL92</acronym>.
</PARA>
</refsect2>
</refsect1>
<REFSYNOPSISDIV>
<REFSYNOPSISDIVINFO>
- <DATE>1998-04-15</DATE>
+ <DATE>1998-09-22</DATE>
</REFSYNOPSISDIVINFO>
<SYNOPSIS>
- DROP OPERATOR <REPLACEABLE CLASS="PARAMETER">id</REPLACEABLE> ( <REPLACEABLE CLASS="PARAMETER">type</REPLACEABLE> | NONE [,...] );
+DROP OPERATOR <REPLACEABLE CLASS="PARAMETER">id</REPLACEABLE> ( <REPLACEABLE CLASS="PARAMETER">type</REPLACEABLE> | NONE [,...] )
</SYNOPSIS>
<REFSECT2 ID="R2-SQL-DROPOPERATOR-1">
<REFSECT2INFO>
- <DATE>1998-04-15</DATE>
+ <DATE>1998-09-22</DATE>
</REFSECT2INFO>
<TITLE>
Inputs
</TITLE>
<PARA>
</PARA>
- <VARIABLELIST>
- <VARLISTENTRY>
- <TERM>
- </TERM>
- <LISTITEM>
- <PARA>
<VARIABLELIST>
<VARLISTENTRY>
<TERM>
- <ReturnValue><replaceable class="parameter">id</replaceable></ReturnValue>
+ <replaceable class="parameter">id</replaceable>
</TERM>
<LISTITEM>
<PARA>
</VARLISTENTRY>
<VARLISTENTRY>
<TERM>
- <ReturnValue><replaceable class="parameter">type</replaceable></ReturnValue>
+ <replaceable class="parameter">type</replaceable>
</TERM>
<LISTITEM>
<PARA>
</LISTITEM>
</VARLISTENTRY>
</variablelist>
- </LISTITEM>
- </VARLISTENTRY>
- </VARIABLELIST>
</REFSECT2>
<REFSECT2 ID="R2-SQL-DROPOPERATOR-2">
<REFSECT2INFO>
- <DATE>1998-04-15</DATE>
+ <DATE>1998-09-22</DATE>
</REFSECT2INFO>
<TITLE>
Outputs
<VARIABLELIST>
<VARLISTENTRY>
<TERM>
+<replaceable>status</replaceable>
</TERM>
<LISTITEM>
<PARA>
</VARLISTENTRY>
<VARLISTENTRY>
<TERM>
- <ReturnValue>ERROR: RemoveOperator: ... does not exist</ReturnValue>
+ <ReturnValue>ERROR: RemoveOperator: binary operator '<REPLACEABLE CLASS="PARAMETER">id</REPLACEABLE>' taking '<REPLACEABLE CLASS="PARAMETER">type1</REPLACEABLE>' and '<REPLACEABLE CLASS="PARAMETER">type2</REPLACEABLE>' does not exist</ReturnValue>
+ </TERM>
+ <LISTITEM>
+ <PARA>
+ This message occurs if the specified binary operator does not exist.
+ </PARA>
+ </LISTITEM>
+ </VARLISTENTRY>
+ <VARLISTENTRY>
+ <TERM>
+ <ReturnValue>ERROR: RemoveOperator: left unary operator '<REPLACEABLE CLASS="PARAMETER">id</REPLACEABLE>' taking '<REPLACEABLE CLASS="PARAMETER">type</REPLACEABLE>' does not exist</ReturnValue>
+ </TERM>
+ <LISTITEM>
+ <PARA>
+ This message occurs if the specified left unary operator
+ specified does not exist.
+ </PARA>
+ </LISTITEM>
+ </VARLISTENTRY>
+ <VARLISTENTRY>
+ <TERM>
+ <ReturnValue>ERROR: RemoveOperator: right unary operator '<REPLACEABLE CLASS="PARAMETER">id</REPLACEABLE>' taking '<REPLACEABLE CLASS="PARAMETER">type</REPLACEABLE>' does not exist</ReturnValue>
</TERM>
<LISTITEM>
<PARA>
- This message occurs if the operator specified doesn't exist.
+ This message occurs if the specified right unary operator
+ specified does not exist.
</PARA>
</LISTITEM>
</VARLISTENTRY>
<REFSECT1 ID="R1-SQL-DROPOPERATOR-1">
<REFSECT1INFO>
- <DATE>1998-04-15</DATE>
+ <DATE>1998-09-22</DATE>
</REFSECT1INFO>
<TITLE>
Description
<REFSECT2 ID="R2-SQL-DROPOPERATOR-3">
<REFSECT2INFO>
- <DATE>1998-04-15</DATE>
+ <DATE>1998-09-22</DATE>
</REFSECT2INFO>
<TITLE>
Notes
</TITLE>
<PARA>
- The <command>DROP OPERATOR</command> statement is a PostgreSQL
+ The <command>DROP OPERATOR</command> statement is a
+<productname>Postgres</productname>
language extension.
</PARA>
<PARA>
- Refer to the <command>CREATE OPERATOR</command> statement for
+ Refer to <command>CREATE OPERATOR</command> for
information on how to create operators.
</PARA>
<PARA>
- It is the user's responsibility to remove any access methods,
- operator classes, and so on, that rely on the deleted operator.
+ It is the user's responsibility to remove any access methods and
+ operator classes that rely on the deleted operator.
</PARA>
</REFSECT2>
Remove power operator <literal>a^n</literal> for <literal>int4</literal>:
</PARA>
<ProgramListing>
- DROP OPERATOR ^ (int4, int4);
+DROP OPERATOR ^ (int4, int4);
</ProgramListing>
<PARA>
Remove left unary operator <literal>!a</literal> for booleans:
</PARA>
<ProgramListing>
- DROP OPERATOR ! (none, bool);
+DROP OPERATOR ! (none, bool);
</ProgramListing>
<PARA>
Remove right unary factorial operator <literal>a!</literal> for
<literal>int4</literal>:
</PARA>
<ProgramListing>
- DROP OPERATOR ! (int4, none);
+DROP OPERATOR ! (int4, none);
</ProgramListing>
</REFSECT1>
<REFSECT2 ID="R2-SQL-DROPOPERATOR-4">
<REFSECT2INFO>
- <DATE>1998-04-15</DATE>
+ <DATE>1998-09-22</DATE>
</REFSECT2INFO>
<TITLE>
SQL92
</TITLE>
<PARA>
- There is no DROP OPERATOR statement in SQL92.
+ There is no <command>DROP OPERATOR</command> in <acronym>SQL92</acronym>.
</PARA>
</refsect2>
</refsect1>
</REFPURPOSE>
<REFSYNOPSISDIV>
<REFSYNOPSISDIVINFO>
- <DATE>1998-04-15</DATE>
+ <DATE>1998-09-22</DATE>
</REFSYNOPSISDIVINFO>
<SYNOPSIS>
- DROP RULE <REPLACEABLE CLASS="PARAMETER">name</REPLACEABLE>
+DROP RULE <REPLACEABLE CLASS="PARAMETER">name</REPLACEABLE>
</SYNOPSIS>
<REFSECT2 ID="R2-SQL-DROPRULE-1">
<REFSECT2INFO>
- <DATE>1998-04-15</DATE>
+ <DATE>1998-09-22</DATE>
</REFSECT2INFO>
<TITLE>
Inputs
</TITLE>
<PARA>
</PARA>
- <VARIABLELIST>
- <VARLISTENTRY>
- <TERM>
- </TERM>
- <LISTITEM>
- <PARA>
<VARIABLELIST>
<VARLISTENTRY>
<TERM>
- <ReturnValue><replaceable class="parameter">name</replaceable></ReturnValue>
+ <replaceable class="parameter">name</replaceable>
</TERM>
<LISTITEM>
<PARA>
</LISTITEM>
</VARLISTENTRY>
</variablelist>
- </LISTITEM>
- </VARLISTENTRY>
- </VARIABLELIST>
</REFSECT2>
<REFSECT2 ID="R2-SQL-DROPRULE-2">
<REFSECT2INFO>
- <DATE>1998-04-15</DATE>
+ <DATE>1998-09-22</DATE>
</REFSECT2INFO>
<TITLE>
Outputs
<VARIABLELIST>
<VARLISTENTRY>
<TERM>
+<replaceable>status</replaceable>
</TERM>
<LISTITEM>
<PARA>
<REFSECT1 ID="R1-SQL-DROPRULE-1">
<REFSECT1INFO>
- <DATE>1998-04-15</DATE>
+ <DATE>1998-09-22</DATE>
</REFSECT1INFO>
<TITLE>
Description
</TITLE>
<PARA>
- <command>DROP RULE</command> drops a rule from the specified PostgreSQL rule
- system. PostgreSQL will immediately cease enforcing it and
+ <command>DROP RULE</command> drops a rule from the specified
+ <productname>Postgres</productname> rule
+ system. <productname>Postgres</productname>
+ will immediately cease enforcing it and
will purge its definition from the system catalogs.
</PARA>
<REFSECT2 ID="R2-SQL-DROPRULE-3">
<REFSECT2INFO>
- <DATE>1998-04-15</DATE>
+ <DATE>1998-09-22</DATE>
</REFSECT2INFO>
<TITLE>
Notes
</TITLE>
<PARA>
- The <command>DROP RULE</command> statement is a PostgreSQL
+ The <command>DROP RULE</command> statement is a
+ <productname>Postgres</productname>
language extension.
</PARA>
<PARA>
- Refer to the <command>CREATE RULE</command> statement for
+ Refer to <command>CREATE RULE</command> for
information on how to create rules.
</PARA>
</refsect2>
<REFSECT2 ID="R2-SQL-DROPRULE-4">
<REFSECT2INFO>
- <DATE>1998-04-15</DATE>
+ <DATE>1998-09-22</DATE>
</REFSECT2INFO>
<TITLE>
Bugs
<REFSECT2 ID="R2-SQL-DROPRULE-5">
<REFSECT2INFO>
- <DATE>1998-04-15</DATE>
+ <DATE>1998-09-22</DATE>
</REFSECT2INFO>
<TITLE>
SQL92
</TITLE>
<PARA>
- There is no DROP RULE statement in SQL92.
+ There is no <command>DROP RULE</command> in SQL92.
</PARA>
</refsect2>
</refsect1>
</REFPURPOSE>
<REFSYNOPSISDIV>
<REFSYNOPSISDIVINFO>
- <DATE>1998-04-15</DATE>
+ <DATE>1998-09-22</DATE>
</REFSYNOPSISDIVINFO>
<SYNOPSIS>
- DROP SEQUENCE <REPLACEABLE CLASS="PARAMETER">seqname</REPLACEABLE> [, ...]
+DROP SEQUENCE <REPLACEABLE CLASS="PARAMETER">seqname</REPLACEABLE> [, ...]
</SYNOPSIS>
<REFSECT2 ID="R2-SQL-DROPSEQUENCE-1">
<REFSECT2INFO>
- <DATE>1998-04-15</DATE>
+ <DATE>1998-09-22</DATE>
</REFSECT2INFO>
<TITLE>
Inputs
</TITLE>
<PARA>
</PARA>
- <VARIABLELIST>
- <VARLISTENTRY>
- <TERM>
- </TERM>
- <LISTITEM>
- <PARA>
<VARIABLELIST>
<VARLISTENTRY>
<TERM>
- <ReturnValue><REPLACEABLE CLASS="PARAMETER">seqname</REPLACEABLE></ReturnValue>
+ <REPLACEABLE CLASS="PARAMETER">seqname</REPLACEABLE>
</TERM>
<LISTITEM>
<PARA>
</LISTITEM>
</VARLISTENTRY>
</variablelist>
- </LISTITEM>
- </VARLISTENTRY>
- </VARIABLELIST>
</REFSECT2>
<REFSECT2 ID="R2-SQL-DROPSEQUENCE-2">
<REFSECT2INFO>
- <DATE>1998-04-15</DATE>
+ <DATE>1998-09-22</DATE>
</REFSECT2INFO>
<TITLE>
Outputs
<VARIABLELIST>
<VARLISTENTRY>
<TERM>
+<replaceable>status</replaceable>
</TERM>
<LISTITEM>
<PARA>
</TERM>
<LISTITEM>
<PARA>
- This message occurs if the sequence specified does not exist.
+ This message occurs if the specified sequence does not exist.
</PARA>
</LISTITEM>
</VARLISTENTRY>
<REFSECT1 ID="R1-SQL-DROPSEQUENCE-1">
<REFSECT1INFO>
- <DATE>1998-04-15</DATE>
+ <DATE>1998-09-22</DATE>
</REFSECT1INFO>
<TITLE>
Description
<REFSECT2 ID="R2-SQL-DROPSEQUENCE-3">
<REFSECT2INFO>
- <DATE>1998-04-15</DATE>
+ <DATE>1998-09-22</DATE>
</REFSECT2INFO>
<TITLE>
Notes
</TITLE>
<PARA>
- The <command>DROP SEQUENCE</command> statement is a PostgreSQL
+ The <command>DROP SEQUENCE</command> statement is a
+ <productname>Postgres</productname>
language extension.
</PARA>
<PARA>
To remove sequence <literal>serial</literal> from database:
</PARA>
<ProgramListing>
- DROP SEQUENCE serial
+DROP SEQUENCE serial
</ProgramListing>
</REFSECT1>
<REFSECT2 ID="R2-SQL-DROPSEQUENCE-4">
<REFSECT2INFO>
- <DATE>1998-04-15</DATE>
+ <DATE>1998-09-22</DATE>
</REFSECT2INFO>
<TITLE>
SQL92
</TITLE>
<PARA>
- There is no <command>DROP SEQUENCE</command> statement in SQL92.
+ There is no <command>DROP SEQUENCE</command> in <acronym>SQL92</acronym>.
</PARA>
</refsect2>
</refsect1>
<REFSYNOPSISDIV>
<REFSYNOPSISDIVINFO>
- <DATE>1998-04-15</DATE>
+ <DATE>1998-09-22</DATE>
</REFSYNOPSISDIVINFO>
<SYNOPSIS>
- DROP TABLE <REPLACEABLE CLASS="PARAMETER">table</REPLACEABLE> [, ...]
+DROP TABLE <REPLACEABLE CLASS="PARAMETER">table</REPLACEABLE> [, ...]
</SYNOPSIS>
<REFSECT2 ID="R2-SQL-DROPTABLE-1">
<REFSECT2INFO>
- <DATE>1998-04-15</DATE>
+ <DATE>1998-09-22</DATE>
</REFSECT2INFO>
<TITLE>
Inputs
</TITLE>
<PARA>
</PARA>
- <VARIABLELIST>
- <VARLISTENTRY>
- <TERM>
- </TERM>
- <LISTITEM>
- <PARA>
<VARIABLELIST>
<VARLISTENTRY>
<TERM>
</LISTITEM>
</VARLISTENTRY>
</variablelist>
- </LISTITEM>
- </VARLISTENTRY>
- </VARIABLELIST>
</REFSECT2>
<REFSECT2 ID="R2-SQL-DROPTABLE-2">
<REFSECT2INFO>
- <DATE>1998-04-15</DATE>
+ <DATE>1998-09-22</DATE>
</REFSECT2INFO>
<TITLE>
Outputs
<VARIABLELIST>
<VARLISTENTRY>
<TERM>
+<replaceable>status</replaceable>
</TERM>
<LISTITEM>
<PARA>
</TERM>
<LISTITEM>
<PARA>
- If table/view specified doesn't exist into database.
+ If the specified table or view does not exist in the database.
</PARA>
</LISTITEM>
</VARLISTENTRY>
<REFSECT1 ID="R1-SQL-DROPTABLE-1">
<REFSECT1INFO>
- <DATE>1998-04-15</DATE>
+ <DATE>1998-09-22</DATE>
</REFSECT1INFO>
<TITLE>
Description
</TITLE>
- <PARA><command>
- </command>DROP TABLE removes tables and views from the database.
+ <PARA>
+<command>DROP TABLE</command> removes tables and views from the database.
Only its owner may destroy a table or view. A table
- may be emptied of rows, but not destroyed, by using DELETE.
+ may be emptied of rows, but not destroyed, by using <command>DELETE</command>.
</PARA>
<PARA>
- If a table being destroyed has secondary indices on it,
+ If a table being destroyed has secondary indexes on it,
they will be removed first. The removal of just a
- secondary index will not affect the indexed table.
+ secondary index will not affect the contents of the underlying table.
</PARA>
<REFSECT2 ID="R2-SQL-DROPTABLE-3">
<REFSECT2INFO>
- <DATE>1998-04-15</DATE>
+ <DATE>1998-09-22</DATE>
</REFSECT2INFO>
<TITLE>
Notes
</TITLE>
<PARA>
- Refer to the <command>CREATE TABLE</command> and
- <command>ALTER TABLE</command> statements for information on
+ Refer to <command>CREATE TABLE</command> and
+ <command>ALTER TABLE</command> for information on
how to create or modify tables.
</PARA>
</REFSECT2>
<command>distributors</command> tables:
</PARA>
<ProgramListing>
- DROP TABLE films, distributors
+DROP TABLE films, distributors
</ProgramListing>
</REFSECT1>
<REFSECT2 ID="R2-SQL-DROPTABLE-4">
<REFSECT2INFO>
- <DATE>1998-04-15</DATE>
+ <DATE>1998-09-22</DATE>
</REFSECT2INFO>
<TITLE>
SQL92
SQL92 specifies some additional capabilities for DROP TABLE:
</PARA>
<synopsis>
- DROP TABLE <replaceable class="parameter">table</replaceable> { RESTRICT | CASCADE }
+DROP TABLE <replaceable class="parameter">table</replaceable> { RESTRICT | CASCADE }
</synopsis>
<variablelist>
<varlistentry>
<tip>
<para>
At present, to remove a referenced view you must drop
- it by hand.
+ it explicitly.
</para>
</tip>
</refsect2>
</REFPURPOSE>
<REFSYNOPSISDIV>
<REFSYNOPSISDIVINFO>
- <DATE>1998-04-15</DATE>
+ <DATE>1998-09-22</DATE>
</REFSYNOPSISDIVINFO>
<SYNOPSIS>
- DROP TRIGGER <REPLACEABLE CLASS="PARAMETER">name</REPLACEABLE> ON <REPLACEABLE CLASS="PARAMETER">table</REPLACEABLE>
+DROP TRIGGER <REPLACEABLE CLASS="PARAMETER">name</REPLACEABLE> ON <REPLACEABLE CLASS="PARAMETER">table</REPLACEABLE>
</SYNOPSIS>
<REFSECT2 ID="R2-SQL-DROPTRIGGER-1">
<REFSECT2INFO>
- <DATE>1998-04-15</DATE>
+ <DATE>1998-09-22</DATE>
</REFSECT2INFO>
<TITLE>
Inputs
</TITLE>
<PARA>
</PARA>
- <VARIABLELIST>
- <VARLISTENTRY>
- <TERM>
- </TERM>
- <LISTITEM>
- <PARA>
<VARIABLELIST>
<VARLISTENTRY>
<TERM>
- <ReturnValue><REPLACEABLE CLASS="PARAMETER">name</REPLACEABLE></ReturnValue>
+ <REPLACEABLE CLASS="PARAMETER">name</REPLACEABLE>
</TERM>
<LISTITEM>
<PARA>
</VARLISTENTRY>
<VARLISTENTRY>
<TERM>
- <ReturnValue><REPLACEABLE CLASS="PARAMETER">table</REPLACEABLE></ReturnValue>
+ <REPLACEABLE CLASS="PARAMETER">table</REPLACEABLE>
</TERM>
<LISTITEM>
<PARA>
</LISTITEM>
</VARLISTENTRY>
</variablelist>
- </LISTITEM>
- </VARLISTENTRY>
- </VARIABLELIST>
</REFSECT2>
<REFSECT2 ID="R2-SQL-DROPTRIGGER-2">
<REFSECT2INFO>
- <DATE>1998-04-15</DATE>
+ <DATE>1998-09-22</DATE>
</REFSECT2INFO>
<TITLE>
Outputs
<VARIABLELIST>
<VARLISTENTRY>
<TERM>
+<replaceable>status</replaceable>
</TERM>
<LISTITEM>
<PARA>
<REFSECT1 ID="R1-SQL-DROPTRIGGER-1">
<REFSECT1INFO>
- <DATE>1998-04-15</DATE>
+ <DATE>1998-09-22</DATE>
</REFSECT1INFO>
<TITLE>
Description
<REFSECT2 ID="R2-SQL-DROPTRIGGER-3">
<REFSECT2INFO>
- <DATE>1998-04-15</DATE>
+ <DATE>1998-09-22</DATE>
</REFSECT2INFO>
<TITLE>
Notes
</TITLE>
<PARA>
- The <command>DROP TRIGGER</command> statement is a PostgreSQL
+ <command>DROP TRIGGER</command> is a <productname>Postgres</productname>
language extension.
</PARA>
<PARA>
- Refer to the <command>CREATE TRIGGER</command> statement for
+ Refer to <command>CREATE TRIGGER</command> for
information on how to create triggers.
</PARA>
</REFSECT2>
Usage
</TITLE>
<PARA>
- Destroy the <literal>if_dist_exists</literal> trigger on table <literal>films</literal>:
+ Destroy the <literal>if_dist_exists</literal> trigger
+ on table <literal>films</literal>:
</PARA>
<ProgramListing>
- DROP TRIGGER if_dist_exists ON films;
+DROP TRIGGER if_dist_exists ON films;
</ProgramListing>
</REFSECT1>
<REFSECT2 ID="R2-SQL-DROPTRIGGER-4">
<REFSECT2INFO>
- <DATE>1998-04-15</DATE>
+ <DATE>1998-09-22</DATE>
</REFSECT2INFO>
<TITLE>
SQL92
</TITLE>
<PARA>
- There is no <command>DROP TRIGGER</command> statement in SQL92.
+ There is no <command>DROP TRIGGER</command> statement in
+ <acronym>SQL92</acronym>.
</PARA>
</refsect2>
</refsect1>
</REFPURPOSE>
<REFSYNOPSISDIV>
<REFSYNOPSISDIVINFO>
- <DATE>1998-04-15</DATE>
+ <DATE>1998-09-22</DATE>
</REFSYNOPSISDIVINFO>
<SYNOPSIS>
- DROP TYPE <REPLACEABLE CLASS="PARAMETER">typename</REPLACEABLE>
+DROP TYPE <REPLACEABLE CLASS="PARAMETER">typename</REPLACEABLE>
</SYNOPSIS>
<REFSECT2 ID="R2-SQL-DROPTYPE-1">
<REFSECT2INFO>
- <DATE>1998-04-15</DATE>
+ <DATE>1998-09-22</DATE>
</REFSECT2INFO>
<TITLE>
Inputs
</TITLE>
<PARA>
</PARA>
- <VARIABLELIST>
- <VARLISTENTRY>
- <TERM>
- </TERM>
- <LISTITEM>
- <PARA>
<VARIABLELIST>
<VARLISTENTRY>
<TERM>
- <ReturnValue><REPLACEABLE CLASS="PARAMETER">typename</REPLACEABLE></ReturnValue>
+ <REPLACEABLE CLASS="PARAMETER">typename</REPLACEABLE>
</TERM>
<LISTITEM>
<PARA>
</LISTITEM>
</VARLISTENTRY>
</variablelist>
- </LISTITEM>
- </VARLISTENTRY>
- </VARIABLELIST>
</REFSECT2>
<REFSECT2 ID="R2-SQL-DROPTYPE-2">
<REFSECT2INFO>
- <DATE>1998-04-15</DATE>
+ <DATE>1998-09-22</DATE>
</REFSECT2INFO>
<TITLE>
Outputs
<VARIABLELIST>
<VARLISTENTRY>
<TERM>
+<replaceable>status</replaceable>
</TERM>
<LISTITEM>
<PARA>
<REFSECT1 ID="R1-SQL-DROPTYPE-1">
<REFSECT1INFO>
- <DATE>1998-04-15</DATE>
+ <DATE>1998-09-22</DATE>
</REFSECT1INFO>
<TITLE>
Description
<REFSECT2 ID="R2-SQL-DROPTYPE-3">
<REFSECT2INFO>
- <DATE>1998-04-15</DATE>
+ <DATE>1998-09-22</DATE>
</REFSECT2INFO>
<TITLE>
Notes
</TITLE>
<PARA>
- DROP TYPE statement is a PostgreSQL language extension.
+ DROP TYPE statement is a <productname>Postgres</productname>
+ language extension.
</PARA>
<PARA>
- Refer to the <command>CREATE TYPE</command> statement for
+ Refer to <command>CREATE TYPE</command> for
inforamation on how to create types.
</PARA>
<PARA>
It is the user's responsibility to remove any operators,
- functions, aggregates, access methods, subtypes, classes,
- and so on, that use a deleted type.
+ functions, aggregates, access methods, subtypes, and classes
+ that use a deleted type.
</PARA>
</refsect2>
<REFSECT2 ID="R2-SQL-DROPTYPE-4">
<REFSECT2INFO>
- <DATE>1998-04-15</DATE>
+ <DATE>1998-09-22</DATE>
</REFSECT2INFO>
<TITLE>
Bugs
To remove the <literal>box</literal> type:
</PARA>
<ProgramListing>
- DROP TYPE box
+DROP TYPE box
</ProgramListing>
</REFSECT1>
<REFSECT2 ID="R2-SQL-DROPTYPE-5">
<REFSECT2INFO>
- <DATE>1998-04-15</DATE>
+ <DATE>1998-09-22</DATE>
</REFSECT2INFO>
<TITLE>
SQL3
</TITLE>
<PARA>
- DROP TYPE is a SQL3 statement.
+ DROP TYPE is a <acronym>SQL3</acronym> statement.
</PARA>
</refsect2>
</refsect1>
<REFSYNOPSISDIV>
<REFSYNOPSISDIVINFO>
- <DATE>1998-04-15</DATE>
+ <DATE>1998-09-22</DATE>
</REFSYNOPSISDIVINFO>
<SYNOPSIS>
- DROP USER <REPLACEABLE CLASS="PARAMETER">username</REPLACEABLE>
+DROP USER <REPLACEABLE CLASS="PARAMETER">username</REPLACEABLE>
</SYNOPSIS>
<REFSECT2 ID="R2-SQL-DROPUSER-1">
<REFSECT2INFO>
- <DATE>1998-04-15</DATE>
+ <DATE>1998-09-22</DATE>
</REFSECT2INFO>
<TITLE>
Inputs
</TITLE>
<PARA>
</PARA>
- <VARIABLELIST>
- <VARLISTENTRY>
- <TERM>
- </TERM>
- <LISTITEM>
- <PARA>
<VARIABLELIST>
<VARLISTENTRY>
<TERM>
- <ReturnValue><REPLACEABLE CLASS="PARAMETER">username</REPLACEABLE></ReturnValue>
+ <REPLACEABLE CLASS="PARAMETER">username</REPLACEABLE>
</TERM>
<LISTITEM>
<PARA>
</LISTITEM>
</VARLISTENTRY>
</variablelist>
- </LISTITEM>
- </VARLISTENTRY>
- </VARIABLELIST>
</REFSECT2>
<REFSECT2 ID="R2-SQL-DROPUSER-2">
<REFSECT2INFO>
- <DATE>1998-04-15</DATE>
+ <DATE>1998-09-22</DATE>
</REFSECT2INFO>
<TITLE>
Outputs
<VARIABLELIST>
<VARLISTENTRY>
<TERM>
+<replaceable>status</replaceable>
</TERM>
<LISTITEM>
<PARA>
<REFSECT1 ID="R1-SQL-DROPUSER-1">
<REFSECT1INFO>
- <DATE>1998-04-15</DATE>
+ <DATE>1998-09-22</DATE>
</REFSECT1INFO>
<TITLE>
Description
</TITLE>
<PARA>
- The <command>DROP USER</command> statement removes the named
+ <command>DROP USER</command> removes the specified
user from the database,
along with any databases owned by the user. It
does not remove tables, views, or triggers owned by the
named user in databases not owned by the user. This statement
- can be used in the place of the <command>destroyuser</command>
+ can be used in place of the <application>destroyuser</application>
script, regardless of how the user was created.
</PARA>
<REFSECT2 ID="R2-SQL-DROPUSER-3">
<REFSECT2INFO>
- <DATE>1998-04-15</DATE>
+ <DATE>1998-09-22</DATE>
</REFSECT2INFO>
<TITLE>
Notes
</TITLE>
<PARA>
- The <command>DROP USER</command> statement is a PostgreSQL
+ <command>DROP USER</command> is a <productname>Postgres</productname>
language extension.
</PARA>
<PARA>
- Refer to the <command>CREATE USER</command> and
- <command>ALTER USER</command> statements for information on
+ Refer to <command>CREATE USER</command> and
+ <command>ALTER USER</command> for information on
how to create or modify user accounts.
</PARA>
</REFSECT2>
To drop a user account:
</PARA>
<ProgramListing>
- DROP USER Jonathan;
+DROP USER Jonathan;
</ProgramListing>
</REFSECT1>
<REFSECT2 ID="R2-SQL-DROPUSER-4">
<REFSECT2INFO>
- <DATE>1998-04-15</DATE>
+ <DATE>1998-09-22</DATE>
</REFSECT2INFO>
<TITLE>
SQL92
</TITLE>
<PARA>
- There is no <command>DROP USER</command> statement in SQL92.
+ There is no <command>DROP USER</command> in <acronym>SQL92</acronym>.
</PARA>
</refsect2>
</refsect1>
</REFPURPOSE>
<REFSYNOPSISDIV>
<REFSYNOPSISDIVINFO>
- <DATE>1998-04-15</DATE>
+ <DATE>1998-09-22</DATE>
</REFSYNOPSISDIVINFO>
<SYNOPSIS>
- DROP VIEW <REPLACEABLE CLASS="PARAMETER">view</REPLACEABLE>
+DROP VIEW <REPLACEABLE CLASS="PARAMETER">view</REPLACEABLE>
</SYNOPSIS>
<REFSECT2 ID="R2-SQL-DROPVIEW-1">
<REFSECT2INFO>
- <DATE>1998-04-15</DATE>
+ <DATE>1998-09-22</DATE>
</REFSECT2INFO>
<TITLE>
Inputs
</TITLE>
<PARA>
</PARA>
- <VARIABLELIST>
- <VARLISTENTRY>
- <TERM>
- </TERM>
- <LISTITEM>
- <PARA>
<VARIABLELIST>
<VARLISTENTRY>
<TERM>
- <ReturnValue><REPLACEABLE CLASS="PARAMETER">view</REPLACEABLE></ReturnValue>
+ <REPLACEABLE CLASS="PARAMETER">view</REPLACEABLE>
</TERM>
<LISTITEM>
<PARA>
- The name of an existing view to drop.
+ The name of an existing view.
</PARA>
</LISTITEM>
</VARLISTENTRY>
</variablelist>
- </LISTITEM>
- </VARLISTENTRY>
- </VARIABLELIST>
</REFSECT2>
<REFSECT2 ID="R2-SQL-DROPVIEW-2">
<REFSECT2INFO>
- <DATE>1998-04-15</DATE>
+ <DATE>1998-09-22</DATE>
</REFSECT2INFO>
<TITLE>
Outputs
<VARIABLELIST>
<VARLISTENTRY>
<TERM>
+<replaceable>status</replaceable>
</TERM>
<LISTITEM>
<PARA>
<REFSECT1 ID="R1-SQL-DROPVIEW-1">
<REFSECT1INFO>
- <DATE>1998-04-15</DATE>
+ <DATE>1998-09-22</DATE>
</REFSECT1INFO>
<TITLE>
Description
<REFSECT2 ID="R2-SQL-DROPVIEW-3">
<REFSECT2INFO>
- <DATE>1998-04-15</DATE>
+ <DATE>1998-09-22</DATE>
</REFSECT2INFO>
<TITLE>
Notes
</TITLE>
<PARA>
- The PostgreSQL <command>DROP TABLE</command> statement also drops views.
+ The <productname>Postgres</productname>
+ <command>DROP TABLE</command> statement also drops views.
</PARA>
<PARA>
- Refer to the<command> CREATE VIEW</command> statement for information on how to create views.
+ Refer to <command>CREATE VIEW</command>
+ for information on how to create views.
</PARA>
</REFSECT2>
This command will remove the view called <literal>kinds</literal>:
</PARA>
<ProgramListing>
- DROP VIEW kinds
+DROP VIEW kinds;
</ProgramListing>
</REFSECT1>
<REFSECT2 ID="R2-SQL-DROPVIEW-4">
<REFSECT2INFO>
- <DATE>1998-04-15</DATE>
+ <DATE>1998-09-22</DATE>
</REFSECT2INFO>
<TITLE>
SQL92
</TITLE>
<PARA>
- SQL92 specifies some additional capabilities for
+ <acronym>SQL92</acronym> specifies some additional capabilities for
<command>DROP VIEW</command>:
</PARA>
<synopsis>
- DROP VIEW <replaceable class="parameter">view</replaceable> {RESTRICT | CASCADE}
+DROP VIEW <replaceable class="parameter">view</replaceable> { RESTRICT | CASCADE }
</synopsis>
+
+ <REFSECT3 ID="R3-SQL-DROPVIEW-1">
+ <REFSECT3INFO>
+ <DATE>1998-09-22</DATE>
+ </REFSECT3INFO>
+ <TITLE>
+ Inputs
+ </TITLE>
+ <PARA>
<variablelist>
<varlistentry>
<term>RESTRICT</term>
</listitem>
</varlistentry>
</variablelist>
+</refsect3>
+
+ <REFSECT3 ID="R3-SQL-DROPVIEW-2">
+ <REFSECT3INFO>
+ <DATE>1998-09-22</DATE>
+ </REFSECT3INFO>
+ <TITLE>
+ Notes
+ </TITLE>
+<para>
<tip>
<para>
- At present, to remove a referenced view from a PostgreSQL database,
- you must drop it by hand.
+ At present, to remove a referenced view from a
+ <productname>Postgres</productname> database,
+ you must drop it explicitly.
</para>
</tip>
</refsect2>