Re: Sequence problems during restart

Поиск
Список
Период
Сортировка
От Masaru Sugawara
Тема Re: Sequence problems during restart
Дата
Msg-id 20011023002841.3422.RK73@echna.ne.jp
обсуждение исходный текст
Ответ на Sequence problems during restart  ("Dave Cramer" <Dave@micro-automation.net>)
Ответы Re: Sequence problems during restart  ("Dave Cramer" <Dave@micro-automation.net>)
Список pgsql-general
On Fri, 19 Oct 2001 13:15:38 -0400
"Dave Cramer" wrote:

> We have a number of tables which have unique id's generated from a
> sequence
>
> i.e. create table blat (id serial, ....)
>
> A number of these sequences seem to have been "set back" by 4 . In other
> words we have records for
>
> Id's 500, 501, 502, 503, and now the sequence  is set to 500.
>


 Hi,

 How about using a CREATE SEQUENCE with a CYCLE option.

 e.g.
 create sequence seq_blat minvalue 500 maxvalue 503 cycle;
 create table blat (id int4 default nextval('seq_blat'),
                    a varchar(10),
                    b varchar(10),
                    ......
                    );

 insert into blat (a, b, ...) values('aaa1', 'bbb1',  .... );
 insert into blat (a, b, ...) values('aaa2', 'bbb2',  .... );
 insert into blat (a, b, ...) values('aaa3', 'bbb3',  .... );
 ...



By the way, a mail server has been downed ?


Regards,
Masaru Sugawara


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

Предыдущее
От: elwood@agouros.de (Konstantinos Agouros)
Дата:
Сообщение: How to insert with a serial
Следующее
От: Markus Wagner
Дата:
Сообщение: where are the memory leaks?