diff options
author | Marc G. Fournier <scrappy@hub.org> | 1998-08-30 21:05:27 +0000 |
---|---|---|
committer | Marc G. Fournier <scrappy@hub.org> | 1998-08-30 21:05:27 +0000 |
commit | 6c4982851a7ce1585fb89adc2747c8f848183d1b (patch) | |
tree | 75ec012134c37f3a9aff83220d8dd21a1bfb900d /src/man/create_sequence.l | |
parent | 6f3de1bb6673b2e8d4ca83a17a482c5c546cd71e (diff) | |
download | postgresql-6c4982851a7ce1585fb89adc2747c8f848183d1b.tar.gz postgresql-6c4982851a7ce1585fb89adc2747c8f848183d1b.zip |
From: Massimo Dal Zotto <dz@cs.unitn.it>
Diffstat (limited to 'src/man/create_sequence.l')
-rw-r--r-- | src/man/create_sequence.l | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/man/create_sequence.l b/src/man/create_sequence.l index 0a695fa6bf4..588e70f3944 100644 --- a/src/man/create_sequence.l +++ b/src/man/create_sequence.l @@ -1,6 +1,6 @@ .\" This is -*-nroff-*- .\" XXX standard disclaimer belongs here.... -.\" $Header: /cvsroot/pgsql/src/man/Attic/create_sequence.l,v 1.5 1998/07/14 01:45:25 momjian Exp $ +.\" $Header: /cvsroot/pgsql/src/man/Attic/create_sequence.l,v 1.6 1998/08/30 21:03:19 scrappy Exp $ .TH "CREATE SEQUENCE" SQL 07/13/98 PostgreSQL PostgreSQL .SH NAME create sequence - create a new sequence number generator @@ -82,6 +82,14 @@ given sequence in the current backend session. Also beware that it does not give the last number ever allocated, only the last one allocated by this backend. .PP +The function +.BR setval +('sequence_name', value) +may be used to set the current value of the specified sequence. +The next call to +.BR nextval +will return the given value + the sequence increment. +.PP Use a query like .nf SELECT * FROM <sequence_name>; @@ -134,6 +142,15 @@ select nextval ('seq'); -- Use sequence in insert -- insert into table _table_ values (nextval ('seq'),...); +.nf +-- +-- Set the sequence value after a copy in +-- +create function table_id_max() returns int4 + as 'select max(id) from _table_' + language 'sql'; +copy _table_ from 'input_file'; +select setval('seq', table_id_max()); .fi .SH "SEE ALSO" drop_sequence(l). |