pgsql: Avoid unnecessary catalog updates in ALTER SEQUENCE

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Avoid unnecessary catalog updates in ALTER SEQUENCE
Date: 2017-05-02 14:47:25
Message-ID: E1d5Z5J-000080-Mw@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Avoid unnecessary catalog updates in ALTER SEQUENCE

ALTER SEQUENCE can do nontransactional changes to the sequence (RESTART
clause) and transactional updates to the pg_sequence catalog (most other
clauses). When just calling RESTART, the code would still needlessly do
a catalog update without any changes. This would entangle that
operation in the concurrency issues of a catalog update (causing either
locking or concurrency errors, depending on how that issue is to be
resolved).

Fix by keeping track during options parsing whether a catalog update is
needed, and skip it if not.

Reported-by: Jason Petersen <jason(at)citusdata(dot)com>

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/3d092fe5409b98272ddd6e623b657308a3c5f004

Modified Files
--------------
src/backend/commands/sequence.c | 51 ++++++++++++++++++++++++++++++++++-------
1 file changed, 43 insertions(+), 8 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Peter Eisentraut 2017-05-02 18:33:43 pgsql: doc: Add missing markup
Previous Message Peter Eisentraut 2017-05-02 14:36:47 pgsql: doc: Update ALTER SEQUENCE claims about changes being nontransac