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
PostgreSQL Database Management System
This directory contains the source code distribution of the PostgreSQL database management system.
PostgreSQL is an advanced object-relational database management system that supports an extended subset of the SQL standard, including transactions, foreign keys, subqueries, triggers, user-defined types and functions. This distribution also contains C language bindings.
Copyright and license information can be found in the file COPYRIGHT.
General documentation about this version of PostgreSQL can be found at https://www.postgresql.org/docs/19/. In particular, information about building PostgreSQL from the source code can be found at https://www.postgresql.org/docs/19/installation.html.
The latest version of this software, and related software, may be obtained at https://www.postgresql.org/download/. For more information look at our web site located at https://www.postgresql.org/.