pgsql: Improve error message for snapshot import in snapmgr.c, take two

2023-09-18 Thread Michael Paquier
Improve error message for snapshot import in snapmgr.c, take two When a snapshot file fails to be read in ImportSnapshot(), it would issue an ERROR as "invalid snapshot identifier" when opening a stream for it in read-only mode. The error handling is improved to be more talkative in failure cases

pgsql: Fix assertion failure with PL/Python exceptions

2023-09-18 Thread Michael Paquier
Fix assertion failure with PL/Python exceptions PLy_elog() was not able to handle correctly cases where a SPI called failed, which would fill in a DETAIL string able to trigger an assertion. We may want to improve this infrastructure so as it is able to provide any extra detail information provid

pgsql: Fix assertion failure with PL/Python exceptions

2023-09-18 Thread Michael Paquier
Fix assertion failure with PL/Python exceptions PLy_elog() was not able to handle correctly cases where a SPI called failed, which would fill in a DETAIL string able to trigger an assertion. We may want to improve this infrastructure so as it is able to provide any extra detail information provid

pgsql: Fix assertion failure with PL/Python exceptions

2023-09-18 Thread Michael Paquier
Fix assertion failure with PL/Python exceptions PLy_elog() was not able to handle correctly cases where a SPI called failed, which would fill in a DETAIL string able to trigger an assertion. We may want to improve this infrastructure so as it is able to provide any extra detail information provid

pgsql: Fix assertion failure with PL/Python exceptions

2023-09-18 Thread Michael Paquier
Fix assertion failure with PL/Python exceptions PLy_elog() was not able to handle correctly cases where a SPI called failed, which would fill in a DETAIL string able to trigger an assertion. We may want to improve this infrastructure so as it is able to provide any extra detail information provid

pgsql: Fix assertion failure with PL/Python exceptions

2023-09-18 Thread Michael Paquier
Fix assertion failure with PL/Python exceptions PLy_elog() was not able to handle correctly cases where a SPI called failed, which would fill in a DETAIL string able to trigger an assertion. We may want to improve this infrastructure so as it is able to provide any extra detail information provid

pgsql: Fix assertion failure with PL/Python exceptions

2023-09-18 Thread Michael Paquier
Fix assertion failure with PL/Python exceptions PLy_elog() was not able to handle correctly cases where a SPI called failed, which would fill in a DETAIL string able to trigger an assertion. We may want to improve this infrastructure so as it is able to provide any extra detail information provid

pgsql: Fix assertion failure with PL/Python exceptions

2023-09-18 Thread Michael Paquier
Fix assertion failure with PL/Python exceptions PLy_elog() was not able to handle correctly cases where a SPI called failed, which would fill in a DETAIL string able to trigger an assertion. We may want to improve this infrastructure so as it is able to provide any extra detail information provid

pgsql: Add function for removing arbitrary nodes in binaryheap.

2023-09-18 Thread Nathan Bossart
Add function for removing arbitrary nodes in binaryheap. This commit introduces binaryheap_remove_node(), which can be used to remove any node from a binary heap. The implementation is straightforward. The target node is replaced with the last node in the heap, and then we sift as needed to pres

pgsql: Fix MSVC build for changes to binaryheap.

2023-09-18 Thread Nathan Bossart
Fix MSVC build for changes to binaryheap. After 5af0263afd, binaryheap.c needs to be listed in Mkvcbuild.pm. Per buildfarm. Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/83223f5f714482dd44883c68ecac2ae8c2d838e8 Modified Files -- src/tools/msvc/Mkvcbui

pgsql: Make binaryheap available to frontend code.

2023-09-18 Thread Nathan Bossart
Make binaryheap available to frontend code. There are a couple of places in frontend code that could make use of this simple binary heap implementation. This commit makes binaryheap usable in frontend code, much like commit 26aaf97b68 did for StringInfo. Like StringInfo, the header file is left

pgsql: Don't crash if cursor_to_xmlschema is used on a non-data-returni

2023-09-18 Thread Tom Lane
Don't crash if cursor_to_xmlschema is used on a non-data-returning Portal. cursor_to_xmlschema() assumed that any Portal must have a tupDesc, which is not so. Add a defensive check. It's plausible that this mistake occurred because of the rather poorly chosen name of the lookup function SPI_curs

pgsql: Don't crash if cursor_to_xmlschema is used on a non-data-returni

2023-09-18 Thread Tom Lane
Don't crash if cursor_to_xmlschema is used on a non-data-returning Portal. cursor_to_xmlschema() assumed that any Portal must have a tupDesc, which is not so. Add a defensive check. It's plausible that this mistake occurred because of the rather poorly chosen name of the lookup function SPI_curs

pgsql: Don't crash if cursor_to_xmlschema is used on a non-data-returni

2023-09-18 Thread Tom Lane
Don't crash if cursor_to_xmlschema is used on a non-data-returning Portal. cursor_to_xmlschema() assumed that any Portal must have a tupDesc, which is not so. Add a defensive check. It's plausible that this mistake occurred because of the rather poorly chosen name of the lookup function SPI_curs

pgsql: Don't crash if cursor_to_xmlschema is used on a non-data-returni

2023-09-18 Thread Tom Lane
Don't crash if cursor_to_xmlschema is used on a non-data-returning Portal. cursor_to_xmlschema() assumed that any Portal must have a tupDesc, which is not so. Add a defensive check. It's plausible that this mistake occurred because of the rather poorly chosen name of the lookup function SPI_curs

pgsql: Don't crash if cursor_to_xmlschema is used on a non-data-returni

2023-09-18 Thread Tom Lane
Don't crash if cursor_to_xmlschema is used on a non-data-returning Portal. cursor_to_xmlschema() assumed that any Portal must have a tupDesc, which is not so. Add a defensive check. It's plausible that this mistake occurred because of the rather poorly chosen name of the lookup function SPI_curs

pgsql: Don't crash if cursor_to_xmlschema is used on a non-data-returni

2023-09-18 Thread Tom Lane
Don't crash if cursor_to_xmlschema is used on a non-data-returning Portal. cursor_to_xmlschema() assumed that any Portal must have a tupDesc, which is not so. Add a defensive check. It's plausible that this mistake occurred because of the rather poorly chosen name of the lookup function SPI_curs

pgsql: Don't crash if cursor_to_xmlschema is used on a non-data-returni

2023-09-18 Thread Tom Lane
Don't crash if cursor_to_xmlschema is used on a non-data-returning Portal. cursor_to_xmlschema() assumed that any Portal must have a tupDesc, which is not so. Add a defensive check. It's plausible that this mistake occurred because of the rather poorly chosen name of the lookup function SPI_curs

pgsql: Fix psql's \? output for \watch

2023-09-18 Thread Alvaro Herrera
Fix psql's \? output for \watch It was reported as misaligned by Kyotaro, but it also needed to be turned into a single translatable phrase (like the one for \g is), as reported by Yugo. This is a new issue (commit f347ec76e2a2), so no backpatch is needed. Author: Kyotaro Horiguchi Author: Yugo

pgsql: doc: Add example for how to set file_fdw column option

2023-09-18 Thread Daniel Gustafsson
doc: Add example for how to set file_fdw column option The documentation is pretty light on how to set column options on foreign tables, and the file_fdw docs refer to COPY when documenting force_null even though it's not used in the same way. Add a small example to describe how to use it. Report