Re: unlogged sequences

Поиск
Список
Период
Сортировка
От Robert Haas
Тема Re: unlogged sequences
Дата
Msg-id CA+Tgmoaw0+S1HcUHu=OoRChXZT0HbJFBeR0Ty=ET+za3zLNAaQ@mail.gmail.com
обсуждение исходный текст
Ответ на Re: unlogged sequences  (Tomas Vondra <tomas.vondra@enterprisedb.com>)
Ответы Re: unlogged sequences  (Tomas Vondra <tomas.vondra@enterprisedb.com>)
Re: unlogged sequences  ("David G. Johnston" <david.g.johnston@gmail.com>)
Список pgsql-hackers
On Thu, Mar 31, 2022 at 10:14 AM Tomas Vondra
<tomas.vondra@enterprisedb.com> wrote:
> * When linking a sequence to a table (ALTER SEQUENCE ... OWNED BY),
> there's an ereport(ERROR) if the relpersistence values do not match.
>
> * Disallow changing persistence for owned sequences directly.

Wait, what? I don't understand why we would want to do either of these things.

It seems to me that it's totally fine to use a logged table with an
unlogged sequence, or an unlogged table with a logged sequence, or any
of the other combinations. You get what you ask for, so make sure to
ask for what you want. And that's it.

If you say something like CREATE [UNLOGGED] TABLE foo (a serial) it's
fine for serial to attribute the same persistence level to the
sequence as it does to the table. But when that's dumped, it's going
to be dumped as a CREATE TABLE command and a CREATE SEQUENCE command,
each of which has a separate persistence level. So you can recreate
whatever state you have.

-- 
Robert Haas
EDB: http://www.enterprisedb.com



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

Предыдущее
От: "David G. Johnston"
Дата:
Сообщение: Re: [WIP] ALTER COLUMN IF EXISTS
Следующее
От: Tom Lane
Дата:
Сообщение: Re: [WIP] ALTER COLUMN IF EXISTS