Hello.
I’m using Postgresql 7.3 on Linux.
I created sequence
CREATE SEQUENCE event_id_seq
INCREMENT 1
MINVALUE 1
MAXVALUE 5
START 1
CACHE 1
CYCLE;
And I created table which uses this sequence as primary key.
CREATE TABLE hw_messages
(
event_id INT PRIMARY KEY DEFAULT nextval(event_id_seq ') NOT NULL,
device_name varchar(50) NOT NULL
CONSTRAINT hw_messages_pkey PRIMARY KEY (event_id)
)
WITH OIDS;
My question is how I can rotate the records in the table. I have maximum number of records in the table defined by sequence. Every time when I try to insert a new record, I get an error about duplicate key. Even if I manually delete a record somewhere from the middle I still might get this error. If I state CYCLE attribute in the sequence, doesn’t it mean that while inserting new records into database if the maximum is met the old records should be deleted? If it is not correct, how can I rotate the records in the table?
Thanks you in advance,
Natasha.