mirror of
https://github.com/postgres/postgres.git
synced 2025-08-05 07:41:25 +03:00
Include information on new DEFAULT and CONSTRAINT clauses.
This commit is contained in:
@@ -1,13 +1,17 @@
|
|||||||
.\" This is -*-nroff-*-
|
.\" This is -*-nroff-*-
|
||||||
.\" XXX standard disclaimer belongs here....
|
.\" XXX standard disclaimer belongs here....
|
||||||
.\" $Header: /cvsroot/pgsql/src/man/Attic/alter_table.l,v 1.2 1996/12/11 00:26:55 momjian Exp $
|
.\" $Header: /cvsroot/pgsql/src/man/Attic/alter_table.l,v 1.3 1997/09/26 15:21:26 thomas Exp $
|
||||||
.TH "ALTER TABLE" SQL 11/5/95 PostgreSQL PostgreSQL
|
.TH "ALTER TABLE" SQL 09/25/97 PostgreSQL
|
||||||
.SH NAME
|
.SH NAME
|
||||||
alter table \(em add attributes to a class
|
alter table \(em add attributes to a class
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
.nf
|
.nf
|
||||||
\fBalter table\fR classname [*]
|
\fBalter table\fR classname [ * ]
|
||||||
\fBadd column\fR attname type
|
\fBadd\fR [ \fBcolumn\fR ] attname type
|
||||||
|
.fi
|
||||||
|
.nf
|
||||||
|
\fBalter table\fR classname [ * ]
|
||||||
|
\fBadd\fR \fB(\fR attname type \fB)\fR
|
||||||
|
|
||||||
.fi
|
.fi
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
@@ -18,7 +22,7 @@ causes a new attribute to be added to an existing class,
|
|||||||
.IR classname .
|
.IR classname .
|
||||||
The new attributes and their types are specified
|
The new attributes and their types are specified
|
||||||
in the same style and with the the same restrictions as in
|
in the same style and with the the same restrictions as in
|
||||||
.IR create table (l).
|
.IR "create table" (l).
|
||||||
.PP
|
.PP
|
||||||
In order to add an attribute to each class in an entire inheritance
|
In order to add an attribute to each class in an entire inheritance
|
||||||
hierarchy, use the
|
hierarchy, use the
|
||||||
|
@@ -1,30 +1,32 @@
|
|||||||
.\" This is -*-nroff-*-
|
.\" This is -*-nroff-*-
|
||||||
.\" XXX standard disclaimer belongs here....
|
.\" XXX standard disclaimer belongs here....
|
||||||
.\" $Header: /cvsroot/pgsql/src/man/Attic/create_table.l,v 1.5 1997/08/26 17:39:30 momjian Exp $
|
.\" $Header: /cvsroot/pgsql/src/man/Attic/create_table.l,v 1.6 1997/09/26 15:21:27 thomas Exp $
|
||||||
.TH "CREATE TABLE" SQL 11/05/95 PostgreSQL PostgreSQL
|
.TH "CREATE TABLE" SQL 09/25/97 PostgreSQL
|
||||||
.SH NAME
|
.SH NAME
|
||||||
create table \(em create a new class
|
create table \(em create a new class
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
.nf
|
.nf
|
||||||
\fBcreate table \fR classname \fB(\fPattname-1 type-1 {\fB,\fP attname-i type-i}\fB)\fP
|
\fBcreate table\fR classname \fB(\fPattname type [\fBdefault\fP value] [\fB,\fP attname type \fBdefault\fP value]\fB)\fP
|
||||||
[\fBinherits\fR \fB(\fR classname-1 {\fB,\fR classname-i} \fB)\fR]
|
[\fBinherits\fR \fB(\fR classname [\fB,\fR classname] \fB)\fR]
|
||||||
|
[\fBconstraint\fR cname \fBcheck\fR \fB(\fR test \fB)\fR [\fB,\fR \fBcheck\fR test]
|
||||||
[\fBarchive\fR \fB=\fR archive_mode]
|
[\fBarchive\fR \fB=\fR archive_mode]
|
||||||
[\fBstore\fR \fB=\fR \*(lqsmgr_name\*(rq]
|
[\fBstore\fR \fB=\fR \*(lqsmgr_name\*(rq]
|
||||||
[\fBarch_store\fR \fB=\fR \*(lqsmgr_name\*(rq]
|
[\fBarch_store\fR \fB=\fR \*(lqsmgr_name\*(rq]
|
||||||
.fi
|
.fi
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
.BR "Create table"
|
.BR "Create Table"
|
||||||
will enter a new class into the current data base. The class will be
|
will enter a new class into the current data base. The class will be
|
||||||
\*(lqowned\*(rq by the user issuing the command. The name of the
|
\*(lqowned\*(rq by the user issuing the command. The name of the
|
||||||
class is
|
class is
|
||||||
.IR classname
|
.IR classname
|
||||||
and the attributes are as specified in the list of
|
and the attributes are as specified in the list of
|
||||||
.IR attname s.
|
.IR attname s.
|
||||||
The
|
Each attribute is created with the type specified by
|
||||||
.IR i th
|
.IR type "."
|
||||||
attribute is created with the type specified by
|
|
||||||
.IR type "-i."
|
|
||||||
Each type may be a simple type, a complex type (set) or an array type.
|
Each type may be a simple type, a complex type (set) or an array type.
|
||||||
|
Each attribute may have a default value, specified by the
|
||||||
|
.IR default
|
||||||
|
clause which is the keyword "default" followed by a constant or expression.
|
||||||
.PP
|
.PP
|
||||||
Each array attribute stores arrays that must have the same number of
|
Each array attribute stores arrays that must have the same number of
|
||||||
dimensions but may have different sizes and array index bounds. An
|
dimensions but may have different sizes and array index bounds. An
|
||||||
@@ -36,6 +38,8 @@ pairs of square brackets:
|
|||||||
.nf
|
.nf
|
||||||
att_name type[][]..[]
|
att_name type[][]..[]
|
||||||
.fi
|
.fi
|
||||||
|
N.B. As of Postgres version 6.0, consistant array dimensions within an
|
||||||
|
attribute are not enforced. This will likely change in a future release.
|
||||||
.PP
|
.PP
|
||||||
The optional
|
The optional
|
||||||
.BR inherits
|
.BR inherits
|
||||||
@@ -50,7 +54,7 @@ Each new class
|
|||||||
.IR classname
|
.IR classname
|
||||||
is automatically created as a type. Therefore, one or more instances
|
is automatically created as a type. Therefore, one or more instances
|
||||||
from the class are automatically a type and can be used in
|
from the class are automatically a type and can be used in
|
||||||
.IR alter table(l)
|
.IR "alter table" (l)
|
||||||
or other
|
or other
|
||||||
.BR "create table"
|
.BR "create table"
|
||||||
statements. See
|
statements. See
|
||||||
@@ -58,6 +62,13 @@ statements. See
|
|||||||
for a further discussion of this point.
|
for a further discussion of this point.
|
||||||
.PP
|
.PP
|
||||||
The optional
|
The optional
|
||||||
|
.BR constraint
|
||||||
|
clause specifies a list of constraints or tests which new or updated entries
|
||||||
|
must satisfy for an insert or update operation to succeed. Each constraint
|
||||||
|
must evaluate to a boolean expression. Multiple attributes may be referenced within
|
||||||
|
a single constraint.
|
||||||
|
.PP
|
||||||
|
The optional
|
||||||
.BR store
|
.BR store
|
||||||
and
|
and
|
||||||
.BR arch_store
|
.BR arch_store
|
||||||
@@ -119,6 +130,14 @@ create table permemp (plan char16) inherits (emp)
|
|||||||
.fi
|
.fi
|
||||||
.nf
|
.nf
|
||||||
--
|
--
|
||||||
|
--Create class emppay with attributes name and wage with
|
||||||
|
--a default salary and constraints on wage range
|
||||||
|
--
|
||||||
|
create table emppay (name text not null, wage float4 default 10.00)
|
||||||
|
constraint empcon check (wage > 5.30 and wage <= 30.00), check (name <> '')
|
||||||
|
.fi
|
||||||
|
.nf
|
||||||
|
--
|
||||||
--Create class foo on magnetic disk and archive historical data
|
--Create class foo on magnetic disk and archive historical data
|
||||||
--
|
--
|
||||||
create table foo (bar int4) archive = heavy
|
create table foo (bar int4) archive = heavy
|
||||||
|
Reference in New Issue
Block a user