alter_sequence.7

来自「PostgreSQL 8.2中增加了很多企业用户所需要的功能和性能上的提高,其开」· 7 代码 · 共 140 行

7
140
字号
.\\" auto-generated by docbook2man-spec $Revision: 1.1.1.1 $.TH "ALTER SEQUENCE" "" "2008-01-03" "SQL - Language Statements" "SQL Commands".SH NAMEALTER SEQUENCE \- change the definition of a sequence generator.SH SYNOPSIS.sp.nfALTER SEQUENCE \fIname\fR [ INCREMENT [ BY ] \fIincrement\fR ]    [ MINVALUE \fIminvalue\fR | NO MINVALUE ] [ MAXVALUE \fImaxvalue\fR | NO MAXVALUE ]    [ RESTART [ WITH ] \fIstart\fR ] [ CACHE \fIcache\fR ] [ [ NO ] CYCLE ]    [ OWNED BY { \fItable\fR.\fIcolumn\fR | NONE } ]ALTER SEQUENCE \fIname\fR SET SCHEMA \fInew_schema\fR  .sp.fi.SH "DESCRIPTION".PP\fBALTER SEQUENCE\fR changes the parameters of an existingsequence generator. Any parameters not specifically set in the\fBALTER SEQUENCE\fR command retain their prior settings..PPYou must own the sequence to use \fBALTER SEQUENCE\fR.To change a sequence's schema, you must also have CREATEprivilege on the new schema..SH "PARAMETERS".PP.TP\fB\fIname\fB\fRThe name (optionally schema-qualified) of a sequence to be altered..TP\fB\fIincrement\fB\fRThe clause INCREMENT BY \fIincrement\fR isoptional. A positive value will make an ascending sequence, anegative one a descending sequence. If unspecified, the oldincrement value will be maintained..TP\fB\fIminvalue\fB\fR.TP\fBNO MINVALUE\fRThe optional clause MINVALUE \fIminvalue\fR determinesthe minimum value a sequence can generate. If NOMINVALUE is specified, the defaults of 1 and-263-1 for ascending and descending sequences,respectively, will be used. If neither option is specified,the current minimum value will be maintained..TP\fB\fImaxvalue\fB\fR.TP\fBNO MAXVALUE\fRThe optional clause MAXVALUE \fImaxvalue\fR determinesthe maximum value for the sequence. If NOMAXVALUE is specified, the defaults are263-1 and -1 for ascending and descendingsequences, respectively, will be used. If neither option isspecified, the current maximum value will be maintained..TP\fB\fIstart\fB\fRThe optional clause RESTART WITH \fIstart\fR changes thecurrent value of the sequence..TP\fB\fIcache\fB\fRThe clause CACHE \fIcache\fR enablessequence numbers to be preallocated and stored in memory forfaster access. The minimum value is 1 (only one value can begenerated at a time, i.e., no cache). If unspecified, the oldcache value will be maintained..TP\fBCYCLE\fRThe optional CYCLE key word may be used to enablethe sequence to wrap around when the\fImaxvalue\fR or\fIminvalue\fR has beenreached byan ascending or descending sequence respectively. If the limit isreached, the next number generated will be the\fIminvalue\fR or\fImaxvalue\fR,respectively..TP\fBNO CYCLE\fRIf the optional NO CYCLE key word isspecified, any calls to \fBnextval\fR after thesequence has reached its maximum value will return an error.If neither CYCLE or NOCYCLE are specified, the old cycle behavior will bemaintained..TP\fBOWNED BY \fItable\fB.\fIcolumn\fB\fR.TP\fBOWNED BY NONE\fRThe OWNED BY option causes the sequence to beassociated with a specific table column, such that if that column(or its whole table) is dropped, the sequence will be automaticallydropped as well. If specified, this association replaces anypreviously specified association for the sequence. The specifiedtable must have the same owner and be in the same schema as thesequence.Specifying OWNED BY NONE removes any existingassociation, making the sequence ``free-standing''..TP\fB\fInew_schema\fB\fRThe new schema for the sequence..PP.SH "EXAMPLES".PPRestart a sequence called serial, at 105:.sp.nfALTER SEQUENCE serial RESTART WITH 105;.sp.fi.SH "NOTES".PPTo avoid blocking of concurrent transactions that obtain numbers from thesame sequence, \fBALTER SEQUENCE\fR's effects on the sequencegeneration parameters are never rolled back;those changes take effect immediately and are not reversible. However,the OWNED BY and SET SCHEMA clauses are ordinarycatalog updates and can be rolled back..PP\fBALTER SEQUENCE\fR will not immediately affect\fBnextval\fR results in backends,other than the current one, that have preallocated (cached) sequencevalues. They will use up all cached values prior to noticing the changedsequence generation parameters. The current backend will be affectedimmediately..PPSome variants of \fBALTER TABLE\fR can be used withsequences as well; for example, to rename a sequence use \fBALTERTABLE RENAME\fR..SH "COMPATIBILITY".PP\fBALTER SEQUENCE\fR conforms to the SQLstandard,except for the OWNED BY and SET SCHEMAclauses, which are PostgreSQL extensions..SH "SEE ALSO"CREATE SEQUENCE [\fBcreate_sequence\fR(7)], DROP SEQUENCE [\fBdrop_sequence\fR(l)]

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?