Commit 3450fd08 authored by Peter Eisentraut's avatar Peter Eisentraut

More editing of reference pages.

parent 8a703496
This diff is collapsed.
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/ref/create_cast.sgml,v 1.10 2003/03/25 16:15:39 petere Exp $ --> <!-- $Header: /cvsroot/pgsql/doc/src/sgml/ref/create_cast.sgml,v 1.11 2003/04/22 10:08:08 petere Exp $ -->
<refentry id="SQL-CREATECAST"> <refentry id="SQL-CREATECAST">
<refmeta> <refmeta>
...@@ -58,11 +58,11 @@ SELECT CAST(42 AS text); ...@@ -58,11 +58,11 @@ SELECT CAST(42 AS text);
<para> <para>
If the cast is marked <literal>AS ASSIGNMENT</> then it can be invoked If the cast is marked <literal>AS ASSIGNMENT</> then it can be invoked
implicitly when assigning to a column of the target data type. implicitly when assigning a value to a column of the target data type.
For example, supposing that <literal>foo.f1</literal> is a column of For example, supposing that <literal>foo.f1</literal> is a column of
type <type>text</type>, then type <type>text</type>, then
<programlisting> <programlisting>
INSERT INTO foo(f1) VALUES(42); INSERT INTO foo (f1) VALUES (42);
</programlisting> </programlisting>
will be allowed if the cast from type <type>integer</type> to type will be allowed if the cast from type <type>integer</type> to type
<type>text</type> is marked <literal>AS ASSIGNMENT</>, otherwise <type>text</type> is marked <literal>AS ASSIGNMENT</>, otherwise
...@@ -75,7 +75,7 @@ INSERT INTO foo(f1) VALUES(42); ...@@ -75,7 +75,7 @@ INSERT INTO foo(f1) VALUES(42);
If the cast is marked <literal>AS IMPLICIT</> then it can be invoked If the cast is marked <literal>AS IMPLICIT</> then it can be invoked
implicitly in any context, whether assignment or internally in an implicitly in any context, whether assignment or internally in an
expression. For example, since <literal>||</> takes <type>text</> expression. For example, since <literal>||</> takes <type>text</>
arguments, operands,
<programlisting> <programlisting>
SELECT 'The time is ' || now(); SELECT 'The time is ' || now();
</programlisting> </programlisting>
...@@ -106,14 +106,16 @@ SELECT 'The time is ' || CAST(now() AS text); ...@@ -106,14 +106,16 @@ SELECT 'The time is ' || CAST(now() AS text);
<para> <para>
To be able to create a cast, you must own the source or the target To be able to create a cast, you must own the source or the target
data type. To create a binary-compatible cast, you must be superuser data type. To create a binary-compatible cast, you must be superuser.
(this restriction is made because an erroneous binary-compatible cast (This restriction is made because an erroneous binary-compatible cast
conversion can easily crash the server). conversion can easily crash the server.)
</para> </para>
</refsect1>
<variablelist> <refsect1>
<title>Parameters</title> <title>Parameters</title>
<variablelist>
<varlistentry> <varlistentry>
<term><replaceable>sourcetype</replaceable></term> <term><replaceable>sourcetype</replaceable></term>
...@@ -183,6 +185,21 @@ SELECT 'The time is ' || CAST(now() AS text); ...@@ -183,6 +185,21 @@ SELECT 'The time is ' || CAST(now() AS text);
</refsect1> </refsect1>
<refsect1>
<title>Diagnostics</title>
<variablelist>
<varlistentry>
<term><computeroutput>CREATE CAST</computeroutput></term>
<listitem>
<para>
Message returned if the cast was successfully created.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 id="sql-createcast-notes"> <refsect1 id="sql-createcast-notes">
<title>Notes</title> <title>Notes</title>
...@@ -201,8 +218,8 @@ SELECT 'The time is ' || CAST(now() AS text); ...@@ -201,8 +218,8 @@ SELECT 'The time is ' || CAST(now() AS text);
argument of a different type was automatically a cast function. argument of a different type was automatically a cast function.
This convention has been abandoned in face of the introduction of This convention has been abandoned in face of the introduction of
schemas and to be able to represent binary compatible casts in the schemas and to be able to represent binary compatible casts in the
catalogs. (The built-in cast functions still follow this naming system catalogs. (The built-in cast functions still follow this naming
scheme, but they have to be shown as casts in <literal>pg_cast</> scheme, but they have to be shown as casts in the system catalog <literal>pg_cast</>
now.) now.)
</para> </para>
</refsect1> </refsect1>
...@@ -227,7 +244,7 @@ CREATE CAST (text AS int4) WITH FUNCTION int4(text); ...@@ -227,7 +244,7 @@ CREATE CAST (text AS int4) WITH FUNCTION int4(text);
<para> <para>
The <command>CREATE CAST</command> command conforms to SQL99, The <command>CREATE CAST</command> command conforms to SQL99,
except that SQL99 does not make provisions for binary compatible except that SQL99 does not make provisions for binary-compatible
types. <literal>AS IMPLICIT</> is a <productname>PostgreSQL</productname> types. <literal>AS IMPLICIT</> is a <productname>PostgreSQL</productname>
extension, too. extension, too.
</para> </para>
......
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/create_constraint.sgml,v 1.8 2002/05/18 15:44:47 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ref/create_constraint.sgml,v 1.9 2003/04/22 10:08:08 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -8,30 +8,35 @@ PostgreSQL documentation ...@@ -8,30 +8,35 @@ PostgreSQL documentation
<refentrytitle id="sql-createconstraint-title">CREATE CONSTRAINT TRIGGER</refentrytitle> <refentrytitle id="sql-createconstraint-title">CREATE CONSTRAINT TRIGGER</refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo> <refmiscinfo>SQL - Language Statements</refmiscinfo>
</refmeta> </refmeta>
<refnamediv> <refnamediv>
<refname> <refname>CREATE CONSTRAINT TRIGGER</refname>
CREATE CONSTRAINT TRIGGER <refpurpose>define a new constraint trigger</refpurpose>
</refname>
<refpurpose>
define a new constraint trigger
</refpurpose>
</refnamediv> </refnamediv>
<refsynopsisdiv> <refsynopsisdiv>
<refsynopsisdivinfo> <synopsis>
<date>2000-04-13</date>
</refsynopsisdivinfo>
<synopsis>
CREATE CONSTRAINT TRIGGER <replaceable class="parameter">name</replaceable> CREATE CONSTRAINT TRIGGER <replaceable class="parameter">name</replaceable>
AFTER <replaceable class="parameter">events</replaceable> ON AFTER <replaceable class="parameter">events</replaceable> ON
<replaceable class="parameter">relation</replaceable> <replaceable class="parameter">constraint</replaceable> <replaceable class="parameter">attributes</replaceable> <replaceable class="parameter">table</replaceable> <replaceable class="parameter">constraint</replaceable> <replaceable class="parameter">attributes</replaceable>
FOR EACH ROW EXECUTE PROCEDURE <replaceable class="parameter">func</replaceable> '(' <replaceable class="parameter">args</replaceable> ')' FOR EACH ROW EXECUTE PROCEDURE <replaceable class="parameter">func</replaceable> ( <replaceable class="parameter">args</replaceable> )
</synopsis> </synopsis>
</refsynopsisdiv>
<refsect1>
<title>Description</title>
<refsect2 id="R2-SQL-CREATECONSTRAINT-1">
<title>
Inputs
</title>
<para> <para>
<command>CREATE CONSTRAINT TRIGGER</command> is used within
<command>CREATE TABLE</command>/<command>ALTER TABLE</command> and by
<application>pg_dump</application> to create the special triggers for
referential integrity.
It is not intended for general use.
</para>
</refsect1>
<refsect1>
<title>Parameters</title>
<variablelist> <variablelist>
<varlistentry> <varlistentry>
...@@ -53,10 +58,10 @@ CREATE CONSTRAINT TRIGGER <replaceable class="parameter">name</replaceable> ...@@ -53,10 +58,10 @@ CREATE CONSTRAINT TRIGGER <replaceable class="parameter">name</replaceable>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><replaceable class="PARAMETER">relation</replaceable></term> <term><replaceable class="PARAMETER">table</replaceable></term>
<listitem> <listitem>
<para> <para>
The name (possibly schema-qualified) of the relation in which The name (possibly schema-qualified) of the table in which
the triggering events occur. the triggering events occur.
</para> </para>
</listitem> </listitem>
...@@ -75,7 +80,7 @@ CREATE CONSTRAINT TRIGGER <replaceable class="parameter">name</replaceable> ...@@ -75,7 +80,7 @@ CREATE CONSTRAINT TRIGGER <replaceable class="parameter">name</replaceable>
<term><replaceable class="PARAMETER">attributes</replaceable></term> <term><replaceable class="PARAMETER">attributes</replaceable></term>
<listitem> <listitem>
<para> <para>
Constraint attributes. The constraint attributes.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
...@@ -84,25 +89,19 @@ CREATE CONSTRAINT TRIGGER <replaceable class="parameter">name</replaceable> ...@@ -84,25 +89,19 @@ CREATE CONSTRAINT TRIGGER <replaceable class="parameter">name</replaceable>
<term><replaceable class="PARAMETER">func</replaceable>(<replaceable class="PARAMETER">args</replaceable>)</term> <term><replaceable class="PARAMETER">func</replaceable>(<replaceable class="PARAMETER">args</replaceable>)</term>
<listitem> <listitem>
<para> <para>
Function to call as part of the trigger processing. The function to call as part of the trigger processing.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
</variablelist> </variablelist>
</para> </refsect1>
</refsect2>
<refsect2 id="R2-SQL-CREATECONSTRAINT-2"> <refsect1>
<title> <title>Diagnostics</title>
Outputs
</title>
<para>
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term><computeroutput> <term><computeroutput>CREATE TRIGGER</computeroutput></term>
CREATE TRIGGER
</computeroutput></term>
<listitem> <listitem>
<para> <para>
Message returned if successful. Message returned if successful.
...@@ -110,24 +109,6 @@ CREATE TRIGGER ...@@ -110,24 +109,6 @@ CREATE TRIGGER
</listitem> </listitem>
</varlistentry> </varlistentry>
</variablelist> </variablelist>
</para>
</refsect2>
</refsynopsisdiv>
<refsect1 id="R1-SQL-CREATECONSTRAINT-1">
<title>
Description
</title>
<para>
<command>CREATE CONSTRAINT TRIGGER</command> is used within
<command>CREATE/ALTER TABLE</command> and by
<application>pg_dump</application> to create the special triggers for
referential integrity.
</para>
<para>
It is not intended for general use.
</para>
</refsect1> </refsect1>
</refentry> </refentry>
......
<!-- $Header: /cvsroot/pgsql/doc/src/sgml/ref/create_conversion.sgml,v 1.7 2003/03/25 16:15:39 petere Exp $ --> <!-- $Header: /cvsroot/pgsql/doc/src/sgml/ref/create_conversion.sgml,v 1.8 2003/04/22 10:08:08 petere Exp $ -->
<refentry id="SQL-CREATECONVERSION"> <refentry id="SQL-CREATECONVERSION">
<refmeta> <refmeta>
...@@ -23,21 +23,24 @@ CREATE [DEFAULT] CONVERSION <replaceable>conversion_name</replaceable> ...@@ -23,21 +23,24 @@ CREATE [DEFAULT] CONVERSION <replaceable>conversion_name</replaceable>
<para> <para>
<command>CREATE CONVERSION</command> defines a new encoding <command>CREATE CONVERSION</command> defines a new encoding
conversion. Conversion names may be used in the CONVERT() function conversion. Conversion names may be used in the <function>convert</function> function
to specify a particular encoding conversion. Also, conversions that to specify a particular encoding conversion. Also, conversions that
are marked DEFAULT can be used for automatic encoding conversion between are marked <literal>DEFAULT</> can be used for automatic encoding conversion between
frontend and backend. For this purpose, two conversions, from encoding A to client and server. For this purpose, two conversions, from encoding A to
B AND from encoding B to A, must be defined. B <emphasis>and</emphasis> from encoding B to A, must be defined.
</para> </para>
<para> <para>
To be able to create a conversion, you must have the execute right To be able to create a conversion, you must have <literal>EXECUTE</literal> privilege
on the function and the create right on the destination schema. on the function and <literal>CREATE</literal> privilege on the destination schema.
</para> </para>
</refsect1>
<variablelist>
<refsect1>
<title>Parameters</title> <title>Parameters</title>
<variablelist>
<varlistentry> <varlistentry>
<term><literal>DEFAULT</literal></term> <term><literal>DEFAULT</literal></term>
...@@ -75,7 +78,7 @@ CREATE [DEFAULT] CONVERSION <replaceable>conversion_name</replaceable> ...@@ -75,7 +78,7 @@ CREATE [DEFAULT] CONVERSION <replaceable>conversion_name</replaceable>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><replaceable>source_encoding</replaceable></term> <term><replaceable>dest_encoding</replaceable></term>
<listitem> <listitem>
<para> <para>
...@@ -97,20 +100,34 @@ CREATE [DEFAULT] CONVERSION <replaceable>conversion_name</replaceable> ...@@ -97,20 +100,34 @@ CREATE [DEFAULT] CONVERSION <replaceable>conversion_name</replaceable>
<para> <para>
The function must have the following signature: The function must have the following signature:
<programlisting> <programlisting>
conv_proc( conv_proc(
INTEGER, -- source encoding id integer, -- source encoding ID
INTEGER, -- destination encoding id integer, -- destination encoding ID
CSTRING, -- source string (null terminated C string) cstring, -- source string (null terminated C string)
CSTRING, -- destination string (null terminated C string) cstring, -- destination string (null terminated C string)
INTEGER -- source string length integer -- source string length
) returns VOID; ) RETURNS void;
</programlisting> </programlisting>
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
</variablelist> </variablelist>
</refsect1>
<refsect1>
<title>Diagnostics</title>
<variablelist>
<varlistentry>
<term><computeroutput>CREATE CONVERSION</computeroutput></term>
<listitem>
<para>
Message returned if the conversion was successfully created.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1> </refsect1>
<refsect1 id="sql-createconversion-notes"> <refsect1 id="sql-createconversion-notes">
...@@ -124,15 +141,14 @@ CREATE [DEFAULT] CONVERSION <replaceable>conversion_name</replaceable> ...@@ -124,15 +141,14 @@ CREATE [DEFAULT] CONVERSION <replaceable>conversion_name</replaceable>
The privileges required to create a conversion may be changed in a future The privileges required to create a conversion may be changed in a future
release. release.
</para> </para>
</refsect1> </refsect1>
<refsect1 id="sql-createconversion-examples"> <refsect1 id="sql-createconversion-examples">
<title>Examples</title> <title>Examples</title>
<para> <para>
To create a conversion from encoding UNICODE to LATIN1 using <function>myfunc</>: To create a conversion from encoding <literal>UNICODE</literal> to
<literal>LATIN1</literal> using <function>myfunc</>:
<programlisting> <programlisting>
CREATE CONVERSION myconv FOR 'UNICODE' TO 'LATIN1' FROM myfunc; CREATE CONVERSION myconv FOR 'UNICODE' TO 'LATIN1' FROM myfunc;
</programlisting> </programlisting>
...@@ -147,7 +163,7 @@ CREATE CONVERSION myconv FOR 'UNICODE' TO 'LATIN1' FROM myfunc; ...@@ -147,7 +163,7 @@ CREATE CONVERSION myconv FOR 'UNICODE' TO 'LATIN1' FROM myfunc;
<command>CREATE CONVERSION</command> <command>CREATE CONVERSION</command>
is a <productname>PostgreSQL</productname> extension. is a <productname>PostgreSQL</productname> extension.
There is no <command>CREATE CONVERSION</command> There is no <command>CREATE CONVERSION</command>
statement in <acronym>SQL99</acronym>. statement in the SQL standard.
</para> </para>
</refsect1> </refsect1>
......
This diff is collapsed.
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/create_domain.sgml,v 1.12 2003/03/25 16:15:39 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ref/create_domain.sgml,v 1.13 2003/04/22 10:08:08 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
<refentry id="SQL-CREATEDOMAIN"> <refentry id="SQL-CREATEDOMAIN">
<refmeta> <refmeta>
<refentrytitle id="sql-createdomain-title"> <refentrytitle id="sql-createdomain-title">CREATE DOMAIN</refentrytitle>
CREATE DOMAIN
</refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo> <refmiscinfo>SQL - Language Statements</refmiscinfo>
</refmeta> </refmeta>
<refnamediv> <refnamediv>
<refname> <refname>CREATE DOMAIN</refname>
CREATE DOMAIN <refpurpose>define a new domain</refpurpose>
</refname>
<refpurpose>
define a new domain
</refpurpose>
</refnamediv> </refnamediv>
<refsynopsisdiv> <refsynopsisdiv>
<refsynopsisdivinfo> <synopsis>
<date>2002-02-24</date>
</refsynopsisdivinfo>
<synopsis>
CREATE DOMAIN <replaceable class="parameter">domainname</replaceable> [AS] <replaceable class="parameter">data_type</replaceable> CREATE DOMAIN <replaceable class="parameter">domainname</replaceable> [AS] <replaceable class="parameter">data_type</replaceable>
[ DEFAULT <replaceable>default_expr</> ] [ DEFAULT <replaceable>default_expr</> ]
[ <replaceable class="PARAMETER">constraint</replaceable> [ ... ] ] [ <replaceable class="PARAMETER">constraint</replaceable> [ ... ] ]
...@@ -31,16 +24,35 @@ where <replaceable class="PARAMETER">constraint</replaceable> is: ...@@ -31,16 +24,35 @@ where <replaceable class="PARAMETER">constraint</replaceable> is:
[ CONSTRAINT <replaceable class="PARAMETER">constraint_name</replaceable> ] [ CONSTRAINT <replaceable class="PARAMETER">constraint_name</replaceable> ]
{ NOT NULL | NULL | CHECK (<replaceable class="PARAMETER">expression</replaceable>) } { NOT NULL | NULL | CHECK (<replaceable class="PARAMETER">expression</replaceable>) }
</synopsis> </synopsis>
</refsynopsisdiv>
<refsect1>
<title>Description</title>
<refsect2 id="R2-SQL-CREATEDOMAIN-1">
<refsect2info>
<date>2002-02-24</date>
</refsect2info>
<title>
Parameters
</title>
<para> <para>
<command>CREATE DOMAIN</command> creates a new data domain. The
user who defines a domain becomes its owner.
</para>
<para>
If a schema name is given (for example, <literal>CREATE DOMAIN
myschema.mydomain ...</>) then the domain is created in the
specified schema. Otherwise it is created in the current schema.
The domain name must be unique among the types and domains existing
in its schema.
</para>
<para>
Domains are useful for abstracting common fields between tables into
a single location for maintenance. For example, an email address column may be used
in several tables, all with the same properties. Define a domain and
use that rather than setting up each table's constraints individually.
</para>
</refsect1>
<refsect1>
<title>Parameters</title>
<variablelist> <variablelist>
<varlistentry> <varlistentry>
...@@ -63,32 +75,26 @@ where <replaceable class="PARAMETER">constraint</replaceable> is: ...@@ -63,32 +75,26 @@ where <replaceable class="PARAMETER">constraint</replaceable> is:
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><literal>DEFAULT <term><literal>DEFAULT <replaceable>default_expr</replaceable></literal></term>
<replaceable>default_expr</replaceable></literal></term>
<listitem> <listitem>
<para> <para>
The <literal>DEFAULT</> clause specifies a default value for The <literal>DEFAULT</> clause specifies a default value for
columns of the domain data type. The value columns of the domain data type. The value is any
is any variable-free expression (but subselects are not allowed). variable-free expression (but subqueries are not allowed).
The The data type of the default expression must match the data
data type of the default expression must match the data type of the type of the domain. If no default value is specified, then
domain. the default value is the null value.
</para>
<para>
The default expression will be used in any insert operation that
does not specify a value for the column. If there is no default
for a domain, then the default is NULL.
</para> </para>
<note>
<para> <para>
If a default value is specified for a particular column, it The default expression will be used in any insert operation
overrides any default associated with the domain. In turn, that does not specify a value for the column. If a default
the domain default overrides any default value associated with value is defined for a particular column, it overrides any
the underlying data type. default associated with the domain. In turn, the domain
default overrides any default value associated with the
underlying data type.
</para> </para>
</note>
</listitem> </listitem>
</varlistentry> </varlistentry>
...@@ -106,7 +112,7 @@ where <replaceable class="PARAMETER">constraint</replaceable> is: ...@@ -106,7 +112,7 @@ where <replaceable class="PARAMETER">constraint</replaceable> is:
<term><literal>NOT NULL</></term> <term><literal>NOT NULL</></term>
<listitem> <listitem>
<para> <para>
Values of this domain are not allowed to be NULL. Values of this domain are not allowed to be null.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
...@@ -115,12 +121,12 @@ where <replaceable class="PARAMETER">constraint</replaceable> is: ...@@ -115,12 +121,12 @@ where <replaceable class="PARAMETER">constraint</replaceable> is:
<term><literal>NULL</></term> <term><literal>NULL</></term>
<listitem> <listitem>
<para> <para>
Values of this domain are allowed to be NULL. This is the default. Values of this domain are allowed to be null. This is the default.
</para> </para>
<para> <para>
This clause is only available for compatibility with This clause is only intended for compatibility with
non-standard SQL databases. Its use is discouraged in new nonstandard SQL databases. Its use is discouraged in new
applications. applications.
</para> </para>
</listitem> </listitem>
...@@ -139,84 +145,50 @@ where <replaceable class="PARAMETER">constraint</replaceable> is: ...@@ -139,84 +145,50 @@ where <replaceable class="PARAMETER">constraint</replaceable> is:
<para> <para>
Currently, <literal>CHECK</literal> expressions cannot contain Currently, <literal>CHECK</literal> expressions cannot contain
subselects nor refer to variables other than <literal>VALUE</>. subqueries nor refer to variables other than <literal>VALUE</>.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
</variablelist> </variablelist>
</para> </refsect1>
</refsect2>
<refsect2 id="R2-SQL-CREATEDOMAIN-2"> <refsect1>
<refsect2info> <title>Diagnostics</title>
<date>2002-02-24</date>
</refsect2info>
<title>
Outputs
</title>
<para>
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term><computeroutput> <term><computeroutput>CREATE DOMAIN</computeroutput></term>
CREATE DOMAIN
</computeroutput></term>
<listitem> <listitem>
<para> <para>
Message returned if the domain is successfully created. Message returned if the domain was successfully created.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
</variablelist> </variablelist>
</para>
</refsect2>
</refsynopsisdiv>
<refsect1 id="R1-SQL-CREATEDOMAIN-1">
<refsect1info>
<date>2002-02-24</date>
</refsect1info>
<title>
Description
</title>
<para>
<command>CREATE DOMAIN</command> allows the user to register a new
data domain with <productname>PostgreSQL</> for use in the
current data base. The user who defines a domain becomes its owner.
</para>
<para>
If a schema name is given (for example, <literal>CREATE DOMAIN
myschema.mydomain ...</>) then the domain is created in the
specified schema. Otherwise it is created in the current schema (the one
at the front of the search path; see <literal>CURRENT_SCHEMA()</>).
The domain name must be unique among the types and domains existing
in its schema.
</para>
<para>
Domains are useful for abstracting common fields between tables into
a single location for maintenance. An email address column may be used
in several tables, all with the same properties. Define a domain and
use that rather than setting up each table's constraints individually.
</para>
</refsect1> </refsect1>
<refsect1> <refsect1>
<title>Examples</title> <title>Examples</title>
<para> <para>
This example creates the <type>country_code</type> data type and then uses the This example creates the <type>country_code</type> data type and then uses the
type in a table definition: type in a table definition:
<programlisting> <programlisting>
CREATE DOMAIN country_code char(2) NOT NULL; CREATE DOMAIN country_code char(2) NOT NULL;
CREATE TABLE countrylist (id INT4, country country_code); CREATE TABLE countrylist (id integer, country country_code);
</programlisting> </programlisting>
</para> </para>
</refsect1> </refsect1>
<refsect1 id="SQL-CREATEDOMAIN-compatibility">
<title>Compatibility</title>
<para>
The command <command>CREATE DOMAIN</command> conforms to the SQL
standard.
</para>
</refsect1>
<refsect1 id="SQL-CREATEDOMAIN-see-also"> <refsect1 id="SQL-CREATEDOMAIN-see-also">
<title>See Also</title> <title>See Also</title>
......
This diff is collapsed.
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/create_group.sgml,v 1.10 2003/03/25 16:15:39 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ref/create_group.sgml,v 1.11 2003/04/22 10:08:08 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -8,35 +8,41 @@ PostgreSQL documentation ...@@ -8,35 +8,41 @@ PostgreSQL documentation
<refentrytitle id="sql-creategroup-title">CREATE GROUP</refentrytitle> <refentrytitle id="sql-creategroup-title">CREATE GROUP</refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo> <refmiscinfo>SQL - Language Statements</refmiscinfo>
</refmeta> </refmeta>
<refnamediv> <refnamediv>
<refname> <refname>CREATE GROUP</refname>
CREATE GROUP <refpurpose>define a new user group</refpurpose>
</refname>
<refpurpose>
define a new user group
</refpurpose>
</refnamediv> </refnamediv>
<refsynopsisdiv> <refsynopsisdiv>
<refsynopsisdivinfo> <synopsis>
<date>2000-01-14</date>
</refsynopsisdivinfo>
<synopsis>
CREATE GROUP <replaceable class="PARAMETER">name</replaceable> [ [ WITH ] <replaceable class="PARAMETER">option</replaceable> [ ... ] ] CREATE GROUP <replaceable class="PARAMETER">name</replaceable> [ [ WITH ] <replaceable class="PARAMETER">option</replaceable> [ ... ] ]
where <replaceable class="PARAMETER">option</replaceable> can be: where <replaceable class="PARAMETER">option</replaceable> can be:
SYSID <replaceable class="PARAMETER">gid</replaceable> SYSID <replaceable class="PARAMETER">gid</replaceable>
| USER <replaceable class="PARAMETER">username</replaceable> [, ...] | USER <replaceable class="PARAMETER">username</replaceable> [, ...]
</synopsis> </synopsis>
</refsynopsisdiv>
<refsect2 id="R2-SQL-CREATEGROUP-1">
<refsect2info> <refsect1>
<date>2000-01-14</date> <title>Description</title>
</refsect2info>
<title>
Inputs
</title>
<para> <para>
<command>CREATE GROUP</command> will create a new group in the
database cluster. You must be a database
superuser to use this command.
</para>
<para>
Use <xref linkend="SQL-ALTERGROUP" endterm="SQL-ALTERGROUP-title">
to change a group's membership, and <xref linkend="SQL-DROPGROUP"
endterm="SQL-DROPGROUP-title"> to remove a group.
</para>
</refsect1>
<refsect1>
<title>Parameters</title>
<variablelist> <variablelist>
<varlistentry> <varlistentry>
...@@ -53,11 +59,11 @@ where <replaceable class="PARAMETER">option</replaceable> can be: ...@@ -53,11 +59,11 @@ where <replaceable class="PARAMETER">option</replaceable> can be:
<listitem> <listitem>
<para> <para>
The <literal>SYSID</literal> clause can be used to choose The <literal>SYSID</literal> clause can be used to choose
the <productname>PostgreSQL</productname> group id of the new the <productname>PostgreSQL</productname> group ID of the new
group. It is not necessary to do so, however. group. It is not necessary to do so, however.
</para> </para>
<para> <para>
If this is not specified, the highest assigned group id plus one, If this is not specified, the highest assigned group ID plus one,
starting at 1, will be used as default. starting at 1, will be used as default.
</para> </para>
</listitem> </listitem>
...@@ -73,54 +79,26 @@ where <replaceable class="PARAMETER">option</replaceable> can be: ...@@ -73,54 +79,26 @@ where <replaceable class="PARAMETER">option</replaceable> can be:
</varlistentry> </varlistentry>
</variablelist> </variablelist>
</para> </refsect1>
</refsect2>
<refsect2 id="R2-SQL-CREATEGROUP-2"> <refsect1>
<refsect2info> <title>Diagnostics</title>
<date>2000-01-14</date>
</refsect2info>
<title>
Outputs
</title>
<para>
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term><computeroutput>CREATE GROUP</computeroutput></term> <term><computeroutput>CREATE GROUP</computeroutput></term>
<listitem> <listitem>
<para> <para>
Message returned if the command completes successfully. Message returned if the group was successfully created.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
</variablelist> </variablelist>
</para>
</refsect2>
</refsynopsisdiv>
<refsect1 id="R1-SQL-CREATEGROUP-1">
<refsect1info>
<date>2000-01-14</date>
</refsect1info>
<title>
Description
</title>
<para>
<command>CREATE GROUP</command> will create a new group in the
database installation. You must be a database
superuser to use this command.
</para>
<para>
Use <xref linkend="SQL-ALTERGROUP" endterm="SQL-ALTERGROUP-title">
to change a group's membership, and <xref linkend="SQL-DROPGROUP"
endterm="SQL-DROPGROUP-title"> to remove a group.
</para>
</refsect1> </refsect1>
<refsect1 id="R1-SQL-CREATEGROUP-2">
<title> <refsect1>
Usage <title>Examples</title>
</title>
<para> <para>
Create an empty group: Create an empty group:
<programlisting> <programlisting>
...@@ -136,24 +114,13 @@ CREATE GROUP marketing WITH USER jonathan, david; ...@@ -136,24 +114,13 @@ CREATE GROUP marketing WITH USER jonathan, david;
</para> </para>
</refsect1> </refsect1>
<refsect1 id="R1-SQL-CREATEGROUP-3"> <refsect1>
<title> <title>Compatibility</title>
Compatibility
</title>
<refsect2 id="R2-SQL-CREATEGROUP-4">
<refsect2info>
<date>2000-01-14</date>
</refsect2info>
<title>
SQL92
</title>
<para> <para>
There is no <command>CREATE GROUP</command> statement in SQL92. There is no <command>CREATE GROUP</command> statement in the SQL
Roles are similar in concept to groups. standard. Roles are similar in concept to groups.
</para> </para>
</refsect2>
</refsect1> </refsect1>
</refentry> </refentry>
......
This diff is collapsed.
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/create_language.sgml,v 1.31 2003/03/25 16:15:39 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ref/create_language.sgml,v 1.32 2003/04/22 10:08:08 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -60,7 +60,7 @@ CREATE [ TRUSTED ] [ PROCEDURAL ] LANGUAGE <replaceable class="parameter">langna ...@@ -60,7 +60,7 @@ CREATE [ TRUSTED ] [ PROCEDURAL ] LANGUAGE <replaceable class="parameter">langna
<literal>TRUSTED</literal> specifies that the call handler for <literal>TRUSTED</literal> specifies that the call handler for
the language is safe, that is, it does not offer an the language is safe, that is, it does not offer an
unprivileged user any functionality to bypass access unprivileged user any functionality to bypass access
restrictions. If this keyword is omitted when registering the restrictions. If this key word is omitted when registering the
language, only users with the language, only users with the
<productname>PostgreSQL</productname> superuser privilege can <productname>PostgreSQL</productname> superuser privilege can
use this language to create new functions. use this language to create new functions.
...@@ -84,8 +84,8 @@ CREATE [ TRUSTED ] [ PROCEDURAL ] LANGUAGE <replaceable class="parameter">langna ...@@ -84,8 +84,8 @@ CREATE [ TRUSTED ] [ PROCEDURAL ] LANGUAGE <replaceable class="parameter">langna
<listitem> <listitem>
<para> <para>
The name of the new procedural language. The language name is The name of the new procedural language. The language name is
case insensitive. A procedural language cannot override one of case insensitive. The name must be unique among the languages
the built-in languages of <productname>PostgreSQL</productname>. in the database.
</para> </para>
<para> <para>
...@@ -146,45 +146,16 @@ CREATE [ TRUSTED ] [ PROCEDURAL ] LANGUAGE <replaceable class="parameter">langna ...@@ -146,45 +146,16 @@ CREATE [ TRUSTED ] [ PROCEDURAL ] LANGUAGE <replaceable class="parameter">langna
<refsect1 id="sql-createlanguage-diagnostics"> <refsect1 id="sql-createlanguage-diagnostics">
<title>Diagnostics</title> <title>Diagnostics</title>
<msgset> <variablelist>
<msgentry> <varlistentry>
<msg> <term><computeroutput>CREATE LANGUAGE</computeroutput></term>
<msgmain> <listitem>
<msgtext>
<screen>
CREATE LANGUAGE
</screen>
</msgtext>
</msgmain>
</msg>
<msgexplan>
<para>
This message is returned if the language is successfully
created.
</para>
</msgexplan>
</msgentry>
<msgentry>
<msg>
<msgmain>
<msgtext>
<screen>
ERROR: PL handler function <replaceable class="parameter">funcname</replaceable>() doesn't exist
</screen>
</msgtext>
</msgmain>
</msg>
<msgexplan>
<para> <para>
This error is returned if the function <replaceable Message returned if the language was successfully created.
class="parameter">funcname</replaceable>() is not found.
</para> </para>
</msgexplan> </listitem>
</msgentry> </varlistentry>
</msgset> </variablelist>
</refsect1> </refsect1>
<refsect1 id="sql-createlanguage-notes"> <refsect1 id="sql-createlanguage-notes">
...@@ -194,7 +165,7 @@ ERROR: PL handler function <replaceable class="parameter">funcname</replaceable ...@@ -194,7 +165,7 @@ ERROR: PL handler function <replaceable class="parameter">funcname</replaceable
This command normally should not be executed directly by users. This command normally should not be executed directly by users.
For the procedural languages supplied in the For the procedural languages supplied in the
<productname>PostgreSQL</productname> distribution, the <xref <productname>PostgreSQL</productname> distribution, the <xref
linkend="app-createlang"> script should be used, which will also linkend="app-createlang"> program should be used, which will also
install the correct call handler. (<command>createlang</command> install the correct call handler. (<command>createlang</command>
will call <command>CREATE LANGUAGE</command> internally.) will call <command>CREATE LANGUAGE</command> internally.)
</para> </para>
...@@ -205,7 +176,7 @@ ERROR: PL handler function <replaceable class="parameter">funcname</replaceable ...@@ -205,7 +176,7 @@ ERROR: PL handler function <replaceable class="parameter">funcname</replaceable
type <type>opaque</>, rather than <type>language_handler</>. type <type>opaque</>, rather than <type>language_handler</>.
To support loading To support loading
of old dump files, <command>CREATE LANGUAGE</> will accept a function of old dump files, <command>CREATE LANGUAGE</> will accept a function
declared as returning <type>opaque</>, but it will issue a NOTICE and declared as returning <type>opaque</>, but it will issue a notice and
change the function's declared return type to <type>language_handler</>. change the function's declared return type to <type>language_handler</>.
</para> </para>
...@@ -216,35 +187,19 @@ ERROR: PL handler function <replaceable class="parameter">funcname</replaceable ...@@ -216,35 +187,19 @@ ERROR: PL handler function <replaceable class="parameter">funcname</replaceable
<para> <para>
Use <xref linkend="sql-droplanguage" endterm="sql-droplanguage-title">, or better yet the <xref Use <xref linkend="sql-droplanguage" endterm="sql-droplanguage-title">, or better yet the <xref
linkend="app-droplang"> script, to drop procedural languages. linkend="app-droplang"> program, to drop procedural languages.
</para> </para>
<para> <para>
The system catalog <classname>pg_language</classname> records The system catalog <classname>pg_language</classname> (see <xref
information about the currently installed procedural languages. linkend="catalog-pg-language">) records information about the
currently installed languages. Also <command>createlang</command>
<screen> has an option to list the installed languages.
Table "pg_language"
Attribute | Type | Modifier
---------------+-----------+----------
lanname | name |
lanispl | boolean |
lanpltrusted | boolean |
lanplcallfoid | oid |
lanvalidator | oid |
lanacl | aclitem[] |
lanname | lanispl | lanpltrusted | lanplcallfoid | lanvalidator | lanacl
-------------+---------+--------------+---------------+--------------+--------
internal | f | f | 0 | 2246 |
c | f | f | 0 | 2247 |
sql | f | t | 0 | 2248 | {=U}
</screen>
</para> </para>
<para> <para>
At present, with the exception of the permissions, the definition The definition of a procedural language cannot be changed once it
of a procedural language cannot be changed once it has been created. has been created, with the exception of the privileges.
</para> </para>
<para> <para>
...@@ -262,7 +217,7 @@ ERROR: PL handler function <replaceable class="parameter">funcname</replaceable ...@@ -262,7 +217,7 @@ ERROR: PL handler function <replaceable class="parameter">funcname</replaceable
The following two commands executed in sequence will register a new The following two commands executed in sequence will register a new
procedural language and the associated call handler. procedural language and the associated call handler.
<programlisting> <programlisting>
CREATE FUNCTION plsample_call_handler () RETURNS language_handler CREATE FUNCTION plsample_call_handler() RETURNS language_handler
AS '$libdir/plsample' AS '$libdir/plsample'
LANGUAGE C; LANGUAGE C;
CREATE LANGUAGE plsample CREATE LANGUAGE plsample
...@@ -280,15 +235,6 @@ CREATE LANGUAGE plsample ...@@ -280,15 +235,6 @@ CREATE LANGUAGE plsample
</para> </para>
</refsect1> </refsect1>
<refsect1>
<title>History</title>
<para>
The <command>CREATE LANGUAGE</command> command first appeared in
<productname>PostgreSQL</productname> 6.3.
</para>
</refsect1>
<refsect1> <refsect1>
<title>See Also</title> <title>See Also</title>
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/create_schema.sgml,v 1.4 2003/02/03 15:56:50 momjian Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ref/create_schema.sgml,v 1.5 2003/04/22 10:08:08 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -8,25 +8,51 @@ PostgreSQL documentation ...@@ -8,25 +8,51 @@ PostgreSQL documentation
<refentrytitle id="sql-createschema-title">CREATE SCHEMA</refentrytitle> <refentrytitle id="sql-createschema-title">CREATE SCHEMA</refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo> <refmiscinfo>SQL - Language Statements</refmiscinfo>
</refmeta> </refmeta>
<refnamediv> <refnamediv>
<refname> <refname>CREATE SCHEMA</refname>
CREATE SCHEMA <refpurpose>define a new schema</refpurpose>
</refname>
<refpurpose>
define a new schema
</refpurpose>
</refnamediv> </refnamediv>
<refsynopsisdiv> <refsynopsisdiv>
<synopsis> <synopsis>
CREATE SCHEMA <replaceable class="parameter">schemaname</replaceable> [ AUTHORIZATION <replaceable class="parameter">username</replaceable> ] [ <replaceable class="parameter">schema_element</replaceable> [ ... ] ] CREATE SCHEMA <replaceable class="parameter">schemaname</replaceable> [ AUTHORIZATION <replaceable class="parameter">username</replaceable> ] [ <replaceable class="parameter">schema_element</replaceable> [ ... ] ]
CREATE SCHEMA AUTHORIZATION <replaceable class="parameter">username</replaceable> [ <replaceable class="parameter">schema_element</replaceable> [ ... ] ] CREATE SCHEMA AUTHORIZATION <replaceable class="parameter">username</replaceable> [ <replaceable class="parameter">schema_element</replaceable> [ ... ] ]
</synopsis> </synopsis>
</refsynopsisdiv>
<refsect1>
<title>Description</title>
<para>
<command>CREATE SCHEMA</command> will enter a new schema
into the current database.
The schema name must be distinct from the name of any existing schema
in the current database.
</para>
<para>
A schema is essentially a namespace:
it contains named objects (tables, data types, functions, and operators)
whose names may duplicate those of other objects existing in other
schemas. Named objects are accessed either by <quote>qualifying</>
their names with the schema name as a prefix, or by setting a search
path that includes the desired schema(s). Unqualified objects are
created in the current schema (the one at the front of the search path,
which can be determined with the function <function>current_schema</function>).
</para>
<refsect2 id="R2-SQL-CREATESCHEMA-1">
<title>
Inputs
</title>
<para> <para>
Optionally, <command>CREATE SCHEMA</command> can include subcommands
to create objects within the new schema. The subcommands are treated
essentially the same as separate commands issued after creating the
schema, except that if the <literal>AUTHORIZATION</> clause is used,
all the created objects will be owned by that user.
</para>
</refsect1>
<refsect1>
<title>Parameters</title>
<variablelist> <variablelist>
<varlistentry> <varlistentry>
...@@ -63,75 +89,34 @@ CREATE SCHEMA AUTHORIZATION <replaceable class="parameter">username</replaceable ...@@ -63,75 +89,34 @@ CREATE SCHEMA AUTHORIZATION <replaceable class="parameter">username</replaceable
</listitem> </listitem>
</varlistentry> </varlistentry>
</variablelist> </variablelist>
</para> </refsect1>
</refsect2>
<refsect2 id="R2-SQL-CREATESCHEMA-2"> <refsect1>
<title> <title>Diagnostics</title>
Outputs
</title>
<para>
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term><computeroutput> <term><computeroutput>CREATE SCHEMA</computeroutput></term>
CREATE SCHEMA
</computeroutput></term>
<listitem> <listitem>
<para> <para>
Message returned if the command is successful. Message returned if the schema was successfully created.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term><computeroutput> <term><computeroutput>ERROR: namespace "<replaceable class="parameter">schemaname</replaceable>" already exists</computeroutput></term>
ERROR: namespace "<replaceable class="parameter">schemaname</replaceable>" already exists
</computeroutput></term>
<listitem> <listitem>
<para> <para>
If the schema specified already exists. Message returned if the schema specified already exists.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
</variablelist> </variablelist>
</para> </refsect1>
</refsect2>
</refsynopsisdiv>
<refsect1 id="R1-SQL-CREATESCHEMA-1">
<title>
Description
</title>
<para>
<command>CREATE SCHEMA</command> will enter a new schema
into the current database.
The schema name must be distinct from the name of any existing schema
in the current database.
</para>
<para>
A schema is essentially a namespace:
it contains named objects (tables, data types, functions, and operators)
whose names may duplicate those of other objects existing in other
schemas. Named objects are accessed either by <quote>qualifying</>
their names with the schema name as a prefix, or by setting a search
path that includes the desired schema(s). Unqualified objects are
created in the current schema (the one at the front of the search path;
see <literal>CURRENT_SCHEMA()</>).
</para>
<para>
Optionally, <command>CREATE SCHEMA</command> can include subcommands
to create objects within the new schema. The subcommands are treated
essentially the same as separate commands issued after creating the
schema, except that if the <literal>AUTHORIZATION</> clause is used,
all the created objects will be owned by that user.
</para>
<refsect2 id="R2-SQL-CREATESCHEMA-3"> <refsect1>
<title> <title>Notes</title>
Notes
</title>
<para> <para>
To create a schema, the invoking user must have <literal>CREATE</> To create a schema, the invoking user must have <literal>CREATE</>
...@@ -142,85 +127,74 @@ ERROR: namespace "<replaceable class="parameter">schemaname</replaceable>" alre ...@@ -142,85 +127,74 @@ ERROR: namespace "<replaceable class="parameter">schemaname</replaceable>" alre
<para> <para>
Use <command>DROP SCHEMA</command> to remove a schema. Use <command>DROP SCHEMA</command> to remove a schema.
</para> </para>
</refsect2>
</refsect1> </refsect1>
<refsect1 id="R1-SQL-CREATESCHEMA-2"> <refsect1>
<title> <title>Examples</title>
Examples
</title>
<para> <para>
Create a schema: Create a schema:
<programlisting>
<programlisting>
CREATE SCHEMA myschema; CREATE SCHEMA myschema;
</programlisting> </programlisting>
</para> </para>
<para> <para>
Create a schema for user <literal>joe</> --- the schema will also Create a schema for user <literal>joe</>; the schema will also be
be named <literal>joe</>: named <literal>joe</>:
<programlisting>
<programlisting>
CREATE SCHEMA AUTHORIZATION joe; CREATE SCHEMA AUTHORIZATION joe;
</programlisting> </programlisting>
</para> </para>
<para> <para>
Create a schema and create a table and view within it: Create a schema and create a table and view within it:
<programlisting>
<programlisting>
CREATE SCHEMA hollywood CREATE SCHEMA hollywood
CREATE TABLE films (title text, release date, awards text[]) CREATE TABLE films (title text, release date, awards text[])
CREATE VIEW winners AS CREATE VIEW winners AS
SELECT title, release FROM films WHERE awards IS NOT NULL; SELECT title, release FROM films WHERE awards IS NOT NULL;
</programlisting> </programlisting>
Notice that the individual subcommands do not end with semicolons. Notice that the individual subcommands do not end with semicolons.
</para> </para>
<para> <para>
The following is an equivalent way of accomplishing the same result: The following is an equivalent way of accomplishing the same result:
<programlisting> <programlisting>
CREATE SCHEMA hollywood; CREATE SCHEMA hollywood;
CREATE TABLE hollywood.films (title text, release date, awards text[]); CREATE TABLE hollywood.films (title text, release date, awards text[]);
CREATE VIEW hollywood.winners AS CREATE VIEW hollywood.winners AS
SELECT title, release FROM hollywood.films WHERE awards IS NOT NULL; SELECT title, release FROM hollywood.films WHERE awards IS NOT NULL;
</programlisting> </programlisting>
</para> </para>
</refsect1> </refsect1>
<refsect1 id="R1-SQL-CREATESCHEMA-3"> <refsect1>
<title> <title>Compatibility</title>
Compatibility
</title>
<refsect2 id="R2-SQL-CREATESCHEMA-4">
<title>
SQL92
</title>
<para> <para>
SQL92 allows a <literal>DEFAULT CHARACTER SET</> clause in The SQL standard allows a <literal>DEFAULT CHARACTER SET</> clause
<command>CREATE SCHEMA</command>, as well as more subcommand types in <command>CREATE SCHEMA</command>, as well as more subcommand
than are presently accepted by <productname>PostgreSQL</productname>. types than are presently accepted by
<productname>PostgreSQL</productname>.
</para> </para>
<para> <para>
SQL92 specifies that the subcommands in <command>CREATE SCHEMA</command> The SQL standard specifies that the subcommands in <command>CREATE
may appear in any order. The present SCHEMA</command> may appear in any order. The present
<productname>PostgreSQL</productname> implementation does not handle all <productname>PostgreSQL</productname> implementation does not
cases of forward references in subcommands; it may sometimes be necessary handle all cases of forward references in subcommands; it may
to reorder the subcommands to avoid forward references. sometimes be necessary to reorder the subcommands to avoid forward
references.
</para> </para>
<para> <para>
In SQL92, the owner of a schema always owns all objects within it. According to the SQL standard, the owner of a schema always owns
<productname>PostgreSQL</productname> allows schemas to contain objects all objects within it. <productname>PostgreSQL</productname>
owned by users other than the schema owner. This can happen only if the allows schemas to contain objects owned by users other than the
schema owner grants <literal>CREATE</> rights on his schema to someone schema owner. This can happen only if the schema owner grants the
else. <literal>CREATE</> privilege on his schema to someone else.
</para> </para>
</refsect2>
</refsect1> </refsect1>
</refentry> </refentry>
......
This diff is collapsed.
This diff is collapsed.
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/create_table_as.sgml,v 1.11 2002/11/21 23:34:43 petere Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/ref/create_table_as.sgml,v 1.12 2003/04/22 10:08:08 petere Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -18,16 +18,12 @@ PostgreSQL documentation ...@@ -18,16 +18,12 @@ PostgreSQL documentation
<synopsis> <synopsis>
CREATE [ [ LOCAL ] { TEMPORARY | TEMP } ] TABLE <replaceable>table_name</replaceable> [ (<replaceable>column_name</replaceable> [, ...] ) ] CREATE [ [ LOCAL ] { TEMPORARY | TEMP } ] TABLE <replaceable>table_name</replaceable> [ (<replaceable>column_name</replaceable> [, ...] ) ]
AS <replaceable>query</replaceable> AS <replaceable>query</replaceable>
</synopsis> </synopsis>
</refsynopsisdiv> </refsynopsisdiv>
<refsect1> <refsect1>
<refsect1info> <title>Description</title>
<date>2001-03-20</date>
</refsect1info>
<title>
Description
</title>
<para> <para>
<command>CREATE TABLE AS</command> creates a table and fills it <command>CREATE TABLE AS</command> creates a table and fills it
with data computed by a <command>SELECT</command> command. The with data computed by a <command>SELECT</command> command. The
...@@ -75,10 +71,9 @@ CREATE [ [ LOCAL ] { TEMPORARY | TEMP } ] TABLE <replaceable>table_name</replace ...@@ -75,10 +71,9 @@ CREATE [ [ LOCAL ] { TEMPORARY | TEMP } ] TABLE <replaceable>table_name</replace
<term><replaceable>column_name</replaceable></term> <term><replaceable>column_name</replaceable></term>
<listitem> <listitem>
<para> <para>
The name of a column in the new table. Multiple column names can The name of a column in the new table. If column names are not
be specified using a comma-delimited list of column names. If provided, they are taken from the output column names of the
column names are not provided, they are taken from the output query.
column names of the query.
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
...@@ -124,21 +119,12 @@ CREATE [ [ LOCAL ] { TEMPORARY | TEMP } ] TABLE <replaceable>table_name</replace ...@@ -124,21 +119,12 @@ CREATE [ [ LOCAL ] { TEMPORARY | TEMP } ] TABLE <replaceable>table_name</replace
<para> <para>
This command is modeled after an <productname>Oracle</productname> This command is modeled after an <productname>Oracle</productname>
feature. There is no command with equivalent functionality in feature. There is no command with equivalent functionality in
SQL92 or SQL99. However, a combination of <literal>CREATE the SQL standard. However, a combination of <literal>CREATE
TABLE</literal> and <literal>INSERT ... SELECT</literal> can TABLE</literal> and <literal>INSERT ... SELECT</literal> can
accomplish the same thing with little more effort. accomplish the same thing with little more effort.
</para> </para>
</refsect1> </refsect1>
<refsect1>
<title>History</title>
<para>
The <command>CREATE TABLE AS</command> command has been available
since <productname>PostgreSQL</productname> 6.3.
</para>
</refsect1>
<refsect1> <refsect1>
<title>See Also</title> <title>See Also</title>
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment