Re: [BUGS] Concurrent ALTER SEQUENCE RESTART Regression - Mailing list pgsql-bugs

From Michael Paquier
Subject Re: [BUGS] Concurrent ALTER SEQUENCE RESTART Regression
Date
Msg-id CAB7nPqQ=yHXxiWU2FuaC13L_5y7UG7R_OkJhWQbXYMJPXCDtNg@mail.gmail.com
Whole thread Raw
In response to Re: [BUGS] Concurrent ALTER SEQUENCE RESTART Regression  (Andres Freund <andres@anarazel.de>)
Responses Re: [BUGS] Concurrent ALTER SEQUENCE RESTART Regression  (Noah Misch <noah@leadboat.com>)
Re: [BUGS] Concurrent ALTER SEQUENCE RESTART Regression  (Petr Jelinek <petr.jelinek@2ndquadrant.com>)
List pgsql-bugs
On Thu, Apr 27, 2017 at 4:10 PM, Andres Freund <andres@anarazel.de> wrote:
> On April 27, 2017 12:06:55 AM PDT, Michael Paquier <michael.paquier@gmail.com> wrote:
>>On Thu, Apr 27, 2017 at 3:23 PM, Andres Freund <andres@anarazel.de>
>>wrote:
>>> More fun:
>>>
>>> A: CREATE SEQUENCE someseq;
>>> A: BEGIN;
>>> A: ALTER SEQUENCE someseq MAXVALUE 10;
>>> B: SELECT nextval('someseq') FROM generate_series(1, 1000);
>>>
>>> => ignores maxvalue
>>
>>Well, for this one that's because the catalog change is
>>transactional...
>
> Or because the locking model is borked.

The operation actually relies heavily on the fact that the exclusive
lock on the buffer of pg_sequence is hold until the end of the catalog
update. And using heap_inplace_update() seems mandatory to me as the
metadata update should be non-transactional, giving the attached. I
have added some isolation tests. Thoughts? The attached makes HEAD map
with the pre-9.6 behavior.
-- 
Michael

-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

Attachment

pgsql-bugs by date:

Previous
From: Michael Meskes
Date:
Subject: Re: [BUGS] BUG #14633: ecpg : nothing is generated when using option-v
Next
From: Pietro Pugni
Date:
Subject: Re: [BUGS] BUG #14632: Plus and minus operators inconsistency with leap years and year intervals.