The data types serial and bigserial
are not true types, but merely
- a notational convenience for setting up identifier columns
+ a notational convenience for setting up unique identifier columns
(similar to the AUTO_INCREMENT property
supported by some other databases). In the current
implementation, specifying
- To use a serial column to insert the next value of
- the sequence into the table, specify that the serial
- column should be assigned the default value. This can be done
- either be excluding from the column from the list of columns in
+ To insert the next value of the sequence into the serial
+ column, specify that the serial
+ column should be assigned its default value. This can be done
+ either by excluding the column from the list of columns in
the INSERT statement, or through the use of
the DEFAULT keyword.
- The sequence created by a serial type is
- automatically dropped when the owning column is dropped and
+ The sequence created for a serial column is
+ automatically dropped when the owning column is dropped, and
cannot be dropped otherwise. (This was not true in
PostgreSQL releases before 7.3. Note
that this automatic drop linkage will not occur for a sequence
dependency link.) Furthermore, this dependency between sequence
and column is made only for the serial> column itself; if
any other columns reference the sequence (perhaps by manually
- calling the nextval>) function), they may be broken
- if the sequence is removed. Using serial> columns in
- fashion is considered bad form.
+ calling the nextval> function), they will be broken
+ if the sequence is removed. Using a serial> column's sequence
+ in such a fashion is considered bad form; if you wish to feed several
+ columns from the same sequence generator, create the sequence as an
+ independent object.