summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas G. Lockhart1997-09-26 15:21:27 +0000
committerThomas G. Lockhart1997-09-26 15:21:27 +0000
commit544992c3d7802789004670df09fa4e647035853e (patch)
tree228d4be75cd1bb9488b59804afaf507b52d10c6b
parent09cfab3a7f9881f4ba22843b73bcd7a5180bc2d3 (diff)
Include information on new DEFAULT and CONSTRAINT clauses.
-rw-r--r--src/man/alter_table.l14
-rw-r--r--src/man/create_table.l39
2 files changed, 38 insertions, 15 deletions
diff --git a/src/man/alter_table.l b/src/man/alter_table.l
index 5b055649f3..e3691daf0e 100644
--- a/src/man/alter_table.l
+++ b/src/man/alter_table.l
@@ -1,13 +1,17 @@
.\" This is -*-nroff-*-
.\" 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 $
-.TH "ALTER TABLE" SQL 11/5/95 PostgreSQL PostgreSQL
+.\" $Header: /cvsroot/pgsql/src/man/Attic/alter_table.l,v 1.3 1997/09/26 15:21:26 thomas Exp $
+.TH "ALTER TABLE" SQL 09/25/97 PostgreSQL
.SH NAME
alter table \(em add attributes to a class
.SH SYNOPSIS
.nf
-\fBalter table\fR classname [*]
- \fBadd column\fR attname type
+\fBalter table\fR classname [ * ]
+ \fBadd\fR [ \fBcolumn\fR ] attname type
+.fi
+.nf
+\fBalter table\fR classname [ * ]
+ \fBadd\fR \fB(\fR attname type \fB)\fR
.fi
.SH DESCRIPTION
@@ -18,7 +22,7 @@ causes a new attribute to be added to an existing class,
.IR classname .
The new attributes and their types are specified
in the same style and with the the same restrictions as in
-.IR create table (l).
+.IR "create table" (l).
.PP
In order to add an attribute to each class in an entire inheritance
hierarchy, use the
diff --git a/src/man/create_table.l b/src/man/create_table.l
index 4bee066f05..ccaab02aaf 100644
--- a/src/man/create_table.l
+++ b/src/man/create_table.l
@@ -1,30 +1,32 @@
.\" This is -*-nroff-*-
.\" 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 $
-.TH "CREATE TABLE" SQL 11/05/95 PostgreSQL PostgreSQL
+.\" $Header: /cvsroot/pgsql/src/man/Attic/create_table.l,v 1.6 1997/09/26 15:21:27 thomas Exp $
+.TH "CREATE TABLE" SQL 09/25/97 PostgreSQL
.SH NAME
create table \(em create a new class
.SH SYNOPSIS
.nf
-\fBcreate table \fR classname \fB(\fPattname-1 type-1 {\fB,\fP attname-i type-i}\fB)\fP
- [\fBinherits\fR \fB(\fR classname-1 {\fB,\fR classname-i} \fB)\fR]
+\fBcreate table\fR classname \fB(\fPattname type [\fBdefault\fP value] [\fB,\fP attname type \fBdefault\fP value]\fB)\fP
+ [\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]
[\fBstore\fR \fB=\fR \*(lqsmgr_name\*(rq]
[\fBarch_store\fR \fB=\fR \*(lqsmgr_name\*(rq]
.fi
.SH DESCRIPTION
-.BR "Create table"
+.BR "Create Table"
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
class is
.IR classname
and the attributes are as specified in the list of
.IR attname s.
-The
-.IR i th
-attribute is created with the type specified by
-.IR type "-i."
+Each attribute is created with the type specified by
+.IR 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
Each array attribute stores arrays that must have the same number of
dimensions but may have different sizes and array index bounds. An
@@ -36,6 +38,8 @@ pairs of square brackets:
.nf
att_name type[][]..[]
.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
The optional
.BR inherits
@@ -50,7 +54,7 @@ Each new class
.IR classname
is automatically created as a type. Therefore, one or more instances
from the class are automatically a type and can be used in
-.IR alter table(l)
+.IR "alter table" (l)
or other
.BR "create table"
statements. See
@@ -58,6 +62,13 @@ statements. See
for a further discussion of this point.
.PP
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
and
.BR arch_store
@@ -119,6 +130,14 @@ create table permemp (plan char16) inherits (emp)
.fi
.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 table foo (bar int4) archive = heavy