Group more closely cache updates for backends in sequence.c
authorMichael Paquier <michael@paquier.xyz>
Mon, 26 Feb 2024 08:03:18 +0000 (17:03 +0900)
committerMichael Paquier <michael@paquier.xyz>
Mon, 26 Feb 2024 08:03:18 +0000 (17:03 +0900)
commit6e951bf98e2e0230ed95db2fafc244536bd7502f
tree741ea1218304a3328fa835aae0a1cf18d37651a8
parent449e798c77ed9a03f8bb04e5d324d4e3cfbbae8e
Group more closely cache updates for backends in sequence.c

Information of sequences is cached for each backend for currval() and
nextval(), and the update of some cached information was mixed in the
middle of computations based on the other properties of a sequence, for
the increment value in nextval() and the cached state when altering a
sequence.

Grouping them makes the code easier to follow and to refactor in the
future, when splitting the computation and the SeqTable change parts.
Note that the cached data is untouched between the areas where these
cache updates are moved.

Issue noticed while doing some refactoring of the sequence code.

Author: Michael Paquier
Reviewed-by: Tomas Vondra
Discussion: http://postgr.es/m/ZWlohtKAs0uVVpZ3@paquier.xyz
src/backend/commands/sequence.c