PostgreSQL Weekly News - July 25, 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 - July 25, 2021
Date: 2021-07-26 12:28:09
Message-ID: 162730248989.25744.11547566889235646111@wrigleys.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-announce

# PostgreSQL Weekly News - July 25, 2021

[Person of the week](https://postgresql.life/post/rafia_sabih/)

Austrian pgDay will take place September 17, 2021 at Schloss Schoenbrunn
(Apothekertrakt) in Vienna.
https://pgday.at/en/

# PostgreSQL Product News

pgSCV 0.7.0, a Prometheus-compatible monitoring agent and metrics exporter for
PostgreSQL, [released](https://github.com/weaponry/pgscv).

pg_validate_extugprade 1.0.0beta, a tool for testing various combinations of
upgrade process for extensions,
[released](https://github.com/rjuju/pg_validate_extupgrade)

pspg 5.1.0 a pager designed for PostgreSQL, released.
https://github.com/okbob/pspg/releases/tag/5.1.0

Database Lab 2.4, a tool for fast cloning of large PostgreSQL databases to
build non-production environments, released:
https://gitlab.com/postgres-ai/database-lab/-/releases

# PostgreSQL Jobs for July

[https://archives.postgresql.org/pgsql-jobs/2021-07/](https://archives.postgresql.org/pgsql-jobs/2021-07/)

# 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

Thomas Munro pushed:

- Support direct I/O on macOS. Macs don't understand O_DIRECT, but they can
disable caching with a separate fcntl() call. Extend the file opening
functions in fd.c to handle this for us if the caller passes in PG_O_DIRECT.
For now, this affects only WAL data and even then only if you set:
max_wal_senders=0 wal_level=minimal This is not expected to be very useful
on its own, but later proposed patches will make greater use of direct I/O,
and it'll be useful for testing if developers on Macs can see the effects.
Reviewed-by: Andres Freund <andres(at)anarazel(dot)de> Discussion:
[https://postgr.es/m/CA%2BhUKG%2BADiyyHe0cun2wfT%2BSVnFVqNYPxoO6J9zcZkVO7%2BNGig%40mail.gmail.com](https://postgr.es/m/CA%2BhUKG%2BADiyyHe0cun2wfT%2BSVnFVqNYPxoO6J9zcZkVO7%2BNGig%40mail.gmail.com)
[https://git.postgresql.org/pg/commitdiff/2dbe8905711ba09a2214b6e835f8f0c2c4981cb3](https://git.postgresql.org/pg/commitdiff/2dbe8905711ba09a2214b6e835f8f0c2c4981cb3)

- Adjust commit 2dbe8905 for ancient macOS. A couple of open flags used in an
assertion didn't exist in macOS 10.4. Per build farm animal prairiedog. Also
add O_EXCL while here (there are a few more standard flags but they're not
relevant and likely to be missing).
[https://git.postgresql.org/pg/commitdiff/04cad8f7bcd63fac567e49fd72e6df42b3b251a9](https://git.postgresql.org/pg/commitdiff/04cad8f7bcd63fac567e49fd72e6df42b3b251a9)

- Don't use #if inside function-like macro arguments. No concrete problem
reported, but in the past it's been known to cause problems on some compilers
so let's avoid doing that. Reported-by: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Discussion:
[https://postgr.es/m/234364.1626704007%40sss.pgh.pa.us](https://postgr.es/m/234364.1626704007%40sss.pgh.pa.us)
[https://git.postgresql.org/pg/commitdiff/0c08856856f54056ce8db116e9d254fda114c383](https://git.postgresql.org/pg/commitdiff/0c08856856f54056ce8db116e9d254fda114c383)

- jit: Don't inline functions that access thread-locals. Code inlined by LLVM
can crash or fail with "Relocation type not implemented yet!" if it tries to
access thread local variables. Don't inline such code. Back-patch to 11,
where LLVM arrived. Bug #16696. Author: Dmitry Marakasov <amdmi3(at)amdmi3(dot)ru>
Reviewed-by: Andres Freund <andres(at)anarazel(dot)de> Discussion:
[https://postgr.es/m/16696-29d944a33801fbfe@postgresql.org](https://postgr.es/m/16696-29d944a33801fbfe@postgresql.org)
[https://git.postgresql.org/pg/commitdiff/0207d5fbebed7eb698a7e5f3adf30fafe95bc4b9](https://git.postgresql.org/pg/commitdiff/0207d5fbebed7eb698a7e5f3adf30fafe95bc4b9)

Amit Kapila pushed:

- Update comments for AlterSubscription. Add explanation as to why the
subscription needs to be disabled to allow slot_name as none. Author: Japin
Li and Amit Kapila Discussion:
[https://postgr.es/m/MEYP282MB1669CBD98E721C77CA696499B61A9@MEYP282MB1669.AUSP282.PROD.OUTLOOK.COM](https://postgr.es/m/MEYP282MB1669CBD98E721C77CA696499B61A9@MEYP282MB1669.AUSP282.PROD.OUTLOOK.COM)
[https://git.postgresql.org/pg/commitdiff/dcecdfafbd2dbdfaa0f82e7710abfa65242a1d1e](https://git.postgresql.org/pg/commitdiff/dcecdfafbd2dbdfaa0f82e7710abfa65242a1d1e)

- Don't allow to set replication slot_name as ''. We don't allow to create
replication slot_name as an empty string ('') via SQL API
pg_create_logical_replication_slot() but it is allowed to be set via Alter
Subscription command. This will lead to apply worker repeatedly keep trying to
stream data via slot_name '' and the user is not allowed to create the slot
with that name. Author: Japin Li Reviewed-By: Ranier Vilela, Amit Kapila
Backpatch-through: 10, where it was introduced Discussion:
[https://postgr.es/m/MEYP282MB1669CBD98E721C77CA696499B61A9@MEYP282MB1669.AUSP282.PROD.OUTLOOK.COM](https://postgr.es/m/MEYP282MB1669CBD98E721C77CA696499B61A9@MEYP282MB1669.AUSP282.PROD.OUTLOOK.COM)
[https://git.postgresql.org/pg/commitdiff/29abde637bbb4b8fcdc96e049813890afa5ab671](https://git.postgresql.org/pg/commitdiff/29abde637bbb4b8fcdc96e049813890afa5ab671)

- Fix potential buffer overruns in proto.c. Prevent potential buffer overruns
when using strcpy to gid buffer. This has been introduced by commit
a8fd13cab0. Reported-by: Tom Lane as per coverity Author: Peter Smith
Reviewed-by: Amit Kapila Discussion:
[https://www.postgresql.org/message-id/161029.1626639923%40sss.pgh.pa.us](https://www.postgresql.org/message-id/161029.1626639923%40sss.pgh.pa.us)
[https://git.postgresql.org/pg/commitdiff/01c3adcdd85f1507ef49bdf5430c59925d08de6f](https://git.postgresql.org/pg/commitdiff/01c3adcdd85f1507ef49bdf5430c59925d08de6f)

Michaël Paquier pushed:

- doc: Mention CASCADE/RESTRICT for DROP STATISTICS. This grammar has no effect
as there are no dependencies on statistics, but it is supported by the parser.
This is more consistent with the other DROP commands. Author: Vignesh C
Discussion:
[https://postgr.es/m/CALDaNm1LA=yNmzcSfy+0oe6CEAgsxXRf_-UutE3ZncFi8QkFNQ@mail.gmail.com](https://postgr.es/m/CALDaNm1LA=yNmzcSfy+0oe6CEAgsxXRf_-UutE3ZncFi8QkFNQ@mail.gmail.com)
Backpatch-through: 10
[https://git.postgresql.org/pg/commitdiff/d1216635610a9855a8ec139e55cd852f67d5ee81](https://git.postgresql.org/pg/commitdiff/d1216635610a9855a8ec139e55cd852f67d5ee81)

- Fix some issues with WAL segment opening for pg_receivewal --compress. The
logic handling the opening of new WAL segments was fuzzy when using --compress
if a partial, non-compressed, segment with the same base name existed in the
repository storing those files. In this case, using --compress would cause
the code to first check for the existence and the size of a non-compressed
segment, followed by the opening of a new compressed, partial, segment. The
code was accidentally working correctly on most platforms as the buildfarm has
proved, except bowerbird where gzflush() could fail in this code path. It is
wrong anyway to take the code path used pre-padding when creating a new
partial, non-compressed, segment, so let's fix it. Note that this issue
exists when users mix successive runs of pg_receivewal with or without
compression, as discovered with the tests introduced by ffc9dda. While on it,
this refactors the code so as code paths that need to know about the ".gz"
suffix are down from four to one in walmethods.c, easing a bit the
introduction of new compression methods. This addresses a second issue where
log messages generated for an unexpected failure would not show the compressed
segment name involved, which was confusing, printing instead the name of the
non-compressed equivalent. Reported-by: Georgios Kokolatos Discussion:
[https://postgr.es/m/YPDLz2x3o1aX2wRh@paquier.xyz](https://postgr.es/m/YPDLz2x3o1aX2wRh@paquier.xyz)
Backpatch-through: 10
[https://git.postgresql.org/pg/commitdiff/7fbe0c8c4d4fe429ee1d6383706ea5ccb0f639d3](https://git.postgresql.org/pg/commitdiff/7fbe0c8c4d4fe429ee1d6383706ea5ccb0f639d3)

- Re-enable TAP tests of pg_receivewal for ZLIB on Windows. This is a revert of
6cea447, that disabled those tests temporarily on Windows due to failures with
bowerbird where gzflush() would fail when executed on a freshly-opened
compressed and partial segment. This problem should be taken care of now
thanks to 7fbe0c8, so let's see what the buildfarm has to say on Windows for
those tests. Discussion:
[https://postgr.es/m/YPDLz2x3o1aX2wRh@paquier.xyz](https://postgr.es/m/YPDLz2x3o1aX2wRh@paquier.xyz)
[https://git.postgresql.org/pg/commitdiff/91d395f47aa92849b2556b1a4d6bc1ff34121a30](https://git.postgresql.org/pg/commitdiff/91d395f47aa92849b2556b1a4d6bc1ff34121a30)

- Disable TAP tests of pg_receivewal for ZLIB on Windows. This reverts commit
91d395f, to avoid running those tests on Windows. The tests are globally
stable across all buildfarm members, except fairywren (crash of pg_receivewal)
and bowerdird (SIGBREAK preventing the buildfarm run to complete). Those
errors are rather strange, as other hosts with very similar characteristics
are able to run those tests without breaking a sweat. For now, disable those
tests on Windows to turn back the buildfarm to green. Per discussion with
Andrew Dunstan. 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/6a2c532c2230159b909382cfa58494ef9d6df703](https://git.postgresql.org/pg/commitdiff/6a2c532c2230159b909382cfa58494ef9d6df703)

- Unify parsing logic for command-line integer options. Most of the integer
options for command-line binaries now make use of a single routine able to do
the job, fixing issues with the detection of sloppy values caused for example
by the use of atoi(), that fails on strings beginning with numerical
characters with junk trailing characters. This commit cuts down the number of
strings requiring translation by 26 per my count, switching the code to have
two error types for invalid and out-of-range values instead. Much more could
be done here, with float or even int64 options, but int32 was the most
appealing case as it is possible to rely on strtol() to do the job reliably.
Note that there are some exceptions for now, like pg_ctl or pg_upgrade that
use their own logging logic. A couple of negative TAP tests required some
adjustments for the new errors generated. pg_dump and pg_restore tracked the
maximum number of parallel jobs within the option parsing. The code is
refactored a bit to track that in the code dedicated to parallelism instead.
Author: Kyotaro Horiguchi, Michael Paquier Reviewed-by: David Rowley, Álvaro
Herrera Discussion:
[https://postgr.es/m/CALj2ACXqdG9WhqVoJ9zYf-iZt7sgK7Szv5USs=he6NnWQ2ofTA@mail.gmail.com](https://postgr.es/m/CALj2ACXqdG9WhqVoJ9zYf-iZt7sgK7Szv5USs=he6NnWQ2ofTA@mail.gmail.com)
[https://git.postgresql.org/pg/commitdiff/6f164e6d17616a157ea5d9e34dbb1b211c080c41](https://git.postgresql.org/pg/commitdiff/6f164e6d17616a157ea5d9e34dbb1b211c080c41)

- Add missing header declarations for pg_basebackup and pg_{dump,restore}. This
fixes two compilation failures caused by 6f164e6. Interesting to see that
missing <limits.h> dies not fail in Linux or even Windows. On MacOS, it
fails, though. Per various buildfarm members.
[https://git.postgresql.org/pg/commitdiff/bc0cc68f8a1648029424e9300b2e4457acd474a6](https://git.postgresql.org/pg/commitdiff/bc0cc68f8a1648029424e9300b2e4457acd474a6)

Peter Eisentraut pushed:

- Use `l*_node()` family of functions where appropriate. Instead of castNode(…,
lfoo(…)) Author: Dagfinn Ilmari Mannsåker <ilmari(at)ilmari(dot)org> Discussion:
[https://www.postgresql.org/message-id/flat/87eecahraj(dot)fsf(at)wibble(dot)ilmari(dot)org](https://www.postgresql.org/message-id/flat/87eecahraj(dot)fsf(at)wibble(dot)ilmari(dot)org)
[https://git.postgresql.org/pg/commitdiff/2b00db4fb0c7f02f000276bfadaab65a14059168](https://git.postgresql.org/pg/commitdiff/2b00db4fb0c7f02f000276bfadaab65a14059168)

- Make UCS_to_most.pl process encodings in sorted order. This just makes the
progress output easier to follow. Reviewed-by: Kyotaro Horiguchi
<horikyota(dot)ntt(at)gmail(dot)com> Reviewed-by: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
Discussion:
[https://www.postgresql.org/message-id/flat/22016aa9-ca59-15c7-01df-f292cb558c4d(at)enterprisedb(dot)com](https://www.postgresql.org/message-id/flat/22016aa9-ca59-15c7-01df-f292cb558c4d(at)enterprisedb(dot)com)
[https://git.postgresql.org/pg/commitdiff/4d56115f721f3f2c6d3b6f017f40b5103ca71448](https://git.postgresql.org/pg/commitdiff/4d56115f721f3f2c6d3b6f017f40b5103ca71448)

- Remove some whitespace in generated C output. It doesn't match the normal
coding style. Reviewed-by: Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>
Reviewed-by: Heikki Linnakangas <hlinnaka(at)iki(dot)fi> Discussion:
[https://www.postgresql.org/message-id/flat/22016aa9-ca59-15c7-01df-f292cb558c4d(at)enterprisedb(dot)com](https://www.postgresql.org/message-id/flat/22016aa9-ca59-15c7-01df-f292cb558c4d(at)enterprisedb(dot)com)
[https://git.postgresql.org/pg/commitdiff/344dedfd1c24f2e2c591f1eadf8414a1f4df910a](https://git.postgresql.org/pg/commitdiff/344dedfd1c24f2e2c591f1eadf8414a1f4df910a)

- More improvements of error messages about mismatching relkind. Follow-up to
2ed532ee8c474e9767e76e1f3251cc3a0224358c, a few error messages in the logical
replication area currently only deal with tables, but if we're anticipating
more relkinds such as sequences being handled, then these messages also fall
into the category affected by the previous patch, so adjust them too.
Reviewed-by: Michael Paquier <michael(at)paquier(dot)xyz> Discussion:
[https://www.postgresql.org/message-id/c9ba5c6a-4bd5-e12c-1b3c-edbcaedbf392@enterprisedb.com](https://www.postgresql.org/message-id/c9ba5c6a-4bd5-e12c-1b3c-edbcaedbf392@enterprisedb.com)
[https://git.postgresql.org/pg/commitdiff/81d5995b4b78017ef9e5c6f151361d1fb949924c](https://git.postgresql.org/pg/commitdiff/81d5995b4b78017ef9e5c6f151361d1fb949924c)

- Rename NodeTag of ExprState. Rename from tag to type, for consistency with all
other node structs. Discussion:
[https://www.postgresql.org/message-id/flat/c1097590-a6a4-486a-64b1-e1f9cc0533ce(at)enterprisedb(dot)com](https://www.postgresql.org/message-id/flat/c1097590-a6a4-486a-64b1-e1f9cc0533ce(at)enterprisedb(dot)com)
[https://git.postgresql.org/pg/commitdiff/d9a38c52cef3cf80c4259277f11d42a86ecb1952](https://git.postgresql.org/pg/commitdiff/d9a38c52cef3cf80c4259277f11d42a86ecb1952)

- Rename argument of _outValue(). Rename from value to node, for consistency
with similar functions. Discussion:
[https://www.postgresql.org/message-id/flat/c1097590-a6a4-486a-64b1-e1f9cc0533ce(at)enterprisedb(dot)com](https://www.postgresql.org/message-id/flat/c1097590-a6a4-486a-64b1-e1f9cc0533ce(at)enterprisedb(dot)com)
[https://git.postgresql.org/pg/commitdiff/3d25b4ea6e2c93c60566c1185d4ee79a6285089a](https://git.postgresql.org/pg/commitdiff/3d25b4ea6e2c93c60566c1185d4ee79a6285089a)

- Rename some node support functions for consistency. Some node function names
didn't match their node type names exactly. Fix those for consistency.
Discussion:
[https://www.postgresql.org/message-id/flat/c1097590-a6a4-486a-64b1-e1f9cc0533ce(at)enterprisedb(dot)com](https://www.postgresql.org/message-id/flat/c1097590-a6a4-486a-64b1-e1f9cc0533ce(at)enterprisedb(dot)com)
[https://git.postgresql.org/pg/commitdiff/31360381f0a5ff5193c3631e6076442352906f59](https://git.postgresql.org/pg/commitdiff/31360381f0a5ff5193c3631e6076442352906f59)

- Add missing enum tags in enums used in nodes. Discussion:
[https://www.postgresql.org/message-id/flat/c1097590-a6a4-486a-64b1-e1f9cc0533ce(at)enterprisedb(dot)com](https://www.postgresql.org/message-id/flat/c1097590-a6a4-486a-64b1-e1f9cc0533ce(at)enterprisedb(dot)com)
[https://git.postgresql.org/pg/commitdiff/983bdc4fac492a99bb8ab5a471ca7437139e5cf6](https://git.postgresql.org/pg/commitdiff/983bdc4fac492a99bb8ab5a471ca7437139e5cf6)

- Fix typo in comment. Author: Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>
Discussion:
[https://www.postgresql.org/message-id/flat/20210716.170209.175434392011070182.horikyota.ntt%40gmail.com](https://www.postgresql.org/message-id/flat/20210716.170209.175434392011070182.horikyota.ntt%40gmail.com)
[https://git.postgresql.org/pg/commitdiff/86a1aae764b03c7fe06e290e409c8d1a72ff187d](https://git.postgresql.org/pg/commitdiff/86a1aae764b03c7fe06e290e409c8d1a72ff187d)

Álvaro Herrera pushed:

- Make new replication slot test code even less racy. Further fix the test code
in ead9e51e8236, this time by waiting until the checkpoint has completed
before moving on; this ensures that the WAL segment removal has already
happened when we create the next slot. Author: Kyotaro Horiguchi
<horikyota(dot)ntt(at)gmail(dot)com> Discussion:
[https://postgr.es/m/20210719.111318.2042379313472032754.horikyota.ntt@gmail.com](https://postgr.es/m/20210719.111318.2042379313472032754.horikyota.ntt@gmail.com)
[https://git.postgresql.org/pg/commitdiff/0d2cb6b2bbc3327dd002f3ecd4d5bde5851b0cdc](https://git.postgresql.org/pg/commitdiff/0d2cb6b2bbc3327dd002f3ecd4d5bde5851b0cdc)

- Improve installation instructions a bit. Reported-by: Daniel Westermann
Discussion:
[https://postgr.es/m/GV0P278MB04835AAEACF894617574EB6BD25A9@GV0P278MB0483.CHEP278.PROD.OUTLOOK.COM](https://postgr.es/m/GV0P278MB04835AAEACF894617574EB6BD25A9@GV0P278MB0483.CHEP278.PROD.OUTLOOK.COM)
[https://git.postgresql.org/pg/commitdiff/aaec237b1a2f368ed2a8794c4f48b3656750eabc](https://git.postgresql.org/pg/commitdiff/aaec237b1a2f368ed2a8794c4f48b3656750eabc)

- Rework installation instructions again. Dept. of second thoughts: the new
verbiage added in commit aaec237b1a2f is targeted at the wrong audience.
Remove the bits about git and talk about how to get tarballs only. People
looking for the git repo can look in the appendix. That'll need to be
expanded, but this commit doesn't do that. In passing, fix a couple of typos
that snuck in with the previous commit. Discussion:
[https://postgr.es/m/713760.1626891263@sss.pgh.pa.us](https://postgr.es/m/713760.1626891263@sss.pgh.pa.us)
[https://git.postgresql.org/pg/commitdiff/73c5d2bfee2907b7f158485a531f00ba61b054f7](https://git.postgresql.org/pg/commitdiff/73c5d2bfee2907b7f158485a531f00ba61b054f7)

- Make ALTER TRIGGER RENAME consistent for partitioned tables. Renaming triggers
on partitioned tables had two problems: first, it did not recurse to renaming
the triggers on the partitions; and second, it failed to prohibit renaming
clone triggers. Having triggers with different names in partitions is
pointless, and furthermore pg_dump would not preserve names for partitions
anyway. Not backpatched -- making the ALTER TRIGGER throw an error in stable
versions might cause problems for existing scripts. Co-authored-by: Arne
Roland <A(dot)Roland(at)index(dot)de> Co-authored-by: Álvaro Herrera
<alvherre(at)alvh(dot)no-ip(dot)org> Reviewed-by: Zhihong Yu <zyu(at)yugabyte(dot)com>
Discussion:
[https://postgr.es/m/d0fd7040c2fb4de1a111b9d9ccc456b8@index.de](https://postgr.es/m/d0fd7040c2fb4de1a111b9d9ccc456b8@index.de)
[https://git.postgresql.org/pg/commitdiff/80ba4bb383538a2ee846fece6a7b8da9518b6866](https://git.postgresql.org/pg/commitdiff/80ba4bb383538a2ee846fece6a7b8da9518b6866)

- Make new test immune to collation. Animals running in Czech locale failed. I
could try to find table names that don't have this problem, but it seems
simpler to just use the C locale. Per buildfarm
[https://git.postgresql.org/pg/commitdiff/6beb38cfc9ddd4cd3d2eb5402981ebdd69a618b4](https://git.postgresql.org/pg/commitdiff/6beb38cfc9ddd4cd3d2eb5402981ebdd69a618b4)

Peter Geoghegan pushed:

- vacuumdb: Correct comment about --force-index-cleanup. Commit 3499df0d added a
comment that incorrectly suggested that --force-index-cleanup did not appear
in the same major version as the similar --no-index-cleanup option. In fact,
both options are new to PostgreSQL 14. Backpatch: 14-, where both options
were introduced.
[https://git.postgresql.org/pg/commitdiff/28766c054f8cc6a7bbcf99497954e7a259d3edb2](https://git.postgresql.org/pg/commitdiff/28766c054f8cc6a7bbcf99497954e7a259d3edb2)

- Doc: vacuum_multixact_failsafe_age is multixact-based. Oversight in commit
1e55e7d1, which added a wraparound failsafe mechanism to VACUUM. Backpatch:
14-, where VACUUM failsafe was introduced.
[https://git.postgresql.org/pg/commitdiff/dd498998a374b3d2a7f5211504f1f1aa15348cf1](https://git.postgresql.org/pg/commitdiff/dd498998a374b3d2a7f5211504f1f1aa15348cf1)

Tom Lane pushed:

- Fix corner-case uninitialized-variable issues in plpgsql. If an error was
raised during our initial attempt to check whether a successfully-compiled
expression is "simple", subsequent calls of exec_stmt_execsql would suppose
that stmt->mod_stmt was already computed when it had not been. This could
lead to assertion failures in debug builds; in production builds the effect
would typically be to act as if INTO STRICT had been specified even when it
had not been. Of course that only matters if the subsequent attempt to
execute the expression succeeds, so that the problem can only be reached by
fixing a failure in some referenced, inline-able SQL function and then
retrying the calling plpgsql function in the same session. (There might be
even-more-obscure ways to change the expression's behavior without changing
the plpgsql function, but that one seems like the only one people would be
likely to hit in practice.) The most foolproof way to fix this would be to
arrange for exec_prepare_plan to not set expr->plan until we've finished the
subsidiary simple-expression check. But it seems hard to do that without
creating reference-count leak issues. So settle for documenting the hazard in
a comment and fixing exec_stmt_execsql to test separately for whether it's
computed stmt->mod_stmt. (That adds a test-and-branch per execution, but
hopefully that's negligible in context.) In v11 and up, also fix
exec_stmt_call which had a variant of the same issue. Per bug #17113 from
Alexander Lakhin. Back-patch to all supported branches. Discussion:
[https://postgr.es/m/17113-077605ce00e0e7ec@postgresql.org](https://postgr.es/m/17113-077605ce00e0e7ec@postgresql.org)
[https://git.postgresql.org/pg/commitdiff/d9809bf8694c17e05537c5dd96cde3e67c02d52a](https://git.postgresql.org/pg/commitdiff/d9809bf8694c17e05537c5dd96cde3e67c02d52a)

- Doc: improve documentation about exponentiation operator. Now that we're not
having to wedge this into the straitjacket of the old operator table format,
we can add another example to clarify the point about left-to-right
associativity. Per suggestion from mdione at grulic.org.ar.
[https://postgr.es/m/162661954599.693.13700316547731859171@wrigleys.postgresql.org](https://postgr.es/m/162661954599.693.13700316547731859171@wrigleys.postgresql.org)
[https://git.postgresql.org/pg/commitdiff/7fa1e1ef741964eeb50f33d7c72622658bb7e5f4](https://git.postgresql.org/pg/commitdiff/7fa1e1ef741964eeb50f33d7c72622658bb7e5f4)

- Fix failure of some headers to compile "standalone". Recently-added references
to ParseState weren't covered by #include references, creating unwanted
ordering dependencies for users of these headers. Oversight in commit
2bfb50b3d. Per headerscheck/cpluspluscheck.
[https://git.postgresql.org/pg/commitdiff/678f5448c2d86976a98b402ef14482a8ba3b159b](https://git.postgresql.org/pg/commitdiff/678f5448c2d86976a98b402ef14482a8ba3b159b)

- Remove configure-time thread safety checking (thread_test.c). This testing was
useful when it was written, nigh twenty years ago, but it seems fairly
pointless for any platform built in the last dozen or more years. (Compare
also the comments at 8a2121185.) Also we now have reports that the test
program itself fails under ThreadSanitizer. Rather than invest effort in
fixing it, let's just drop it, and assume that the few people who still care
already know they need to use --disable-thread-safety. Back-patch into v14,
for consistency with 8a2121185. Discussion:
[https://postgr.es/m/CADhDkKzPSiNvA3Hyq+wSR_icuPmazG0cFe=YnC3U-CFcYLc8Xw@mail.gmail.com](https://postgr.es/m/CADhDkKzPSiNvA3Hyq+wSR_icuPmazG0cFe=YnC3U-CFcYLc8Xw@mail.gmail.com)
[https://git.postgresql.org/pg/commitdiff/76fa3db33654e543b5c796e28c6fc5b505a19c2a](https://git.postgresql.org/pg/commitdiff/76fa3db33654e543b5c796e28c6fc5b505a19c2a)

- Make printf("%s", NULL) print "(null)" instead of crashing. We previously took
a hard-line attitude that callers should never print a null string pointer,
and doing so is worthy of an assertion failure or crash. However, we've long
since flushed out any easy-to-find bugs of that nature. What remains is a lot
of code that perhaps could fail that way in hard-to-reach corner cases. For
example, in something as simple as ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT), errmsg("constraint \"%s\" for
table \"%s\" does not exist", conname,
get_rel_name(relid)))); one must wonder whether it's completely guaranteed
that get_rel_name cannot return NULL in this context. If such a situation did
occur, the existing policy converts what might be a pretty minor bug into a
server crash condition. This is not good for robustness. Hence, let's follow
the lead of glibc and print "(null)" instead of failing. We should, of
course, still consider it a bug if that behavior is reachable in ordinary use;
but crashing seems less desirable than not crashing. This fix works
across-the-board in v12 and up, where we always use src/port/snprintf.c.
Before that, on most platforms we're at the mercy of the local libc, but it
appears that Solaris 10 is the only supported platform where we'd still get a
crash. Most other platforms such as `*BSD`, macOS, and Solaris 11 have adopted
glibc's behavior at some point. (AIX and HPUX just print "" not "(null)", but
that's close enough.) I've not checked what Windows' native printf would do,
but it doesn't matter because we've long used snprintf.c on that platform. In
v12 and up, also const-ify related code so that we're not casting away const
on the constant string. This is just neatnik-ism, since next to no compilers
will warn about that. Discussion:
[https://postgr.es/m/17098-b960f3616c861f83@postgresql.org](https://postgr.es/m/17098-b960f3616c861f83@postgresql.org)
[https://git.postgresql.org/pg/commitdiff/3779ac62d709467fe6331c8f0285d42e7487a01c](https://git.postgresql.org/pg/commitdiff/3779ac62d709467fe6331c8f0285d42e7487a01c)

- Fix check for conflicting session- vs transaction-level locks. We have an
implementation restriction that PREPARE TRANSACTION can't handle cases where
both session-lifespan and transaction-lifespan locks are held on the same
lockable object. (That's because we'd otherwise need to acquire a new
PROCLOCK entry during post-prepare cleanup, which is an operation that might
fail. The situation can only arise with odd usages of advisory locks, so
removing the restriction is probably not worth the amount of effort it would
take.) AtPrepare_Locks attempted to enforce this, but its logic was many
bricks shy of a load, because it only detected cases where the session and
transaction locks had the same lockmode. Locks of different modes on the same
object would lead to the rather unhelpful message "PANIC: we seem to have
dropped a bit somewhere". To fix, build a transient hashtable with one entry
per locktag, not one per locktag + mode, and use that to detect conflicts.
Per bug #17122 from Alexander Pyhalov. This bug is ancient, so back-patch to
all supported branches. Discussion:
[https://postgr.es/m/17122-04f3c32098a62233@postgresql.org](https://postgr.es/m/17122-04f3c32098a62233@postgresql.org)
[https://git.postgresql.org/pg/commitdiff/6310809c4aa146b3996a35524955c6c6943d241a](https://git.postgresql.org/pg/commitdiff/6310809c4aa146b3996a35524955c6c6943d241a)

- Get rid of artificial restriction on hash table sizes on Windows. The point of
introducing the hash_mem_multiplier GUC was to let users reproduce the old
behavior of hash aggregation, i.e. that it could use more than work_mem at
need. However, the implementation failed to get the job done on Win64, where
work_mem is clamped to 2GB to protect various places that calculate memory
sizes using "long int". As written, the same clamp was applied to hash_mem.
This resulted in severe performance regressions for queries requiring a bit
more than 2GB for hash aggregation, as they now spill to disk and there's no
way to stop that. Getting rid of the work_mem restriction seems like a good
idea, but it's a big job and could not conceivably be back-patched. However,
there's only a fairly small number of places that are concerned with the
hash_mem value, and it turns out to be possible to remove the restriction
there without too much code churn or any ABI breaks. So, let's do that for now
to fix the regression, and leave the larger task for another day. This patch
does introduce a bit more infrastructure that should help with the larger
task, namely pg_bitutils.h support for working with size_t values. Per gripe
from Laurent Hasson. Back-patch to v13 where the behavior change came in.
Discussion:
[https://postgr.es/m/997817.1627074924@sss.pgh.pa.us](https://postgr.es/m/997817.1627074924@sss.pgh.pa.us)
Discussion:
[https://postgr.es/m/MN2PR15MB25601E80A9B6D1BA6F592B1985E39@MN2PR15MB2560.namprd15.prod.outlook.com](https://postgr.es/m/MN2PR15MB25601E80A9B6D1BA6F592B1985E39@MN2PR15MB2560.namprd15.prod.outlook.com)
[https://git.postgresql.org/pg/commitdiff/28d936031a86d94806c6604480ff3f3f169b371c](https://git.postgresql.org/pg/commitdiff/28d936031a86d94806c6604480ff3f3f169b371c)

Fujii Masao pushed:

- Make XLOG_FPI_FOR_HINT records honor full_page_writes setting. Commit
2c03216d83 changed XLOG_FPI_FOR_HINT records so that they always included
full-page images even when full_page_writes was disabled. However, in this
setting, they don't need to do that because hint bit updates don't need to be
protected from torn writes. Therefore, this commit makes XLOG_FPI_FOR_HINT
records honor full_page_writes setting. That is, XLOG_FPI_FOR_HINT records may
include no full-page images if full_page_writes is disabled, and WAL replay of
them does nothing. Reported-by: Zhang Wenjie Author: Kyotaro Horiguchi
Reviewed-by: Fujii Masao Discussion:
[https://postgr.es/m/tencent_60F11973A111EED97A8596FFECC4A91ED405@qq.com](https://postgr.es/m/tencent_60F11973A111EED97A8596FFECC4A91ED405@qq.com)
[https://git.postgresql.org/pg/commitdiff/7fcf2faf9c7dd473208fd6d5565f88d7f733782b](https://git.postgresql.org/pg/commitdiff/7fcf2faf9c7dd473208fd6d5565f88d7f733782b)

- doc: Document that only superusers can use pg_import_system_collations().
Back-patch to v10 where pg_import_system_collations() was added. Author:
Atsushi Torikoshi Reviewed-by: Fujii Masao Discussion:
[https://postgr.es/m/b7f484692a3e283710032e68b7f40617@oss.nttdata.com](https://postgr.es/m/b7f484692a3e283710032e68b7f40617@oss.nttdata.com)
[https://git.postgresql.org/pg/commitdiff/90b6c339b2b37ee320ff6125ef8c8ad0073aa31b](https://git.postgresql.org/pg/commitdiff/90b6c339b2b37ee320ff6125ef8c8ad0073aa31b)

John Naylor pushed:

- Add missing check of noError parameter in euc_tw_and_big5.c. Oversight in
ea1b99a66 Yukun Wang Backpatch to v14 where this parameter was introduced
Discussion:
[https://www.postgresql.org/message-id/flat/OS0PR01MB6003FCEFF0201EF21685FD33B4E39%40OS0PR01MB6003.jpnprd01.prod.outlook.com](https://www.postgresql.org/message-id/flat/OS0PR01MB6003FCEFF0201EF21685FD33B4E39%40OS0PR01MB6003.jpnprd01.prod.outlook.com)
[https://git.postgresql.org/pg/commitdiff/004874b72e8e60966f88de2d95667fe66c0466ca](https://git.postgresql.org/pg/commitdiff/004874b72e8e60966f88de2d95667fe66c0466ca)

- Document "B" and "us" as accepted units in postgres.conf.sample. In
postgresql.conf, memory and file size GUCs can be specified with "B" (bytes)
as of b06d8e58b. Likewise, time GUCs can be specified with "us" (microseconds)
as of caf626b2c. Update postgres.conf.sample to reflect that fact. Pavel
Luzanov Backpatch to v12, which is the earliest version that allows both of
these units. A separate commit will document the "B" case for v11.
Discussion:
[https://www.postgresql.org/message-id/flat/f10d16fc-8fa0-1b3c-7371-cb3a35a13b7a%40postgrespro.ru](https://www.postgresql.org/message-id/flat/f10d16fc-8fa0-1b3c-7371-cb3a35a13b7a%40postgrespro.ru)
[https://git.postgresql.org/pg/commitdiff/bb95feabb8572f5069ad37763707862af5a81942](https://git.postgresql.org/pg/commitdiff/bb95feabb8572f5069ad37763707862af5a81942)

- Fix division by zero error in date_bin. Bauyrzhan Sakhariyev, via Github
Backpatch to v14
[https://git.postgresql.org/pg/commitdiff/a0db4294aeffe428cdcb381fc66ba725ec588e95](https://git.postgresql.org/pg/commitdiff/a0db4294aeffe428cdcb381fc66ba725ec588e95)

David Rowley pushed:

- Make nodeSort.c use Datum sorts for single column sorts. Datum sorts can be
significantly faster than tuple sorts, especially when the data type being
sorted is a pass-by-value type. Something in the region of 50-70% performance
improvements appear to be possible. Just in case there's any confusion; the
Datum sort is only used when the targetlist of the Sort node contains a single
column, not when there's a single column in the sort key and multiple items in
the target list. Author: Ronan Dunklau Reviewed-by: James Coleman, David
Rowley, Ranier Vilela, Hou Zhijie Tested-by: John Naylor Discussion:
[https://postgr.es/m/3177670.itZtoPt7T5@aivenronan](https://postgr.es/m/3177670.itZtoPt7T5@aivenronan)
[https://git.postgresql.org/pg/commitdiff/91e9e89dccdfdf4216953d3d8f5515dcdef177fb](https://git.postgresql.org/pg/commitdiff/91e9e89dccdfdf4216953d3d8f5515dcdef177fb)

Andres Freund pushed:

- Deduplicate choice of horizon for a relation procarray.c. 5a1e1d83022 was a
minimal bug fix for dc7420c2c92. To avoid future bugs of that kind,
deduplicate the choice of a relation's horizon into a new helper,
GlobalVisHorizonKindForRel(). As the code in question was only introduced in
dc7420c2c92 it seems worth backpatching this change as well, otherwise 14 will
look different from all other branches. A different approach to this was
suggested by Matthias van de Meent. Author: Andres Freund Discussion:
[https://postgr.es/m/20210621122919.2qhu3pfugxxp3cji@alap3.anarazel.de](https://postgr.es/m/20210621122919.2qhu3pfugxxp3cji@alap3.anarazel.de)
Backpatch: 14, like 5a1e1d83022
[https://git.postgresql.org/pg/commitdiff/d9d8aa9bb9aa2a850f53facd2c91e454129af57b](https://git.postgresql.org/pg/commitdiff/d9d8aa9bb9aa2a850f53facd2c91e454129af57b)

# Pending Patches

Dilip Kumar sent in another revision of a patch to add TOAST compression method
options.

Kyotaro HORIGUCHI sent in two more revisions of a patch to prevent xlog
page-header errors during recovery.

Greg Nancarrow sent in another revision of a patch to add a new
"client_connection" event and client connection trigger support.

Jacob Champion sent in another revision of a patch to support NSS as a libpq TLS
backend.

Thomas Munro sent in a patch to support direct I/O on Solaris.

Andres Freund sent in two revisions of a WIP patch to optimize allocations by
separating hot from cold paths, and improve slab performance by avoiding the
need to iterate over all chunks when allocating a new block.

Daniel Gustafsson sent in a patch to disable OpenSSL EVP digest padding in
pgcrypto, and add alternative output for OpenSSL 3 without legacy loaded.

Ranier Vilela sent in two revisions of a patch to avoid some strlen calls.

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

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

Dipesh Pandit sent in two more revisions of a patch to mitigate directory scan
for WAL archiver by maintaining the log segment number of current file which is
being archived and incrementing it by '1' to get the next WAL file, rather than
rescanning the directory by default.

Andres Freund and Yura Sokolov traded patches to improve dead tuple storage for
lazy vacuum by Andres by adding a radix tree implementation, and Yura by adding
a specialized vacuum tid map.

Denis Hirn sent in another revision of a patch to allow multiple linear
recursive self-references in CTEs.

Peter Eisentraut sent in a patch to make the Unicode makefile parallel-safe.

Ronan Dunklau sent in another revision of a patch to tag and remove resjunk
added for SortGroupClause, and teach sort and result nodes to perform a
simplified version of a projection.

Filip Gospodinov sent in another revision of a patch to fix the pkg-config file
for static linking by hard coding -lpgcommon and -lpgport in Libs.private.

Tomáš Vondra sent in another revision of a patch to implement logical decoding /
replication of sequences.

Tomáš Vondra sent in another revision of a patch to handle Expr op Expr clauses
in extended stats.

Tomáš Vondra sent in two more revisions of a patch to make GROUP BY more
efficient.

David Rowley sent in another revision of a patch to make nodeSort.c do Datum
sorts for single column sorts.

Peifeng Qiu sent in two revisions of a patch to add kerberos delegation support
to libpq.

John Naylor sent in another revision of a patch to rewrite pg_verify_str for
speed.

Hou Zhijie and Greg Nancarrow traded patches to enable users to declare a
table's parallel data-modification safety, enable parallel select for insert,
and add a pg_get_table_parallel_dml_safety(regclass) function returning records
of (objid, classid, parallel_safety).

Ranier Vilela and Aleksander Alekseev traded patches to unshadow a couple of
variables.

Simon Riggs sent in two more revisions of a patch to make it possible for hash
indexes to back UNIQUE constraints and allow for multicolumn hash indexes.

Bruce Momjian sent in four more revisions of a patch to fix a bug in the
arithmetic of fractional intervals.

Yugo Nagata sent in a patch to correct an error in the libpq documentation where
the fact that the commands stored locally in the output buffer until it is
flushed.

Yugo Nagata sent in another revision of a patch intended to fix a bug that
manifested as using prepared BEGIN statement in a pipeline in pgbench could
cause an error.

Richard Guo sent in another revision of a patch to fix up some infelicities in
partition-wise JOINs.

David Rowley sent in another revision of a patch to add planner support for
ORDER BY aggregates.

Ronan Dunklau and Ranier Vilela traded patches to fix postgres_fdw PathKey's
handling by paying attention to the operator family being used for the sort.

Thomas Munro sent in two revisions of a patch to make the SIMD code more
platform neutral, add ARM/NEON support for UTF-8 validation, and add POWER
AltiVec support for UTF-8 validation.

Dean Rasheed sent in another revision of a patch to make exponentiation with
negative exponents work with NUMERIC.

Peter Eisentraut sent in a patch to test query cancelation in psql.

Pavel Stěhule and Aleksander Alekseev traded patches to enhance the PL/pgsql
debugging API to add returning the text value of variable content.

Vigneshwaran C sent in two more revisions of a patch to add schema-level
granularity for PUBLICATIONs.

Jacob Champion sent in a patch to add indicators for wide Unicode code points
which have been added since the Unicode 5.0.

Thomas Munro and Soumyadeep Chakraborty traded patches to Optimize
ProcSendSignal() by changing from tracking target backends by pid to using
pgprocno, which doesn't require scanning the ProcArray. Doing it this way also
removes some special cases that need to be checked for during startup.

Andres Freund sent in a patch to pgbench to restrict to use pipelining only to
do PQconsumeInput() when necessary.

Nitin Jadhav sent in two more revisions of a patch to show the progress of the
operations performed during startup process.

Ajin Cherian sent in four more revisions of a patch to drop empty transactions
from logical replication.

Thomas Munro sent in a patch to Teach pgindent about special file-local
typenames.

Erik Rijkers sent in another revision of a patch to implement the JSON_TABLE
part of the SQL/JSON spec.

Alexander Pyhalov sent in another revision of a patch to make it possible to
push CASE expressions to foreign servers.

Zeng Wenjing sent in another revision of a patch to implement global temporary
tables.

Justin Pryzby sent in another revision of a patch to implement ALTER TABLE ...
ACCESS METHOD, and make it possible to specify the table access method of
partitioned tables.

Hou Zhijie sent in a patch to add a quickselect facility, which can be used
among other things to compute medians quickly.

Artur Zakirov sent in a patch intended to fix a bug that manifested as stored
procedure triggered by logical replication is unable to use notification events
by moving the SignalBackends() calls inside AtCommit_Notify().

Peter Eisentraut sent in a patch to pg_amcheck to fix block number parsing on
command line so it correctly handles systems where sizeof(long)==4.

Haiying Tang sent in a patch to support tab-completion for single quoted input
which contains an equals sign.

Fabien COELHO sent in another revision of a patch to add a SHOW_ALL_RESULTS
option to psql.

Dean Rasheed and Tom Lane traded patches to allow for NUMERICs to have negative
scales.

Michael Banck sent in another revision of a patch to add a new PGC_ADMINSET GUC
context and a new pg_change_role_settings predefined role. These create an
administrator which lies between superuser and user in its capabilities.

Greg Nancarrow sent in another revision of a patch to fix parallel worker failed
assertion and coredump.

Andrey Borodin sent in a patch to avoid duplication in relcache and syscache
callbacks.

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

Robert Haas sent in a patch to refactor some end-of-recovery code out of
StartupXLOG(), postpone some end-of-recovery operations relating to allowing
WAL, and create a XLogAcceptWrites() function with code from StartupXLOG().

Andrey Borodin sent in a patch to improve error reporting of ReadPageInternal()
by ensuring that the unhelpful error "no record found" no longer occurs.

Tom Lane sent in a patch to remove the "long int"-related limit on hash table
sizes.

Haiying Tang sent in another revision of a patch to put in a minor fix for a
regress example.

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

Bharath Rupireddy sent in another revision of a patch to disallow RESTART option
for CREATE SEQUENCE.

Julien Rouhaud sent in a patch to make pg_stat_statements tests immune to
prepared statements invalidation.

Browse pgsql-announce by date

  From Date Subject
Next Message CYBERTEC PostgreSQL International GmbH via PostgreSQL Announce 2021-07-29 15:05:16 pg_timetable v4 is out!
Previous Message CYBERTEC PostgreSQL International GmbH via PostgreSQL Announce 2021-07-22 18:52:23 PGDay Austria 2021 - Full schedule out now!