pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
To: Jason Petersen <jason@citusdata.com>
To: pgsql-bugs@postgresql.org
Subject: Re: Concurrent ALTER SEQUENCE RESTART Regression
Date: Tue, 2 May 2017 10:53:19 -0400
Message-ID: <c1864238-8f82-f8b5-b4d0-de351d3fbd9b@2ndquadrant.com> (raw)
In-Reply-To: <D992B4C2-8F80-4DE0-8348-6E0696C3F967@citusdata.com>
References: <D992B4C2-8F80-4DE0-8348-6E0696C3F967@citusdata.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-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



view thread (84+ messages)  latest in thread

Message-ID: <c1864238-8f82-f8b5-b4d0-de351d3fbd9b@2ndquadrant.com>
Permalink:  ../c1864238-8f82-f8b5-b4d0-de351d3fbd9b@2ndquadrant.com/
Also on:    postgresql.org/message-id/c1864238-8f82-f8b5-b4d0-de351d3fbd9b@2ndquadrant.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: peter.eisentraut@2ndquadrant.com, jason@citusdata.com
  Subject: Re: Concurrent ALTER SEQUENCE RESTART Regression
  In-Reply-To: <c1864238-8f82-f8b5-b4d0-de351d3fbd9b@2ndquadrant.com>
  References: <D992B4C2-8F80-4DE0-8348-6E0696C3F967@citusdata.com> <c1864238-8f82-f8b5-b4d0-de351d3fbd9b@2ndquadrant.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox