From a75f2d21a8366aece67b8aa144a8644f6195e75f Mon Sep 17 00:00:00 2001 From: "Thomas G. Lockhart" Date: Tue, 29 Dec 1998 02:24:47 +0000 Subject: Clean up to ensure tag completion as required by the newest versions of Norm's Modular Style Sheets and jade/docbook. From Vince Vielhaber . --- doc/src/sgml/ref/create_sequence.sgml | 70 ++++++++++++++++++----------------- 1 file changed, 37 insertions(+), 33 deletions(-) (limited to 'doc/src/sgml/ref/create_sequence.sgml') diff --git a/doc/src/sgml/ref/create_sequence.sgml b/doc/src/sgml/ref/create_sequence.sgml index e8fb57f3b4f..f6d6ae0b8d4 100644 --- a/doc/src/sgml/ref/create_sequence.sgml +++ b/doc/src/sgml/ref/create_sequence.sgml @@ -12,7 +12,7 @@ Creates a new sequence number generator - + 1998-04-15 @@ -197,8 +197,11 @@ CREATE SEQUENCE seqname If the minimum and maximum values are inconsistant. - - + + + + + @@ -254,27 +257,28 @@ SELECT last_value FROM sequence_name; - - Unexpected results may be obtained if a cache setting greater than one - is used for a sequence object that will be used concurrently by multiple - backends. Each backend will allocate "cache" successive sequence values - during one access to the sequence object and increase the sequence - object's last_value accordingly. Then, the next cache-1 uses of nextval - within that backend simply return the preallocated values without touching - the shared object. So, numbers allocated but not used in the current session - will be lost. Furthermore, although multiple backends are guaranteed to - allocate distinct sequence values, the values may be generated out of - sequence when all the backends are considered. (For example, with a cache - setting of 10, backend A might reserve values 1..10 and return nextval=1, -then - backend B might reserve values 11..20 and return nextval=11 before backend - A has generated nextval=2.) Thus, with a cache setting of one it is safe - to assume that nextval values are generated sequentially; with a cache - setting greater than one you should only assume that the nextval values - are all distinct, not that they are generated purely sequentially. - Also, last_value will reflect the latest value reserved by any backend, - whether or not it has yet been returned by nextval. - + + Unexpected results may be obtained if a cache setting greater than one + is used for a sequence object that will be used concurrently by multiple + backends. Each backend will allocate "cache" successive sequence values + during one access to the sequence object and increase the sequence + object's last_value accordingly. Then, the next cache-1 uses of nextval + within that backend simply return the preallocated values without touching + the shared object. So, numbers allocated but not used in the current session + will be lost. Furthermore, although multiple backends are guaranteed to + allocate distinct sequence values, the values may be generated out of + sequence when all the backends are considered. (For example, with a cache + setting of 10, backend A might reserve values 1..10 and return nextval=1, + then + backend B might reserve values 11..20 and return nextval=11 before backend + A has generated nextval=2.) Thus, with a cache setting of one it is safe + to assume that nextval values are generated sequentially; with a cache + setting greater than one you should only assume that the nextval values + are all distinct, not that they are generated purely sequentially. + Also, last_value will reflect the latest value reserved by any backend, + whether or not it has yet been returned by nextval. + + @@ -324,16 +328,16 @@ INSERT INTO distributors VALUES (NEXTVAL('serial'),'nothing'); Set the sequence value after a COPY FROM: -CREATE FUNCTION distributors_id_max() RETURNS INT4 - AS 'SELECT max(id) FROM distributors' - LANGUAGE 'sql'; -BEGIN; -COPY distributors FROM 'input_file'; -SELECT setval('serial', distributors_id_max()); -END; + CREATE FUNCTION distributors_id_max() RETURNS INT4 + AS 'SELECT max(id) FROM distributors' + LANGUAGE 'sql'; + BEGIN; + COPY distributors FROM 'input_file'; + SELECT setval('serial', distributors_id_max()); + END; - + @@ -342,7 +346,7 @@ END; CREATE SEQUENCE is a Postgres - language extension. + language extension. -- cgit v1.2.3