Avoid unnecessary catalog updates in ALTER SEQUENCE
authorPeter Eisentraut
Tue, 2 May 2017 14:41:48 +0000 (10:41 -0400)
committerPeter Eisentraut
Tue, 2 May 2017 14:41:48 +0000 (10:41 -0400)
commit3d092fe5409b98272ddd6e623b657308a3c5f004
tree4155097b18e2045d6508833462a3edf6b9fc9a58
parenta35ac7c4e3ccf93876b4652d94a418fc82e0eda3
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
src/backend/commands/sequence.c