pg.ddx.io pgsql-committers@postgresql.org mailing list archive
help / color / mirror / Atom feedpgsql: Fix pg_sequence_last_value() for unlogged sequences on standbys.
6+ messages / 1 participants
[nested] [flat]
* pgsql: Fix pg_sequence_last_value() for unlogged sequences on standbys.
@ 2024-05-13 20:57 Nathan Bossart <nathan@postgresql.org>
0 siblings, 0 replies; 6+ messages in thread
From: Nathan Bossart @ 2024-05-13 20:57 UTC (permalink / raw)
To: pgsql-committers@lists.postgresql.org
Fix pg_sequence_last_value() for unlogged sequences on standbys.
Presently, when this function is called for an unlogged sequence on
a standby server, it will error out with a message like
ERROR: could not open file "base/5/16388": No such file or directory
Since the pg_sequences system view uses pg_sequence_last_value(),
it can error similarly. To fix, modify the function to return NULL
for unlogged sequences on standby servers. Since this bug is
present on all versions since v15, this approach is preferable to
making the ERROR nicer because we need to repair the pg_sequences
view without modifying its definition on released versions. For
consistency, this commit also modifies the function to return NULL
for other sessions' temporary sequences. The pg_sequences view
already appropriately filters out such sequences, so there's no bug
there, but we might as well offer some defense in case someone
invokes this function directly.
Unlogged sequences were first introduced in v15, but temporary
sequences are much older, so while the fix for unlogged sequences
is only back-patched to v15, the temporary sequence portion is
back-patched to all supported versions.
We could also remove the privilege check in the pg_sequences view
definition in v18 if we modify this function to return NULL for
sequences for which the current user lacks privileges, but that is
left as a future exercise for when v18 development begins.
Reviewed-by: Tom Lane, Michael Paquier
Discussion: https://postgr.es/m/20240501005730.GA594666%40nathanxps13
Backpatch-through: 12
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/3cb2f13ac500983c9c6b1eef3b3c2091c26f3040
Modified Files
--------------
doc/src/sgml/system-views.sgml | 29 +++++++++++++++++++++++++----
src/backend/commands/sequence.c | 31 ++++++++++++++++++++++---------
src/test/recovery/t/001_stream_rep.pl | 8 ++++++++
3 files changed, 55 insertions(+), 13 deletions(-)
^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Fix pg_sequence_last_value() for unlogged sequences on standbys.
@ 2024-05-13 20:57 Nathan Bossart <nathan@postgresql.org>
0 siblings, 0 replies; 6+ messages in thread
From: Nathan Bossart @ 2024-05-13 20:57 UTC (permalink / raw)
To: pgsql-committers@lists.postgresql.org
Fix pg_sequence_last_value() for unlogged sequences on standbys.
Presently, when this function is called for an unlogged sequence on
a standby server, it will error out with a message like
ERROR: could not open file "base/5/16388": No such file or directory
Since the pg_sequences system view uses pg_sequence_last_value(),
it can error similarly. To fix, modify the function to return NULL
for unlogged sequences on standby servers. Since this bug is
present on all versions since v15, this approach is preferable to
making the ERROR nicer because we need to repair the pg_sequences
view without modifying its definition on released versions. For
consistency, this commit also modifies the function to return NULL
for other sessions' temporary sequences. The pg_sequences view
already appropriately filters out such sequences, so there's no bug
there, but we might as well offer some defense in case someone
invokes this function directly.
Unlogged sequences were first introduced in v15, but temporary
sequences are much older, so while the fix for unlogged sequences
is only back-patched to v15, the temporary sequence portion is
back-patched to all supported versions.
We could also remove the privilege check in the pg_sequences view
definition in v18 if we modify this function to return NULL for
sequences for which the current user lacks privileges, but that is
left as a future exercise for when v18 development begins.
Reviewed-by: Tom Lane, Michael Paquier
Discussion: https://postgr.es/m/20240501005730.GA594666%40nathanxps13
Backpatch-through: 12
Branch
------
REL_15_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/857d280c652876e0bbf0e1b5c237574514b50ebc
Modified Files
--------------
doc/src/sgml/system-views.sgml | 29 +++++++++++++++++++++++++----
src/backend/commands/sequence.c | 31 ++++++++++++++++++++++---------
src/test/recovery/t/001_stream_rep.pl | 9 +++++++++
3 files changed, 56 insertions(+), 13 deletions(-)
^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Fix pg_sequence_last_value() for unlogged sequences on standbys.
@ 2024-05-13 20:57 Nathan Bossart <nathan@postgresql.org>
0 siblings, 0 replies; 6+ messages in thread
From: Nathan Bossart @ 2024-05-13 20:57 UTC (permalink / raw)
To: pgsql-committers@lists.postgresql.org
Fix pg_sequence_last_value() for unlogged sequences on standbys.
Presently, when this function is called for an unlogged sequence on
a standby server, it will error out with a message like
ERROR: could not open file "base/5/16388": No such file or directory
Since the pg_sequences system view uses pg_sequence_last_value(),
it can error similarly. To fix, modify the function to return NULL
for unlogged sequences on standby servers. Since this bug is
present on all versions since v15, this approach is preferable to
making the ERROR nicer because we need to repair the pg_sequences
view without modifying its definition on released versions. For
consistency, this commit also modifies the function to return NULL
for other sessions' temporary sequences. The pg_sequences view
already appropriately filters out such sequences, so there's no bug
there, but we might as well offer some defense in case someone
invokes this function directly.
Unlogged sequences were first introduced in v15, but temporary
sequences are much older, so while the fix for unlogged sequences
is only back-patched to v15, the temporary sequence portion is
back-patched to all supported versions.
We could also remove the privilege check in the pg_sequences view
definition in v18 if we modify this function to return NULL for
sequences for which the current user lacks privileges, but that is
left as a future exercise for when v18 development begins.
Reviewed-by: Tom Lane, Michael Paquier
Discussion: https://postgr.es/m/20240501005730.GA594666%40nathanxps13
Backpatch-through: 12
Branch
------
REL_13_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/09ec5d45548ae435717176c4ac954f43e34ac731
Modified Files
--------------
src/backend/commands/sequence.c | 27 ++++++++++++++++++---------
1 file changed, 18 insertions(+), 9 deletions(-)
^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Fix pg_sequence_last_value() for unlogged sequences on standbys.
@ 2024-05-13 20:57 Nathan Bossart <nathan@postgresql.org>
0 siblings, 0 replies; 6+ messages in thread
From: Nathan Bossart @ 2024-05-13 20:57 UTC (permalink / raw)
To: pgsql-committers@lists.postgresql.org
Fix pg_sequence_last_value() for unlogged sequences on standbys.
Presently, when this function is called for an unlogged sequence on
a standby server, it will error out with a message like
ERROR: could not open file "base/5/16388": No such file or directory
Since the pg_sequences system view uses pg_sequence_last_value(),
it can error similarly. To fix, modify the function to return NULL
for unlogged sequences on standby servers. Since this bug is
present on all versions since v15, this approach is preferable to
making the ERROR nicer because we need to repair the pg_sequences
view without modifying its definition on released versions. For
consistency, this commit also modifies the function to return NULL
for other sessions' temporary sequences. The pg_sequences view
already appropriately filters out such sequences, so there's no bug
there, but we might as well offer some defense in case someone
invokes this function directly.
Unlogged sequences were first introduced in v15, but temporary
sequences are much older, so while the fix for unlogged sequences
is only back-patched to v15, the temporary sequence portion is
back-patched to all supported versions.
We could also remove the privilege check in the pg_sequences view
definition in v18 if we modify this function to return NULL for
sequences for which the current user lacks privileges, but that is
left as a future exercise for when v18 development begins.
Reviewed-by: Tom Lane, Michael Paquier
Discussion: https://postgr.es/m/20240501005730.GA594666%40nathanxps13
Backpatch-through: 12
Branch
------
REL_14_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/c8714230ad35cc4587555ebe7052ba0ec87722f0
Modified Files
--------------
src/backend/commands/sequence.c | 27 ++++++++++++++++++---------
1 file changed, 18 insertions(+), 9 deletions(-)
^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Fix pg_sequence_last_value() for unlogged sequences on standbys.
@ 2024-05-13 20:57 Nathan Bossart <nathan@postgresql.org>
0 siblings, 0 replies; 6+ messages in thread
From: Nathan Bossart @ 2024-05-13 20:57 UTC (permalink / raw)
To: pgsql-committers@lists.postgresql.org
Fix pg_sequence_last_value() for unlogged sequences on standbys.
Presently, when this function is called for an unlogged sequence on
a standby server, it will error out with a message like
ERROR: could not open file "base/5/16388": No such file or directory
Since the pg_sequences system view uses pg_sequence_last_value(),
it can error similarly. To fix, modify the function to return NULL
for unlogged sequences on standby servers. Since this bug is
present on all versions since v15, this approach is preferable to
making the ERROR nicer because we need to repair the pg_sequences
view without modifying its definition on released versions. For
consistency, this commit also modifies the function to return NULL
for other sessions' temporary sequences. The pg_sequences view
already appropriately filters out such sequences, so there's no bug
there, but we might as well offer some defense in case someone
invokes this function directly.
Unlogged sequences were first introduced in v15, but temporary
sequences are much older, so while the fix for unlogged sequences
is only back-patched to v15, the temporary sequence portion is
back-patched to all supported versions.
We could also remove the privilege check in the pg_sequences view
definition in v18 if we modify this function to return NULL for
sequences for which the current user lacks privileges, but that is
left as a future exercise for when v18 development begins.
Reviewed-by: Tom Lane, Michael Paquier
Discussion: https://postgr.es/m/20240501005730.GA594666%40nathanxps13
Backpatch-through: 12
Branch
------
REL_12_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/2812059d3eeaa05ef98dc2e2cc71a716967aeeb8
Modified Files
--------------
src/backend/commands/sequence.c | 27 ++++++++++++++++++---------
1 file changed, 18 insertions(+), 9 deletions(-)
^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Fix pg_sequence_last_value() for unlogged sequences on standbys.
@ 2024-05-13 20:57 Nathan Bossart <nathan@postgresql.org>
0 siblings, 0 replies; 6+ messages in thread
From: Nathan Bossart @ 2024-05-13 20:57 UTC (permalink / raw)
To: pgsql-committers@lists.postgresql.org
Fix pg_sequence_last_value() for unlogged sequences on standbys.
Presently, when this function is called for an unlogged sequence on
a standby server, it will error out with a message like
ERROR: could not open file "base/5/16388": No such file or directory
Since the pg_sequences system view uses pg_sequence_last_value(),
it can error similarly. To fix, modify the function to return NULL
for unlogged sequences on standby servers. Since this bug is
present on all versions since v15, this approach is preferable to
making the ERROR nicer because we need to repair the pg_sequences
view without modifying its definition on released versions. For
consistency, this commit also modifies the function to return NULL
for other sessions' temporary sequences. The pg_sequences view
already appropriately filters out such sequences, so there's no bug
there, but we might as well offer some defense in case someone
invokes this function directly.
Unlogged sequences were first introduced in v15, but temporary
sequences are much older, so while the fix for unlogged sequences
is only back-patched to v15, the temporary sequence portion is
back-patched to all supported versions.
We could also remove the privilege check in the pg_sequences view
definition in v18 if we modify this function to return NULL for
sequences for which the current user lacks privileges, but that is
left as a future exercise for when v18 development begins.
Reviewed-by: Tom Lane, Michael Paquier
Discussion: https://postgr.es/m/20240501005730.GA594666%40nathanxps13
Backpatch-through: 12
Branch
------
REL_16_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/c1664c8eefad0a034d64adde1c2ff70d23be6a2c
Modified Files
--------------
doc/src/sgml/system-views.sgml | 29 +++++++++++++++++++++++++----
src/backend/commands/sequence.c | 31 ++++++++++++++++++++++---------
src/test/recovery/t/001_stream_rep.pl | 8 ++++++++
3 files changed, 55 insertions(+), 13 deletions(-)
^ permalink raw reply [nested|flat] 6+ messages in thread
end of thread, other threads:[~2024-05-13 20:57 UTC | newest]
Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2024-05-13 20:57 pgsql: Fix pg_sequence_last_value() for unlogged sequences on standbys. Nathan Bossart <nathan@postgresql.org>
2024-05-13 20:57 pgsql: Fix pg_sequence_last_value() for unlogged sequences on standbys. Nathan Bossart <nathan@postgresql.org>
2024-05-13 20:57 pgsql: Fix pg_sequence_last_value() for unlogged sequences on standbys. Nathan Bossart <nathan@postgresql.org>
2024-05-13 20:57 pgsql: Fix pg_sequence_last_value() for unlogged sequences on standbys. Nathan Bossart <nathan@postgresql.org>
2024-05-13 20:57 pgsql: Fix pg_sequence_last_value() for unlogged sequences on standbys. Nathan Bossart <nathan@postgresql.org>
2024-05-13 20:57 pgsql: Fix pg_sequence_last_value() for unlogged sequences on standbys. Nathan Bossart <nathan@postgresql.org>
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