OSDN Git Service

FIRST REPOSITORY
[eos/hostdependOTHERS.git] / I386LINUX / util / I386LINUX / man / man7 / alter_sequence.7
1 .\\" auto-generated by docbook2man-spec $Revision: 1.25 $
2 .TH "ALTER SEQUENCE" "7" "2003-11-02" "SQL - Language Statements" "SQL Commands"
3 .SH NAME
4 ALTER SEQUENCE \- alter the definition of a sequence generator
5
6 .SH SYNOPSIS
7 .sp
8 .nf
9 ALTER SEQUENCE \fIname\fR [ INCREMENT [ BY ] \fIincrement\fR ]
10     [ MINVALUE \fIminvalue\fR | NO MINVALUE ] [ MAXVALUE \fImaxvalue\fR | NO MAXVALUE ]
11     [ RESTART [ WITH ] \fIstart\fR ] [ CACHE \fIcache\fR ] [ [ NO ] CYCLE ]
12   
13 .sp
14 .fi
15 .SH "DESCRIPTION"
16 .PP
17 \fBALTER SEQUENCE\fR changes the parameters of an existing
18 sequence generator. Any parameter not specifically set in the
19 \fBALTER SEQUENCE\fR command retains its prior setting.
20 .SH "PARAMETERS"
21 .PP
22 .TP
23 \fB\fIname\fB\fR
24 The name (optionally schema-qualified) of a sequence to be altered.
25 .TP
26 \fB\fIincrement\fB\fR
27 The clause INCREMENT BY \fIincrement\fR is
28 optional. A positive value will make an ascending sequence, a
29 negative one a descending sequence. If unspecified, the old
30 increment value will be maintained.
31 .TP
32 \fB\fIminvalue\fB\fR
33 .TP
34 \fBNO MINVALUE\fR
35 The optional clause MINVALUE \fIminvalue\fR determines
36 the minimum value a sequence can generate. If NO
37 MINVALUE is specified, the defaults of 1 and
38 -263-1 for ascending and descending sequences,
39 respectively, will be used. If neither option is specified,
40 the current minimum value will be maintained.
41 .TP
42 \fB\fImaxvalue\fB\fR
43 .TP
44 \fBNO MAXVALUE\fR
45 The optional clause MAXVALUE \fImaxvalue\fR determines
46 the maximum value for the sequence. If NO
47 MAXVALUE is specified, the defaults are
48 263-1 and -1 for ascending and descending
49 sequences, respectively, will be used. If neither option is
50 specified, the current maximum value will be maintained.
51 .TP
52 \fB\fIstart\fB\fR
53 The optional clause RESTART WITH \fIstart\fR changes the
54 current value of the sequence.
55 .TP
56 \fB\fIcache\fB\fR
57 The clause CACHE \fIcache\fR enables
58 sequence numbers to be preallocated and stored in memory for
59 faster access. The minimum value is 1 (only one value can be
60 generated at a time, i.e., no cache). If unspecified, the old
61 cache value will be maintained.
62 .TP
63 \fBCYCLE\fR
64 The optional CYCLE key word may be used to enable
65 the sequence to wrap around when the
66 \fImaxvalue\fR or
67 \fIminvalue\fR has been
68 reached by
69 an ascending or descending sequence respectively. If the limit is
70 reached, the next number generated will be the
71 \fIminvalue\fR or
72 \fImaxvalue\fR,
73 respectively.
74 .TP
75 \fBNO CYCLE\fR
76 If the optional NO CYCLE key word is
77 specified, any calls to \fBnextval\fR after the
78 sequence has reached its maximum value will return an error.
79 If neither CYCLE or NO
80 CYCLE are specified, the old cycle behaviour will be
81 maintained.
82 .PP
83 .SH "EXAMPLES"
84 .PP
85 Restart a sequence called serial, at 105:
86 .sp
87 .nf
88 ALTER SEQUENCE serial RESTART WITH 105;
89 .sp
90 .fi
91 .SH "NOTES"
92 .PP
93 To avoid blocking of concurrent transactions that obtain numbers from the
94 same sequence, \fBALTER SEQUENCE\fR is never rolled back;
95 the changes take effect immediately and are not reversible.
96 .PP
97 \fBALTER SEQUENCE\fR will not immediately affect
98 nextval results in backends,
99 other than the current one, that have preallocated (cached) sequence
100 values. They will use up all cached values prior to noticing the changed
101 sequence parameters. The current backend will be affected immediately.
102 .SH "COMPATIBILITY"
103 .SS "SQL99"
104 .PP
105 \fBALTER SEQUENCE\fR is a PostgreSQL
106 language extension.
107 There is no \fBALTER SEQUENCE\fR statement
108 in SQL99.