I have a simple table in my PostgreSQL database like this:
CREATE TABLE person_type
(
id serial NOT NULL,
name character(55) NOT NULL,
CONSTRAINT person_type_pkey PRIMARY KEY (id),
CONSTRAINT person_type_name_key UNIQUE (name)
)
As you can see the id is automatically incremented and the name must be unique. Every time I run an INSERT sql statements, even when it fails, the id is incremented by one.
How can I prevent this? In order that each time a row is inserted successfully, the primary keys are correlative