agora inbox for pgsql-committers@postgresql.orghelp / color / mirror / Atom feed
pgsql: pg_stash_advice: Fix failure to reload empty advice string. 2+ messages / 1 participants [nested] [flat]
* pgsql: pg_stash_advice: Fix failure to reload empty advice string. @ 2026-09-08 15:08 Robert Haas <rhaas@postgresql.org> 0 siblings, 0 replies; 2+ messages in thread From: Robert Haas @ 2026-09-08 15:08 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org pg_stash_advice: Fix failure to reload empty advice string. There's not really any good reason to store an empty advice string in an advice stash, but it's entirely possible that some people might do it by accident. If they do that without this fix, restarting the system will result in failure while reloading pg_stash_advice.tsv. The root cause is that I (rhaas) did not think clearly enough when defining pgsa_next_tsv_field(). After returning each field on the line, it set *cursor to the start of the next field, and after returning all of them, it set *cursor to the trailing NUL byte. But when the last field on the line is empty, this is ambiguous: if we're pointing at the trailing NUL byte, it could be either because it's the start of the zero-length field or because we're out of fields. To remove the ambiguity, this commit decides that *cursor will instead be set to NULL when there are no more fields. Reported-by: Noah Misch <noah@leadboat.com> Discussion: https://postgr.es/m/20260827171830.68.noahmisch@microsoft.com Backpatch-through: 19 Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/dc33cca1859e2d2500ee8f3c0e564561428b4fcf Modified Files -------------- contrib/pg_stash_advice/stashpersist.c | 33 ++++++++++++++++++++------------ contrib/pg_stash_advice/t/001_persist.pl | 18 +++++++++-------- 2 files changed, 31 insertions(+), 20 deletions(-) ^ permalink raw reply [nested|flat] 2+ messages in thread
* pgsql: pg_stash_advice: Fix failure to reload empty advice string. @ 2026-09-08 15:08 Robert Haas <rhaas@postgresql.org> 0 siblings, 0 replies; 2+ messages in thread From: Robert Haas @ 2026-09-08 15:08 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org pg_stash_advice: Fix failure to reload empty advice string. There's not really any good reason to store an empty advice string in an advice stash, but it's entirely possible that some people might do it by accident. If they do that without this fix, restarting the system will result in failure while reloading pg_stash_advice.tsv. The root cause is that I (rhaas) did not think clearly enough when defining pgsa_next_tsv_field(). After returning each field on the line, it set *cursor to the start of the next field, and after returning all of them, it set *cursor to the trailing NUL byte. But when the last field on the line is empty, this is ambiguous: if we're pointing at the trailing NUL byte, it could be either because it's the start of the zero-length field or because we're out of fields. To remove the ambiguity, this commit decides that *cursor will instead be set to NULL when there are no more fields. Reported-by: Noah Misch <noah@leadboat.com> Discussion: https://postgr.es/m/20260827171830.68.noahmisch@microsoft.com Backpatch-through: 19 Branch ------ REL_19_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/21b2808536859f1ffe257088df0f6f09edfd96a1 Modified Files -------------- contrib/pg_stash_advice/stashpersist.c | 33 ++++++++++++++++++++------------ contrib/pg_stash_advice/t/001_persist.pl | 18 +++++++++-------- 2 files changed, 31 insertions(+), 20 deletions(-) ^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2026-09-08 15:08 UTC | newest] Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2026-09-08 15:08 pgsql: pg_stash_advice: Fix failure to reload empty advice string. Robert Haas <rhaas@postgresql.org> 2026-09-08 15:08 pgsql: pg_stash_advice: Fix failure to reload empty advice string. Robert Haas <rhaas@postgresql.org>
This inbox is served by agora; see mirroring instructions for how to clone and mirror all data and code used for this inbox