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

From Peter Eisentraut
Subject Re: [BUGS] Concurrent ALTER SEQUENCE RESTART Regression
Date
Msg-id c1864238-8f82-f8b5-b4d0-de351d3fbd9b@2ndquadrant.com
Whole thread Raw
In response to [BUGS] Concurrent ALTER SEQUENCE RESTART Regression  (Jason Petersen <jason@citusdata.com>)
Responses Re: [BUGS] Concurrent ALTER SEQUENCE RESTART Regression  (Andres Freund <andres@anarazel.de>)
List pgsql-bugs
On 4/24/17 15:52, Jason Petersen wrote:
>   1. Create a new sequence: CREATE SEQUENCE my_seq;
>   2. Start this loop twice in different shells:
>        while true; do psql -1Xtc 'ALTER SEQUENCE my_seq RESTART 1'; done

> Each loop should repeatedly succeed and simply print ALTER SEQUENCE over and over.

> The output stream is punctuated by occasional "ERROR:  tuple concurrently updated" messages.

This message comes from the pg_sequence catalog update.  But in the case
of the RESTART clause, you don't need to update the catalog, because it
just needs to write to the sequence's relation.  So I have tweaked the
code a little to omit the catalog update if it's not needed.  Your test
case works without errors now.

-- 
Peter Eisentraut              http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services


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

pgsql-bugs by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: [BUGS] Concurrent ALTER SEQUENCE RESTART Regression
Next
From: Peter Eisentraut
Date:
Subject: Re: [BUGS] Concurrent ALTER SEQUENCE RESTART Regression