Received: from tnt.diff.org ([62.98.101.22]) by mail.postgresql.org (8.11.1/8.11.1) with ESMTP id f01I2kL81332 for ; Mon, 1 Jan 2001 13:02:46 -0500 (EST) (envelope-from nonsolosoft@diff.org) Received: (from fer@localhost) by tnt.diff.org (8.11.1/8.9.3) id f01FmZm13200; Mon, 1 Jan 2001 16:48:35 +0100 (CET) (envelope-from nonsolosoft@diff.org) Date: Mon, 1 Jan 2001 16:48:35 +0100 (CET) Message-Id: <200101011548.f01FmZm13200@tnt.diff.org> X-Authentication-Warning: tnt.diff.org: fer set sender to nonsolosoft@diff.org using -f From: Ferruccio Zamuner To: pgsql-sql@postgresql.org Subject: resetting serials and sequences X-Archive-Number: 200101/3 X-Sequence-Number: 664 Hi, #create temp table a ( id serial primary key, name text not null); #insert into a (name) values ('Tom'); #insert into a (name) values ('Fer'); #insert into a (name) values ('Mario'); #select * from a; id | name ----+------- 1 | Tom 2 | Fer 3 | Mario (3 rows) OK. Now for some reason I need to reset everything without drop tables: #delete from a; #select setval ('a_id_seq', 1); vacuum; And now reinsert items: #insert into a (name) values ('Tom'); #insert into a (name) values ('Fer'); #insert into a (name) values ('Mario'); #select * from a; id | name ----+------- 2 | Tom 3 | Fer 4 | Mario (3 rows) We have missed the id "1"!!! Otherway: #select setval('a_id_seq', 0); ERROR: a_id_seq.setval: value 0 is of of bounds (1,2147483647) Is this a bug? Best wishes for the brand new year \fer