5bb8896 | Alvaro Herrera | 09 September 2022, 11:51:45 UTC | Doc fixes for MERGE statement In commit 3d895bc846f2 I introduced a bogus semicolon mid-statement by careless cut-n-paste; move it. This had already been reported by Justin Pryzby. Also, change the styling a bit by avoiding names in CamelCase. This is more consistent with the style we use elsewhere. Backpatch to 15. Author: Vitaly Burovoy <vitaly.burovoy@gmail.com> Reviewed-by: Vik Fearing <vik@postgresfriends.org> Discussion: https://postgr.es/m/9afe5766-5a61-7860-598c-136867fad065@gmail.com Discussion: https://postgr.es/m/20220819133016.GV26426@telsasoft.com | 09 September 2022, 11:51:45 UTC |
68b0da6 | Alvaro Herrera | 09 September 2022, 10:22:20 UTC | Fix GetForeignKey*Triggers for self-referential FKs Because of inadequate filtering, the check triggers were confusing the search for action triggers in GetForeignKeyActionTriggers and vice-versa in GetForeignKeyCheckTriggers; this confusion results in seemingly random assertion failures, and can have real impact in non-asserting builds depending on catalog order. Change these functions so that they correctly ignore triggers that are not relevant to each side. To reduce the odds of further problems, do not break out of the searching loop in assertion builds. This break is likely to hide bugs; without it, we would have detected this bug immediately. This problem was introduced by f4566345cf40, so backpatch to 15 where that commit first appeared. Author: Amit Langote <amitlangote09@gmail.com> Discussion: https://postgr.es/m/20220908172029.sejft2ppckbo6oh5@awork3.anarazel.de Discussion: https://postgr.es/m/4104619.1662663056@sss.pgh.pa.us | 09 September 2022, 10:22:20 UTC |
0a7c9ee | Michael Paquier | 09 September 2022, 01:01:14 UTC | Add more error context to RestoreBlockImage() and consume it On failure in restoring a block image, no details were provided, while it is possible to see failure with an inconsistent record state, a failure in processing decompression or a failure in decompression because a build does not support this option. RestoreBlockImage() is used in two code paths in the backend code, during recovery and when checking a page consistency after applying masking, and both places are changed to consume the error message produced by the internal routine when it returns a false status. All the error messages are reported under ERRCODE_INTERNAL_ERROR, that gets used also when attempting to access a page compressed by a method not supported by the build attempting the decompression. This is something that can happen in core when doing physical replication with primary and standby using inconsistent build options, for example. This routine is available since 2c03216d and it has never provided any context about the error happening when it failed. This change is justified even more after 57aa5b2, that introduced compression of FPWs in WAL. Reported-by: Justin Prysby Author: Michael Paquier Discussion: https://postgr.es/m/20220905002320.GD31833@telsasoft.com Backpatch-through: 15 | 09 September 2022, 01:01:14 UTC |
ade2409 | Alvaro Herrera | 08 September 2022, 11:17:02 UTC | Choose FK name correctly during partition attachment During ALTER TABLE ATTACH PARTITION, if the name of a parent's foreign key constraint is already used on the partition, the code tries to choose another one before the FK attributes list has been populated, so the resulting constraint name was "<relname>__fkey" instead of "<relname>_<attrs>_fkey". Repair, and add a test case. Backpatch to 12. In 11, the code to attach a partition was not smart enough to cope with conflicting constraint names, so the problem doesn't exist there. Author: Jehan-Guillaume de Rorthais <jgdr@dalibo.com> Discussion: https://postgr.es/m/20220901184156.738ebee5@karst | 08 September 2022, 11:17:02 UTC |
dd38ff2 | Thomas Munro | 08 September 2022, 08:25:20 UTC | Fix recovery_prefetch with low maintenance_io_concurrency. We should process completed IOs *before* trying to start more, so that it is always possible to decode one more record when the decoded record queue is empty, even if maintenance_io_concurrency is set so low that a single earlier WAL record might have saturated the IO queue. That bug was hidden because the effect of maintenance_io_concurrency was arbitrarily clamped to be at least 2. Fix the ordering, and also remove that clamp. We need a special case for 0, which is now treated the same as recovery_prefetch=off, but otherwise the number is used directly. This allows for testing with 1, which would have made the problem obvious in simple test scenarios. Also add an explicit error message for missing contrecords. It was a bit strange that we didn't report an error already, and became a latent bug with prefetching, since the internal state that tracks aborted contrecords would not survive retrying, as revealed by 026_overwrite_contrecord.pl with this adjustment. Reporting an error prevents that. Back-patch to 15. Reported-by: Justin Pryzby <pryzby@telsasoft.com> Reviewed-by: Kyotaro Horiguchi <horikyota.ntt@gmail.com> Discussion: https://postgr.es/m/20220831140128.GS31833%40telsasoft.com | 08 September 2022, 08:36:44 UTC |
144cefa | Alvaro Herrera | 07 September 2022, 15:33:49 UTC | Message style fixes | 07 September 2022, 15:33:49 UTC |
25996a8 | Amit Kapila | 07 September 2022, 03:16:32 UTC | Doc: Explain about Column List feature. Add a new logical replication section for "Column Lists" (analogous to the Row Filters page). This explains how the feature can be used and the caveats in it. Author: Peter Smith Reviewed-by: Shi yu, Vignesh C, Erik Rijkers, Amit Kapila Backpatch-through: 15, where it was introduced Discussion: https://postgr.es/m/CAHut+PvOuc9=_4TbASc5=VUqh16UWtFO3GzcKQK_5m1hrW3vqg@mail.gmail.com | 07 September 2022, 03:16:32 UTC |
e256312 | Tom Lane | 06 September 2022, 22:00:32 UTC | Fix new pg_publication_tables query. The addition of published column names forgot to filter on attisdropped, leading to cases where you could see "........pg.dropped.1........" or the like as a reportedly-published column. While we're here, rewrite the new subquery to get a more efficient plan for it. Hou Zhijie, per report from Jaime Casanova. Back-patch to v15 where the bug was introduced. (Sadly, this means we need a post-beta4 catversion bump before beta4 has even hit the streets. I see no good alternative though.) Discussion: https://postgr.es/m/Yxa1SU4nH2HfN3/i@ahch-to | 06 September 2022, 22:00:32 UTC |
6e55ea7 | Tom Lane | 05 September 2022, 21:12:45 UTC | Stamp 15beta4. | 05 September 2022, 21:12:45 UTC |
77ce482 | Peter Eisentraut | 05 September 2022, 12:37:22 UTC | Translation updates Source-Git-URL: https://git.postgresql.org/git/pgtranslation/messages.git Source-Git-Hash: f2c273bb8723eb69911a4b0b9d02ca15bbc7c60f | 05 September 2022, 12:37:22 UTC |
6ce4c4d | David Rowley | 05 September 2022, 06:43:36 UTC | Doc: clarify partitioned table limitations Improve documentation regarding the limitations of unique and primary key constraints on partitioned tables. The existing documentation didn't make it clear that the constraint columns had to be present in the partition key as bare columns. The reader could be led to believe that it was ok to include the constraint columns as part of a function call's parameters or as part of an expression. Additionally, the documentation didn't mention anything about the fact that we disallow unique and primary key constraints if the partition keys contain *any* function calls or expressions, regardless of if the constraint columns appear as columns elsewhere in the partition key. The confusion here was highlighted by a report on the general mailing list by James Vanns. Discussion: https://postgr.es/m/CAH7vdhNF0EdYZz3GLpgE3RSJLwWLhEk7A_fiKS9dPBT3Dz_3eA@mail.gmail.com Discussion: https://postgr.es/m/CAApHDvoU-u9iTqKjteYRFfi+UNEk7dbSAcyxEQD==vZt9B1KnA@mail.gmail.com Reviewed-by: Erik Rijkers Backpatch-through: 11 | 05 September 2022, 06:43:36 UTC |
46b588a | Tomas Vondra | 04 September 2022, 22:06:39 UTC | Reinstate tests accidentally removed by e3fcca0d0d Commit e3fcca0d0d24 reverted modifications to HOT for BRIN, but it also removed a couple unrelated tests from stats.sql. Reinstate those tests. Reported-by: Peter Eisentraut | 04 September 2022, 22:06:45 UTC |
01474f5 | Tomas Vondra | 04 September 2022, 21:37:42 UTC | Force parallelism in partition_aggregate Commit db0d67db2 tweaked sort costing, which however resulted in a couple plan changes in our regression tests. Most of the new plans were fine, but partition_aggregate were meant to test parallel plans and the new plans were serial. Fix that by lowering parallel_setup_cost to 0, which is enough to switch to the parallel plan again. Report and patch by David Rowley. Author: David Rowley Reviewed-by: Tomas Vondra Discussion: https://postgr.es/m/CAApHDvpVFgWzXdtUQkjyOPhNrNvumRi_=ftgS79KeAZ92tnHKQ@mail.gmail.com | 04 September 2022, 21:37:42 UTC |
4209126 | Michael Paquier | 03 September 2022, 11:57:23 UTC | doc: Fix two queries related to jsonb functions These have been updated by the revert done in 2f2b18b, but the pre-revert state was correct. Note that the result was incorrectly formatted in the first case. Author: Erik Rijkers Discussion: https://postgr.es/m/13777e96-24b6-396b-cb16-8ad01b6ac130@xs4all.nl Backpatch-through: 13 | 03 September 2022, 11:57:23 UTC |
a3e88e5 | Bruce Momjian | 03 September 2022, 03:32:19 UTC | doc: simplify docs about analyze and inheritance/partitions Discussion: https://postgr.es/m/YxAqYijOsLzgLQgy@momjian.us Backpatch-through: 10 | 03 September 2022, 03:32:19 UTC |
170704d | Bruce Momjian | 03 September 2022, 01:57:41 UTC | doc: clarify recursion internal behavior Reported-by: Drew DeVault Discussion: https://postgr.es/m/20211018091720.31299-1-sir@cmpwn.com Backpatch-through: 10 | 03 September 2022, 01:57:41 UTC |
4ddcb20 | Bruce Momjian | 03 September 2022, 01:47:30 UTC | relnotes: improve collation check and ICU items Reported-by: Matthias van de Meent Discussion: https://postgr.es/m/CAEze2WhrNAT2g8upDUhfqt1nWfV_JdUgXAQu7oT4rY2L68O-HQ@mail.gmail.com Backpatch-through: 15 only | 03 September 2022, 01:47:55 UTC |
d0d9344 | Thomas Munro | 03 September 2022, 00:58:16 UTC | Fix cache invalidation bug in recovery_prefetch. XLogPageRead() can retry internally after a pread() system call has succeeded, in the case of short reads, and page validation failures while in standby mode (see commit 0668719801). Due to an oversight in commit 3f1ce973, these cases could leave stale data in the internal cache of xlogreader.c without marking it invalid. The main defense against stale cached data on failure to read a page was in the error handling path of the calling function ReadPageInternal(), but that wasn't quite enough for errors handled internally by XLogPageRead()'s retry loop if we then exited with XLREAD_WOULDBLOCK. 1. ReadPageInternal() now marks the cache invalid before calling the page_read callback, by setting state->readLen to 0. It'll be set to a non-zero value only after a successful read. It'll stay valid as long as the caller requests data in the cached range. 2. XLogPageRead() no long performs internal retries while reading ahead. While such retries should work, the general philosophy is that we should give up prefetching if anything unusual happens so we can handle it when recovery catches up, to reduce the complexity of the system. Let's do that here too. 3. While here, a new function XLogReaderResetError() improves the separation between xlogrecovery.c and xlogreader.c, where the former previously clobbered the latter's internal error buffer directly. The new function makes this more explicit, and also clears a related flag, without which a standby would needlessly retry in the outer function. Thanks to Noah Misch for tracking down the conditions required for a rare build farm failure in src/bin/pg_ctl/t/003_promote.pl, and providing a reproducer. Back-patch to 15. Reported-by: Noah Misch <noah@leadboat.com> Discussion: https://postgr.es/m/20220807003627.GA4168930%40rfd.leadboat.com | 03 September 2022, 01:29:36 UTC |
ab31318 | Amit Kapila | 02 September 2022, 11:03:18 UTC | Doc: fix column list vs. replica identity rules. It was not strictly correct to say that a column list must always include replica identity columns because that is true for only updates and deletes. Author: Peter Smith Reviwed-by: Vignesh C, Amit Kapila Backpatch-through: 15, where it was introduced Discussion: https://postgr.es/m/CAHut+PvOuc9=_4TbASc5=VUqh16UWtFO3GzcKQK_5m1hrW3vqg@mail.gmail.com | 02 September 2022, 11:03:18 UTC |
ea4a066 | Etsuro Fujita | 02 September 2022, 07:45:01 UTC | Doc: Update struct Trigger definition. Commit 487e9861d added a new field to struct Trigger, but failed to update the documentation to match; backpatch to v13 where that came in. Reviewed by Richard Guo. Discussion: https://postgr.es/m/CAPmGK17NY92CyxJ%2BBG7A3JZurmng4jfRfzPiBTtNupGMF0xW1g%40mail.gmail.com | 02 September 2022, 07:45:01 UTC |
96ef323 | Andrew Dunstan | 01 September 2022, 21:09:46 UTC | Revert SQL/JSON features The reverts the following and makes some associated cleanups: commit f79b803dc: Common SQL/JSON clauses commit f4fb45d15: SQL/JSON constructors commit 5f0adec25: Make STRING an unreserved_keyword. commit 33a377608: IS JSON predicate commit 1a36bc9db: SQL/JSON query functions commit 606948b05: SQL JSON functions commit 49082c2cc: RETURNING clause for JSON() and JSON_SCALAR() commit 4e34747c8: JSON_TABLE commit fadb48b00: PLAN clauses for JSON_TABLE commit 2ef6f11b0: Reduce running time of jsonb_sqljson test commit 14d3f24fa: Further improve jsonb_sqljson parallel test commit a6baa4bad: Documentation for SQL/JSON features commit b46bcf7a4: Improve readability of SQL/JSON documentation. commit 112fdb352: Fix finalization for json_objectagg and friends commit fcdb35c32: Fix transformJsonBehavior commit 4cd8717af: Improve a couple of sql/json error messages commit f7a605f63: Small cleanups in SQL/JSON code commit 9c3d25e17: Fix JSON_OBJECTAGG uniquefying bug commit a79153b7a: Claim SQL standard compliance for SQL/JSON features commit a1e7616d6: Rework SQL/JSON documentation commit 8d9f9634e: Fix errors in copyfuncs/equalfuncs support for JSON node types. commit 3c633f32b: Only allow returning string types or bytea from json_serialize commit 67b26703b: expression eval: Fix EEOP_JSON_CONSTRUCTOR and EEOP_JSONEXPR size. The release notes are also adjusted. Backpatch to release 15. Discussion: https://postgr.es/m/40d2c882-bcac-19a9-754d-4299e1d87ac7@postgresql.org | 01 September 2022, 21:10:42 UTC |
c4e861b | David Rowley | 01 September 2022, 07:21:58 UTC | Fix some possibly latent bugs in slab.c Primarily, this fixes an incorrect calculation in SlabCheck which was looking in the wrong byte for the sentinel check. The reason that we've never noticed this before in the form of a failing sentinel check is because the pre-check to this always fails because all current core users of slab contexts have a chunk size which is already MAXALIGNed, therefore there's never any space for the sentinel byte. It is possible that an extension needs to use a slab context and if they do with a chunk size that's not MAXALIGNed, then they'll likely get errors about overwritten sentinel bytes. Additionally, this patch changes various calculations which are being done based on the sizeof(SlabBlock). Currently, sizeof(SlabBlock) is a multiple of 8, therefore sizeof(SlabBlock) is the same as MAXALIGN(sizeof(SlabBlock)), however, if we were to ever have to add any fields to that struct as part of a bug fix, then SlabAlloc could end up returning a non-MAXALIGNed pointer. To be safe, let's ensure we always MAXALIGN sizeof(SlabBlock) before using it in any calculations. This patch has already been applied to master in d5ee4db0e. Diagnosed-by: Tomas Vondra, Tom Lane Author: Tomas Vondra, David Rowley Discussion: https://postgr.es/m/CAA4eK1%2B1JyW5TiL%3DyV-3Uq1CrfnTyn0Xrk5uArt31Z%3D8rgPhXQ%40mail.gmail.com Backpatch-through: 10 | 01 September 2022, 07:21:58 UTC |
974299a | Bruce Momjian | 01 September 2022, 03:11:46 UTC | doc: in create statistics docs, mention analyze for parent info Discussion: https://postgr.es/m/Yv1Bw8J+1pYfHiRl@momjian.us Backpatch-through: 10 | 01 September 2022, 03:11:46 UTC |
7d78fdb | Bruce Momjian | 01 September 2022, 02:35:09 UTC | doc: mention "bloom" as a possible index access method Also remove USING erroneously added recently. Reported-by: Jeff Janes Discussion: https://postgr.es/m/CAMkU=1zhCpC7hottyMWM5Pimr9vRLprSwzLg+7PgajWhKZqRzw@mail.gmail.com Backpatch-through: 10 | 01 September 2022, 02:35:09 UTC |
6a27e2f | Bruce Momjian | 01 September 2022, 02:19:06 UTC | doc: use FILTER in aggregate example Reported-by: michal.palenik@freemap.sk Discussion: https://postgr.es/m/163499710897.684.7420075366995883688@wrigleys.postgresql.org Backpatch-through: 10 | 01 September 2022, 02:19:06 UTC |
8dc12a9 | Bruce Momjian | 01 September 2022, 02:04:36 UTC | doc: clarify that pgcrypto's gen_random_uuid calls core func. Previously it was just marked as a duplicate of the core function. Reported-by: Andreas Dijkman Discussion: https://postgr.es/m/17349-24d61e214429e8c1@postgresql.org Backpatch-through: 13 | 01 September 2022, 02:04:36 UTC |
8d489a3 | Bruce Momjian | 01 September 2022, 01:46:14 UTC | doc: split out the NATURAL/CROSS JOIN in SELECT syntax This allows the syntax to be more accurate about what clauses are supported. Also switch an example query to use the ANSI join syntax. Reported-by: Joel Jacobson Discussion: https://postgr.es/m/67b71d3e-0c22-44df-a223-351f14418319@www.fastmail.com Backpatch-through: 11 | 01 September 2022, 01:46:14 UTC |
a2039b1 | Bruce Momjian | 01 September 2022, 01:10:37 UTC | doc: warn of SECURITY DEFINER schemas for non-sql_body functions Non-sql_body functions are evaluated at runtime. Reported-by: Erki Eessaar Discussion: https://postgr.es/m/AM9PR01MB8268BF5E74E119828251FD34FE409@AM9PR01MB8268.eurprd01.prod.exchangelabs.com Backpatch-through: 10 | 01 September 2022, 01:10:37 UTC |
0b16ee7 | Bruce Momjian | 01 September 2022, 00:27:27 UTC | doc: mention that SET TIME ZONE often needs to be quoted Also mention that time zone abbreviations are not supported. Reported-by: philippe.godfrin@nov.com Discussion: https://postgr.es/m/163888728952.1269.5167822676466793158@wrigleys.postgresql.org Backpatch-through: 10 | 01 September 2022, 00:27:27 UTC |
e40707c | Bruce Momjian | 31 August 2022, 23:43:06 UTC | doc: document the maximum char/varchar length value Reported-by: Japin Li Discussion: https://postgr.es/m/MEYP282MB1669B13E98AE531617CB1386B6979@MEYP282MB1669.AUSP282.PROD.OUTLOOK.COM Backpatch-through: 10 | 31 August 2022, 23:43:06 UTC |
27e8fc4 | Bruce Momjian | 31 August 2022, 23:28:42 UTC | doc: show direction is optional in FETCH/MOVE's FROM/IN syntax It used to show direction was required for FROM/IN. Reported-by: Rob <rirans@comcast.net> Discussion: https://postgr.es/m/20211015165248.isqjceyilelhnu3k@localhost Author: Rob <rirans@comcast.net> Backpatch-through: 10 | 31 August 2022, 23:28:42 UTC |
3da5ecb | Bruce Momjian | 31 August 2022, 21:08:44 UTC | doc: simplify WITH clause syntax in CREATE DATABASE Reported-by: Rob <rirans@comcast.net> Discussion: https://postgr.es/m/20211016171149.yaouvlw5kvux6dvk@localhost Author: Rob <rirans@comcast.net> Backpatch-through: 10 | 31 August 2022, 21:08:44 UTC |
0c599e7 | Tom Lane | 31 August 2022, 20:23:20 UTC | Prevent long-term memory leakage in autovacuum launcher. get_database_list() failed to restore the caller's memory context, instead leaving current context set to TopMemoryContext which is how CommitTransactionCommand() leaves it. The callers both think they are using short-lived contexts, for the express purpose of not having to worry about cleaning up individual allocations. The net effect therefore is that supposedly short-lived allocations could accumulate indefinitely in the launcher's TopMemoryContext. Although this has been broken for a long time, it seems we didn't have any obvious memory leak here until v15's rearrangement of the stats logic. I (tgl) am not entirely convinced that there's no other leak at all, though, and we're surely at risk of adding one in future back-patched fixes. So back-patch to all supported branches, even though this may be only a latent bug in pre-v15. Reid Thompson Discussion: https://postgr.es/m/972a4e12b68b0f96db514777a150ceef7dcd2e0f.camel@crunchydata.com | 31 August 2022, 20:23:20 UTC |
61f6e5c | Tom Lane | 31 August 2022, 14:42:05 UTC | In the Snowball dictionary, don't try to stem excessively-long words. If the input word exceeds 1000 bytes, don't pass it to the stemmer; just return it as-is after case folding. Such an input is surely not a word in any human language, so whatever the stemmer might do to it would be pretty dubious in the first place. Adding this restriction protects us against a known recursion-to-stack-overflow problem in the Turkish stemmer, and it seems like good insurance against any other safety or performance issues that may exist in the Snowball stemmers. (I note, for example, that they contain no CHECK_FOR_INTERRUPTS calls, so we really don't want them running for a long time.) The threshold of 1000 bytes is arbitrary. An alternative definition could have been to treat such words as stopwords, but that seems like a bigger break from the old behavior. Per report from Egor Chindyaskin and Alexander Lakhin. Thanks to Olly Betts for the recommendation to fix it this way. Discussion: https://postgr.es/m/1661334672.728714027@f473.i.mail.ru | 31 August 2022, 14:42:05 UTC |
fe9d009 | Peter Eisentraut | 31 August 2022, 05:42:01 UTC | plpython: Don't create pgxsdir subdirectory in installdir target As of db23464715f4792298c639153dda7bfd9ad9d602, we don't install anything there anymore from plpython, so we don't need to create the installation directory anymore. | 31 August 2022, 05:42:31 UTC |
529d8f3 | Tom Lane | 30 August 2022, 21:28:32 UTC | On NetBSD, force dynamic symbol resolution at postmaster start. The default of lazy symbol resolution means that when the postmaster first reaches the select() call in ServerLoop, it'll need to resolve the link to that libc entry point. NetBSD's dynamic loader takes an internal lock while doing that, and if a signal interrupts the operation then there is a risk of self-deadlock should the signal handler do anything that requires that lock, as several of the postmaster signal handlers do. The window for this is pretty narrow, and timing considerations make it unlikely that a signal would arrive right then anyway. But it's semi-repeatable on slow single-CPU machines, and in principle the race could happen with any hardware. The least messy solution to this is to force binding of dynamic symbols at postmaster start, using the "-z now" linker option. While we're at it, also use "-z relro" so as to provide a small security gain. It's not entirely clear whether any other platforms share this issue, but for now we'll assume it's NetBSD-specific. (We might later try to use "-z now" on more platforms for performance reasons, but that would not likely be something to back-patch.) Report and patch by me; the idea to fix it this way is from Andres Freund. Discussion: https://postgr.es/m/3384826.1661802235@sss.pgh.pa.us | 30 August 2022, 21:28:55 UTC |
eb29fa3 | Robert Haas | 29 August 2022, 14:47:12 UTC | Prevent WAL corruption after a standby promotion. When a PostgreSQL instance performing archive recovery but not using standby mode is promoted, and the last WAL segment that it attempted to read ended in a partial record, the previous code would create invalid WAL on the new timeline. The WAL from the previously timeline would be copied to the new timeline up until the end of the last valid record, but instead of beginning to write WAL at immediately afterwards, the promoted server would write an overwrite contrecord at the beginning of the next segment. The end of the previous segment would be left as all-zeroes, resulting in failures if anything tried to read WAL from that file. The root of the issue is that ReadRecord() decides whether to set abortedRecPtr and missingContrecPtr based on the value of StandbyMode, but ReadRecord() switches to a new timeline based on the value of ArchiveRecoveryRequested. We shouldn't try to write an overwrite contrecord if we're switching to a new timeline, so change the test in ReadRecod() to check ArchiveRecoveryRequested instead. Code fix by Dilip Kumar. Comments by me incorporating suggested language from Álvaro Herrera. Further review from Kyotaro Horiguchi and Sami Imseih. Discussion: http://postgr.es/m/CAFiTN-t7umki=PK8dT1tcPV=mOUe2vNhHML6b3T7W7qqvvajjg@mail.gmail.com Discussion: http://postgr.es/m/FB0DEA0B-E14E-43A0-811F-C1AE93D00FF3%40amazon.com | 29 August 2022, 15:18:55 UTC |
ebe2b40 | Tom Lane | 28 August 2022, 14:44:52 UTC | Doc: fix example of recursive query. Compute total number of sub-parts correctly, per jason@banfelder.net Simon Riggs Discussion: https://postgr.es/m/166161184718.1235920.6304070286124217754@wrigleys.postgresql.org | 28 August 2022, 14:44:52 UTC |
73cbdb7 | John Naylor | 23 August 2022, 02:55:05 UTC | Switch format specifier for replication origins to %d Using %u with uint16 causes warnings with -Wformat-signedness. There are many other warnings, but for now change only these since c920fe4818 already changed the message string for most of them. Per report from Peter Eisentraut Discussion: https://www.postgresql.org/message-id/31e63649-0355-7088-831e-b07d5f908a8c%40enterprisedb.com | 28 August 2022, 14:04:35 UTC |
44817d9 | Michael Paquier | 27 August 2022, 06:22:07 UTC | Use correct connection for cancellation in frontend's parallel slots While waiting for slots to become available in wait_on_slots() in parallel_slot.c, the cancellation always relied on the first connection in the set to do the job. This could cause problems when this slot's socket is gone as PQgetCancel() would return NULL in this case. Rather than always using the first connection, this changes the logic to use the first valid connection for the cancellation. Author: Ranier Vilela Reviewed-by: Justin Pryzby Discussion: https://postgr.es/m/CAEudQAokk1h_pUwGXsYS4oVOuf35s1O2o3TXGHpV8=AWikvgHA@mail.gmail.com Backpatch-through: 14 | 27 August 2022, 06:22:07 UTC |
d4e9bca | Peter Eisentraut | 26 August 2022, 08:33:55 UTC | Remove obsolete comment The comment in basebackup.c updated by 33bd4698c11 was actually obsolete to begin with, since the symbols it was referring to haven't existed in that header file for quite some time. The header file is still needed for other reasons, though, so keep the #include, just drop the comment. | 26 August 2022, 08:45:01 UTC |
2829cfa | Etsuro Fujita | 26 August 2022, 07:55:01 UTC | Fix typo in comment. | 26 August 2022, 07:55:01 UTC |
c742eb3 | Peter Eisentraut | 25 August 2022, 18:46:58 UTC | libpq code should use libpq_gettext(), not _() Fix some wrong use and install a safeguard against future mistakes. | 25 August 2022, 18:48:20 UTC |
01b23da | Jeff Davis | 25 August 2022, 17:26:31 UTC | Fix doc oversight for custom WAL resource managers. Reported-by: Bharath Rupireddy Backpatch-through: 15 Discussion: https://postgr.es/m/CALj2ACU+at7RqnWEzS59QsFg3ZOF4C4GSp7pt+PWiLEp0zrEKg@mail.gmail.com | 25 August 2022, 17:28:43 UTC |
19c4de8 | Peter Eisentraut | 25 August 2022, 13:04:38 UTC | Update another comment still referring to pg_start/stop_backup() | 25 August 2022, 13:05:28 UTC |
f2dcf1a | Peter Eisentraut | 25 August 2022, 04:35:16 UTC | pg_dump: Fix new ICU tests ICU doesn't support some server encodings, so we need to exclude them if a non-supported encoding was set up. | 25 August 2022, 04:41:47 UTC |
36a8881 | Michael Paquier | 01 July 2022, 00:37:17 UTC | Fix code comments still referring to pg_start/stop_backup() pg_start_backup() and pg_stop_backup() have been respectively renamed to pg_backup_start() and pg_backup_stop() as of 39969e2, but a few comments did not get the call. Reviewed-by: Kyotaro Horiguchi, David Steele Discussion: https://postgr.es/m/YrqGlj1+4DF3dbZ/@paquier.xyz | 24 August 2022, 20:10:29 UTC |
72b6828 | Peter Eisentraut | 24 August 2022, 18:13:52 UTC | pg_dump: Dump colliculocale This was forgotten when the new column was introduced. Author: Marina Polyakova <m.polyakova@postgrespro.ru> Reviewed-by: Julien Rouhaud <rjuju123@gmail.com> Discussion: https://www.postgresql.org/message-id/7ad26354e75259f59c4a6c6997b8ee32%40postgrespro.ru | 24 August 2022, 18:16:12 UTC |
3d3c05c | Tom Lane | 24 August 2022, 17:01:40 UTC | Defend against stack overrun in a few more places. SplitToVariants() in the ispell code, lseg_inside_poly() in geo_ops.c, and regex_selectivity_sub() in selectivity estimation could recurse until stack overflow; fix by adding check_stack_depth() calls. So could next() in the regex compiler, but that case is better fixed by converting its tail recursion to a loop. (We probably get better code that way too, since next() can now be inlined into its sole caller.) There remains a reachable stack overrun in the Turkish stemmer, but we'll need some advice from the Snowball people about how to fix that. Per report from Egor Chindyaskin and Alexander Lakhin. These mistakes are old, so back-patch to all supported branches. Richard Guo and Tom Lane Discussion: https://postgr.es/m/1661334672.728714027@f473.i.mail.ru | 24 August 2022, 17:02:19 UTC |
e682805 | David Rowley | 24 August 2022, 11:46:40 UTC | Doc: remove duplicate "a" from func.sgml Author: Shinya Kato Discussion: https://postgr.es/m/76c01275776749a167f49379ebec57f1@oss.nttdata.com Backpatch-through: 15, where that change was introduced | 24 August 2022, 11:46:40 UTC |
f02147b | Peter Eisentraut | 24 August 2022, 11:27:34 UTC | Fix ICU locale option handling in CREATE DATABASE The code took the LOCALE option as the default/fallback for ICU_LOCALE, but this was neither documented nor intended, so remove it. (It was probably left in from an earlier patch version.) Reported-by: Marina Polyakova <m.polyakova@postgrespro.ru> Discussion: https://www.postgresql.org/message-id/flat/f385ba25e7f8be427b8c582e5cca7d79%40postgrespro.ru#515a31c5429d6d37ad1d5c9d66962a1e | 24 August 2022, 11:34:53 UTC |
dfe2eb7 | Peter Eisentraut | 23 August 2022, 19:50:12 UTC | Message style adjustment | 23 August 2022, 19:50:12 UTC |
2c63b09 | Tom Lane | 23 August 2022, 13:55:37 UTC | Doc: document possible need to raise kernel's somaxconn limit. On fast machines, it's possible for applications such as pgbench to issue connection requests so quickly that the postmaster's listen queue overflows in the kernel, resulting in unexpected failures (with not-very-helpful error messages). Most modern OSes allow the queue size to be increased, so document how to do that. Per report from Kevin McKibbin. Discussion: https://postgr.es/m/CADc_NKg2d+oZY9mg4DdQdoUcGzN2kOYXBu-3--RW_hEe0tUV=g@mail.gmail.com | 23 August 2022, 13:55:44 UTC |
d53ff6a | Tom Lane | 23 August 2022, 13:41:37 UTC | Doc: prefer sysctl to /proc/sys in docs and comments. sysctl is more portable than Linux's /proc/sys file tree, and often easier to use too. That's why most of our docs refer to sysctl when talking about how to adjust kernel parameters. Bring the few stragglers into line. Discussion: https://postgr.es/m/361175.1661187463@sss.pgh.pa.us | 23 August 2022, 13:41:53 UTC |
42681df | Amit Kapila | 23 August 2022, 04:38:43 UTC | Add CHECK_FOR_INTERRUPTS while decoding changes. While decoding changes in a loop, if we skip all the changes there is no CFI making the loop uninterruptible. Reported-by: Whale Song and Andrey Borodin Bug: 17580 Author: Masahiko Sawada Reviwed-by: Amit Kapila Backpatch-through: 10 Discussion: https://postgr.es/m/17580-849c1d5b6d7eb422@postgresql.org Discussion: https://postgr.es/m/B319ECD6-9A28-4CDF-A8F4-3591E0BF2369@yandex-team.ru | 23 August 2022, 04:38:43 UTC |
045ec34 | Andres Freund | 23 August 2022, 03:16:50 UTC | pgstat: Acquire lock when reading variable-numbered stats Somewhere during the development of the patch acquiring a lock during read access to variable-numbered stats got lost. The missing lock acquisition won't cause corruption, but can lead to reading torn values when accessing stats. Add the missing lock acquisitions. Reported-by: Greg Stark <stark@mit.edu> Reviewed-by: "Drouvot, Bertrand" <bdrouvot@amazon.com> Reviewed-by: Andres Freund <andres@anarazel.de> Author: Kyotaro Horiguchi <horikyota.ntt@gmail.com> Discussion: https://postgr.es/m/CAM-w4HMYkM_DkYhWtUGV+qE_rrBxKOzOF0+5faozxO3vXrc9wA@mail.gmail.com Backpatch: 15- | 23 August 2022, 03:17:45 UTC |
a2caf18 | Peter Eisentraut | 22 August 2022, 13:31:50 UTC | Fix assertion failure in CREATE DATABASE An assertion would fail when creating a database with libc locale provider from a template database with icu locale provider. Reported-by: Marina Polyakova <m.polyakova@postgrespro.ru> Reviewed-by: Julien Rouhaud <rjuju123@gmail.com> Discussion: https://www.postgresql.org/message-id/flat/f385ba25e7f8be427b8c582e5cca7d79%40postgrespro.ru#515a31c5429d6d37ad1d5c9d66962a1e | 22 August 2022, 13:31:50 UTC |
3725b7f | Peter Eisentraut | 22 August 2022, 11:26:52 UTC | pg_upgrade: Fix thinko in database info acquisition routine When checking whether the major version supports per-database locale providers, it was always looking at the version of the old cluster instead of the cluster that was passed in. This would lead to failures to detect locale provider mismatches. Reported-by: Marina Polyakova <m.polyakova@postgrespro.ru> Reviewed-by: Julien Rouhaud <rjuju123@gmail.com> Discussion: https://www.postgresql.org/message-id/flat/f385ba25e7f8be427b8c582e5cca7d79%40postgrespro.ru#515a31c5429d6d37ad1d5c9d66962a1e | 22 August 2022, 12:30:41 UTC |
254d79f | Amit Kapila | 22 August 2022, 03:21:25 UTC | Use logical operator && instead of & in vacuumparallel.c. As such the current usage of & won't produce incorrect results but it would be better to use && to short-circuit the evaluation of second condition when the same is not required. Author: Ranier Vilela Reviewed-by: Tom Lane, Bharath Rupireddy Backpatch-through: 15, where it was introduced Discussion: https://postgr.es/m/CAEudQApL8QcoYwQuutkWKY_h7gBY8F0Xs34YKfc7-G0i83K_pw@mail.gmail.com | 22 August 2022, 03:21:25 UTC |
24f457a | David Rowley | 19 August 2022, 23:40:59 UTC | Remove shadowed local variables that are new in v15 Compiling with -Wshadow=compatible-local yields quite a few warnings about local variables being shadowed by compatible local variables in an inner scope. Of course, this is perfectly valid in C, but we have had bugs in the past as a result of developers failing to notice this. af7d270dd is a recent example. Here we do a cleanup of warnings we receive from -Wshadow=compatible-local for code which is new to PostgreSQL 15. We've yet to have the discussion about if we actually ever want to run that as a standard compilation flag. We'll need to at least get the number of warnings down to something easier to manage before we can realistically consider if we want this or not. This commit is the first step towards reducing the warnings. The changes being made here are all fairly trivial. Because of that, and the fact that v15 is still in beta, this is being back-patched into 15. It seems more risky not to do this as the risk of future bugs is increased by the additional conflicts that this commit could cause for any future bug fixes touching the same areas as this commit. Author: Justin Pryzby Discussion: https://postgr.es/m/20220817145434.GC26426%40telsasoft.com Backpatch-through: 15 | 19 August 2022, 23:40:59 UTC |
4496020 | Peter Geoghegan | 19 August 2022, 16:26:06 UTC | Avoid reltuples distortion in very small tables. Consistently avoid trusting a sample of only one page at the point that VACUUM determines a new reltuples for the target table (though only when the table is larger than a single page). This is follow-up work to commit 74388a1a, which added a heuristic to prevent reltuples from becoming distorted by successive VACUUM operations that each scan only a single heap page (which was itself more or less a bugfix for an issue in commit 44fa8488, which simplified VACUUM's handling of scanned pages). The original bugfix commit did not account for certain remaining cases that where not affected by its "2% of total relpages" heuristic. This happened with relations that are small enough that just one of its pages exceeded the 2% threshold, yet still big enough for VACUUM to deem skipping most of its pages via the visibility map worthwhile. reltuples could still become distorted over time with such a table, at least in scenarios where the VACUUM command is run repeatedly and without the table itself ever changing. Author: Peter Geoghegan <pg@bowt.ie> Discussion: https://postgr.es/m/CAH2-Wzk7d4m3oEbEWkWQKd+gz-eD_peBvdXVk1a_KBygXadFeg@mail.gmail.com Backpatch: 15-, where the rules for scanned pages changed. | 19 August 2022, 16:26:06 UTC |
4afe79b | Michael Paquier | 19 August 2022, 01:00:23 UTC | doc: Improve some markups and some wording around archiving modules This commit adds or fixes used markups in a couple of places in the docs (for <command>, <systemitem> and <literal>). While on it, clarify some of the documentation added recently for archiving modules with archive_command, that would still be used as default choice if no external module is defined (though an archive module could as well use an archive_command). Author: Maxim Yablokov Discussion: https://postgr.es/m/b47ec4e8-6f6a-2aba-038e-d5db150b245e@postgrespro.ru Backpatch-through: 15 | 19 August 2022, 01:00:23 UTC |
08c23f4 | Peter Geoghegan | 19 August 2022, 00:34:12 UTC | Initialize index stats during parallel VACUUM. Initialize shared memory allocated for index stats to avoid a hard crash. This was possible when parallel VACUUM became confused about the current phase of index processing. Oversight in commit 8e1fae1938, which refactored parallel VACUUM. Author: Masahiko Sawada <sawada.mshk@gmail.com> Reported-By: Justin Pryzby <pryzby@telsasoft.com> Discussion: https://postgr.es/m/20220818133406.GL26426@telsasoft.com Backpatch: 15-, the first version with the refactoring commit. | 19 August 2022, 00:34:12 UTC |
72af71a | Jeff Davis | 18 August 2022, 21:23:59 UTC | Use correct LSN for error reporting in pg_walinspect Usage of ReadNextXLogRecord()'s first_record parameter for error reporting isn't always correct. For instance, in GetWALRecordsInfo() and GetWalStats(), we're reading multiple records, and first_record is always passed as the LSN of the first record which is then used for error reporting for later WAL record read failures. This isn't correct. The correct parameter to use for error reports in case of WAL reading failures is xlogreader->EndRecPtr. This change fixes it. While on it, removed an unnecessary Assert in pg_walinspect code. Reported-by: Robert Haas Author: Bharath Rupireddy Reviewed-by: Robert Haas Discussion: https://www.postgresql.org/message-id/CA%2BTgmoZAOGzPUifrcZRjFZ2vbtcw3mp-mN6UgEoEcQg6bY3OVg%40mail.gmail.com Backpatch-through: 15 | 18 August 2022, 21:23:59 UTC |
2a42c1c | Tom Lane | 18 August 2022, 16:11:47 UTC | Fix subtly-incorrect matching of parent and child partitioned indexes. When creating a partitioned index, DefineIndex tries to identify any existing indexes on the partitions that match the partitioned index, so that it can absorb those as child indexes instead of building new ones. Part of the matching is to compare IndexInfo structs --- but that wasn't done quite right. We're comparing the IndexInfo built within DefineIndex itself to one made from existing catalog contents by BuildIndexInfo. Notably, while BuildIndexInfo will run index expressions and predicates through expression preprocessing, that has not happened to DefineIndex's struct. The result is failure to match and subsequent creation of duplicate indexes. The easiest and most bulletproof fix is to build a new IndexInfo using BuildIndexInfo, thereby guaranteeing that the processing done is identical. While here, let's also extract the opfamily and collation data from the new partitioned index, removing ad-hoc logic that duplicated knowledge about how those are constructed. Per report from Christophe Pettus. Back-patch to v11 where we invented partitioned indexes. Richard Guo and Tom Lane Discussion: https://postgr.es/m/8864BFAA-81FD-4BF9-8E06-7DEB8D4164ED@thebuild.com | 18 August 2022, 16:12:03 UTC |
576bb0f | Robert Haas | 18 August 2022, 15:09:39 UTC | When using the WAL-logged CREATE DATABASE strategy, bulk extend. This should improve performance, and was suggested by Andres Freund. Back-patch to v15 to keep the code consistent across branches. Dilip Kumar Discussion: http://postgr.es/m/C3458199-FEDD-4356-865A-08DFAA5D4065@anarazel.de Discussion: http://postgr.es/m/CAFiTN-sJ0vVpJrZ=R5M+g7Tr8=NN4wKOtrqOcDEsfFfnZgivVA@mail.gmail.com | 18 August 2022, 15:22:48 UTC |
9c4c22f | Peter Eisentraut | 18 August 2022, 09:33:53 UTC | Simplify and clarify an error message | 18 August 2022, 09:33:53 UTC |
7cadaac | John Naylor | 18 August 2022, 01:57:13 UTC | Refer to replication origin roident as "ID" in user facing messages and docs The table column that stores this is of type oid, but is actually limited to uint16 and has a different path for creating new values. Some of the documentation already referred to it as an ID, so let's standardize on that. While at it, most format strings already use %u, so for consintency change the remaining stragglers using %d. Per suggestions from Tom Lane and Justin Pryzby Discussion: https://www.postgresql.org/message-id/3437166.1659620465%40sss.pgh.pa.us Backpatch to v15 | 18 August 2022, 02:10:39 UTC |
522ae01 | Michael Paquier | 17 August 2022, 05:55:24 UTC | Allow event trigger table_rewrite for ALTER MATERIALIZED VIEW This event can happen when using SET ACCESS METHOD, as the data files of the materialized need a full refresh but this command tag was not updated to reflect that. The documentation is updated to track this behavior. Author: Onder Kalaci Discussion: https://postgr.es/m/CACawEhXwHN3X34FiwoYG8vXR-oyUdrp7qcfRWSzS+NPahS5gSw@mail.gmail.com Backpatch-through: 15 | 17 August 2022, 05:55:24 UTC |
be6aadf | Tomas Vondra | 16 August 2022, 21:52:10 UTC | Fix assert in logicalmsg_desc The assert, introduced by 9f1cf97bb5, is intended to check if the prefix is terminated by a \0 byte, but it has two flaws. Firstly, prefix_size includes the \0 byte, so prefix[prefix_size] points to the byte after the null byte. Secondly, the check ensures the byte is not equal \0, while it should be checking the opposite. Backpatch-through: 14 Discussion: https://postgr.es/m/b99b6101-2f14-3796-3dfa-4a6cd7d4326d@enterprisedb.com | 16 August 2022, 22:13:42 UTC |
ac222a3 | Daniel Gustafsson | 16 August 2022, 20:54:43 UTC | doc: Remove reference to tty libpq connstring param The tty connection string parameter was removed in commit 14d9b3760 but the reference to it in the docs was mistakenly kept. Fix by removing it from the libpq documentation. Backpatch through v14 where the parameter was removed. Author: Noriyoshi Shinoda <noriyoshi.shinoda@hpe.com> Discussion: https://postgr.es/m/DM4PR84MB173433216FCC2A3961879000EE6B9@DM4PR84MB1734.NAMPRD84.PROD.OUTLOOK.COM Backpatch-through: 14 | 16 August 2022, 20:54:43 UTC |
207fc75 | Daniel Gustafsson | 16 August 2022, 10:44:24 UTC | doc: Add missing parenthesis to keycombo The SIGINT keycombo for the pg_waldump stats emission was lacking a closing parenthesis. Backpatch to 15 where this feature was added. Discussion: https://postgr.es/m/EC39E60E-C8B6-4CDF-8BFA-E4D140446B41@yesql.se Backpatch-through: 15 | 16 August 2022, 10:44:24 UTC |
76d2579 | Amit Kapila | 16 August 2022, 09:44:27 UTC | Fix replica identity check for a partitioned table. The current publisher code checks if UPDATE or DELETE can be executed with the replica identity of the table even if it's a partitioned table. We can skip checking the replica identity for partitioned tables because the operations are actually performed on the leaf partitions (not the partitioned table). Reported-by: Brad Nicholson Author: Hou Zhijie Reviewed-by: Peter Smith, Amit Kapila Backpatch-through: 13 Discussion: https://postgr.es/m/CAMMnM%3D8i5DohH%3DYKzV0_wYuYSYvuOJoL9F5nzXTc%2ByzsG1f6rg%40mail.gmail.com | 16 August 2022, 09:44:27 UTC |
16c6856 | Tatsuo Ishii | 16 August 2022, 00:26:40 UTC | doc: fix wrong tag used in create sequence manual. In ref/create_sequence.sgml <literal> tag was used for nextval function name. This should have been <function> tag. Author: Noboru Saito Discussion: https://postgr.es/m/CAAM3qnJTDFFfRf5JHJ4AYrNcqXgMmj0pbH0%2Bvm%3DYva%2BpJyGymA%40mail.gmail.com Backpatch-through: 10 | 16 August 2022, 00:26:40 UTC |
ef9f359 | Tom Lane | 15 August 2022, 19:40:07 UTC | Add missing bad-PGconn guards in libpq entry points. There's a convention that externally-visible libpq functions should check for a NULL PGconn pointer, and fail gracefully instead of crashing. PQflush() and PQisnonblocking() didn't get that memo though. Also add a similar check to PQdefaultSSLKeyPassHook_OpenSSL; while it's not clear that ordinary usage could reach that with a null conn pointer, it's cheap enough to check, so let's be consistent. Daniele Varrazzo and Tom Lane Discussion: https://postgr.es/m/CA+mi_8Zm_mVVyW1iNFgyMd9Oh0Nv8-F+7Y3-BqwMgTMHuo_h2Q@mail.gmail.com | 15 August 2022, 19:40:07 UTC |
a5d2337 | Michael Paquier | 15 August 2022, 04:37:32 UTC | Fix outdated --help message for postgres -f This option switch supports a total of 8 values, as told by set_plan_disabling_options() and the documentation, but this was not reflected in the output generated by --help. Author: Junwang Zhao Discussion: https://postgr.es/m/CAEG8a3+pT3cWzyjzKs184L1XMNm8NDnoJLiSjAYSO7XqpRh_vA@mail.gmail.com Backpatch-through: 10 | 15 August 2022, 04:37:32 UTC |
9ae4841 | Tom Lane | 14 August 2022, 16:05:27 UTC | Preserve memory context of VarStringSortSupport buffers. When enlarging the work buffers of a VarStringSortSupport object, varstrfastcmp_locale was careful to keep them in the ssup_cxt memory context; but varstr_abbrev_convert just used palloc(). The latter creates a hazard that the buffers could be freed out from under the VarStringSortSupport object, resulting in stomping on whatever gets allocated in that memory later. In practice, because we only use this code for ICU collations (cf. 3df9c374e), the problem is confined to use of ICU collations. I believe it may have been unreachable before the introduction of incremental sort, too, as traditional sorting usually just uses one context for the duration of the sort. We could fix this by making the broken stanzas in varstr_abbrev_convert match the non-broken ones in varstrfastcmp_locale. However, it seems like a better idea to dodge the issue altogether by replacing the pfree-and-allocate-anew coding with repalloc, which automatically preserves the chunk's memory context. This fix does add a few cycles because repalloc will copy the chunk's content, which the existing coding assumes is useless. However, we don't expect that these buffer enlargement operations are performance-critical. Besides that, it's far from obvious that copying the buffer contents isn't required, since these stanzas make no effort to mark the buffers invalid by resetting last_returned, cache_blob, etc. That seems to be safe upon examination, but it's fragile and could easily get broken in future, which wouldn't get revealed in testing with short-to-moderate-size strings. Per bug #17584 from James Inform. Whether or not the issue is reachable in the older branches, this code has been broken on its own terms from its introduction, so patch all the way back. Discussion: https://postgr.es/m/17584-95c79b4a7d771f44@postgresql.org | 14 August 2022, 16:05:27 UTC |
aee9543 | Tom Lane | 13 August 2022, 20:59:58 UTC | Avoid misbehavior when hash_table_bytes < bucket_size. It's possible to reach this case when work_mem is very small and tupsize is (relatively) very large. In that case ExecChooseHashTableSize would get an assertion failure, or with asserts off it'd compute nbuckets = 0, which'd likely cause misbehavior later (I've not checked). To fix, clamp the number of buckets to be at least 1. This is due to faulty conversion of old my_log2() coding in 28d936031. Back-patch to v13, as that was. Zhang Mingli Discussion: https://postgr.es/m/beb64ca0-91e2-44ac-bf4a-7ea36275ec02@Spark | 13 August 2022, 20:59:58 UTC |
00ac616 | Tom Lane | 13 August 2022, 19:21:28 UTC | Catch stack overflow when recursing in transformFromClauseItem(). Most parts of the parser can expect that the stack overflow check in transformExprRecurse() will trigger before things get desperate. However, transformFromClauseItem() can recurse directly to self without having analyzed any expressions, so it's possible to drive it to a stack-overrun crash. Add a check to prevent that. Per bug #17583 from Egor Chindyaskin. Back-patch to all supported branches. Richard Guo Discussion: https://postgr.es/m/17583-33be55b9f981f75c@postgresql.org | 13 August 2022, 19:21:28 UTC |
94478f4 | Peter Eisentraut | 13 August 2022, 08:32:38 UTC | Add missing fields to _outConstraint() As of 897795240cfaaed724af2f53ed2c50c9862f951f, check constraints can be declared invalid. But that patch didn't update _outConstraint() to also show the relevant struct fields (which were only applicable to foreign keys before that). This currently only affects debugging output, so no impact in practice. | 13 August 2022, 08:37:38 UTC |
c7bc39c | Peter Eisentraut | 12 August 2022, 22:00:41 UTC | pg_upgrade: Fix some minor code issues 96ef3b8ff1cf1950e897fd2f766d4bd9ef0d5d56 accidentally copied a not applicable comment from the float8_pass_by_value code to the data_checksums code. Remove that. 87d3b35a1ca31a9d947a8f919a6006679216dff0 changed pg_upgrade to checking the checksum version rather than just the Boolean presence of checksums, but didn't change the field type in its ControlData struct from bool. So this would not work correctly if there ever is a checksum version larger than 1. | 12 August 2022, 22:11:01 UTC |
560d052 | Bruce Momjian | 12 August 2022, 19:43:23 UTC | doc: add missing role attributes to user management section Reported-by: Shinya Kato Discussion: https://postgr.es/m/1ecdb1ff78e9b03dfce37e85eaca725a@oss.nttdata.com Author: Shinya Kato Backpatch-through: 10 | 12 August 2022, 19:43:23 UTC |
4445461 | Bruce Momjian | 12 August 2022, 19:05:13 UTC | doc: add section about heap-only tuples (HOT) Reported-by: Jonathan S. Katz Discussion: https://postgr.es/m/c59ffbd5-96ac-a5a5-a401-14f627ca1405@postgresql.org Backpatch-through: 11 | 12 August 2022, 19:05:13 UTC |
5eb38dc | Bruce Momjian | 12 August 2022, 16:02:21 UTC | doc: warn about security issues around log files Reported-by: Simon Riggs Discussion: https://postgr.es/m/CANP8+jJESuuXYq9Djvf-+tx2vY2OFLmfEuu+UvwHNJ1RT7iJCQ@mail.gmail.com Author: Simon Riggs Backpatch-through: 10 | 12 August 2022, 16:02:21 UTC |
c90dfb6 | Bruce Momjian | 12 August 2022, 15:35:23 UTC | doc: clarify configuration file for Windows builds The use of file 'config.pl' was not clearly explained. Reported-by: liambowen@gmail.com Discussion: https://postgr.es/m/164246013804.31952.4958087335645367498@wrigleys.postgresql.org Backpatch-through: 10 | 12 August 2022, 15:35:23 UTC |
5d499da | Bruce Momjian | 12 August 2022, 15:26:03 UTC | doc: document the CREATE INDEX "USING" clause Somehow this was in the syntax but had no description. Reported-by: robertcorrington@gmail.com Discussion: https://postgr.es/m/164228771825.31954.2719791849363756957@wrigleys.postgresql.org Backpatch-through: 10 | 12 August 2022, 15:26:03 UTC |
b79e626 | Bruce Momjian | 12 August 2022, 14:59:00 UTC | doc: clarify CREATE TABLE AS ... IF NOT EXISTS Mention that the table is not modified if it already exists. Reported-by: frank_limpert@yahoo.com Discussion: https://postgr.es/m/164441177106.9677.5991676148704507229@wrigleys.postgresql.org Backpatch-through: 10 | 12 August 2022, 14:59:00 UTC |
cdb2577 | Bruce Momjian | 12 August 2022, 14:30:01 UTC | doc: improve wal_level docs for the 'minimal' level Reported-by: David G. Johnston Discussion: https://postgr.es/m/CAKFQuwZ24UcfkoyLLSW3PMGQATomOcw1nuYFRuMev-NoOF+mYw@mail.gmail.com Author: David G. Johnston Backpatch-through: 14, partial to 13 | 12 August 2022, 14:30:01 UTC |
89512ee | Bruce Momjian | 12 August 2022, 13:06:48 UTC | doc: clarify DROP EXTENSION dependent members text Member tracking was added in PG 13. Reported-by: David G. Johnston Discussion: https://postgr.es/m/CAKFQuwY1YtxQHVWUFYvSnOjZ5VPpXjF33V52bSKEwFjK2K=1Aw@mail.gmail.com Author: David G. Johnston Backpatch-through: 13 | 12 August 2022, 13:07:08 UTC |
1b94f8f | Robert Haas | 12 August 2022, 12:55:07 UTC | Avoid using a fake relcache entry to own an SmgrRelation. If an error occurs before we close the fake relcache entry, the the fake relcache entry will be destroyed by the SmgrRelation will survive until end of transaction. Its smgr_owner pointer ends up pointing to already-freed memory. The original reason for using a fake relcache entry here was to try to avoid reusing an SMgrRelation across a relevant invalidation. To avoid that problem, just call smgropen() again each time we need a reference to it. Hopefully someday we will come up with a more elegant approach, but accessing uninitialized memory is bad so let's do this for now. Dilip Kumar, reviewed by Andres Freund and Tom Lane. Report by Justin Pryzby. Discussion: http://postgr.es/m/20220802175043.GA13682@telsasoft.com Discussion: http://postgr.es/m/CAFiTN-vSFeE6_W9z698XNtFROOA_nSqUXWqLcG0emob_kJ+dEQ@mail.gmail.com | 12 August 2022, 12:55:07 UTC |
d6d1fbf | Alvaro Herrera | 12 August 2022, 11:16:50 UTC | MERGE docs adjustments Per Justin Pryzby Discussion: https://postgr.es/m/20220801145257.GA15006@telsasoft.com Discussion: https://postgr.es/m/20220714162618.GH18011@telsasoft.com | 12 August 2022, 11:16:50 UTC |
455d254 | Alvaro Herrera | 12 August 2022, 10:05:50 UTC | Reject MERGE in CTEs and COPY The grammar added for MERGE inadvertently made it accepted syntax in places that were not prepared to deal with it -- namely COPY and inside CTEs, but invoking these things with MERGE currently causes assertion failures or weird misbehavior in non-assertion builds. Protect those places by checking for it explicitly until somebody decides to implement it. Reported-by: Alexey Borzov <borz_off@cs.msu.su> Discussion: https://postgr.es/m/17579-82482cd7b267b862@postgresql.org | 12 August 2022, 10:05:50 UTC |
e1878cf | Peter Eisentraut | 12 August 2022, 06:17:30 UTC | Fix _outConstraint() for "identity" constraints The set of fields printed by _outConstraint() in the CONSTR_IDENTITY case didn't match the set of fields actually used in that case. (The code was probably uncarefully copied from the CONSTR_DEFAULT case.) Fix that by using the right set of fields. Since there is no read support for this node type, this is really just for debugging output right now, so it doesn't affect anything important. | 12 August 2022, 06:52:45 UTC |
15014b8 | Amit Kapila | 12 August 2022, 05:58:54 UTC | Back-Patch "Add wait_for_subscription_sync for TAP tests." This was originally done in commit 0c20dd33db for 16 only, to eliminate duplicate code and as an infrastructure that makes it easier to write future tests. However, it has been suggested that it would be good to back-patch this testing infrastructure to aid future tests in back-branches. Backpatch to all supported versions. Author: Masahiko Sawada Reviewed by: Amit Kapila, Shi yu Discussion: https://postgr.es/m/CAD21AoC-fvAkaKHa4t1urupwL8xbAcWRePeETvshvy80f6WV1A@mail.gmail.com Discussion: https://postgr.es/m/E1oJBIf-0006sw-SA@gemulon.postgresql.org | 12 August 2022, 05:58:54 UTC |
eeb1671 | Peter Eisentraut | 11 August 2022, 08:35:39 UTC | Add missing space in _outA_Const() output Mistake introduced by 639a86e36aaecb84faaf941dcd0b183ba0aba9e9. | 11 August 2022, 08:35:39 UTC |
272248a | Amit Kapila | 11 August 2022, 04:26:49 UTC | Fix catalog lookup with the wrong snapshot during logical decoding. Previously, we relied on HEAP2_NEW_CID records and XACT_INVALIDATION records to know if the transaction has modified the catalog, and that information is not serialized to snapshot. Therefore, after the restart, if the logical decoding decodes only the commit record of the transaction that has actually modified a catalog, we will miss adding its XID to the snapshot. Thus, we will end up looking at catalogs with the wrong snapshot. To fix this problem, this changes the snapshot builder so that it remembers the last-running-xacts list of the decoded RUNNING_XACTS record after restoring the previously serialized snapshot. Then, we mark the transaction as containing catalog changes if it's in the list of initial running transactions and its commit record has XACT_XINFO_HAS_INVALS. To avoid ABI breakage, we store the array of the initial running transactions in the static variables InitialRunningXacts and NInitialRunningXacts, instead of storing those in SnapBuild or ReorderBuffer. This approach has a false positive; we could end up adding the transaction that didn't change catalog to the snapshot since we cannot distinguish whether the transaction has catalog changes only by checking the COMMIT record. It doesn't have the information on which (sub) transaction has catalog changes, and XACT_XINFO_HAS_INVALS doesn't necessarily indicate that the transaction has catalog change. But that won't be a problem since we use snapshot built during decoding only to read system catalogs. On the master branch, we took a more future-proof approach by writing catalog modifying transactions to the serialized snapshot which avoids the above false positive. But we cannot backpatch it because of a change in the SnapBuild. Reported-by: Mike Oh Author: Masahiko Sawada Reviewed-by: Amit Kapila, Shi yu, Takamichi Osumi, Kyotaro Horiguchi, Bertrand Drouvot, Ahsan Hadi Backpatch-through: 10 Discussion: https://postgr.es/m/81D0D8B0-E7C4-4999-B616-1E5004DBDCD2%40amazon.com | 11 August 2022, 04:26:49 UTC |
f88798c | Robert Haas | 10 August 2022, 18:03:09 UTC | Move basebackup code to new directory src/backend/backup Reviewed by David Steele and Justin Pryzby Discussion: http://postgr.es/m/CA+TgmoafqboATDSoXHz8VLrSwK_MDhjthK4hEpYjqf9_1Fmczw%40mail.gmail.com | 10 August 2022, 18:03:09 UTC |
ad3e07c | Tom Lane | 10 August 2022, 17:37:25 UTC | Fix handling of R/W expanded datums that are passed to SQL functions. fmgr_sql must make expanded-datum arguments read-only, because it's possible that the function body will pass the argument to more than one callee function. If one of those functions takes the datum's R/W property as license to scribble on it, then later callees will see an unexpected value, leading to wrong answers. From a performance standpoint, it'd be nice to skip this in the common case that the argument value is passed to only one callee. However, detecting that seems fairly hard, and certainly not something that I care to attempt in a back-patched bug fix. Per report from Adam Mackler. This has been broken since we invented expanded datums, so back-patch to all supported branches. Discussion: https://postgr.es/m/WScDU5qfoZ7PB2gXwNqwGGgDPmWzz08VdydcPFLhOwUKZcdWbblbo-0Lku-qhuEiZoXJ82jpiQU4hOjOcrevYEDeoAvz6nR0IU4IHhXnaCA=@mackler.email Discussion: https://postgr.es/m/187436.1660143060@sss.pgh.pa.us | 10 August 2022, 17:37:25 UTC |
df64c24 | Daniel Gustafsson | 10 August 2022, 12:16:31 UTC | Fix typo in test_oat_hooks README Discussion: https://postgr.es/m/3F066AFE-19F9-4DF5-A498-B09643857A39@yesql.se | 10 August 2022, 12:16:31 UTC |
c5d6788 | Amit Kapila | 10 August 2022, 11:00:59 UTC | Improve the protocol message descriptions for 2PC logical replication. The messages were using 'two-phase transaction' at some places and 'prepared transaction' at other places. Make them consistently use 'prepared transaction'. Reported-by: Ekaterina Kiryanova Author: Peter Smith Reviewed by: Amit Kapila Backpatch-through: 15 Discussion: https://postgr.es/m/745414e7-efb2-a6ae-5b83-fcbdf35aabc8@postgrespro.ru | 10 August 2022, 11:00:59 UTC |