Re: unlogged sequences

Поиск
Список
Период
Сортировка
От Tomas Vondra
Тема Re: unlogged sequences
Дата
Msg-id 96015387-a21e-5f29-fe85-f5eefe6201b5@enterprisedb.com
обсуждение исходный текст
Ответ на Re: unlogged sequences  (Robert Haas <robertmhaas@gmail.com>)
Ответы Re: unlogged sequences
Список pgsql-hackers
On 4/1/22 02:25, Robert Haas wrote:
> 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.
> 

Well, yeah. I did this because the patch was somewhat inconsistent when
handling owned sequences - it updated persistence for owned sequences
when persistence for the table changed, expecting to keep them in sync,
but then it also allowed operations that'd break it.

But that started a discussion about exactly this, and AFAICS there's
agreement we want to allow the table and owned sequences to have
different persistence values.

The discussion about the details is still ongoing, but I think it's
clear we'll ditch the restrictions you point out.

regards

-- 
Tomas Vondra
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company



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

Предыдущее
От: Robert Haas
Дата:
Сообщение: Re: head fails to build on SLES 12 (wal_compression=zstd)
Следующее
От: "David G. Johnston"
Дата:
Сообщение: Re: unlogged sequences