pgsql: Don't let libpq "event" procs break the state of PGresult object

2022-02-18 Thread Tom Lane
Don't let libpq "event" procs break the state of PGresult objects. As currently implemented, failure of a PGEVT_RESULTCREATE callback causes the PGresult to be converted to an error result. This is intellectually inconsistent (shouldn't a failing callback likewise prevent creation of the error re

pgsql: Don't let libpq PGEVT_CONNRESET callbacks break a PGconn.

2022-02-18 Thread Tom Lane
Don't let libpq PGEVT_CONNRESET callbacks break a PGconn. As currently implemented, failure of a PGEVT_CONNRESET callback forces the PGconn into the CONNECTION_BAD state (without closing the socket, which is inconsistent with other failure paths), and prevents later callbacks from being called. T

pgsql: Add support for building with ZSTD.

2022-02-18 Thread Robert Haas
Add support for building with ZSTD. This commit doesn't actually add anything that uses ZSTD; that will be done separately. It just puts the basic infrastructure into place. Jeevan Ladhe, Robert Haas, and Michael Paquier. Reviewed by Justin Pryzby and Andres Freund. Discussion: http://postgr.es

pgsql: Rearrange libpq's error reporting to avoid duplicated error text

2022-02-18 Thread Tom Lane
Rearrange libpq's error reporting to avoid duplicated error text. Since commit ffa2e4670, libpq accumulates text in conn->errorMessage across a whole query cycle. In some situations, we may report more than one error event within a cycle: the easiest case to reach is where we report a FATAL error

pgsql: Fix inconsistencies in SRF checks of pg_config() and string_to_t

2022-02-18 Thread Michael Paquier
Fix inconsistencies in SRF checks of pg_config() and string_to_table() The execution paths of those functions have been using a set of checks inconsistent with any other SRF function: - string_to_table() missed a check on expectedDesc, the tuple descriptor expected by the caller, that should never

pgsql: doc: Simplify description of --with-lz4

2022-02-18 Thread Michael Paquier
doc: Simplify description of --with-lz4 LZ4 is used in much more areas of the system now than just WAL and table data. This commit simplifies the installation documentation of Windows and *nix by removing any details of the areas extended when building with LZ4. Author: Jeevan Ladhe Discussion: