serial grows on failed requests

From: rihad <rihad(at)mail(dot)ru>
To: pgsql-general(at)postgresql(dot)org
Subject: serial grows on failed requests
Date: 2007-08-17 10:51:42
Message-ID: 46C57DBE.3000307@mail.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi, my table is defined as:
CREATE TABLE users (
id integer NOT NULL,
...
);

CREATE SEQUENCE users_id_seq
INCREMENT BY 1
NO MAXVALUE
NO MINVALUE
CACHE 1;

ALTER SEQUENCE users_id_seq OWNED BY users.id;

Although it's just a more verbose way to say
create table users (id serial primary key);
:)

When I do an insert that fails (like FK inconsistency, illegal value,
etc.) the users.id grows nonetheless... This is unacceptable for my
current needs. Any way to prevent that while still maintaining ease of
use? Using PostgreSQL 8.2.4

Thanks.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Andreas Kretschmer 2007-08-17 11:03:11 Re: serial grows on failed requests
Previous Message Alban Hertroys 2007-08-17 10:32:57 Re: [RESEND] Transaction auto-abort causes grief with Spring Framework