pgsql: Don't let libpq "event" procs break the state of PGresult object
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 result? what about side-effects on the behavior seen by other event procs? why does PQfireResultCreateEvents act differently from PQgetResult?), but more importantly it destroys any promises we might wish to make about the behavior of libpq in nontrivial operating modes, such as pipeline mode. For example, it's not possible to promise that PGRES_PIPELINE_SYNC results will be returned if an event callback fails on those. With this definition, expecting applications to behave sanely in the face of possibly-failing callbacks seems like a very big lift. Hence, redefine the result of a callback failure as being simply that that event procedure won't be called any more for this PGresult (which was true already). Event procedures can still signal failure back to the application through out-of-band mechanisms, for example via their passthrough arguments. Similarly, don't let failure of a PGEVT_RESULTCOPY callback prevent PQcopyResult from succeeding. That definition allowed a misbehaving event proc to break single-row mode (our sole internal use of PQcopyResult), and it probably had equally deleterious effects for outside uses. Discussion: https://postgr.es/m/[email protected] Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/ce1e7a2f716919652c280937087b24937677f8b3 Modified Files -- doc/src/sgml/libpq.sgml | 31 --- src/interfaces/libpq/fe-exec.c | 37 +++-- src/interfaces/libpq/libpq-events.c | 14 -- 3 files changed, 31 insertions(+), 51 deletions(-)
pgsql: Don't let libpq PGEVT_CONNRESET callbacks break a PGconn.
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. This seems highly questionable, and indeed is questioned by comments in the source. Instead, let's just ignore the result value of PGEVT_CONNRESET calls. Like the preceding commit, this converts event callbacks into "pure observers" that cannot affect libpq's processing logic. Discussion: https://postgr.es/m/[email protected] Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/2e372869aa38a9d6e4552c192da4454b17e01e38 Modified Files -- doc/src/sgml/libpq.sgml | 11 +-- src/interfaces/libpq/fe-connect.c | 28 ++-- 2 files changed, 11 insertions(+), 28 deletions(-)
pgsql: Add support for building with ZSTD.
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/m/ca+tgmoatqkgd+8sjcv+bzvw4xaoewminhju83yg12+nxtqz...@mail.gmail.com Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/6c417bbcc8ff98875234ca269979fc7defde58e5 Modified Files -- configure | 265 ++ configure.ac | 33 + doc/src/sgml/install-windows.sgml | 9 ++ doc/src/sgml/installation.sgml| 9 ++ src/Makefile.global.in| 1 + src/include/pg_config.h.in| 6 + src/tools/msvc/Solution.pm| 13 ++ src/tools/msvc/config_default.pl | 1 + src/tools/msvc/vcregress.pl | 1 + 9 files changed, 338 insertions(+)
pgsql: Rearrange libpq's error reporting to avoid duplicated error text
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 message from the server, and then a bit later we detect loss of connection. Since, historically, each error PGresult bears the entire content of conn->errorMessage, this results in duplication of the FATAL message in any output that concatenates the contents of the PGresults. Accumulation in errorMessage still seems like a good idea, especially in view of the number of places that did ad-hoc error concatenation before ffa2e4670. So to fix this, let's track how much of conn->errorMessage has been read out into error PGresults, and only include new text in later PGresults. The tricky part of that is to be sure that we never discard an error PGresult once made (else we'd risk dropping some text, a problem much worse than duplication). While libpq formerly did that in some code paths, a little bit of rearrangement lets us postpone making an error PGresult at all until we are about to return it. A side benefit of that postponement is that it now becomes practical to return a dummy static PGresult in cases where we hit out-of-memory while trying to manufacture an error PGresult. This eliminates the admittedly-very-rare case where we'd return NULL from PQgetResult, indicating successful query completion, even though what actually happened was an OOM failure. Discussion: https://postgr.es/m/[email protected] Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/618c16707a6d6e8f5c83ede2092975e4670201ad Modified Files -- .../test_decoding/expected/slot_creation_error.out | 1 - src/interfaces/libpq/fe-auth.c | 2 +- src/interfaces/libpq/fe-connect.c | 8 +- src/interfaces/libpq/fe-exec.c | 180 - src/interfaces/libpq/fe-lobj.c | 17 +- src/interfaces/libpq/fe-protocol3.c| 55 +-- src/interfaces/libpq/libpq-int.h | 26 ++- 7 files changed, 224 insertions(+), 65 deletions(-)
pgsql: Fix inconsistencies in SRF checks of pg_config() and string_to_t
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 be NULL. Introduced in 66f1630. - pg_config() should check for a ReturnSetInfo, and expectedDesc cannot be NULL. Its error messages were also inconsistent. Introduced in a5c43b8. Extracted from a larger patch by the same author, in preparation for a larger patch set aimed at refactoring the way tuplestores are created and checked in SRF functions. Author: Melanie Plageman Reviewed-by: Justin Pryzby Discussion: https://postgr.es/m/caakru_azyd1z3w_r7ou4sortjrcs+pxehw1cwjexkofke6t...@mail.gmail.com Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/07daca53bfcad59618a9c6fad304e380cc9d2bc1 Modified Files -- src/backend/utils/adt/varlena.c| 3 ++- src/backend/utils/misc/pg_config.c | 12 2 files changed, 10 insertions(+), 5 deletions(-)
pgsql: doc: Simplify description of --with-lz4
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: https://postgr.es/m/canm22cgny8af76pitomxp603nagwkxba4dyn2fac4yhpebq...@mail.gmail.com Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/d7a978601d4e469f1a8f19122c049bb25fd7f096 Modified Files -- doc/src/sgml/install-windows.sgml | 5 ++--- doc/src/sgml/installation.sgml| 2 -- 2 files changed, 2 insertions(+), 5 deletions(-)
