Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit544992c

Browse files
author
Thomas G. Lockhart
committed
Include information on new DEFAULT and CONSTRAINT clauses.
1 parent09cfab3 commit544992c

File tree

2 files changed

+38
-15
lines changed

2 files changed

+38
-15
lines changed

‎src/man/alter_table.l

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
.\" This is -*-nroff-*-
22
.\" XXX standard disclaimer belongs here....
3-
.\" $Header: /cvsroot/pgsql/src/man/Attic/alter_table.l,v 1.2 1996/12/11 00:26:55 momjian Exp $
4-
.TH "ALTER TABLE" SQL11/5/95 PostgreSQL PostgreSQL
3+
.\" $Header: /cvsroot/pgsql/src/man/Attic/alter_table.l,v 1.3 1997/09/26 15:21:26 thomas Exp $
4+
.TH "ALTER TABLE" SQL09/25/97 PostgreSQL
55
.SH NAME
66
alter table\(em add attributes to a class
77
.SH SYNOPSIS
88
.nf
9-
\fBaltertable\fR classname [*]
10-
\fBaddcolumn\fR attname type
9+
\fBaltertable\fR classname [ * ]
10+
\fBadd\fR [\fBcolumn\fR ] attname type
11+
.fi
12+
.nf
13+
\fBaltertable\fR classname [ * ]
14+
\fBadd\fR\fB(\fR attname type\fB)\fR
1115

1216
.fi
1317
.SH DESCRIPTION
@@ -18,7 +22,7 @@ causes a new attribute to be added to an existing class,
1822
.IR classname.
1923
The new attributes and their types are specified
2024
in the same style and with the the same restrictions as in
21-
.IR createtable (l).
25+
.IR"create table"(l).
2226
.PP
2327
In order to add an attribute to each class in an entire inheritance
2428
hierarchy, use the

‎src/man/create_table.l

Lines changed: 29 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,32 @@
11
.\" This is -*-nroff-*-
22
.\" XXX standard disclaimer belongs here....
3-
.\" $Header: /cvsroot/pgsql/src/man/Attic/create_table.l,v 1.5 1997/08/2617:39:30 momjian Exp $
4-
.TH "CREATE TABLE" SQL11/05/95 PostgreSQL PostgreSQL
3+
.\" $Header: /cvsroot/pgsql/src/man/Attic/create_table.l,v 1.6 1997/09/2615:21:27 thomas Exp $
4+
.TH "CREATE TABLE" SQL09/25/97 PostgreSQL
55
.SH NAME
66
create table\(em create a new class
77
.SH SYNOPSIS
88
.nf
9-
\fBcreatetable\fR classname\fB(\fPattname-1 type-1 {\fB,\fP attname-i type-i}\fB)\fP
10-
[\fBinherits\fR\fB(\fR classname-1 {\fB,\fR classname-i}\fB)\fR]
9+
\fBcreatetable\fR classname\fB(\fPattname type [\fBdefault\fP value] [\fB,\fP attname type\fBdefault\fP value]\fB)\fP
10+
[\fBinherits\fR\fB(\fR classname [\fB,\fR classname]\fB)\fR]
11+
[\fBconstraint\fR cname\fBcheck\fR\fB(\fR test\fB)\fR [\fB,\fR\fBcheck\fR test]
1112
[\fBarchive\fR\fB=\fR archive_mode]
1213
[\fBstore\fR\fB=\fR\*(lqsmgr_name\*(rq]
1314
[\fBarch_store\fR\fB=\fR\*(lqsmgr_name\*(rq]
1415
.fi
1516
.SH DESCRIPTION
16-
.BR"Createtable"
17+
.BR"CreateTable"
1718
will enter a new class into the current data base. The class will be
1819
\*(lqowned\*(rq by the user issuing the command. The name of the
1920
class is
2021
.IR classname
2122
and the attributes are as specified in the list of
2223
.IR attnames.
23-
The
24-
.IR ith
25-
attribute is created with the type specified by
26-
.IR type"-i."
24+
Each attribute is created with the type specified by
25+
.IR type"."
2726
Each type may be a simple type, a complex type (set) or an array type.
27+
Each attribute may have a default value, specified by the
28+
.IR default
29+
clause which is the keyword "default" followed by a constant or expression.
2830
.PP
2931
Each array attribute stores arrays that must have the same number of
3032
dimensions but may have different sizes and array index bounds. An
@@ -36,6 +38,8 @@ pairs of square brackets:
3638
.nf
3739
att_name type[][]..[]
3840
.fi
41+
N.B. As of Postgres version 6.0, consistant array dimensions within an
42+
attribute are not enforced. This will likely change in a future release.
3943
.PP
4044
The optional
4145
.BR inherits
@@ -50,14 +54,21 @@ Each new class
5054
.IR classname
5155
is automatically created as a type. Therefore, one or more instances
5256
from the class are automatically a type and can be used in
53-
.IR altertable(l)
57+
.IR"alter table"(l)
5458
or other
5559
.BR"create table"
5660
statements. See
5761
.IR pgintro(1)
5862
for a further discussion of this point.
5963
.PP
6064
The optional
65+
.BR constraint
66+
clause specifies a list of constraints or tests which new or updated entries
67+
must satisfy for an insert or update operation to succeed. Each constraint
68+
must evaluate to a boolean expression. Multiple attributes may be referenced within
69+
a single constraint.
70+
.PP
71+
The optional
6172
.BR store
6273
and
6374
.BR arch_store
@@ -119,6 +130,14 @@ create table permemp (plan char16) inherits (emp)
119130
.fi
120131
.nf
121132
--
133+
--Create class emppay with attributes name and wage with
134+
--a default salary and constraints on wage range
135+
--
136+
create table emppay (name text not null, wage float4 default 10.00)
137+
constraint empcon check (wage > 5.30 and wage <= 30.00), check (name <> '')
138+
.fi
139+
.nf
140+
--
122141
--Create class foo on magnetic disk and archive historical data
123142
--
124143
create table foo (bar int4) archive = heavy

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp