Re: [PATCHES] TRUNCATE TABLE with IDENTITY

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: [PATCHES] TRUNCATE TABLE with IDENTITY
Дата
Msg-id 3919.1210981275@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: TRUNCATE TABLE with IDENTITY  (Zoltan Boszormenyi <zb@cybertec.at>)
Ответы Re: [PATCHES] TRUNCATE TABLE with IDENTITY  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: [PATCHES] TRUNCATE TABLE with IDENTITY  (Neil Conway <neilc@samurai.com>)
Список pgsql-hackers
Zoltan Boszormenyi <zb@cybertec.at> writes:
>> Attached patch implements the extension found in the current SQL200n draft,
>> implementing stored start value and supporting ALTER SEQUENCE seq RESTART;

> Updated patch implements TRUNCATE ... RESTART IDENTITY
> which restarts all owned sequences for the truncated table(s).

Applied with corrections.  Most notably, since ALTER SEQUENCE RESTART
is nontransactional like most other ALTER SEQUENCE operations, I
rearranged things to try to ensure that foreseeable failures like
deadlock and lack of permissions would be detected before TRUNCATE
starts to issue any RESTART commands.

One interesting point here is that the patch as submitted allowed
ALTER SEQUENCE MINVALUE/MAXVALUE to be used to set a sequence range
that the original START value was outside of.  This would result in
a failure at ALTER SEQUENCE RESTART.  Since, as stated above, we
really don't want that happening during TRUNCATE, I adjusted the
patch to make such an ALTER SEQUENCE fail.  This is at least potentially
an incompatible change: command sequences that used to be legal could
now fail.  I doubt it's very likely to bite anyone in practice, though.

            regards, tom lane

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

Предыдущее
От: Andrew Dunstan
Дата:
Сообщение: Re: missing $PostgreSQL:$
Следующее
От: Tom Lane
Дата:
Сообщение: Re: [PATCHES] TRUNCATE TABLE with IDENTITY