# PostgreSQL Weekly News - May 9, 2021 Person of the week: [https://postgresql.life/post/dave_page/](https://postgresql.life/post/dave_page/)
# PostgreSQL Product News pgBackRest 2.33, a backup and restore system for PostgreSQL, released. [https://pgbackrest.org/release.html#2.33](https://pgbackrest.org/release.html#2.33) pg_probackup 2.4.15, a utility to manage backup and recovery of PostgreSQL database clusters, released. [https://github.com/postgrespro/pg_probackup/releases/tag/2.4.15](https://github.com/postgrespro/pg_probackup/releases/tag/2.4.15) # PostgreSQL Jobs for May [https://archives.postgresql.org/pgsql-jobs/2021-05/](https://archives.postgresql.org/pgsql-jobs/2021-05/) # 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 [email protected]. # Applied Patches Alexander Korotkov pushed: - Make websearch_to_tsquery() parse text in quotes as a single token. websearch_to_tsquery() splits text in quotes into tokens and connects them with phrase operator on its own. However, that leads to surprising results when the token contains no words. For instance, websearch_to_tsquery('"aaa: bbb"') is 'aaa <2> bbb', because it is equivalent of to_tsquery(E'aaa <-> \':\' <-> bbb'). But websearch_to_tsquery('"aaa: bbb"') has to be 'aaa <-> bbb' in order to match to_tsvector('aaa: bbb'). Since 0c4f355c6a, we anyway connect lexemes of complex tokens with phrase operators. Thus, let's just websearch_to_tsquery() parse text in quotes as a single token. Therefore, websearch_to_tsquery() should process the quoted text in the same way phraseto_tsquery() does. This solution is what we exactly need and also simplifies the code. This commit is an incompatible change, so we don't backpatch it. Reported-by: Valentin Gatien-Baron Discussion: [https://postgr.es/m/CA%2B0DEqiZs7gdOd4ikmg%3D0UWG%2BSwWOLxPsk_JW-sx9WNOyrb0KQ%40mail.gmail.com](https://postgr.es/m/CA%2B0DEqiZs7gdOd4ikmg%3D0UWG%2BSwWOLxPsk_JW-sx9WNOyrb0KQ%40mail.gmail.com) Author: Alexander Korotkov Reviewed-by: Tom Lane, Zhihong Yu [https://git.postgresql.org/pg/commitdiff/eb086056fec44516efdd5db71244a079fed65c7f](https://git.postgresql.org/pg/commitdiff/eb086056fec44516efdd5db71244a079fed65c7f) - Remove mention of the version number from pg_trgm docs. We don't usually mention the version number in similar situations. So, neither mention it here. Reported-by: Bruce Momjian Discussion: [https://postgr.es/m/20210503234914.GO6180%40momjian.us](https://postgr.es/m/20210503234914.GO6180%40momjian.us) [https://git.postgresql.org/pg/commitdiff/ae9492a61bbf575e2862cf9323c7f02806382093](https://git.postgresql.org/pg/commitdiff/ae9492a61bbf575e2862cf9323c7f02806382093) Amit Kapila pushed: - Fix the computation of slot stats for 'total_bytes'. Previously, we were using the size of all the changes present in ReorderBuffer to compute total_bytes after decoding a transaction and that can lead to counting some of the transactions' changes more than once. Fix it by using the size of the changes decoded for a transaction to compute 'total_bytes'. Author: Sawada Masahiko Reviewed-by: Vignesh C, Amit Kapila Discussion: [https://postgr.es/m/[email protected]](https://postgr.es/m/[email protected]) [https://git.postgresql.org/pg/commitdiff/205f466282be11ec97506f73341e47b72e0aee5d](https://git.postgresql.org/pg/commitdiff/205f466282be11ec97506f73341e47b72e0aee5d) - Tighten the concurrent abort check during decoding. During decoding of an in-progress or prepared transaction, we detect concurrent abort with an error code ERRCODE_TRANSACTION_ROLLBACK. That is not sufficient because a callback can decide to throw that error code at other times as well. Reported-by: Tom Lane Author: Amit Kapila Reviewed-by: Dilip Kumar Discussion: [https://postgr.es/m/caa4ek1kcjprs4azhb48qmm4j8xoc1+td8jo-4yu84e+mjwq...@mail.gmail.com](https://postgr.es/m/caa4ek1kcjprs4azhb48qmm4j8xoc1+td8jo-4yu84e+mjwq...@mail.gmail.com) [https://git.postgresql.org/pg/commitdiff/2ce353fc19024d62e59ad99850d7592ebc9abecf](https://git.postgresql.org/pg/commitdiff/2ce353fc19024d62e59ad99850d7592ebc9abecf) - Update replication statistics after every stream/spill. Currently, replication slot statistics are updated at prepare, commit, and rollback. Now, if the transaction is interrupted the stats might not get updated. Fixed this by updating replication statistics after every stream/spill. In passing update the docs to change the description of some of the slot stats. Author: Vignesh C, Sawada Masahiko Reviewed-by: Amit Kapila Discussion: [https://postgr.es/m/[email protected]](https://postgr.es/m/[email protected]) [https://git.postgresql.org/pg/commitdiff/592f00f8dec68038301467a904ac514eddabf6cd](https://git.postgresql.org/pg/commitdiff/592f00f8dec68038301467a904ac514eddabf6cd) Peter Eisentraut pushed: - Factor out system call names from error messages. One more that ought to have been part of 82c3cd974131d7fa1cfcd07cebfb04fffe26ee35. [https://git.postgresql.org/pg/commitdiff/853c8c75571558f4b474eeac3ef9e6fcf9be62ba](https://git.postgresql.org/pg/commitdiff/853c8c75571558f4b474eeac3ef9e6fcf9be62ba) - libpq: Refactor some error messages for easier translation. [https://git.postgresql.org/pg/commitdiff/ced12b73a9bc76b887cb7137df3d56222e2b5263](https://git.postgresql.org/pg/commitdiff/ced12b73a9bc76b887cb7137df3d56222e2b5263) - Remove unused function argument. became unused by 04942bffd0aa9bd0d143d99b473342eb9ecee88b [https://git.postgresql.org/pg/commitdiff/c285babf8f44d86b7fd1e73e9e4f94456b825bfb](https://git.postgresql.org/pg/commitdiff/c285babf8f44d86b7fd1e73e9e4f94456b825bfb) - Prevent lwlock dtrace probes from unnecessary work. If dtrace is compiled in but disabled, the lwlock dtrace probes still evaluate their arguments. Since PostgreSQL 13, T_NAME(lock) does nontrivial work, so it should be avoided if not needed. To fix, make these calls conditional on the `*_ENABLED()` macro corresponding to each probe. Reviewed-by: Craig Ringer <[email protected]> Discussion: [https://www.postgresql.org/message-id/cagry4nwxkus_rvxfw-ugrzbyxpffm5kjwkt5o+0+stuga5b...@mail.gmail.com](https://www.postgresql.org/message-id/cagry4nwxkus_rvxfw-ugrzbyxpffm5kjwkt5o+0+stuga5b...@mail.gmail.com) [https://git.postgresql.org/pg/commitdiff/b94409a02f6122d77b5154e481c0819fed6b4c95](https://git.postgresql.org/pg/commitdiff/b94409a02f6122d77b5154e481c0819fed6b4c95) - doc: Add index entry for "multirange type". Before now, looking up "multirange" in the index only led to the multirange() function. To make this more useful, also add an entry pointing to the range types section. [https://git.postgresql.org/pg/commitdiff/5df6aeab42279eaea8e9ff92744645b155c85b03](https://git.postgresql.org/pg/commitdiff/5df6aeab42279eaea8e9ff92744645b155c85b03) - Fix ALTER TABLE / INHERIT with generated columns. When running ALTER TABLE t2 INHERIT t1, we must check that columns in t2 that correspond to a generated column in t1 are also generated and have the same generation expression. Otherwise, this would allow creating setups that a normal CREATE TABLE sequence would not allow. Discussion: [https://www.postgresql.org/message-id/[email protected]](https://www.postgresql.org/message-id/[email protected]) [https://git.postgresql.org/pg/commitdiff/a970edbed306354b0079bdcdc2fc74312122ad89](https://git.postgresql.org/pg/commitdiff/a970edbed306354b0079bdcdc2fc74312122ad89) - pg_dump: Fix dump of generated columns in partitions. The previous fix for dumping of inherited generated columns (0bf83648a52df96f7c8677edbbdf141bfa0cf32b) must not be applied to partitions, since, unlike normal inherited tables, they are always dumped separately and reattached. Reported-by: Santosh Udupi <[email protected]> Discussion: [https://www.postgresql.org/message-id/flat/CACLRvHZ4a-%2BSM_159%2BtcrHdEqxFrG%3DW4gwTRnwf7Oj0UNj5R2A%40mail.gmail.com](https://www.postgresql.org/message-id/flat/CACLRvHZ4a-%2BSM_159%2BtcrHdEqxFrG%3DW4gwTRnwf7Oj0UNj5R2A%40mail.gmail.com) [https://git.postgresql.org/pg/commitdiff/feb270d1005f3d7b3705dec9e04c9a205750ea97](https://git.postgresql.org/pg/commitdiff/feb270d1005f3d7b3705dec9e04c9a205750ea97) - doc: Fix typos. [https://git.postgresql.org/pg/commitdiff/c98a6d7887ea6588b4e9797903182312a2b46f67](https://git.postgresql.org/pg/commitdiff/c98a6d7887ea6588b4e9797903182312a2b46f67) - GUC description improvements for clarity. [https://git.postgresql.org/pg/commitdiff/38f36aad8c55c8f91e3fb8720fae1847c8fa0552](https://git.postgresql.org/pg/commitdiff/38f36aad8c55c8f91e3fb8720fae1847c8fa0552) - Fix typo. [https://git.postgresql.org/pg/commitdiff/9f989a8581cc37879d493a5a78b0f01ec0e3245a](https://git.postgresql.org/pg/commitdiff/9f989a8581cc37879d493a5a78b0f01ec0e3245a) Tom Lane pushed: - Fix performance issue in new regex match-all detection code. Commit 824bf7190 introduced a new search of the NFAs generated by regex compilation. I failed to think hard about the performance characteristics of that search, with the predictable outcome that it's bad: weird regexes can trigger exponential search time. Worse, there's no check-for-interrupt in that code, so you can't even cancel the query if this happens. Fix by introducing memo-ization of the search results, so that any one NFA state need be examined in detail just once. This potentially uses a lot of memory, but we can bound the memory usage by putting a limit on the number of states for which we'll try to prove match-all-ness. That is sane because we already have a limit (DUPINF) on the maximum finite string length that a matchall regex can match; and patterns that involve much more than DUPINF states would probably exceed that limit anyway. Also, rearrange the logic so that we check the basic is-the-graph- all-RAINBOW-arcs property before we start the recursive search to determine path lengths. This will ensure that we fall out quickly whenever the NFA couldn't possibly be matchall. Also stick in a check-for-interrupt, just in case these measures don't completely eliminate the risk of slowness. Discussion: [https://postgr.es/m/[email protected]](https://postgr.es/m/[email protected]) [https://git.postgresql.org/pg/commitdiff/f68970e33f4dc48094c24c78c452ad730ae9ae12](https://git.postgresql.org/pg/commitdiff/f68970e33f4dc48094c24c78c452ad730ae9ae12) - Disable cache clobber to avoid breaking postgres_fdw termination test. Commit 93f414614 improved a pre-existing test case so that it would show whether or not termination of the "remote" worker process happened. This soon exposed that, when debug_invalidate_system_caches_always (nee CLOBBER_CACHE_ALWAYS) is enabled, no such termination occurs. That's because cache invalidation forces postgres_fdw connections to be dropped at end of transaction, so that there's no worker to terminate. There's a race condition as to whether the worker will manage to get out of the BackendStatusArray before we look, but at least on buildfarm member hyrax, it's failed twice in two attempts. Rather than re-lobotomizing the test, let's fix this by transiently disabling debug_invalidate_system_caches_always. (Hooray for that being just a GUC nowadays, rather than a compile-time option.) If this proves not to be enough to make the test stable, we can do the other thing instead. Discussion: [https://postgr.es/m/[email protected]](https://postgr.es/m/[email protected]) [https://git.postgresql.org/pg/commitdiff/1273a15bf91fa322915e32d3b6dc6ec916397268](https://git.postgresql.org/pg/commitdiff/1273a15bf91fa322915e32d3b6dc6ec916397268) - Doc: improve and centralize the documentation for OID alias types. Previously, a lot of information about type regclass existed only in the discussion of the sequence functions. Maybe that made sense in the beginning, because I think originally those were the only functions taking regclass. But it doesn't make sense anymore. Move that material to the "Object Identifier Types" section in datatype.sgml, generalize it to talk about the other `reg*` types as well, and add more examples. Per bug #16991 from Federico Caselli. Discussion: [https://postgr.es/m/[email protected]](https://postgr.es/m/[email protected]) [https://git.postgresql.org/pg/commitdiff/f33a178a34809a2bae7a5f4c00984d87771f4204](https://git.postgresql.org/pg/commitdiff/f33a178a34809a2bae7a5f4c00984d87771f4204) - Doc: update RELEASE_CHANGES checklist. Update checklist to reflect current practice: The platform-specific FAQ files are long gone. We've never routinely updated the libbind code we borrowed, either, and there seems no reason to start now. Explain current practice of running pgindent twice per cycle. Discussion: [https://postgr.es/m/[email protected]](https://postgr.es/m/[email protected]) [https://git.postgresql.org/pg/commitdiff/e8ce68b0b9ae2757c6153a88bf869904d2d5ac0b](https://git.postgresql.org/pg/commitdiff/e8ce68b0b9ae2757c6153a88bf869904d2d5ac0b) - Doc: trivial wording adjustment. Improve self-referential foreign key example, per suggestion from David Johnston. Discussion: [https://postgr.es/m/cakfquwztke7+hun4yugqu2+gapi4cy18txmrg_z5nadkxfp...@mail.gmail.com](https://postgr.es/m/cakfquwztke7+hun4yugqu2+gapi4cy18txmrg_z5nadkxfp...@mail.gmail.com) [https://git.postgresql.org/pg/commitdiff/c38cadc0907a8d071b043b2b32b83efa09db38ea](https://git.postgresql.org/pg/commitdiff/c38cadc0907a8d071b043b2b32b83efa09db38ea) - Doc: copy-editing for debug_invalidate_system_caches_always description. I came to fix "useful only useful", but the more I looked at the text the more things I thought could be improved. [https://git.postgresql.org/pg/commitdiff/f9b809e7fbe36cd3fe1ce33edb277288a31da386](https://git.postgresql.org/pg/commitdiff/f9b809e7fbe36cd3fe1ce33edb277288a31da386) - Sync guc.c and postgresql.conf.sample with the SGML docs. It seems that various people have moved GUCs around in the config.sgml listing without bothering to make the code agree. Ensure that the config_group codes assigned to GUCs match where they are listed in config.sgml. Likewise ensure that postgresql.conf.sample lists GUCs in the same sub-section and same ordering as they appear in config.sgml. (I've got some doubts about some of these choices, but for the purposes of this patch, we'll treat config.sgml as gospel.) Notably, this requires adding a WAL_RECOVERY config_group value, because 1d257577e didn't. As long as we're renumbering that enum anyway, let's take out the values corresponding to major groups that are divided into sub-groups. No GUC should be assigned to the major group itself, so those values just create a temptation to do the wrong thing, while adding work for translators. In passing, adjust the short_desc strings for PRESET_OPTIONS GUCs to uniformly use the phrasing "Shows XYZ.", removing the impression some of these strings left that you can set the value. While some of these errors are old, no back-patch, as changing the contents of the pg_settings view in stable branches seems more likely to be seen as a compatibility break than anything helpful. Bharath Rupireddy, Justin Pryzby, Tom Lane Discussion: [https://postgr.es/m/[email protected]](https://postgr.es/m/[email protected]) Discussion: [https://postgr.es/m/[email protected]](https://postgr.es/m/[email protected]) [https://git.postgresql.org/pg/commitdiff/a55a98477b690dedb9b4368d7e5710c8e7fa534e](https://git.postgresql.org/pg/commitdiff/a55a98477b690dedb9b4368d7e5710c8e7fa534e) Robert Haas pushed: - amcheck: Improve some confusing reports about TOAST problems. Don't phrase reports in terms of the number of tuples thus-far returned by the index scan, but rather in terms of the chunk_seq values found inside the tuples. Patch by me, reviewed by Mark Dilger. Discussion: [http://postgr.es/m/ca+tgmozuonckdcdr778ekue+f1r5obieu63db2ogmphaeve...@mail.gmail.com](http://postgr.es/m/ca+tgmozuonckdcdr778ekue+f1r5obieu63db2ogmphaeve...@mail.gmail.com) [https://git.postgresql.org/pg/commitdiff/50529e5b4e39ad80a637ba0905277f9691eb4a15](https://git.postgresql.org/pg/commitdiff/50529e5b4e39ad80a637ba0905277f9691eb4a15) - docs: Clarify how ALTER TABLE .. SET COMPRESSION works. Justin Pryzby, per a complaint from Michael Paquier. Reviewed by Dilip Kumar and by me. Discussion: [http://postgr.es/m/[email protected]](http://postgr.es/m/[email protected]) [https://git.postgresql.org/pg/commitdiff/2d0f662402635d591cac9f1daae5e81e7c4374fc](https://git.postgresql.org/pg/commitdiff/2d0f662402635d591cac9f1daae5e81e7c4374fc) - Additional doc fixes for configurable TOAST compression. The grammar changes in commit bbe0a81db69bd10bd166907c3701492a29aca294 allow SET COMPRESSION to be used with ALTER MATERIALIZED VIEW as well as with ALTER TABLE, so update those docs to say that it works. Also, update the documentation for the pg_column_compression() to explain that it will return NULL when there's no relevant value. Patch by me, per concerns from Michael Paquier. Discussion: [http://postgr.es/m/ca+tgmob9h5u4inl9km0drzgky-jl4ocvw0dwrmqtlpq1zhk...@mail.gmail.com](http://postgr.es/m/ca+tgmob9h5u4inl9km0drzgky-jl4ocvw0dwrmqtlpq1zhk...@mail.gmail.com) [https://git.postgresql.org/pg/commitdiff/448b02c00515ba9d6683a8a97fe4305604d80028](https://git.postgresql.org/pg/commitdiff/448b02c00515ba9d6683a8a97fe4305604d80028) Bruce Momjian pushed: - Update query_id computation. Properly fix: - the "ONLY" in FROM [ONLY] isn't hashed - the agglevelsup field in GROUPING isn't hashed - WITH TIES not being hashed (new in PG 13) - "DISTINCT" in "GROUP BY [DISTINCT]" isn't hashed (new in PG 14) Reported-by: Julien Rouhaud Discussion: [https://postgr.es/m/20210425081119.ulyzxqz23ueh3wuj@nol](https://postgr.es/m/20210425081119.ulyzxqz23ueh3wuj@nol) [https://git.postgresql.org/pg/commitdiff/f7a97b6ec31f3f57a6154d0039c4de81ad517064](https://git.postgresql.org/pg/commitdiff/f7a97b6ec31f3f57a6154d0039c4de81ad517064) Álvaro Herrera pushed: - Fix OID passed to object-alter hook during ALTER CONSTRAINT. The OID of the constraint is used instead of the OID of the trigger -- an easy mistake to make. Apparently the object-alter hooks are not very well tested :-( Backpatch to 12, where this typo was introduced by 578b229718e8 Discussion: [https://postgr.es/m/[email protected]](https://postgr.es/m/[email protected]) [https://git.postgresql.org/pg/commitdiff/e798d095da3a4a4bb5c50bb3dff886f07ef52f55](https://git.postgresql.org/pg/commitdiff/e798d095da3a4a4bb5c50bb3dff886f07ef52f55) - Have ALTER CONSTRAINT recurse on partitioned tables. When ALTER TABLE .. ALTER CONSTRAINT changes deferrability properties changed in a partitioned table, we failed to propagate those changes correctly to partitions and to triggers. Repair by adding a recursion mechanism to affect all derived constraints and all derived triggers. (In particular, recurse to partitions even if their respective parents are already in the desired state: it is possible for the partitions to have been altered individually.) Because foreign keys involve tables in two sides, we cannot use the standard ALTER TABLE recursion mechanism, so we invent our own by following pg_constraint.conparentid down. When ALTER TABLE .. ALTER CONSTRAINT is invoked on the derived pg_constraint object that's automaticaly created in a partition as a result of a constraint added to its parent, raise an error instead of pretending to work and then failing to modify all the affected triggers. Before this commit such a command would be allowed but failed to affect all triggers, so it would silently misbehave. (Restoring dumps of existing databases is not affected, because pg_dump does not produce anything for such a derived constraint anyway.) Add some tests for the case. Backpatch to 11, where foreign key support was added to partitioned tables by commit 3de241dba86f. (A related change is commit f56f8f8da6af in pg12 which added support for FKs `*referencing*` partitioned tables; this is what forces us to use an ad-hoc recursion mechanism for this.) Diagnosed by Tom Lane from bug report from Ron L Johnson. As of this writing, no reviews were offered. Discussion: [https://postgr.es/m/[email protected]](https://postgr.es/m/[email protected]) Discussion: [https://postgr.es/m/[email protected]](https://postgr.es/m/[email protected]) [https://git.postgresql.org/pg/commitdiff/6f70d7ca1d1937a9f7b79eff6fb18ed1bb2a4c47](https://git.postgresql.org/pg/commitdiff/6f70d7ca1d1937a9f7b79eff6fb18ed1bb2a4c47) - Remove unused argument of ATAddForeignConstraint. Commit 0325d7a5957b made this unused but forgot to remove it. Do so now. Author: Amit Langote <[email protected]> Discussion: [https://postgr.es/m/[email protected]](https://postgr.es/m/[email protected]) [https://git.postgresql.org/pg/commitdiff/c250062df42ffd3e252471f6205bfb6cbef67b7b](https://git.postgresql.org/pg/commitdiff/c250062df42ffd3e252471f6205bfb6cbef67b7b) - Track detached partitions more accurately in partdescs. In d6b8d29419df I (Álvaro) was sloppy about recording whether a partition descripor does or does not include detached partitions, when the snapshot checking does not see the pg_inherits row marked detached. In that case no partition was omitted, yet in the relcache entry we were saving the partdesc as omitting partitions. Flip that (so we save it as a partdesc not omitting partitions, which indeed it doesn't), which hopefully makes the code easier to reason about. Author: Amit Langote <[email protected]> Discussion: [https://postgr.es/m/ca+hiwqe7gxgu4vdzwzzfiz+ont5ssopofkgtrzgedpqwrl+...@mail.gmail.com](https://postgr.es/m/ca+hiwqe7gxgu4vdzwzzfiz+ont5ssopofkgtrzgedpqwrl+...@mail.gmail.com) [https://git.postgresql.org/pg/commitdiff/3fe773b149755977d2ffde2afd89557b39d0afd9](https://git.postgresql.org/pg/commitdiff/3fe773b149755977d2ffde2afd89557b39d0afd9) - Improve documentation on DETACH PARTITION lock levels. This was forgotten in 71f4c8c6f74b. Reported-by: Pavel Luzanov <[email protected]> Author: Amit Langote <[email protected]> Discussion: [https://postgr.es/m/[email protected]](https://postgr.es/m/[email protected]) [https://git.postgresql.org/pg/commitdiff/db6e1aeb952e9aed26ba2a56b4145293c72b8068](https://git.postgresql.org/pg/commitdiff/db6e1aeb952e9aed26ba2a56b4145293c72b8068) - Document lock level used by ALTER TABLE VALIDATE CONSTRAINT. Backpatch all the way back to 9.6. Author: Simon Riggs <[email protected]> Discussion: [https://postgr.es/m/CANbhV-EwxvdhHuOLdfG2ciYrHOHXV=mm6=fd5amhqch09li...@mail.gmail.com](https://postgr.es/m/CANbhV-EwxvdhHuOLdfG2ciYrHOHXV=mm6=fd5amhqch09li...@mail.gmail.com) [https://git.postgresql.org/pg/commitdiff/469116389e18dbf6be0bd555bc2055a26be91a48](https://git.postgresql.org/pg/commitdiff/469116389e18dbf6be0bd555bc2055a26be91a48) - Remove redundant variable. Author: Amul Sul <[email protected]> Reviewed-by: Jeevan Ladhe <[email protected]> Reviewed-by: Bharath Rupireddy <[email protected]> Reviewed-by: Justin Pryzby <[email protected]> Discussion: [https://postgr.es/m/caaj_b94hancrpvreuub9-qun2ub+gfcox3fg_vx0s6afse+...@mail.gmail.com](https://postgr.es/m/caaj_b94hancrpvreuub9-qun2ub+gfcox3fg_vx0s6afse+...@mail.gmail.com) [https://git.postgresql.org/pg/commitdiff/a288d94c91e345ebeb10ac30f247270c8c8e380a](https://git.postgresql.org/pg/commitdiff/a288d94c91e345ebeb10ac30f247270c8c8e380a) - AlterSubscription_refresh: avoid stomping on global variable. This patch replaces use of the global "wrconn" variable in AlterSubscription_refresh with a local variable of the same name, making it consistent with other functions in subscriptioncmds.c (e.g. DropSubscription). The global wrconn is only meant to be used for logical apply/tablesync worker. Abusing it this way is known to cause trouble if an apply worker manages to do a subscription refresh, such as reported by Jeremy Finzel and diagnosed by Andres Freund back in November 2020, at [https://www.postgresql.org/message-id/[email protected]](https://www.postgresql.org/message-id/[email protected]) Backpatch to 10. In branch master, also move the connection establishment to occur outside the PG_TRY block; this way we can remove a test for NULL in PG_FINALLY, and it also makes the code more consistent with similar code in the same file. Author: Peter Smith <[email protected]> Reviewed-by: Bharath Rupireddy <[email protected]> Reviewed-by: Japin Li <[email protected]> Discussion: [https://postgr.es/m/cahut+pu7jv9l2boex_z0utjxfdevqsauw2mjqwu+ctmdrez...@mail.gmail.com](https://postgr.es/m/cahut+pu7jv9l2boex_z0utjxfdevqsauw2mjqwu+ctmdrez...@mail.gmail.com) [https://git.postgresql.org/pg/commitdiff/4e8c0f1a0d0d095a749a329a216c88a340a455b6](https://git.postgresql.org/pg/commitdiff/4e8c0f1a0d0d095a749a329a216c88a340a455b6) Andres Freund pushed: - jit: Fix warning reported by gcc-11 caused by dubious function signature. Reported-By: Erik Rijkers <[email protected]> Discussion: [https://postgr.es/m/[email protected]](https://postgr.es/m/[email protected]) Backpatch: 13, where b059d2f45685 introduced the issue. [https://git.postgresql.org/pg/commitdiff/7f2e10baa2482494dbcf70e0ae6f0469771e0b4c](https://git.postgresql.org/pg/commitdiff/7f2e10baa2482494dbcf70e0ae6f0469771e0b4c) Peter Geoghegan pushed: - Remove overzealous VACUUM visibility map assertion. The all_visible_according_to_vm variable's value is inherently prone to becoming invalidated concurrently, since it is set before we even acquire a lock on a related heap page buffer. Oversight in commit 7136bf34, which added the assertion in passing. Author: Masahiko Sawada <[email protected]> Reported-By: Tang <[email protected]> Diagnosed-By:: Masahiko Sawada <[email protected]> Discussion: [https://postgr.es/m/cad21aodzgc8_myra5m1fyydomw_evktqiyh7sfdk4kehdms...@mail.gmail.com](https://postgr.es/m/cad21aodzgc8_myra5m1fyydomw_evktqiyh7sfdk4kehdms...@mail.gmail.com) [https://git.postgresql.org/pg/commitdiff/c9787385db47ba423d845b34d58e158551c6335d](https://git.postgresql.org/pg/commitdiff/c9787385db47ba423d845b34d58e158551c6335d) Thomas Munro pushed: - Revert per-index collation version tracking feature. Design problems were discovered in the handling of composite types and record types that would cause some relevant versions not to be recorded. Misgivings were also expressed about the use of the pg_depend catalog for this purpose. We're out of time for this release so we'll revert and try again. Commits reverted: 1bf946bd: Doc: Document known problem with Windows collation versions. cf002008: Remove no-longer-relevant test case. ef387bed: Fix bogus collation-version-recording logic. 0fb0a050: Hide internal error for pg_collation_actual_version(<bad OID>). ff942057: Suppress "warning: variable 'collcollate' set but not used". d50e3b1f: Fix assertion in collation version lookup. f24b1569: Rethink extraction of collation dependencies. 257836a7: Track collation versions for indexes. cd6f479e: Add pg_depend.refobjversion. 7d1297df: Remove pg_collation.collversion. Discussion: [https://postgr.es/m/CA%2BhUKGLhj5t1fcjqAu8iD9B3ixJtsTNqyCCD4V0aTO9kAKAjjA%40mail.gmail.com](https://postgr.es/m/CA%2BhUKGLhj5t1fcjqAu8iD9B3ixJtsTNqyCCD4V0aTO9kAKAjjA%40mail.gmail.com) [https://git.postgresql.org/pg/commitdiff/ec48314708262d8ea6cdcb83f803fc83dd89e721](https://git.postgresql.org/pg/commitdiff/ec48314708262d8ea6cdcb83f803fc83dd89e721) - Doc: Update notes about libc collation versions. The per-index collation version tracking feature was reverted, but we still have the ability to ask Windows (352f6f2d) and FreeBSD (ca051d8b) for collation versions to store in pg_collation.collversion. So, from the reverted patch, take a few words of documentation about libc on all three supported OSes to replace the pre-existing note that mentioned only glibc. Discussion: [https://postgr.es/m/CA%2BhUKGLhj5t1fcjqAu8iD9B3ixJtsTNqyCCD4V0aTO9kAKAjjA%40mail.gmail.com](https://postgr.es/m/CA%2BhUKGLhj5t1fcjqAu8iD9B3ixJtsTNqyCCD4V0aTO9kAKAjjA%40mail.gmail.com) [https://git.postgresql.org/pg/commitdiff/b65431ca5e12a475ba7cf68afb63edb070c2ce08](https://git.postgresql.org/pg/commitdiff/b65431ca5e12a475ba7cf68afb63edb070c2ce08) Tomáš Vondra pushed: - Make pg_get_statisticsobjdef_expressions return NULL. The usual behavior for functions in ruleutils.c is to return NULL when the object does not exist. pg_get_statisticsobjdef_expressions raised an error instead, so correct that. Reported-by: Justin Pryzby Discussion: [https://postgr.es/m/20210505210947.GA27406%40telsasoft.com](https://postgr.es/m/20210505210947.GA27406%40telsasoft.com) [https://git.postgresql.org/pg/commitdiff/8d4b311d2494ca592e30aed03b29854d864eb846](https://git.postgresql.org/pg/commitdiff/8d4b311d2494ca592e30aed03b29854d864eb846) - Fix typos in comments about extended statistics. Reported-by: Justin Pryzby Discussion: [https://postgr.es/m/20210505210947.GA27406%40telsasoft.com](https://postgr.es/m/20210505210947.GA27406%40telsasoft.com) [https://git.postgresql.org/pg/commitdiff/93f9af138795a7d12366187de95f4961fb07ed98](https://git.postgresql.org/pg/commitdiff/93f9af138795a7d12366187de95f4961fb07ed98) - Mention statistics objects in maintenance.sgml. The docs mentioned expression indexes as a way to improve selectivity estimates for functions, but we have a second option to improve that by creating extended statistics. So mention that too. Reported-by: Justin Pryzby Discussion: [https://postgr.es/m/20210505210947.GA27406%40telsasoft.com](https://postgr.es/m/20210505210947.GA27406%40telsasoft.com) [https://git.postgresql.org/pg/commitdiff/44f90ad092f95fe19bebb51465193bc63849c15f](https://git.postgresql.org/pg/commitdiff/44f90ad092f95fe19bebb51465193bc63849c15f) - Copy the INSERT query in postgres_fdw. When executing the INSERT with batching, we may need to rebuild the query when the batch size changes, in which case we pfree the current string. We must not release the original string, stored in fdw_private, because that may be needed in EXPLAIN ANALYZE. So make copy of the SQL, but only for INSERT queries. Reported-by: Pavel Stehule Discussion: [https://postgr.es/m/CAFj8pRCL_Rjw-MCR6J7VX9OF7MR6PA5K8qUbrMvprW_e-aHkfQ%40mail.gmail.com](https://postgr.es/m/CAFj8pRCL_Rjw-MCR6J7VX9OF7MR6PA5K8qUbrMvprW_e-aHkfQ%40mail.gmail.com) [https://git.postgresql.org/pg/commitdiff/c6a01d924939306e95c8deafd09352be6a955648](https://git.postgresql.org/pg/commitdiff/c6a01d924939306e95c8deafd09352be6a955648) Andrew Dunstan pushed: - Add a copyright notice to perl files lacking one. [https://git.postgresql.org/pg/commitdiff/8fa6e6919c1aaa6f74c74e16452aaf0b5f3b4cd5](https://git.postgresql.org/pg/commitdiff/8fa6e6919c1aaa6f74c74e16452aaf0b5f3b4cd5) - Remove extraneous newlines added by perl copyright patch. [https://git.postgresql.org/pg/commitdiff/8b82de0164c13eb3b113a525dc7eda7887f5238b](https://git.postgresql.org/pg/commitdiff/8b82de0164c13eb3b113a525dc7eda7887f5238b) - Add a README and Makefile recipe for Gen_dummy_probes.pl. Discussion: [https://postgr.es/m/[email protected]](https://postgr.es/m/[email protected]) [https://git.postgresql.org/pg/commitdiff/8292c0675a793a5afd0a8eedbeb0db7abfb844f3](https://git.postgresql.org/pg/commitdiff/8292c0675a793a5afd0a8eedbeb0db7abfb844f3) Michaël Paquier pushed: - Fix incorrect error code for CREATE/ALTER TABLE COMPRESSION. Specifying an incorrect value for the compression method of an attribute caused ERRCODE_FEATURE_NOT_SUPPORTED to be raised as error. Use instead ERRCODE_INVALID_PARAMETER_VALUE to be more consistent. Author: Dilip Kumar Discussion: [https://postgr.es/m/CAFiTN-vH84fE-8C4zGZw4v0Wyh4Y2v=5jwg2fge5+lpadvz...@mail.gmail.com](https://postgr.es/m/CAFiTN-vH84fE-8C4zGZw4v0Wyh4Y2v=5jwg2fge5+lpadvz...@mail.gmail.com) [https://git.postgresql.org/pg/commitdiff/9681f2160dcbe2a02fd2e2db2322ea204eff6562](https://git.postgresql.org/pg/commitdiff/9681f2160dcbe2a02fd2e2db2322ea204eff6562) David Rowley pushed: - Move memory accounting Asserts for Result Cache code. In 9eacee2e6, I included some code to verify the cache's memory tracking is correct by counting up the number of entries and the memory they use each time we evict something from the cache. Those values are then compared to the expected values using Assert. The problem is that this requires looping over the entire cache hash table each time we evict an entry from the cache. That can be pretty expensive, as noted by Pavel Stehule. Here we move this memory accounting checking code so that we only verify it on cassert builds once when shutting down the Result Cache node. Aside from the performance increase, this has two distinct advantages: 1) We do the memory checks at the last possible moment before destroying the cache. This means we'll now catch accounting problems that might sneak in after a cache eviction. 2) We now do the memory Assert checks when there were no cache evictions. This increases the coverage. One small disadvantage is that we'll now miss any memory tracking issues that somehow managed to resolve themselves by the end of execution. However, it seems to me that such a memory tracking problem would be quite unlikely, and likely somewhat less harmful if one were to exist. In passing, adjust the loop over the hash table to use the standard simplehash.h method of iteration. Reported-by: Pavel Stehule Discussion: [https://postgr.es/m/CAFj8pRAzgoSkdEiqrKbT=7yg9fa5fjuap3jmjywudqyq6ki...@mail.gmail.com](https://postgr.es/m/CAFj8pRAzgoSkdEiqrKbT=7yg9fa5fjuap3jmjywudqyq6ki...@mail.gmail.com) [https://git.postgresql.org/pg/commitdiff/92c4c269d24d016c19858a21347ff25a7de1f486](https://git.postgresql.org/pg/commitdiff/92c4c269d24d016c19858a21347ff25a7de1f486) # Pending Patches Aleksander Alekseev sent in another revision of a patch to allow CustomScan nodes to signal projection support. Melanie Plageman sent in another revision of a patch to avoid an immediate fsync for just-built indexes. Dilip Kumar sent in two revisions of a patch to add TOAST compression method options. Vigneshwaran C sent in four more revisions of a patch to identify missing publications from publisher during CREATE/ALTER SUBSCRIPTION. Bertrand Drouvot sent in a patch to intended to fix a bug that manifested as pg_upgrade can result in early wraparound on databases with high transaction load by exactly copying the oldestXid limit from the source database. Bertrand Drouvot sent in a patch to intended to fix a bug that manifested as orphaned dependencies by adding a new catalog snapshot is DirtyCatalogSnapshot controlled by a new UseDirtyCatalogSnapshot variable, and using it to check for in-flight dependencies and get the objects' description to generate the error messages. Thomas Munro sent in another revision of a patch to add a new TAP test under src/test/recovery to run the standard regression tests with a streaming replica replaying the WAL. This provides a basic workout for WAL decoding and redo code. Mark Dilger sent in two revisions of a patch to extend amcheck to check TOAST size and compression. Jeff Davis sent in a patch to bound ItemPointers in table AMs in a way that other parts of the system expect. Dilip Kumar and Kyotaro HORIGUCHI traded patches to intended to fix a bug that manifested as a race condition in recovery. Craig Ringer sent in another revision of a patch to make Valgrind runs simpler with make USE_VALGRIND=1. David Fetter sent in a patch to clarify some column descriptions in pg_constraint. Vigneshwaran C sent in two more revisions of a patch to print the backtrace of a specified postgres process. Craig Ringer sent in a patch to emit dummy statements for probes.d probes when disabled. Jeff Davis sent in another revision of a patch to implement ALTER TABLE ... SET ACCESS METHOD. Amit Langote sent in a patch to clarify the documentation of ALTER TABLE ... DETACH PARTITION CONCURRENTLY. Etsuro Fujita sent in a patch to fix EXPLAIN ANALYZE for async capable nodes. Etsuro Fujita sent in a patch to describe the way asynchronous execution works for FDWs. Nitin Jadhav sent in a patch to implement list partitioning for multiple columns. Yugo Nagata sent in another revision of a patch to implement incremental view maintenance. Konstantin Knizhnik sent in another revision of a patch to remove unneeded self-joins. Andrey Borodin sent in another revision of a patch to speed up GiST index builds. Etsuro Fujita sent in a patch to fix an infelicity between inherited UPDATE/DELETE and async execution by modifying postgresPlanDirectModify() so that it clears the async-capable flag if it is set. James Coleman sent in a patch to parallelize correlated subqueries that execute within each worker. Jeff Janes sent in a patch to add configure cache checkpoints before fatal checks. Hou Zhijie sent in another revision of a patch to fix EXPLAIN's information about FDW batch inserts. Erik Rijkers and Alexander Korotkov traded patches to improve the example in JSON path queries to highlight what's actually happening. Bruce Momjian sent in another revision of a patch to fix a misbehavior in interval arithmetic. Hou Zhijie sent in a patch to fix a bug where there was an inaccurate error message when fdw batch_size was set to 0. David Rowley sent in another revision of a patch to speed up NOT IN() with a set of Consts. Andrew Dunstan sent in another revision of a patch to implement the JSON_TABLE part of SQL/JSON. Andrew Dunstan sent in another revision of a patch to implement the functions from SQL/JSON. Tom Lane sent in a patch to make a binary-coercible C function in order to reduce opr_sanity test's runtime under CLOBBER_CACHE_ALWAYS. David Rowley sent in a patch to only validate resultcache memory on plan shutdown. Vigneshwaran C sent in a patch to correct the data type for the logical replication message formats.
