PostgreSQL Weekly News - August 1, 2021

From: PWN via PostgreSQL Announce <announce-noreply(at)postgresql(dot)org>
To: PostgreSQL Announce <pgsql-announce(at)lists(dot)postgresql(dot)org>
Subject: PostgreSQL Weekly News - August 1, 2021
Date: 2021-08-02 01:43:13
Message-ID: 162786859325.25751.2226078786729473978@wrigleys.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-announce

# PostgreSQL Weekly News - August 1, 2021

# PostgreSQL in the News

Planet PostgreSQL: [https://planet.postgresql.org/](https://planet.postgresql.org/)

PostgreSQL Weekly News is brought to you this week by David Fetter

Submit news and announcements by Sunday at 3:00pm PST8PDT to david(at)fetter(dot)org(dot)

# Applied Patches

Michaël Paquier pushed:

- Fix a couple of memory leaks in src/bin/pg_basebackup/. These have been
introduced by 7fbe0c8, and could happen for pg_basebackup and pg_receivewal.
Per report from Coverity for the ones in walmethods.c, I have spotted the ones
in receivelog.c after more review. Backpatch-through: 10
[https://git.postgresql.org/pg/commitdiff/4ef64c425dbcda151c9f163aadff982343808e09](https://git.postgresql.org/pg/commitdiff/4ef64c425dbcda151c9f163aadff982343808e09)

- doc: Fix command example to run regression tests with PGOPTIONS. The
documentation mentioned the use of log_checkpoints, that cannot be used in
this context. This commit replaces log_checkpoints with force_parallel_mode,
a developer option useful to perform checks related to parallelism. Oversight
in 854434c. Author: Haiying Tang Discussion:
[https://postgr.es/m/OS0PR01MB6113954B883ACEB2DDC973F2FBE59@OS0PR01MB6113.jpnprd01.prod.outlook.com](https://postgr.es/m/OS0PR01MB6113954B883ACEB2DDC973F2FBE59@OS0PR01MB6113.jpnprd01.prod.outlook.com)
Backpatch-through: 14
[https://git.postgresql.org/pg/commitdiff/efe080220942fb8c2fdca66a3ab436159f7db86b](https://git.postgresql.org/pg/commitdiff/efe080220942fb8c2fdca66a3ab436159f7db86b)

- Skip trailing whitespaces when parsing integer options. strtoint(), via
strtol(), would skip leading whitespaces but the same rule was not applied for
trailing whitespaces, leading to an inconsistent behavior. Some tests are
changed to cover more this area. Author: Michael Paquier Reviewed-by: Kyotaro
Horiguchi Discussion:
[https://postgr.es/m/YP5Pv0d13Ct+03ve@paquier.xyz](https://postgr.es/m/YP5Pv0d13Ct+03ve@paquier.xyz)
[https://git.postgresql.org/pg/commitdiff/f7a9a3d4b24a4ad0de7992f01a0dd2a02ccd30a4](https://git.postgresql.org/pg/commitdiff/f7a9a3d4b24a4ad0de7992f01a0dd2a02ccd30a4)

- Simplify matching pattern check in TAP tests of pg_receivewal. A check in the
ZLIB portion of the test to match the name of a non-compressed partial segment
with a completed compressed segment was using m//, while a simple equality
check is enough. This makes the test a bit stricter without impacting its
coverage. Author: Kyotaro Horiguchi Discussion:
[https://postgr.es/m/20210726.174622.826565852378770261.horikyota.ntt@gmail.com](https://postgr.es/m/20210726.174622.826565852378770261.horikyota.ntt@gmail.com)
[https://git.postgresql.org/pg/commitdiff/24ba1a87e4056ec34c8a685633a1a14fb89e5700](https://git.postgresql.org/pg/commitdiff/24ba1a87e4056ec34c8a685633a1a14fb89e5700)

- Add support for SET ACCESS METHOD in ALTER TABLE. The logic used to support a
change of access method for a table is similar to changes for tablespace or
relation persistence, requiring a table rewrite with an exclusive lock of the
relation changed. Table rewrites done in ALTER TABLE already go through the
table AM layer when scanning tuples from the old relation and inserting them
into the new one, making this implementation straight-forward. Note that
partitioned tables are not supported as these have no access methods defined.
Author: Justin Pryzby, Jeff Davis Reviewed-by: Michael Paquier, Vignesh C
Discussion:
[https://postgr.es/m/20210228222530.GD20769@telsasoft.com](https://postgr.es/m/20210228222530.GD20769@telsasoft.com)
[https://git.postgresql.org/pg/commitdiff/b0483263dda0824cc49e3f8a022dab07e1cdf9a7](https://git.postgresql.org/pg/commitdiff/b0483263dda0824cc49e3f8a022dab07e1cdf9a7)

- Clarify some comments making use of leetspeak term "up2date". Most of these
are new, as of a8fd13c, and "up-to-date" is much easier to parse for the
average reader. Author: Peter Smith Discussion:
[https://postgr.es/m/CAHut+PtHbHvgOjs_R9LyDF21j-Wn8SxoTtWMQNP2ifXN6t2cSg@mail.gmail.com](https://postgr.es/m/CAHut+PtHbHvgOjs_R9LyDF21j-Wn8SxoTtWMQNP2ifXN6t2cSg@mail.gmail.com)
[https://git.postgresql.org/pg/commitdiff/7b7fbe1e8bb4b2a244d1faa618789db411316e55](https://git.postgresql.org/pg/commitdiff/7b7fbe1e8bb4b2a244d1faa618789db411316e55)

- Add missing exit() in pg_verifybackup when failing to find pg_waldump.
pg_verifybackup needs by default pg_waldump to check after a range of WAL
segments required for a backup, except if --no-parse-wal is specified. The
code checked for the presence of the binary pg_waldump in an installation and
reported an error, but it forgot to properly exit(). This could lead to
confusing errors reported. Reviewed-by: Robert Haas, Fabien Coelho
Discussion:
[https://postgr.es/m/YQDMdB+B68yePFeT@paquier.xyz](https://postgr.es/m/YQDMdB+B68yePFeT@paquier.xyz)
Backpatch-through: 13
[https://git.postgresql.org/pg/commitdiff/2ad98fdf53edf1a90123e3b189cc6f0a31986891](https://git.postgresql.org/pg/commitdiff/2ad98fdf53edf1a90123e3b189cc6f0a31986891)

- Add some missing exit() calls in error paths for various binaries. The
following changes are done: - In pg_archivecleanup, the cleanup of older WAL
segments would never fail immediately. - In pgbench, the initialization of a
thread barrier would not fail hard. - In pg_recvlogical, a stat() failure
never got the call. - In pg_basebackup, two chmod() reported a failure without
exit()'ing when unpacking some tar data freshly received. It may be possible
to continue writing some data even after this failure, but that could be
confusing to the user at the end. These are arguably bugs, but they would
happen for code paths where a failure is unlikely going to happen, so no
backpatch is done. Reviewed-by: Robert Haas, Fabien Coelho Discussion:
[https://postgr.es/m/YQDMdB+B68yePFeT@paquier.xyz](https://postgr.es/m/YQDMdB+B68yePFeT@paquier.xyz)
[https://git.postgresql.org/pg/commitdiff/856de3b39cf6041338b286a99257c324ce647f4e](https://git.postgresql.org/pg/commitdiff/856de3b39cf6041338b286a99257c324ce647f4e)

- Fix typo in tab-complete.c. Introduced in b048326. Reported-by: Jeff Davis
Discussion:
[https://postgr.es/m/10785e3e9456a5d761164d3e60d9c4981b80e321.camel@j-davis.com](https://postgr.es/m/10785e3e9456a5d761164d3e60d9c4981b80e321.camel@j-davis.com)
[https://git.postgresql.org/pg/commitdiff/15c6ede04577f856f702bf0a032297de667f382a](https://git.postgresql.org/pg/commitdiff/15c6ede04577f856f702bf0a032297de667f382a)

- Use --no-loop for new calls of pg_receivewal --endpos in TAP tests. Those
tests are not designed to fail, but if they do, like on some cases for Windows
because of ZLIB (?), they could remain stuck. Using --no-loop makes the test
fail immediately. The oldest test with --endpos already did that. Those
tests have been added in ffc9dda. Reviewed-by: Andrew Dunstan Discussion:
[https://postgr.es/m/ec093ff1-a53c-0091-46a2-4537354b0dd4@dunslane.net](https://postgr.es/m/ec093ff1-a53c-0091-46a2-4537354b0dd4@dunslane.net)
[https://git.postgresql.org/pg/commitdiff/3df93a66593c344e6298e618df3fa5090fca4309](https://git.postgresql.org/pg/commitdiff/3df93a66593c344e6298e618df3fa5090fca4309)

- Enable TAP tests of pg_receivewal for ZLIB on Windows, take three. This
reverts commit 6a2c532. fairywren and bowerbird failed those tests because of
incorrect versions of ZLIB linked to, causing errors like SIGBREAKs that
stopped buildfarm runs or EACCES failures when writing compressed WAL
segments. Andrew Dunstan has done all the investigation here, so he deserves
all the credit for being able to enable those tests on Windows. Discussion:
[https://postgr.es/m/9040d5ed-6462-66a4-07ac-2923785ae563@dunslane.net](https://postgr.es/m/9040d5ed-6462-66a4-07ac-2923785ae563@dunslane.net)
[https://git.postgresql.org/pg/commitdiff/0b8ea707580640f9d5562de77f4b563fa9131547](https://git.postgresql.org/pg/commitdiff/0b8ea707580640f9d5562de77f4b563fa9131547)

David Rowley pushed:

- Fix incorrect comment for get_agg_clause_costs. Adjust the header comment in
get_agg_clause_costs so that it matches what the function currently does. No
recursive searching has been done ever since 0a2bc5d61. It also does not
determine the aggtranstype like the comment claimed. That's all done in
preprocess_aggref(). preprocess_aggref also now determines the numOrderedAggs,
so remove the mention that get_agg_clause_costs also calculates "counts".
Normally, since this is just an adjustment of a comment it might not be worth
back-patching, but since this code is new to PG14 and that version is still in
beta, then it seems worth having the comments match. Discussion:
[https://postgr.es/m/CAApHDvrrGrTJFPELrjx0CnDtz9B7Jy2XYW3Z2BKifAWLSaJYwQ@mail.gmail.com](https://postgr.es/m/CAApHDvrrGrTJFPELrjx0CnDtz9B7Jy2XYW3Z2BKifAWLSaJYwQ@mail.gmail.com)
Backpatch-though: 14
[https://git.postgresql.org/pg/commitdiff/2b58f894e56a1944e824e19c92337d6bf24d9c41](https://git.postgresql.org/pg/commitdiff/2b58f894e56a1944e824e19c92337d6bf24d9c41)

- Remove seemingly unneeded include directory in MSVC scripts. This appears to
have been added way back in ee3b4188a but it's a little unclear why the change
made in that commit is even needed given that 320c7eb8c, dated 18 months
earlier, added code to copy fmgroids.h to src/include/utils. amcheck seems to
get away without adding the additional include directory, so perhaps dblink
can get away with it too. This builds ok in my VS2017 environment, but the
buildfarm may serve as a reminder about why ee3b4188a was required. There's
only one way to find out for sure. Discussion:
[https://postgr.es/m/CAApHDvpo6g5csCTjc_0C7DMvgFPomVb0Rh-AcW5afd=Ya=LRuw@mail.gmail.com](https://postgr.es/m/CAApHDvpo6g5csCTjc_0C7DMvgFPomVb0Rh-AcW5afd=Ya=LRuw@mail.gmail.com)
[https://git.postgresql.org/pg/commitdiff/4b763ff642e1a3608cbcaff062f6c2f465bfc6bd](https://git.postgresql.org/pg/commitdiff/4b763ff642e1a3608cbcaff062f6c2f465bfc6bd)

- Doc: Clarify lock levels taken during ATTACH PARTITION. It wasn't all that
clear which lock levels, if any, would be held on the DEFAULT partition during
an ATTACH PARTITION operation. Also, clarify which locks will be taken if the
DEFAULT partition or the table being attached are themselves partitioned
tables. Here I'm only backpatching to v12 as before then we obtained an
ACCESS EXCLUSIVE lock on the partitioned table. It seems much less relevant
to mention which locks are taken on other tables when the partitioned table
itself is locked with an ACCESS EXCLUSIVE lock. Author: Matthias van de
Meent, David Rowley Discussion:
[https://postgr.es/m/CAEze2WiTB6iwrV8W_J=fnrnZ7fowW3qu-8iQ8zCHP3FiQ6+o-A@mail.gmail.com](https://postgr.es/m/CAEze2WiTB6iwrV8W_J=fnrnZ7fowW3qu-8iQ8zCHP3FiQ6+o-A@mail.gmail.com)
Backpatch-through: 12
[https://git.postgresql.org/pg/commitdiff/8709228775b549a2388e6568f463a4115e5a4c10](https://git.postgresql.org/pg/commitdiff/8709228775b549a2388e6568f463a4115e5a4c10)

- Use the AddFile function consistently in MSVC build scripts. We seem to be
using a mix of manually adding to the 'files' hash and calling the Addfile()
method. Let's just consistently use AddFile(). Reviewed-by: Dagfinn Ilmari
Mannsåker Discussion:
[https://postgr.es/m/CAApHDvpo6g5csCTjc_0C7DMvgFPomVb0Rh-AcW5afd=Ya=LRuw@mail.gmail.com](https://postgr.es/m/CAApHDvpo6g5csCTjc_0C7DMvgFPomVb0Rh-AcW5afd=Ya=LRuw@mail.gmail.com)
[https://git.postgresql.org/pg/commitdiff/ed1884a2fedeffd2e6902451a9d41f4b3f6e859f](https://git.postgresql.org/pg/commitdiff/ed1884a2fedeffd2e6902451a9d41f4b3f6e859f)

- Make the includes field an array in MSVC build scripts. Previously the
'includes' field was a string. It's slightly nicer to manage this when it's
defined as an array instead. This allows us to more easily detect and
eliminate duplicates. Reviewed-by: Álvaro Herrera, Andrew Dunstan, Dagfinn
Ilmari Mannsåker Discussion:
[https://postgr.es/m/CAApHDvpo6g5csCTjc_0C7DMvgFPomVb0Rh-AcW5afd=Ya=LRuw@mail.gmail.com](https://postgr.es/m/CAApHDvpo6g5csCTjc_0C7DMvgFPomVb0Rh-AcW5afd=Ya=LRuw@mail.gmail.com)
[https://git.postgresql.org/pg/commitdiff/33d74c5d00e45248df66fa1bcd9222e0713ea5b1](https://git.postgresql.org/pg/commitdiff/33d74c5d00e45248df66fa1bcd9222e0713ea5b1)

- Don't duplicate references and libraries in MSVC scripts. In order not to
duplicate references and libraries in the Visual Studio project files produced
by the MSVC build scripts, have them check if a particular reference or
library already exists before adding the same one again. Reviewed-by: Álvaro
Herrera, Andrew Dunstan, Dagfinn Ilmari Mannsåker Discussion:
[https://postgr.es/m/CAApHDvpo6g5csCTjc_0C7DMvgFPomVb0Rh-AcW5afd=Ya=LRuw@mail.gmail.com](https://postgr.es/m/CAApHDvpo6g5csCTjc_0C7DMvgFPomVb0Rh-AcW5afd=Ya=LRuw@mail.gmail.com)
[https://git.postgresql.org/pg/commitdiff/15f16ec6511cf50374b09876e39c6939f2da0f08](https://git.postgresql.org/pg/commitdiff/15f16ec6511cf50374b09876e39c6939f2da0f08)

- Adjust MSVC build scripts to parse Makefiles for defines. This adjusts the
MSVC build scripts to look at the compile flags mentioned in the Makefile to
look for -D arguments in order to determine which constants should be defined
in Visual Studio builds. One small anomaly that appeared as a result of this
change is that the Makefile for the ltree contrib module defined LOWER_NODE,
but this was not properly defined in the MSVC build scripts. This meant that
MSVC builds would differ in case sensitivity in the ltree module when compared
to builds using a make build environment. To maintain the same behavior here
we remove the -DLOWER_NODE from the Makefile and just always define it in
ltree.h for non-MSVC builds. We need to maintain the old behavior here as
this affects the on-disk compatibility of GiST indexes when using the ltree
type. The only other resulting change here is that REFINT_VERBOSE is now
defined for the autoinc, insert_username and moddatetime contrib modules.
Previously on MSVC, this was only defined for the refint module. This aligns
the behavior to build environments using make as all 4 of these modules share
the same Makefile. Reviewed-by: Tom Lane Discussion:
[https://postgr.es/m/CAApHDvpo6g5csCTjc_0C7DMvgFPomVb0Rh-AcW5afd=Ya=LRuw@mail.gmail.com](https://postgr.es/m/CAApHDvpo6g5csCTjc_0C7DMvgFPomVb0Rh-AcW5afd=Ya=LRuw@mail.gmail.com)
[https://git.postgresql.org/pg/commitdiff/245de48455daaf51f2f3e8b198d87b5dd9fd4516](https://git.postgresql.org/pg/commitdiff/245de48455daaf51f2f3e8b198d87b5dd9fd4516)

Tom Lane pushed:

- Harden pg_stat_statements tests against CLOBBER_CACHE_ALWAYS. Turns out the
buildfarm hasn't been testing this, which will soon change. Julien Rouhaud,
per report from me Discussion:
[https://postgr.es/m/42557.1627229005@sss.pgh.pa.us](https://postgr.es/m/42557.1627229005@sss.pgh.pa.us)
[https://git.postgresql.org/pg/commitdiff/0806d08d4626f0a71a4e83cb399ee965a8aac99b](https://git.postgresql.org/pg/commitdiff/0806d08d4626f0a71a4e83cb399ee965a8aac99b)

- Use the "pg_temp" schema alias in EXPLAIN and related output. This patch
causes EXPLAIN output to refer to objects that are in the current session's
temp schema with the "pg_temp" schema alias rather than that schema's actual
name. This is useful for our own testing purposes since it will stabilize
EXPLAIN VERBOSE output for such cases, allowing us to use that in regression
tests. It should be less confusing for end users too. Since ruleutils.c needs
to change behavior for this, the change also leaks into a few other users of
ruleutils.c, for example pg_get_viewdef(). AFAICS that won't cause any
problems. We did find that aggressively trying to change this behavior
across-the-board would cause issues, but as long as "pg_temp" only appears
within generated SQL text, I think it'll be fine. Along the way, make
get_namespace_name_or_temp conform to the same API as get_namespace_name, ie
that it returns a palloc'd string or NULL. The current behavior hasn't caused
any bugs since no callers attempt to pfree the result, but if it gets more
widespread usage that could become a problem. Amul Sul, reviewed and extended
by me Discussion:
[https://postgr.es/m/CAAJ_b97W=QaGmag9AhWNbmx3uEYsNkXWL+OVW1_E1D3BtgWvtw@mail.gmail.com](https://postgr.es/m/CAAJ_b97W=QaGmag9AhWNbmx3uEYsNkXWL+OVW1_E1D3BtgWvtw@mail.gmail.com)
[https://git.postgresql.org/pg/commitdiff/48c5c9068211e0a04fd9553c8714b2821ed3ad17](https://git.postgresql.org/pg/commitdiff/48c5c9068211e0a04fd9553c8714b2821ed3ad17)

- In event triggers, use "pg_temp" only for our own temp schema.
pg_event_trigger_ddl_commands used "pg_temp" to refer to any temp schema, not
only that of the current backend. This seems like overreach. It's somewhat
unlikely that DDL commands would refer to temp objects of other sessions to
begin with, but if they do, "pg_temp" would be a most misleading way to
display the action. While this seems like a bug, it's not quite out of the
realm of possibility that somebody out there is expecting the current
behavior. Hence, fix in HEAD, but don't back-patch. Discussion:
[https://postgr.es/m/CAAJ_b97W=QaGmag9AhWNbmx3uEYsNkXWL+OVW1_E1D3BtgWvtw@mail.gmail.com](https://postgr.es/m/CAAJ_b97W=QaGmag9AhWNbmx3uEYsNkXWL+OVW1_E1D3BtgWvtw@mail.gmail.com)
[https://git.postgresql.org/pg/commitdiff/024515cac50e246d92bbe67e9de4da0f302972ef](https://git.postgresql.org/pg/commitdiff/024515cac50e246d92bbe67e9de4da0f302972ef)

- Stabilize output of new regression test. Commit 48c5c9068 failed to allow for
buildfarm animals that force jit = on. I'm surprised that this hasn't come up
elsewhere in explain.sql, so turn it off for that whole test script not just
the one new test case. Per buildfarm.
[https://git.postgresql.org/pg/commitdiff/674f6fe8e65a37289432fa373e5d742a36751ae8](https://git.postgresql.org/pg/commitdiff/674f6fe8e65a37289432fa373e5d742a36751ae8)

- Fix bugs in polymorphic-argument resolution for multiranges. We failed to deal
with an UNKNOWN-type input for anycompatiblemultirange; that should throw an
error indicating that we don't know how to resolve the multirange type. We
also failed to infer the type of an anycompatiblerange output from an
anycompatiblemultirange input or vice versa. Per bug #17066 from Alexander
Lakhin. Back-patch to v14 where multiranges were added. Discussion:
[https://postgr.es/m/17066-16a37f6223a8470b@postgresql.org](https://postgr.es/m/17066-16a37f6223a8470b@postgresql.org)
[https://git.postgresql.org/pg/commitdiff/336ea6e6ff1109e7b83370565e3cb211804fda0c](https://git.postgresql.org/pg/commitdiff/336ea6e6ff1109e7b83370565e3cb211804fda0c)

- Improve libpq's handling of OOM during error message construction. Commit
ffa2e4670 changed libpq so that multiple error reports occurring during one
operation (a connection attempt or query) are accumulated in
conn->errorMessage, where before new ones usually replaced any prior error.
At least in theory, that makes us more vulnerable to running out of memory for
the errorMessage buffer. If it did happen, the user would be left with just
an empty-string error report, which is pretty unhelpful. We can improve this
by relying on pqexpbuffer.c's existing "broken buffer" convention to track
whether we've hit OOM for the current operation's error string, and then
substituting a constant "out of memory" string in the small number of places
where the errorMessage is read out. While at it, apply the same method to
similar OOM cases in pqInternalNotice and pqGetErrorNotice3. Back-patch to
v14 where ffa2e4670 came in. In principle this could go back further; but in
view of the lack of field reports, the hazard seems negligible in older
branches. Discussion:
[https://postgr.es/m/530153.1627425648@sss.pgh.pa.us](https://postgr.es/m/530153.1627425648@sss.pgh.pa.us)
[https://git.postgresql.org/pg/commitdiff/514b4c11d24701d2cc90ad75ed787bf1380af673](https://git.postgresql.org/pg/commitdiff/514b4c11d24701d2cc90ad75ed787bf1380af673)

- In postgres_fdw, allow CASE expressions to be pushed to the remote server.
This is simple enough except for the need to check whether CaseTestExpr nodes
have a collation that is not derived from a remote Var. For that, examine the
CASE's "arg" expression and then pass that info down into the recursive
examination of the WHEN expressions. Alexander Pyhalov, reviewed by Gilles
Darold and myself Discussion:
[https://postgr.es/m/fda09032e90d85d9b726a41e03f9097f@postgrespro.ru](https://postgr.es/m/fda09032e90d85d9b726a41e03f9097f@postgrespro.ru)
[https://git.postgresql.org/pg/commitdiff/5d44fff01eebfe0c7a118326605864e662a44f46](https://git.postgresql.org/pg/commitdiff/5d44fff01eebfe0c7a118326605864e662a44f46)

- Doc: add a glossary entry for "domain". Anton Voloshin and Jürgen Purtz,
reviewed by Laurenz Albe Discussion:
[https://postgr.es/m/2ea65bdf-1380-f088-02bd-ff1a31ed265c@postgrespro.ru](https://postgr.es/m/2ea65bdf-1380-f088-02bd-ff1a31ed265c@postgrespro.ru)
[https://git.postgresql.org/pg/commitdiff/3dddb2a8219d3cfd163a83561d4b4613cd2ea376](https://git.postgresql.org/pg/commitdiff/3dddb2a8219d3cfd163a83561d4b4613cd2ea376)

- Use elog, not Assert, to report failure to provide an outer snapshot. As of
commit 84f5c2908, executing SQL commands (via SPI or otherwise) requires
having either an active Portal, or a caller-established active snapshot. We
were simply Assert'ing that that's the case. But we've now had a couple
different reports of people testing extensions that didn't meet this
requirement, and were confused by the resulting crash. Let's convert the
Assert to a test-and-elog, in hopes of making the issue clearer for extension
authors. Per gripes from Liu Huailing and RekGRpth. Back-patch to v11, like
the prior commit. Discussion:
[https://postgr.es/m/OSZPR01MB6215671E3C5956A034A080DFBEEC9@OSZPR01MB6215.jpnprd01.prod.outlook.com](https://postgr.es/m/OSZPR01MB6215671E3C5956A034A080DFBEEC9@OSZPR01MB6215.jpnprd01.prod.outlook.com)
Discussion:
[https://postgr.es/m/17035-14607d308ac8643c@postgresql.org](https://postgr.es/m/17035-14607d308ac8643c@postgresql.org)
[https://git.postgresql.org/pg/commitdiff/ef12f32c0870b73ab7589ffc178094ac9ba3e84f](https://git.postgresql.org/pg/commitdiff/ef12f32c0870b73ab7589ffc178094ac9ba3e84f)

- Doc: alphabetize the regexp_foo() function descriptions in 9.7.3. For no
visible reason (other than historical accident no doubt), regexp_replace() was
out of order. Re-order to match the way that these functions are listed in
9.4. (That means substring() remains first, because it's SQL-standard and the
rest aren't.) I've not touched the text other than to move it. This is just
to reduce confusion in the diffs for upcoming additions.
[https://git.postgresql.org/pg/commitdiff/64a1f225654f8866422010ff28e0d3384ae4c3af](https://git.postgresql.org/pg/commitdiff/64a1f225654f8866422010ff28e0d3384ae4c3af)

Dean Rasheed pushed:

- Allow numeric scale to be negative or greater than precision. Formerly, when
specifying NUMERIC(precision, scale), the scale had to be in the range [0,
precision], which was per SQL spec. This commit extends the range of allowed
scales to [-1000, 1000], independent of the precision (whose valid range
remains [1, 1000]). A negative scale implies rounding before the decimal
point. For example, a column might be declared with a scale of -3 to round
values to the nearest thousand. Note that the display scale remains
non-negative, so in this case the display scale will be zero, and all digits
before the decimal point will be displayed. A scale greater than the
precision supports fractional values with zeros immediately after the decimal
point. Take the opportunity to tidy up the code that packs, unpacks and
validates the contents of a typmod integer, encapsulating it in a small set of
new inline functions. Bump the catversion because the allowed contents of
atttypmod have changed for numeric columns. This isn't a change that requires
a re-initdb, but negative scale values in the typmod would confuse old
backends. Dean Rasheed, with additional improvements by Tom Lane. Reviewed by
Tom Lane. Discussion:
[https://postgr.es/m/CAEZATCWdNLgpKihmURF8nfofP0RFtAKJ7ktY6GcZOPnMfUoRqA@mail.gmail.com](https://postgr.es/m/CAEZATCWdNLgpKihmURF8nfofP0RFtAKJ7ktY6GcZOPnMfUoRqA@mail.gmail.com)
[https://git.postgresql.org/pg/commitdiff/085f931f52494e1f304e35571924efa6fcdc2b44](https://git.postgresql.org/pg/commitdiff/085f931f52494e1f304e35571924efa6fcdc2b44)

- Fix corner-case errors and loss of precision in numeric_power(). This fixes a
couple of related problems that arise when raising numbers to very large
powers. Firstly, when raising a negative number to a very large integer
power, the result should be well-defined, but the previous code would only
cope if the exponent was small enough to go through power_var_int(). Otherwise
it would throw an internal error, attempting to take the logarithm of a
negative number. Fix this by adding suitable handling to the general case in
power_var() to cope with negative bases, checking for integer powers there.
Next, when raising a (positive or negative) number whose absolute value is
slightly less than 1 to a very large power, the result should approach zero as
the power is increased. However, in some cases, for sufficiently large powers,
this would lose all precision and return 1 instead of 0. This was due to the
way that the local_rscale was being calculated for the final full-precision
calculation: local_rscale = rscale + (int) val - ln_dweight + 8 The first
two terms on the right hand side are meant to give the number of significant
digits required in the result ("val" being the estimated result weight).
However, this failed to account for the fact that rscale is clipped to a
maximum of NUMERIC_MAX_DISPLAY_SCALE (1000), and the result weight might be
less then -1000, causing their sum to be negative, leading to a loss of
precision. Fix this by forcing the number of significant digits calculated to
be nonnegative. It's OK for it to be zero (when the result weight is less than
-1000), since the local_rscale value then includes a few extra digits to
ensure an accurate result. Finally, add additional underflow checks to
exp_var() and power_var(), so that they consistently return zero for cases
like this where the result is indistinguishable from zero. Some paths through
this code already returned zero in such cases, but others were throwing
overflow errors. Dean Rasheed, reviewed by Yugo Nagata. Discussion:
[http://postgr.es/m/CAEZATCW6Dvq7+3wN3tt5jLj-FyOcUgT5xNoOqce5=6Su0bCR0w@mail.gmail.com](http://postgr.es/m/CAEZATCW6Dvq7+3wN3tt5jLj-FyOcUgT5xNoOqce5=6Su0bCR0w@mail.gmail.com)
[https://git.postgresql.org/pg/commitdiff/4dd5ce2fd9b9b2134886fee7fe4cb36d1988adb2](https://git.postgresql.org/pg/commitdiff/4dd5ce2fd9b9b2134886fee7fe4cb36d1988adb2)

Tomáš Vondra pushed:

- psql \dX: check schema when listing statistics objects. Commit ad600bba04
added psql command \dX listing extended statistics objects, but it failed to
consider search_path when selecting the elements so some of the returned
elements might be invisible. The visibility was already considered for tab
completion (added by commit d99d58cdc8), so adding it to the query is fairly
simple. Reported and fix by Justin Pryzby, regression tests by me. Backpatch
to PostgreSQL 14, where \dX was introduced. Batchpatch-through: 14 Author:
Justin Pryzby Reviewed-by: Tatsuro Yamada Discussion:
[https://postgr.es/m/c027a541-5856-75a5-0868-341301e1624b%40nttcom.co.jp_1](https://postgr.es/m/c027a541-5856-75a5-0868-341301e1624b%40nttcom.co.jp_1)
[https://git.postgresql.org/pg/commitdiff/f68b609230689f9886a46e5d9ab8d6cdd947e0dc](https://git.postgresql.org/pg/commitdiff/f68b609230689f9886a46e5d9ab8d6cdd947e0dc)

Álvaro Herrera pushed:

- Remove newly added useless assertion check. Coverity complained that my commit
80ba4bb38353 added a dubious coding for a consistency check that there isn't
more than one row for a certain tgrelid/tgparentid combination. But we don't
check for that explicitly anywhere else, and if we were to do it, it should be
a full shouldn't-happen elog not just an assert. It doesn't seem that this is
very important anyway, so remove it. Discussion:
[https://postgr.es/m/1337562.1627224583@sss.pgh.pa.us](https://postgr.es/m/1337562.1627224583@sss.pgh.pa.us)
[https://git.postgresql.org/pg/commitdiff/21b3aa9c8faf39ef45a5223681d8947e0a00e7da](https://git.postgresql.org/pg/commitdiff/21b3aa9c8faf39ef45a5223681d8947e0a00e7da)

- Set pg_setting.pending_restart when pertinent config lines are removed. This
changes the behavior of examining the pg_file_settings view after changing a
config option that requires restart. The user needs to know that any change
of such options does not take effect until a restart, and this worked
correctly if the line is edited without removing it. However, for the case
where the line is removed altogether, the flag doesn't get set, because a flag
was only set in set_config_option, but that's not called for lines removed.
Repair. (Ref.: commits 62d16c7fc561 and a486e35706ea) Author: Álvaro Herrera
<alvherre(at)alvh(dot)no-ip(dot)org> Reviewed-by: Daniel Gustafsson <daniel(at)yesql(dot)se>
Reviewed-by: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> Discussion:
[https://postgr.es/m/202107262302.xsfdfc5sb7sh@alvherre.pgsql](https://postgr.es/m/202107262302.xsfdfc5sb7sh@alvherre.pgsql)
[https://git.postgresql.org/pg/commitdiff/93a0bf2390327a482ff37317f6e17547e735409e](https://git.postgresql.org/pg/commitdiff/93a0bf2390327a482ff37317f6e17547e735409e)

- Close yet another race condition in replication slot test code. Buildfarm
shows that this test has a further failure mode when a checkpoint starts
earlier than expected, so we detect a "checkpoint completed" line that's not
the one we want. Change the config to try and prevent this. Per buildfarm
While at it, update one comment that was forgotten in commit d18e75664a2f.
Author: Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com> Discussion:
[https://postgr.es/m/20210729.162038.534808353849568395.horikyota.ntt@gmail.com](https://postgr.es/m/20210729.162038.534808353849568395.horikyota.ntt@gmail.com)
[https://git.postgresql.org/pg/commitdiff/ce197e91d02ca38ac1b956a3e0c11596099e7893](https://git.postgresql.org/pg/commitdiff/ce197e91d02ca38ac1b956a3e0c11596099e7893)

Bruce Momjian pushed:

- pg_resetxlog: add option to set oldest xid & use by pg_upgrade. Add
pg_resetxlog -u option to set the oldest xid in pg_control. Previously -x set
this value be -2 billion less than the -x value. However, this causes the
server to immediately scan all relation's relfrozenxid so it can advance
pg_control's oldest xid to be inside the autovacuum_freeze_max_age range,
which is inefficient and might disrupt diagnostic recovery. pg_upgrade will
use this option to better create the new cluster to match the old cluster.
Reported-by: Jason Harvey, Floris Van Nee Discussion:
[https://postgr.es/m/20190615183759.GB239428@rfd.leadboat.com,](https://postgr.es/m/20190615183759.GB239428@rfd.leadboat.com,)
87da83168c644fd9aae38f546cc70295(at)opammb0562(dot)comp(dot)optiver(dot)com Author: Bertrand
Drouvot Backpatch-through: 9.6
[https://git.postgresql.org/pg/commitdiff/74cf7d46a91d601e0f8d957a7edbaeeb7df83efc](https://git.postgresql.org/pg/commitdiff/74cf7d46a91d601e0f8d957a7edbaeeb7df83efc)

- doc: for various substring funcs, document if only first match. Reported-by:
troy(at)frericks(dot)us Discussion:
[https://postgr.es/m/162614304115.701.2392941350859387646@wrigleys.postgresql.org](https://postgr.es/m/162614304115.701.2392941350859387646@wrigleys.postgresql.org)
Backpatch-through: 13
[https://git.postgresql.org/pg/commitdiff/6feebcb6b44631c3dc435e971bd80c2dd218a5ab](https://git.postgresql.org/pg/commitdiff/6feebcb6b44631c3dc435e971bd80c2dd218a5ab)

Andrew Dunstan pushed:

- Disable command echo in pg_upgrade-created windows scripts. This makes them
more like the Unix equivalents. Discussion:
[https://postgr.es/m/73deed30-3363-44e9-48a5-98aa66a8a00f@dunslane.net](https://postgr.es/m/73deed30-3363-44e9-48a5-98aa66a8a00f@dunslane.net)
[https://git.postgresql.org/pg/commitdiff/91d76613b7ec75b6642accaff91dc7d657e549e9](https://git.postgresql.org/pg/commitdiff/91d76613b7ec75b6642accaff91dc7d657e549e9)

- Add -w back to the flags for pg_ctl (re)start in PostgresNode. This is now the
default for pg_ctl, but having the flag here explicitly does no harm and helps
with backwards compatibility of the PostgresNode module.
[https://git.postgresql.org/pg/commitdiff/b33259e261ae99dc7c503a6a7615bd492047588b](https://git.postgresql.org/pg/commitdiff/b33259e261ae99dc7c503a6a7615bd492047588b)

- Add adjust_conf method to PostgresNode. This method will modify or delete an
existing line in the config file rather than simply appending to the file.
This makes adjustment of files for older versions much simpler and more
compact.
[https://git.postgresql.org/pg/commitdiff/dbfe6e4b1766369654e20113b0cab79bd939d544](https://git.postgresql.org/pg/commitdiff/dbfe6e4b1766369654e20113b0cab79bd939d544)

- Unify PostgresNode's new() and get_new_node() methods. There is only one
constructor now for PostgresNode, with the idiomatic name 'new'. The method is
not exported by the class, and must be called as
"PostgresNode->new('name',[args])". All the TAP tests that use PostgresNode
are modified accordingly. Third party scripts will need adjusting, which is a
fairly mechanical process (I just used a sed script).
[https://git.postgresql.org/pg/commitdiff/201a76183e2056c2217129e12d68c25ec9c559c8](https://git.postgresql.org/pg/commitdiff/201a76183e2056c2217129e12d68c25ec9c559c8)

- Add a getter function for a PostgresNode install_path. Experience has shown
this can be useful, and while not strictly necessary we should not normally
expose the internals of PostgresNode objects.
[https://git.postgresql.org/pg/commitdiff/87076c40834c2971f073f69be33a5f95ffa8f8a1](https://git.postgresql.org/pg/commitdiff/87076c40834c2971f073f69be33a5f95ffa8f8a1)

- Add PostgresVersion.pm method to emit the major version string. For versions
before 10, this will produce dotted notation unless a separator argument is
given, in which case it is used.
[https://git.postgresql.org/pg/commitdiff/1e8d89f8800e0aaafc66e87e8e5fedf5dbd038cf](https://git.postgresql.org/pg/commitdiff/1e8d89f8800e0aaafc66e87e8e5fedf5dbd038cf)

- Remove the last vestiges of Exporter from PostgresNode. Clients wanting to
call get_free_port now need to do so via a qualified name:
PostgresNode::get_free_port().
[https://git.postgresql.org/pg/commitdiff/5dc932f9e7b7d1992abd33d1c519899dd1c30272](https://git.postgresql.org/pg/commitdiff/5dc932f9e7b7d1992abd33d1c519899dd1c30272)

- Avoid calling TestLib::perl2host on a symlinked directory. Certain versions of
msys2/Windows have been observed to resolve symlinks in perl2host rather than
just follow them. This defeats using a symlinked shorter path to a longer
path, and makes certain tests fail. We therefore call perl2host on the parent
directory of the symlink and thereafter just use that result. Apply to
release 14 where the problem has been observed.
[https://git.postgresql.org/pg/commitdiff/b35a67bc04243da609843949c53e6841e748243a](https://git.postgresql.org/pg/commitdiff/b35a67bc04243da609843949c53e6841e748243a)

- Make TestLib::perl2host more consistent and robust. Sometimes cygpath has been
observed to return a path with a trailing slash. That can cause problems,
Also, make "cygpath" usage consistent with "pwd -W" with respect to the use of
forward slashes. Backpatch to release 14 where the current code was
introduced.
[https://git.postgresql.org/pg/commitdiff/bad106752272c05de5a56036b8a84ae6ff3249a0](https://git.postgresql.org/pg/commitdiff/bad106752272c05de5a56036b8a84ae6ff3249a0)

- Silence perl warning about uninitialized value.
[https://git.postgresql.org/pg/commitdiff/0d1401931868e03342ed4689b5af2522eb40f750](https://git.postgresql.org/pg/commitdiff/0d1401931868e03342ed4689b5af2522eb40f750)

Fujii Masao pushed:

- Avoid using ambiguous word "non-negative" in error messages. The error
messages using the word "non-negative" are confusing because it's ambiguous
about whether it accepts zero or not. This commit improves those error
messages by replacing it with less ambiguous word like "greater than zero" or
"greater than or equal to zero". Also this commit added the note about the
word "non-negative" to the error message style guide, to help writing the new
error messages. When postgres_fdw option fetch_size was set to zero,
previously the error message "fetch_size requires a non-negative integer
value" was reported. This error message was outright buggy. Therefore
back-patch to all supported versions where such buggy error message could be
thrown. Reported-by: Hou Zhijie Author: Bharath Rupireddy Reviewed-by:
Kyotaro Horiguchi, Fujii Masao Discussion:
[https://postgr.es/m/OS0PR01MB5716415335A06B489F1B3A8194569@OS0PR01MB5716.jpnprd01.prod.outlook.com](https://postgr.es/m/OS0PR01MB5716415335A06B489F1B3A8194569@OS0PR01MB5716.jpnprd01.prod.outlook.com)
[https://git.postgresql.org/pg/commitdiff/0e1275fb073cbbff2185f4067d67785e56941e50](https://git.postgresql.org/pg/commitdiff/0e1275fb073cbbff2185f4067d67785e56941e50)

- Update minimum recovery point on truncation during WAL replay of abort record.
If a file is truncated, we must update minRecoveryPoint. Once a file is
truncated, there's no going back; it would not be safe to stop recovery at a
point earlier than that anymore. Commit 7bffc9b7bf changed xact_redo_commit()
so that it updates minRecoveryPoint on truncation, but forgot to change
xact_redo_abort(). Back-patch to all supported versions. Reported-by:
mengjuan(dot)cmj(at)alibaba-inc(dot)com Author: Fujii Masao Reviewed-by: Heikki
Linnakangas Discussion:
[https://postgr.es/m/b029fce3-4fac-4265-968e-16f36ff4d075.mengjuan.cmj@alibaba-inc.com](https://postgr.es/m/b029fce3-4fac-4265-968e-16f36ff4d075.mengjuan.cmj@alibaba-inc.com)
[https://git.postgresql.org/pg/commitdiff/a00c138b78521b9bc68b480490a8d601ecdeb816](https://git.postgresql.org/pg/commitdiff/a00c138b78521b9bc68b480490a8d601ecdeb816)

John Naylor pushed:

- Disallow negative strides in date_bin(). It's not clear what the semantics of
negative strides would be, so throw an error instead. Per report from
Bauyrzhan Sakhariyev Reviewed-by: Tom Lane, Michael Paquier Discussion:
[https://www.postgresql.org/message-id/CAKpL73vZmLuFVuwF26FJ%2BNk11PVHhAnQRoREFcA03x7znRoFvA%40mail.gmail.com](https://www.postgresql.org/message-id/CAKpL73vZmLuFVuwF26FJ%2BNk11PVHhAnQRoREFcA03x7znRoFvA%40mail.gmail.com)
Backpatch to v14
[https://git.postgresql.org/pg/commitdiff/3ba70d4e152372fd8ab90ed0887ee08d505ef306](https://git.postgresql.org/pg/commitdiff/3ba70d4e152372fd8ab90ed0887ee08d505ef306)

- Fix range check in ECPG numeric to int conversion. The previous coding guarded
against -INT_MAX instead of INT_MIN, leading to -2147483648 being rejected as
out of range. Per bug #17128 from Kevin Sweet Discussion:
[https://www.postgresql.org/message-id/flat/17128-55a8a879727a3e3a%40postgresql.org](https://www.postgresql.org/message-id/flat/17128-55a8a879727a3e3a%40postgresql.org)
Reviewed-by: Tom Lane Backpatch to all supported branches
[https://git.postgresql.org/pg/commitdiff/5fcf3945bd90bb0170938ad780159779367dc8ac](https://git.postgresql.org/pg/commitdiff/5fcf3945bd90bb0170938ad780159779367dc8ac)

- Remove redundant setting of pg_attribute.attcompression. Since e6241d8e0, no
attribute needs a non-default value of this during initdb, so let the usual
machinery for defaults take care of it.
[https://git.postgresql.org/pg/commitdiff/89404a01b4dadab8231dfa08cab507191c2ac929](https://git.postgresql.org/pg/commitdiff/89404a01b4dadab8231dfa08cab507191c2ac929)

Daniel Gustafsson pushed:

- Remove unused directory from test/ssl .gitignore. The clientside log saved
from the testrun was removed in 1caef31d9 but the entry in the .gitignore file
remained. While this exists in older branches as well, it's mostly a
cosmetical fix so no back- patching is done. Reviewed-by: Michael Paquier
Discussion:
[https://postgr.es/m/F8E73040-BB6F-43BF-95B4-3CEC037BE856@yesql.se](https://postgr.es/m/F8E73040-BB6F-43BF-95B4-3CEC037BE856@yesql.se)
[https://git.postgresql.org/pg/commitdiff/454ae15d10ea2d11669b69e82c98fbd03126fd69](https://git.postgresql.org/pg/commitdiff/454ae15d10ea2d11669b69e82c98fbd03126fd69)

- docs: Fix bit_count example output. The returnvalue for the bit_count(::bytea)
example was assuming a non-default value of standard_conforming_strings. This
was fixed in the tests in commit ebedd0c78. Author: wangzk(dot)fnstxz(at)fujitsu(dot)com
Discussion:
[https://postgr.es/m/OSZPR01MB6551FFAC1088C82C3D799BE0FAEB9@OSZPR01MB6551.jpnprd01.prod.outlook.com](https://postgr.es/m/OSZPR01MB6551FFAC1088C82C3D799BE0FAEB9@OSZPR01MB6551.jpnprd01.prod.outlook.com)
Backpatch-through: 14
[https://git.postgresql.org/pg/commitdiff/fcf4c0ae1db8594cf3d3e84d2564616497eecd5a](https://git.postgresql.org/pg/commitdiff/fcf4c0ae1db8594cf3d3e84d2564616497eecd5a)

Amit Kapila pushed:

- Refactor to make common functions in proto.c and worker.c. This is a
non-functional change only to refactor code to extract some replication logic
into static functions. This is done as preparation for the 2PC streaming
patch which also shares this common logic. Author: Peter Smith Reviewed-By:
Amit Kapila Discussion:
[https://postgr.es/m/CAHut+PuiSA8AiLcE2N5StzSKs46SQEP_vDOUD5fX2XCVtfZ7mQ@mail.gmail.com](https://postgr.es/m/CAHut+PuiSA8AiLcE2N5StzSKs46SQEP_vDOUD5fX2XCVtfZ7mQ@mail.gmail.com)
[https://git.postgresql.org/pg/commitdiff/91f9861242cd7dcf28fae216b1d8b47551c9159d](https://git.postgresql.org/pg/commitdiff/91f9861242cd7dcf28fae216b1d8b47551c9159d)

- Remove unused argument in apply_handle_commit_internal(). Oversight in commit
0926e96c49. Author: Masahiko Sawada Reviewed-By: Amit Kapila
Backpatch-through: 14, where it was introduced Discussion:
[https://postgr.es/m/CAD21AoDeScrsHhLyEPYqN3sydg6PxAPVBboK=30xJfUVihNZDA@mail.gmail.com](https://postgr.es/m/CAD21AoDeScrsHhLyEPYqN3sydg6PxAPVBboK=30xJfUVihNZDA@mail.gmail.com)
[https://git.postgresql.org/pg/commitdiff/16bd4becee32240d09db5c6cbec87957fdfcd2d9](https://git.postgresql.org/pg/commitdiff/16bd4becee32240d09db5c6cbec87957fdfcd2d9)

Etsuro Fujita pushed:

- postgres_fdw: Fix handling of pending asynchronous requests. A pending
asynchronous request is handled by process_pending_request(), which previously
not only processed an in-progress remote query but performed ExecForeignScan()
to produce a tuple to return to the local server asynchronously from the
result of the remote query. But that led to a server crash when executing a
query or led to an "InstrStartNode called twice in a row" or "InstrEndLoop
called on running node" failure when doing EXPLAIN ANALYZE of it, in cases
where the plan tree for it contained multiple async-capable nodes accessing
the same initplan/subplan that contained multiple async-capable nodes scanning
the same foreign tables as for the parent async-capable nodes, as reported by
Andrey Lepikhov. The reason is that the second step in
process_pending_request() invoked when executing the initplan/subplan for one
of the parent async-capable nodes caused recursive execution of the
initplan/subplan for another of the parent async-capable nodes. To fix, split
process_pending_request() into the two steps and postpone the second step
until ForeignAsyncConfigureWait() is called for each of the pending
asynchronous requests. Also, in ExecAppendAsyncEventWait() we assumed that
FDWs would register at least one wait event in a WaitEventSet created there
when they were called from ForeignAsyncConfigureWait() in that function, but
allow FDWs to register zero wait events in the WaitEventSet; modify
ExecAppendAsyncEventWait() to just return in that case. Oversight in commit
27e1f1456. Back-patch to v14 where that commit went in. Andrey Lepikhov and
Etsuro Fujita Discussion:
[https://postgr.es/m/fe5eaa19-1704-e4a4-76ee-3b9d37ade399@postgrespro.ru](https://postgr.es/m/fe5eaa19-1704-e4a4-76ee-3b9d37ade399@postgrespro.ru)
[https://git.postgresql.org/pg/commitdiff/1ec7fca8592178281cd5cdada0f27a340fb813fc](https://git.postgresql.org/pg/commitdiff/1ec7fca8592178281cd5cdada0f27a340fb813fc)

Heikki Linnakangas pushed:

- Update obsolete comment that still referred to CheckpointLock. CheckpointLock
was removed in commit d18e75664a, and commit ce197e91d0 updated a leftover
comment in CreateCheckPoint, but there was another copy of it in
CreateRestartPoint still.
[https://git.postgresql.org/pg/commitdiff/df9f0c716cc75d9842b3de79159b9191c108987c](https://git.postgresql.org/pg/commitdiff/df9f0c716cc75d9842b3de79159b9191c108987c)

- Don't use O_SYNC or similar when opening signal file to fsync it. No need to
use get_sync_bit() when we're calling pg_fsync() on the file. We're not
writing to the files, so it doesn't make any difference in practice, but seems
less surprising this way. Reviewed-by: Andres Freund Discussion:
[https://www.postgresql.org/message-id/b3b71061-4919-e882-4857-27e370ab134a%40iki.fi](https://www.postgresql.org/message-id/b3b71061-4919-e882-4857-27e370ab134a%40iki.fi)
[https://git.postgresql.org/pg/commitdiff/e9f5a0681cb9cf74b4c1c98e10182ccce04aa08c](https://git.postgresql.org/pg/commitdiff/e9f5a0681cb9cf74b4c1c98e10182ccce04aa08c)

- Remove unnecessary 'restoredFromArchive' global variable. It might've been
useful for debugging purposes, but meh. There's 'readSource' which does almost
the same thing. Reviewed-by: Andres Freund Discussion:
[https://www.postgresql.org/message-id/b3b71061-4919-e882-4857-27e370ab134a%40iki.fi](https://www.postgresql.org/message-id/b3b71061-4919-e882-4857-27e370ab134a%40iki.fi)
[https://git.postgresql.org/pg/commitdiff/6b16532811f07fbb58e4b1b248775acbf9f732a2](https://git.postgresql.org/pg/commitdiff/6b16532811f07fbb58e4b1b248775acbf9f732a2)

- Extract code to describe recovery stop reason to a function. StartupXLOG() is
very long, this makes it a little bit more readable. Reviewed-by: Andres
Freund Discussion:
[https://www.postgresql.org/message-id/b3b71061-4919-e882-4857-27e370ab134a%40iki.fi](https://www.postgresql.org/message-id/b3b71061-4919-e882-4857-27e370ab134a%40iki.fi)
[https://git.postgresql.org/pg/commitdiff/4fe8dcdff3af73f6ca16eb3edfa3339c7ee0d2c4](https://git.postgresql.org/pg/commitdiff/4fe8dcdff3af73f6ca16eb3edfa3339c7ee0d2c4)

- Move InRecovery and standbyState global vars to xlogutils.c. They are used in
code that runs both during normal operation and during WAL replay, and needs
to behave differently during replay. Move them to xlogutils.c, because that's
where we have other helper functions used by redo routines. Reviewed-by:
Andres Freund Discussion:
[https://www.postgresql.org/message-id/b3b71061-4919-e882-4857-27e370ab134a%40iki.fi](https://www.postgresql.org/message-id/b3b71061-4919-e882-4857-27e370ab134a%40iki.fi)
[https://git.postgresql.org/pg/commitdiff/317632f3073fc06047a42075eb5e28a9577a4f96](https://git.postgresql.org/pg/commitdiff/317632f3073fc06047a42075eb5e28a9577a4f96)

Robert Haas pushed:

- Remove unnecessary call to ReadCheckpointRecord(). It should always be the
case that the last checkpoint record is still readable, because otherwise, a
crash would leave us in a situation from which we can't recover. Therefore the
test removed by this patch should always succeed. For it to fail, either there
has to be a serious bug in the code someplace, or the user has to be manually
modifying pg_wal while crash recovery is running. If it's the first one, we
should fix the bug. If it's the second one, they should stop, or anyway
they're doing so at their own risk. In neither case does a full checkpoint
instead of an end-of-recovery record seem like a clear winner. Furthermore,
rarely-taken code paths are particularly vulnerable to bugs, so let's simplify
by getting rid of this one. Discussion:
[http://postgr.es/m/CA+TgmoYmw==TOJ6EzYb_vcjyS09NkzrVKSyBKUUyo1zBEaJASA@mail.gmail.com](http://postgr.es/m/CA+TgmoYmw==TOJ6EzYb_vcjyS09NkzrVKSyBKUUyo1zBEaJASA@mail.gmail.com)
[https://git.postgresql.org/pg/commitdiff/1d919de5eb3fffa7cc9479ed6d2915fb89794459](https://git.postgresql.org/pg/commitdiff/1d919de5eb3fffa7cc9479ed6d2915fb89794459)

Jeff Davis pushed:

- Improve documentation for START_REPLICATION ... LOGICAL. The starting point
may not be exactly what the client requested; it may be at the slot's
confirmed_flush_lsn. Also, upgrade the message from DEBUG1 to LOG when this
happens. Reviewed-by: Amit Kapila Discussion:
[https://postgr.es/m/c5c861d576f2511732f8002c76245da587110b1c.camel%40j-davis.com](https://postgr.es/m/c5c861d576f2511732f8002c76245da587110b1c.camel%40j-davis.com)
[https://git.postgresql.org/pg/commitdiff/14d474e079e1edf08926a2e68028cbd82dd614c4](https://git.postgresql.org/pg/commitdiff/14d474e079e1edf08926a2e68028cbd82dd614c4)

# Pending Patches

Bharath Rupireddy sent in another revision of a patch to improve publication
error messages by distinguishing the ones for unlogged tables from the ones for
temporary tables.

Daniel Gustafsson sent in another revision of a patch to support NSS as a libpq
TLS backend.

David Fetter and Greg Nancarrow traded patches to use fewer instructions to find
the decimal length of integers for formatting.

John Naylor sent in two more revisions of a patch to add fast paths for
validating UTF-8 text.

Justin Pryzby and Bharath Rupireddy traded patches to make it possible to log
events in the startup process.

Haiying Tang and Vigneshwaran C traded patches to add schema level granularity
to PUBLICATIONs.

Nathan Bossart sent in two more revisions of a patch to clarify initdb
--sync-only help message and docs.

Amit Langote sent in another revision of a patch to allow batching of inserts
during cross-partition updates.

Andrey V. Lepikhov sent in another revision of a patch to remove unneeded
self-joins.

David Rowley sent in another revision of a patch to the the postgres_fdw to add
ORDER BY to some remote SQL queries.

Peter Smith sent in another revision of a patch to add row filtering for logical
replication.

Daniel Westermann sent in a patch to fix a typo.

Amit Langote sent in a patch to use a separate tupledesc structure for plans in
src/backend/executor/nodeModifyTable.c:ExecInsert.

Dagfinn Ilmari Mannsåker sent in a patch to comply with perlcritic by
prohibiting map and grep in void context.

Dipesh Pandit sent in another revision of a patch to mitigate a
performance-killing directory scan for WAL archiver.

Bertrand Drouvot sent in another revision of a patch to make it possible to do
logical decoding on a standby.

Bharath Rupireddy sent in another revision of a patch to use a WaitLatch for
`{pre, post}_auth_delay`.

Daniel Gustafsson and Jacob Champion traded patches to rework the sslfiles
Makefile target.

Bruce Momjian sent in four more revisions of a patch to fix some issues with the
way interval arithmetic is being handled.

Peter Smith sent in two more revisions of a patch to add prepare API support for
streaming transactions.

Pavel Stěhule sent in another revision of a patch to add an --options-file
option and supporting machinery to pg_dump.

Pavel Stěhule sent in another revision of a patch to add filtering to pg_dump.

Pavel Stěhule sent in another revision of a patch to return the text value of
variable content in the plpgsql debugging API.

Michaël Paquier sent in a patch to document RESTART in CREATE SEQUENCE, while
describing its behavior according to START.

Daniel Gustafsson sent in another revision of a patch to emit namespace in the
post-copy errmsg.

Melanie Plageman sent in a patch to use pgsr for AIO bitmapheapscan.

Yugo Nagata sent in another revision of a patch to pgbench to prevent it from
aborting unnecessarily.

Amit Langote sent in another revision of a patch to rework query relation
permission checking by moving the permission checking information from the range
table entries to a new node type called RelPermissionInfo, averting many
searches through the range tables.

Ronan Dunklau sent in a patch to add a READ_REPLICATION_SLOT command, which is
to be used in the context of a physical replication connection, and use same in
pg_receivewal to get a better estimate of the start_lsn needed.

Daniil Zakhlystov sent in a patch to add zlib and zstd streaming compression,
and use same when implementing libpq compression.

Hayato Kuroda sent in a patch to add the local pid to fallback_application_name.

Masahiko Sawada sent in two more revisions of a patch to add errcontext to
errors in applying logical replication changes, add a
pg_stat_logical_replication_error statistics view, and add a skip_xid option to
ALTER SUBSCRIPTION.

Yura Sokolov sent in a patch to add an integerset2 implementation to bdbench,
which is intended to improve dead tuple storage for lazy vacuum.

RGU sent in a patch to gather partial paths for subproblem's topmost scan/join
rel.

Dean Rasheed sent in a patch to avert an incorrect division by zero error in
to_char.

Prabhat Sahu sent in a patch to add a TAP test for prohibit_wal.

John Naylor sent in another revision of a patch to accelerate tuple sorting for
common types.

Daniel Gustafsson sent in another revision of a patch to fix sscanf limits in
pg_basebackup and pg_dump, and fix a bug in TOC file error message printing
which manifested as sometimes failing to include the name of the file where the
error occurred.

Tomáš Vondra sent in another revision of a patch to add operations on sequences
to logical replication.

Melanie Plageman sent in another revision of a patch to fix a race condition in
parallel hash join batch cleanup, clarify the naming of Parallel Hash Join
phases, and make it possible to use parallel hash on full and right outer joins.

Hou Zhijie sent in a patch to remove an unused parameter in maybe_send_schema.

David Rowley and Tomáš Vondra traded patches to use generation context to speed
up tuplesorts.

Álvaro Herrera sent in another revision of a patch to avoid creating archive
status ".ready" files too early.

Heikki Linnakangas sent in three more revisions of a patch to move code around
in StartupXLOG(), split xlog.c into xlog.c and xlogrecovery.c, and move the code
to apply one WAL record to a subroutine.

Ajin Cherian sent in a patch to fix a possible failure in 021_twophase tap test
by changing the test so that it waits for both subscriptions to catch up before
checking the prepared transaction count.

Gilles Darold sent in another revision of a patch to add functions regexp_count,
regexp_instr, and regexp_like, and add new parameters to regexp_replace and
regexp_substr to make it possible to specify position and occurrence.

Tomáš Vondra sent in another revision of a patch to improve the performance of
the slab allocator.

David Rowley sent in another revision of a patch to track non-pruned partitions
in RelOptInfo, and allow ordered partition scans in more cases.

Vigneshwaran C sent in another revision of a patch to include the actual
datatype used in logical replication message format documentation.

Browse pgsql-announce by date

  From Date Subject
Next Message United States PostgreSQL Association via PostgreSQL Announce 2021-08-05 08:42:20 PGConf NYC 2021 Call for Papers and Sponsors Opens!
Previous Message CYBERTEC PostgreSQL International GmbH via PostgreSQL Announce 2021-07-29 15:05:16 pg_timetable v4 is out!