rotate records

Поиск
Список
Период
Сортировка
От Natasha Galkina
Тема rotate records
Дата
Msg-id C2E6BA7FD3442A4C916735460ABB064F563758@bones.invent.psi.com
обсуждение исходный текст
Ответы Re: rotate records  (Michael Fuhr <mike@fuhr.org>)
Список pgsql-general

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.

 

 

В списке pgsql-general по дате отправления:

Предыдущее
От: "Amrit Angsusing"
Дата:
Сообщение: Re: Could DBmirror be done with the mechine using RPM installation instaed of souce code [tar.gz] ?
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: How to specify infinity for intervals ?