summaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
6 hoursFurther post-revert cleanup after online checksumsREL_19_STABLEDaniel Gustafsson
When reverting I had missed updating the documentation for tracking data checksum failures and the checksum version in the REDO record. The test- code for enabling and disabling checksums offline was originally kept to minimize backpatching conflicts, but the amount of testcode backpatching doesn't really warrant keeping dead code. Since no version has been shipped since bumping XLOG_PAGE_MAGIC it is left at the previous bump version. Reported-by: Fujii Masao <masao.fujii@gmail.com> Reported-by: Manuel Reyes Bravo <manuelreyesbravo@gmail.com> Discussion: https://postgr.es/m/CAHGQGwFLNCA9nVHSsC_=G_mvsK_fAFb+QbJAL7=R9cK2PL9ZBQ@mail.gmail.com
14 hoursChange GEQO fitness comparisons to consider disabled_nodes.Robert Haas
Prior to v18, the total cost of a plan was just one number, a floating-point value. Commit e22253467942fdb100087787c3e1e3a8620c54b2 introduced a second component, the number of disabled_nodes at or below that level of the plan tree. Unfortunately, I (rhaas) failed to realize that GEQO extracts the cost from each candidate plan and compares it directly as a measure of fitness. This means that, at least in principle, it's possible for GEQO to prefer a plan with more disabled_nodes and lower cost over one with fewer disabled_nodes and higher cost, which is incorrect. It may be possible for that to become a practical issue in v18, but it's much more likely to become an issue in v19 due to pg_plan_advice. Hence, since the straightforward fix breaks ABI compatibility, back-patch only to v19. Backpatch-through: 19 Discussion: https://postgr.es/m/CA+TgmoYmXy-jiP5qDhqNEiYFEBzQsArO6O2d9E8szNZqi1bePQ@mail.gmail.com
14 hoursFix postmaster crash on whitespace-only oauth_validator_librariesDaniel Gustafsson
The check_oauth_validator check for an empty validator list didn't test for a string with only whitespace, which would cause the postmaster to crash. Instead of testing for the empty string cases, pass the config value to SplitDirectoriesString unconditionally. If an empty list is returned then the input string was empty. Since pstrdup cannot handle NULL, assert that the string ie set. While users cannot set the string to NULL, it is initialized to NULL so guard against programmer error. Check the parsed list instead. Assert that the GUC string is non-NULL before pstrdup(); users cannot set it to NULL, but the C variable is initialized that way. This also adds a TAP test that reloads a whitespace-only setting after pg_hba_file_rules and waits until the existing backend sees the restored GUC. Author: Grigorev Jurij <ju.grigorev@ftdata.ru> Reviewed-by: Jacob Champion <jacob.champion@enterprisedb.com> Reviewed-by: Daniel Gustafsson <daniel@yesql.se> Discussion: https://postgr.es/m/04fa84f6ebbe400f940e179ebe1070e9@localhost.localdomain Backpatch-through: 18
16 hoursHave the REPACK decoding worker use timeout values from the steering backendÁlvaro Herrera
The worker connects as the table owner in a new session, so a role- or database-level lock_timeout and transaction_timeout unhelpfully apply to it, possibly canceling the wait for older transactions. This cannot be overridden by the REPACK calling session. Fix by passing the timeout values from the steering backend via the DecodingWorkerShared struct and adopting these values in the worker; this way, values from session-local SET reach the worker too. In passing, remove a pointless member from the same struct. Author: Shihao Zhong <zhong950419@gmail.com> Backpatch-through: 19 Discussion: https://postgr.es/m/CAGRkXqTYaBjFvjtjPb1+=sZWvt93=2c472bmM+xdG7w9ZvAydA@mail.gmail.com
17 hoursTolerate partial pgstats entries in pgstat_gc_entry_refs()Michael Paquier
pgstat_get_entry_ref_cached() inserts a local entry_ref with shmem-related fields set to NULL, expecting pgstat_get_entry_ref() (its sole caller) to fill them up before returning. If an ERROR happens while pgstat_get_entry_ref() runs, it could be possible to finish with a local pgstats entry partially filled. This could lead to a crash of pgstat_gc_entry_refs(), which tolerates a NULL shared_stats in an assertion but unconditionally dereferenced its "dropped" and "generation" fields. This extends 4069df21beb8, being a cheap insurance against NULL pointer dereference, if some code paths of pgstat_get_entry_ref() are not able to perform any cleanup actions (for example after a dsm_create() throwing an ERROR). Reviewed-by: Grigorev Jurij <ju.grigorev@ftdata.ru> Discussion: https://postgr.es/m/aqtiKTvl519bu8-V@paquier.xyz Backpatch-through: 15
17 hoursFix REPACK worker startup and shutdown sequencesÁlvaro Herrera
A REPACK background worker can fail to start for various reasons, but the REPACK steering process was not handling them correctly. For instance, the steering process waits on a condition variable, but it would simply hang if the worker doesn't send the signal. (A signal would be sent by postmaster, but it would wake up the process only to be ignored and continue sleeping.) Fix this by splitting the wait in two: first wait for the worker to attach to the error queue, and then wait on the condition variable as before. The shutdown sequence can also get stuck, if the message queue gets full while trying to shut down (this can apparently happen if the log level is set to very noisy). Previously the worker would send a signal and then detach; but the steering process can receive that signal, act on it, then fail to wake up to handle the detach, sleeping indefinitely. Fix this by having the worker send a Terminate message, which the steering process can react to. Author: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com> Author: Shihao Zhong <zhong950419@gmail.com> Author: Álvaro Herrera <alvherre@kurilemu.de> Reviewed-by: Antonin Houska <ah@cybertec.at> Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com> Reviewed-by: Shihao Zhong <zhong950419@gmail.com> Reported-by: Nathan Bossart <nathandbossart@gmail.com> Reported-by: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com> Reported-by: Nikolay Samokhvalov <nik@postgres.ai> Backpatch-through: 19 Discussion: https://postgr.es/m/CALj2ACVAxA9HxvFe8HSspTJ-UO4Aoz%3DkuQdZBeLrod0gqUxH3g%40mail.gmail.com Discussion: https://postgr.es/m/apBpOVZOyqrakEr_@nathan
22 hoursFix assertion after aborting internal subtransaction at transaction endFujii Masao
Previously, aborting an internal subtransaction during COMMIT or PREPARE TRANSACTION could cause the following assertion failure. This could happen, for example, when a deferred constraint trigger fired at COMMIT and its PL/pgSQL exception block caught an error raised while executing the trigger function. TRAP: failed Assert("s->blockState == TBLOCK_SUBINPROGRESS || s->blockState == TBLOCK_INPROGRESS || s->blockState == TBLOCK_IMPLICIT_INPROGRESS || s->blockState == TBLOCK_PARALLEL_INPROGRESS || s->blockState == TBLOCK_STARTED"), File: "xact.c", Line: 4851, PID: 73455 An internal subtransaction should be able to be aborted while the parent transaction is in the COMMIT or PREPARE TRANSACTION phase. However, RollbackAndReleaseCurrentSubTransaction()'s assertion check previously did not allow TBLOCK_END and TBLOCK_PREPARE as parent transaction states, causing the assertion failure. This commit fixes the assertion check by allowing those two parent transaction states. Backpatch to all supported versions. Reported-by: Fabrízio de Royes Mello <fabrizio@planetscale.com> Author: Patrick Reynolds <piki@planetscale.com> Reviewed-by: Fujii Masao <masao.fujii@gmail.com> Reviewed-by: Chao Li <li.evan.chao@gmail.com> Reviewed-by: Fabrízio de Royes Mello <fabrizio@planetscale.com> Discussion: https://postgr.es/m/CABo-N97AeMbWuYTWg-3%3D2DkTR3EkvS%2BFt%3DyEaWB181STsR1mBg%40mail.gmail.com Backpatch-through: 14
24 hoursDistinguish publication exclusions in object addresses.Amit Kapila
A pg_publication_rel entry can represent either an explicitly published relation or a table excluded from a FOR ALL TABLES publication, but the object address code treated every entry as a published relation without checking prexcept. EXCEPT entries thus appeared as ordinary published-table mappings in dependency messages, pg_identify_object(), and pg_identify_object_as_address(). Report such entries as "publication excluded relation" instead, with object identities indicating that the table is excluded from the publication. pg_get_object_address() also accepts this new object type, so that the output of pg_identify_object_as_address() can still be passed back to it to look up the same object. "publication relation" now resolves only non-EXCEPT entries, and "publication excluded relation" only EXCEPT entries. Oversight in commit fd366065e06. Author: Fujii Masao <masao.fujii@gmail.com> Author: Vignesh C <vignesh21@gmail.com> Reviewed-by: shveta malik <shveta.malik@gmail.com> Reviewed-by: Peter Smith <smithpb2250@gmail.com> Reviewed-by: Zhijie Hou <houzj.fnst@fujitsu.com> Reviewed-by: Nisha Moond <nisha.moond412@gmail.com> Reviewed-by: Amit Kapila <amit.kapila16@gmail.com> Reviewed-by: Chao Li <li.evan.chao@gmail.com> Reviewed-by: Manuel Reyes Bravo <manuelreyesbravo@gmail.com> Discussion: https://postgr.es/m/CAHGQGwHfESBexa7fq99EvFCf31av=O9h9udnw22ymxmm6LMZzw@mail.gmail.com Backpatch-through: 19, where it was introduced
32 hoursFix online checksums revert leftoversDaniel Gustafsson
When reverting the online checksums feature in commit c05d5ce12366f10 I accidentally left the data checksum column in pg_control_checkpoint, removed setting the checksum init in pg_control_init and omitted the XLOG_PAGE_MAGIC bump required. Reported-by: Fujii Masao <masao.fujii@gmail.com> Reported-by: Manuel Reyes Bravo <manuelreyesbravo@gmail.com> Reported-by: Heikki Linnakangas <hlinnaka@iki.fi> Discussion: https://postgr.es/m/CAHGQGwH-wHTq4xd2dedEj0niDHkezcCT_OLmMpGp9NEHW4Dvkw@mail.gmail.com
39 hoursFix multixact members truncation at page boundaryHeikki Linnakangas
Like in PerformOffsetsTruncation() and e.g. in TruncateSUBTRANS(), need to step back to previous page at page boundary, to avoid passing a cutoff page to SimpleLruTruncate() that hasn't been created yet. Otherwise you can get a bogus 'LOG: could not truncate directory "pg_multixact/members": apparent wraparound' message in the log. Reported-by: Noah Misch <noah@leadboat.com> Discussion: https://www.postgresql.org/message-id/20260827231757.78.noahmisch@microsoft.com Backpatch-through: 19
41 hoursUse the join collation when unique-ifying a semijoin's RHSAlexander Korotkov
A semijoin whose RHS is unique-ified groups the RHS on the expressions in SpecialJoinInfo.semi_rhs_exprs. Those were recorded with whatever collation the RHS expression itself exposes, which need not be the collation the join compares with. Neither SortGroupClause nor the pathkey machinery carries a collation of its own, so both Unique-over-Sort and HashAggregate then grouped by the wrong equality: values the join considers equal survived, and the following inner join emitted the outer row once per survivor. With a non-deterministic collation on one side, "SELECT count(*) FROM t WHERE c IN (SELECT c0 FROM t2)" therefore counted more rows than the same predicate reports for the rows of t. Label each RHS expression with the operator's input collation, the same treatment process_equivalence() gives to equivalence class members. Every consumer of semi_rhs_exprs reads the collation off the expression, so this fixes the sort-based and hash-based paths together; in the branches where create_unique_path() also passes these expressions to relation_has_unique_index_for(), it likewise stops a unique index built with a different collation from being taken as proof that unique-ification can be skipped. The same goes for a subquery's DISTINCT computed under a different collation, since translate_sub_tlist() punts on the relabeled expressions. Reported-by: Suyang Zhong <syzhong16@gmail.com> Author: Andrey Rachitskiy <pl0h0yp1@gmail.com> Reviewed-by: Tender Wang <tndrwang@gmail.com> Reviewed-by: Richard Guo <guofenglinux@gmail.com> Reviewed-by: Alexander Korotkov <aekorotkov@gmail.com> Discussion: https://postgr.es/m/19633-647cd4c73a84b085%40postgresql.org Backpatch-through: 14
42 hoursFix index rebuild progress reporting for REPACK (CONCURRENTLY)Fujii Masao
Previously, during REPACK (CONCURRENTLY), index_rebuild_count in pg_stat_progress_repack and pg_stat_progress_cluster did not advance as indexes were rebuilt. This made it impossible for users monitoring the operation to tell how many indexes had been completed. Fix this by incrementing the count after each index is built on the new heap, so that both views report the number of completed index builds. Author: Fujii Masao <masao.fujii@gmail.com> Reviewed-by: Álvaro Herrera <alvherre@kurilemu.de> Discussion: https://postgr.es/m/CAHGQGwFUsrBvTurkSU8TEc=DZTunqteUXrasseqNMT7AMBZKRw@mail.gmail.com Backpatch-through: 19
42 hoursSuppress progress reporting when creating TOAST indexesFujii Masao
Previously, when REPACK, CLUSTER, or VACUUM FULL created a transient TOAST table, index_rebuild_count in pg_stat_progress_repack and pg_stat_progress_cluster reported 2 before any indexes on the main table had been rebuilt. This could mislead users monitoring the operation. This happened because creating the TOAST index writes the CREATE INDEX phase to the same progress slot used for the index rebuild count of the enclosing command. Fix this by passing INDEX_CREATE_SUPPRESS_PROGRESS when creating a TOAST index, preserving the progress information of the enclosing command and keeping the count at zero until the main-table indexes are rebuilt. Author: Adam Lee <adam8157@gmail.com> Reviewed-by: Fujii Masao <masao.fujii@gmail.com> Reviewed-by: Álvaro Herrera <alvherre@kurilemu.de> Discussion: https://postgr.es/m/aj4gJQMba0kClQmj@Mac Backpatch-through: 19
42 hoursRevert online data checksum transitionsDaniel Gustafsson
The feature to enable, or disable, data checksums in an online cluster saw a number of postcommit fixes during the beta period. Suspicions were raised about the risk of more issues surfacing after GA. To avoid shipping code which may have bugs, this reverts in full, or in part, the following commits: aaf8b9989f7, cd857dec0e0, 5fee7cab1b8, 25b922ec582, 8fb8ded8895, b3a37ffbc5b, abac86c7a27, 3a18526e8d6, 01805b7d16b, 343d98c3601, e469e4784ea, 8d22f523245, e5e1f6dc795, 5ab239c9a90, 0ca1b301059, 9a39056c418, 2018bd61679, 1df361e3d82, bf25e5571b3, 381d19da153, b120358c612, 07009121c23, d771b0a907e, f19c0eccae9, 0907112d388, 397f0fd06ed, 602f19c84ca, e3a27cad462, 4ae3e98c02c, b364828f825 A few bits remain as they have merit on their own: * The fix for offline checksums not preserving initial state in pg_control_init. The test case for this fix has been moved to src/bin/pg_checksums/t/002_actions.pl to survive the revert which removed the previous location. * When a page verification is logged, the additional note which informs if the buffer will be zeroed out was kept to aid any debugging around checksum failures. * The Data Checksum section in the docs was kept, but rewritten to reflect the current state. * The enum containing checksum states is kept and some hardcoded references to the off state (0) are replaced with the label PG_DATA_CHECKSUM_OFF instead. Discussion: https://postgr.es/m/E15AC050-C4B5-488D-BB2D-3C7AC9F89EA8@yesql.se Discussion: https://postgr.es/m/anwm6UPxoVS41QA2@bdtpg Discussion: https://postgr.es/m/CA+Tgmob9NY6m0YNFTQ4nFH2d0iC9SQRruDYxfndGKKzh8OC80w@mail.gmail.com Discussion: https://postgr.es/m/E07A611B-9CF3-4FDB-8CE8-A221E39040EC%40yesql.se
42 hoursMessage style improvementPeter Eisentraut
3 daysFail REPACK in presence of invalid indexes, take 2Álvaro Herrera
Commit 0c5d6269614e was confused about which indexes are potentially problematic to rebuild: we thought only !indisready indexes could fail to rebuild, and thus would attempt to rebuild !indisvalid ones that are "ready" (that is, being maintained by DML but not yet completed). However, that's wrong, because it could be that the validation phase of such an index failed or was interrupted partway through. So, have REPACK throw an error with all !indisvalid indexes, not just those !indisready. (!indisready implies !indisvalid, so this is an expansion of what happened with the previous commit.) Reported-by: shihao zhong <zhong950419@gmail.com> Backpatch-through: 19 Discussion: https://postgr.es/m/CAGRkXqRA4YetT8Nu3+1-45+ffTwi2bd1d1eDFME39Y9OPRMytQ@mail.gmail.com
3 daysFix missing SIREAD lock on the row found by ON CONFLICT.Dean Rasheed
INSERT ... ON CONFLICT decides what to do based on the conflicting row found by the arbiter index probe, but SSI never saw that read: the probe runs with a dirty snapshot, which predicate locking ignores, and the later fetch of the row uses SnapshotAny. When the statement then writes nothing, as with DO NOTHING, DO UPDATE with a WHERE clause rejecting the row, or DO SELECT, nothing records the read at all. A concurrent writer of that row went unnoticed and write skew could commit at SERIALIZABLE, even though the same schedule with a plain SELECT of the row fails with a serialization error. To fix, read the conflicting tuple again with the query snapshot, right where the probe finds it. The table AM takes the SIREAD lock and checks for a concurrent writer of the tuple as part of that read, both under the buffer lock, so a writer either sees the lock or is seen. A predicate lock by itself acquired separately after the probe could not offer that: a writer passing its conflict check in between would be missed. Doing this in the probe covers every conflict action, including rows that the WHERE clause of DO UPDATE or DO SELECT then rejects. The DO NOTHING and DO UPDATE cases have been broken since ON CONFLICT was added in 9.5; DO SELECT is new in v19. Backpatch to all supported branches. Author: Zsolt Parragi <zsolt.parragi@percona.com> Author: Andrey Borodin <x4mmm@yandex-team.ru> Reported-by: Andrey Borodin <x4mmm@yandex-team.ru> Reported-by: Zsolt Parragi <zsolt.parragi@percona.com> Discussion: https://postgr.es/m/787936C5-4155-4CF9-939D-39DC0EC1C892@yandex-team.ru Discussion: https://postgr.es/m/CAN4CZFM1GkHJkpMeo4G5rxtacVsfeKCJYiik9E9AKX1E9VYQ1w@mail.gmail.com Backpatch-through: 14
3 daysRevert UPDATE/DELETE FOR PORTION OFPeter Eisentraut
List of commits reverted: 8e72d914c52 Add UPDATE/DELETE FOR PORTION OF b6ccd30d8ff Add isolation tests for UPDATE/DELETE FOR PORTION OF 33db6c4baf1 Fix DELETE/UPDATE FOR PORTION OF with rules 7b22f15a015 Add psql tab completion for FOR PORTION OF clause 7ca8c942967 Fix FOR PORTION OF with non-updatable view columns 993a7aa0e4a Fix cross-leftover pollution in FOR PORTION OF insert triggers 7ac030d5b15 Require UPDATE permission on FOR PORTION OF column f0aedc7cb0e Small terminology fixes in comments 7d13b03a2e6 Fix FOR PORTION OF for inheritance children a272a58b942 Move FOR PORTION OF volatile check into planner a40fdf65886 Reject child partition FDWs in FOR PORTION OF bc3ae886a75 Forbid FOR PORTION OF with WHERE CURRENT OF c8d49ffb007 Forbid generated columns in FOR PORTION OF 5b5e99047ab Forbid FOR PORTION OF on views with INSTEAD OF triggers c58c83ce50c Fix RLS checks for FOR PORTION OF leftover rows 5454fe4a6e7 Test what BEFORE UPDATE triggers do to FOR PORTION OF 2a9541ddfd3 Deparse FOR PORTION OF using the range column's current name. fd92f74b91d Avoid RETURNING side effects for FOR PORTION OF leftovers. f3a116a26ff Enforce WITH CHECK OPTION on DELETE FOR PORTION OF leftovers c7e34c31e84 Fix error code for null FOR PORTION OF target 938f4f8f343 Fix assertion failures in DELETE FOR PORTION OF tuple routing f1940321687 Resolve untyped parameters in FOR PORTION OF FROM/TO bounds 98f6984e5c0 Don't evaluate the FOR PORTION OF target under EXPLAIN plus release notes entries. Discussion: https://www.postgresql.org/message-id/62bf70cc-dc33-4188-8070-a8c177bb61de%40eisentraut.org
3 daysUpdate FSM in COPY FREEZE replayMelanie Plageman
d96f87332b3 folded COPY FREEZE visibility map updates into XLOG_HEAP2_MULTI_INSERT records. Unlike the former XLOG_HEAP2_VISIBLE redo path, multi-insert redo only updated the FSM when the record did not contain a heap page FPI and the heap page had less than 20% free space. This can leave all-frozen pages with missing or stale FSM entries on a standby. After promotion, vacuum will skip those pages, preventing their free space from being discovered. When a multi-insert record sets the page all-frozen, record the heap page's free space unconditionally. Reported-by: Melanie Plageman <melanieplageman@gmail.com> Discussion: https://postgr.es/m/CAAKRu_bS3nfMJCF2fjE%2Bceb5-t%3D2p_VPMk2PWuVomrOFxg5DGQ%40mail.gmail.com Backpatch-through: 19
3 daysHandle no-op visibility map set during redoMelanie Plageman
add323da40a consolidated visibility map updates into XLOG_HEAP2_PRUNE records. It assumed that a record setting the visibility map would always modify the VM page during replay. That is not true when the requested bits are already set on the standby. Primary and standby visibility maps can diverge for several reasons. This issue was exposed by a CREATE DATABASE ... STRATEGY WAL_LOG bug. After a standby with an out-of-date VM is promoted, VACUUM may set bits that were already present on the former primary. When the former primary later replays that record as a standby, visibilitymap_set() is a no-op. Restore visibilitymap_set()'s former API, which returns the state of the VM bits before setting the requested flags. Use that result to set the VM page LSN only when the visibilitymap_set() updates the page. Reported-by: Rogers Wang <rogers.ww@qq.com> Discussion: https://postgr.es/m/tencent_2E870046716FD94285045E96505A2D4E2908%40qq.com Backpatch-through: 19
4 daysFix parallel GIN index build with keys larger than 65535 bytesPeter Eisentraut
During a parallel GIN build, each key is serialized into a GinTuple, a transient representation used only while sorting. _gin_build_tuple() lays out the whole tuple (the palloc size, the key memcpy, and the offset of the posting list) from a local variable holding the real key length, but then stored that length in GinTuple.keylen, which was uint16. For a key longer than 65535 bytes, the stored length was thus silently truncated. On read-back, GinTupleGetFirst() and _gin_parse_tuple_items() recompute the posting-list offset from the truncated keylen and land inside the key data, so ginPostingListDecodeAllSegments() decodes garbage: an assertion failure with assertions enabled, and a read past the end of the allocation without, which could in turn lead to a crash or garbage being written into the index. Only parallel builds are affected, because only they materialize a GinTuple; a serial build of the same data succeeds, as index_form_tuple() compresses large keys before the GinMaxItemSize check. To fix, widen GinTuple.keylen to Size, which is what VARSIZE_ANY() returns and what GinBuffer.keylen already uses, and use Size for the local in _gin_build_tuple() too, which was an int that truncated VARSIZE_ANY() the same way. Widening keylen moves GinTuple.data. The key value is accessed in place in data, so data must be MAXALIGN'ed; before, that was only true by accident of the field layout. Make that explicit with alignas(MAXIMUM_ALIGNOF) on data, so that the layout stays correct on 32-bit platforms, where Size is 4 bytes and would otherwise leave data under-aligned when MAXIMUM_ALIGNOF is 8. Bug: #19545 Author: Ewan Young <kdbase.hack@gmail.com> Reported-by: Yuelin Wang <1217816127@qq.com> Reviewed-by: Peter Eisentraut <peter@eisentraut.org> Discussion: https://www.postgresql.org/message-id/flat/19545-0f25b7e47351e8fc%40postgresql.org
4 daysAvoid setting pd_prune_xid when inserting frozen tuplesMelanie Plageman
378a216187a set pd_prune_xid on inserts so that on-access pruning could later set the pages all-visible. heap_multi_insert() skipped this only when setting the page all-frozen, but it can insert frozen tuples even when not setting the page all-frozen. Inserting frozen tuples should not set pd_prune_xid as they introduce no work for on-access pruning. Fix by only setting pd_prune_xid when inserting non-frozen tuples. Reported-by: Melanie Plageman <melanieplageman@gmail.com> Reviewed-by: Chao Li <li.evan.chao@gmail.com> Discussion: https://postgr.es/m/CAAKRu_a02pu7U2S0qPZ5L%2BoWb2m2Zp965sOKCCLnKUAKNo-hfg%40mail.gmail.com Backpatch-through: 19
4 daysDescribe special values in more GUC descriptions.Nathan Bossart
Commit 977d865c36 established some rules for mentioning special values (e.g., -1, 0, an empty string) in GUC descriptions. A few parameters either neglect to mention their special values or describe them in a way that doesn't follow those rules. Most of these parameters were added after the aforementioned commit. This commit fixes them. Reviewed-by: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com> Reviewed-by: Fujii Masao <masao.fujii@gmail.com> Reviewed-by: Chao Li <li.evan.chao@gmail.com> Reviewed-by: Álvaro Herrera <alvherre@kurilemu.de> Discussion: https://postgr.es/m/aqMkIpRr62cVqtCZ%40nathan Backpatch-through: 19
4 daysRename the WAIT FOR command to WAIT in the documentationAlexander Korotkov
The command tag is WAIT, but the reference page called the command "WAIT FOR" in its title, index entry, psql help name and throughout its prose, and so did the error messages. FOR is a noise word that makes the grammar read like English, exactly as INTO does for INSERT and FROM does for DELETE; neither of those is part of the command's name. Settle on WAIT everywhere the command is named, and keep WAIT FOR LSN wherever the syntax itself is being shown. Rename the reference page's id and file name to match, following cb2c696b1dd: v19 is not released, so the URL is not yet baked into a supported version, and every other page's id matches its title. Reported-by: Masahiko Sawada sawada.mshk@gmail.com Author: Xuneng Zhou xunengzhou@gmail.com Reviewed-by: Alexander Korotkov aekorotkov@gmail.com Discussion: https://postgr.es/m/CAD21AoBdtiPTbm7T_aNeDON9JpFG9g%3DJDUP4WU-Y8t8_xqvR5Q%40mail.gmail.com Backpatch-through: 19
4 daysFix timeout overflow in WAIT FOR LSNAlexander Korotkov
Commit 447aae13b03 accepted TIMEOUT values up to INT64_MAX milliseconds, but computing the deadline multiplies by 1000, which caused an int64 overflow. And the command reported a timeout at once instead of waiting. Parse the value as an int instead, which simplifies the code and is consistent with other timeout values such as the statement_timeout GUC. The specified values are now rounded to the nearest millisecond, so a positive timeout below half a millisecond becomes zero and waits indefinitely. Backpatch to v19, where the TIMEOUT option was introduced. Reported-by: ChangAo Chen <cca5507@qq.com> Author: ChangAo Chen <cca5507@qq.com> Reviewed-by: Xuneng Zhou <xunengzhou@gmail.com> Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com> Discussion: https://postgr.es/m/tencent_86B83240785807077600A1778566B5C12908@qq.com Backpatch-through: 19
4 daysDon't let JSON constructor coercions block SQL function inliningRichard Guo
contain_context_dependent_node_walker() reports a CaseTestExpr as context-dependent unless it sits under a simple CaseExpr or the elemexpr of an ArrayCoerceExpr. A JsonConstructorExpr whose RETURNING type requires a coercion also carries a CaseTestExpr placeholder in that coercion, so any SQL function called with such a constructor as an argument was refused inlining. Teach the walker that a CaseTestExpr is expected within the coercion of a JsonConstructorExpr, the same way it already handles the elemexpr of an ArrayCoerceExpr. This is safe now that eval_const_expressions no longer lets an enclosing simple CASE clobber that placeholder. Author: Richard Guo <guofenglinux@gmail.com> Discussion: https://postgr.es/m/CAMbWs48A=VCFbteTkuCoknO1_0-Cu0aMBT0M07dm7vj1QyixDg@mail.gmail.com Backpatch-through: 19
4 daysFix const-folding of JSON constructors inside a simple CASERichard Guo
A JSON constructor with a RETURNING clause uses a CaseTestExpr as the placeholder for its result in the coercion expression. When such a constructor appears in a WHEN clause of a simple CASE whose test expression is a constant, eval_const_expressions substituted that constant for the placeholder, so the coercion produced the CASE's test value instead of the constructor's result. For instance, CASE 'x' WHEN JSON_OBJECT('a': 'b' RETURNING text) THEN 1 ELSE 0 END evaluated to 1. To fix, keep case_val out of scope while simplifying the coercion, as is already done for the elemexpr of an ArrayCoerceExpr. Back-patch to v16, where the SQL/JSON constructor functions were introduced. Author: Richard Guo <guofenglinux@gmail.com> Discussion: https://postgr.es/m/CAMbWs48A=VCFbteTkuCoknO1_0-Cu0aMBT0M07dm7vj1QyixDg@mail.gmail.com Backpatch-through: 16
4 daysDisallow SET UNLOGGED for tables in a publication's EXCEPT clause.Amit Kapila
Unlogged tables cannot be replicated, so they can neither be published nor be named in a publication's EXCEPT clause. ALTER TABLE ... SET UNLOGGED checked only whether the table was published, so a table in an EXCEPT clause could still be made unlogged, leaving a state that CREATE PUBLICATION would reject and that pg_dump could not restore. Author: Vignesh C <vignesh21@gmail.com> Reviewed-by: Amit Kapila <amit.kapila16@gmail.com> Reviewed-by: Chao Li <li.evan.chao@gmail.com> Reviewed-by: shveta malik <shveta.malik@gmail.com> Reviewed-by: Hayato Kuroda <kuroda.hayato@fujitsu.com> Reviewed-by: Peter Smith <smithpb2250@gmail.com> Reviewed-by: Zhijie Hou <houzj.fnst@fujitsu.com> Discussion: https://postgr.es/m/CALDaNm1r2MkGu6h8zgU1Kj1sX-FcMQ7wGTeLSnhx-5joiyXEvg@mail.gmail.com Backpatch-through: 19, where it was introduced
4 daysFix stale copies of PHVs in subqueriesRichard Guo
When a subquery references an output of another subquery that gets pulled up, and that output must be wrapped in a PlaceHolderVar because of an intermediate outer join, the PHV expression is pushed down into the subquery. That copy is not preprocessed along with the outer query's expressions, so the two copies can diverge. This used to be harmless, but since commit 2ebf25e7d join removal edits the whole query tree, walking into subqueries, and can trip an assert in ChangeVarNodes if it removes a rel whose Var survives only in such a copy. To fix, preprocess these copies at their owning query level, early in subquery_planner, before anything can consume them (in particular before SubLinks are turned into SubPlans). This covers copies pushed into both LATERAL subquery RTEs and SubLink subselects, and handles nested copies innermost-first. extract_lateral_references no longer preprocesses the copies it pulls out. Correspondingly, the subquery's own processing must leave the contents of an upper-level PHV alone, since the owning level has already preprocessed them: eval_const_expressions returns such a PHV unchanged, and flatten_join_alias_vars no longer recurses into it. Back-patch to v16, as with commit 2ebf25e7d. Reported-by: Tender Wang <tndrwang@gmail.com> Author: Richard Guo <guofenglinux@gmail.com> Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> Discussion: https://postgr.es/m/CAHewXN=kWGAXV537mKtSyBYobGdHhYJVDJJMXXZEmmPWE_zaPw@mail.gmail.com Backpatch-through: 16
4 daysFix Makefile buildMichael Paquier
db169985c10f has missed once reference to ddlutils.c in adt's Makefile, making the build fail with ./configure. Meson was fine. Per buildfarm. Discussion: https://postgr.es/m/aqdaP73B-CIrmSPV@paquier.xyz Backpatch-through: 19, only
4 daysRevert pg_get_role_ddl(), pg_get_tablespace_ddl(), and pg_get_database_ddl().Andrew Dunstan
List of commits reverted: 4881981f920 Add infrastructure for pg_get_*_ddl functions 76e514ebb4b Add pg_get_role_ddl() function b99fd9fd7f3 Add pg_get_tablespace_ddl() function a4f774cf1c7 Add pg_get_database_ddl() function 6c7bce28c83 Fixups for a4f774cf1c7 1f108fc02ec Fix pfree crash in pg_get_role_ddl() and pg_get_database_ddl(). cda0c4c5d6f Reject invalid databases in pg_get_database_ddl() 79fba6ebaba doc: Fix missing role attribute in pg_get_tablespace_ddl() description. c529ee38b9e Convert ddlutils regression tests to TAP tests. df1bac400fb Fix timezone dependence in test_misc/012_ddlutils.pl 5642a0367c2 Avoid SIGSEGV in pg_get_database_ddl() on NULL tablespace 2af70e93747 Fix incorrect declarations of variadic pg_get_*_ddl() functions. d6ed87d1989 Use named boolean parameters for pg_get_*_ddl option arguments plus the corresponding release notes entries. Discussion: https://postgr.es/m/20260827015242.54.noahmisch@microsoft.com
5 daysFail REPACK in presence of !indisready indexesÁlvaro Herrera
Like VACUUM FULL, non-concurrent REPACK would try to rebuild such indexes, which can sometimes succeed. Concurrent REPACK would however fail. The inconsistency is not good, so make them both throw an error quickly to force the user to make a decision on those indexes (most likely, drop them). Author: Álvaro Herrera <alvherre@kurilemu.de> Reported-by: Zsolt Parragi <zsolt.parragi@percona.com> Suggested-by: Kyotaro Horiguchi <horikyota.ntt@gmail.com> Discussion: https://postgr.es/m/CAN4CZFO5A3YE0Dd-bn7eKrB20pECO3=U0wKg1z2rO=DxgWJJHQ@mail.gmail.com
5 daysRe-read standby LSN after recovery endsAlexander Korotkov
WaitForLSN() samples the current position before checking whether recovery is still in progress. If recovery reaches the target and ends between those operations, the promotion path can compare against the stale sample and incorrectly return NOT_IN_RECOVERY. Read the position again after observing that recovery has ended, before deciding whether promotion reached the target. Author: Xuneng Zhou <xunengzhou@gmail.com> Discussion: https://postgr.es/m/CABPTF7U0gW5%2B-4oL7-qdML-yerZxUb7ku4QXp7JxCYo0qyJ_Tw%40mail.gmail.com Reviewed-by: Alexander Korotkov <aekorotkov@gmail.com> Backpatch-through: 19
5 daysWake primary_flush waiters after implicit WAL flushesAlexander Korotkov
XLogWrite() can advance the flush position when it finishes a WAL segment, even if its caller requested only a write. When this happens while AdvanceXLInsertBuffer() recycles a buffer, primary_flush waiters are not notified and can sleep until an unrelated flush or checkpoint. Track such progress with a process-local pending flag and perform the wakeup after releasing WAL write and insertion locks, keeping WaitLSNLock acquisition outside the contended WAL path. Add a deterministic injection-point test that forces this path and inspects the registration directly in shared memory. Author: Xuneng Zhou <xunengzhou@gmail.com> Discussion: https://postgr.es/m/CABPTF7U0gW5%2B-4oL7-qdML-yerZxUb7ku4QXp7JxCYo0qyJ_Tw%40mail.gmail.com Reviewed-by: Alexander Korotkov <aekorotkov@gmail.com> Backpatch-through: 19
5 daysPrevent WAIT FOR LSN from deadlocking recovery on held locksAlexander Korotkov
A backend waiting for WAL replay can retain locks acquired by earlier statements. If the startup process needs one of those locks, directly or through another backend, before reaching the target LSN, a deadlock can arise: startup waits for the backend to release the lock, while the backend waits for startup to advance replay. The lock manager records the backend's held locks, but WAIT FOR LSN does not register its dependency on replay as a lock wait. The deadlock detector therefore cannot see the complete cycle. With unlimited standby conflict delays and no other timeout or cancellation, this deadlock can persist indefinitely. Write and flush waits are restricted as well. Their positions are floored by the replay position, so without an active walreceiver the startup process can be their only source of progress. If a held lock blocks replay, these waits can form the same cycle: the backend waits for replay to advance, while replay waits for the backend to release the lock. Streaming does advance them independently, but only while WAL keeps arriving. If reception stops before the target is reached, a blocked startup process cannot restart the walreceiver. It also cannot replay newer checkpoint records needed to advance restartpoints and recycle WAL, so continued reception can exhaust available space in pg_wal before the target is reached. An active receiver at the start of the wait therefore does not guarantee that the wait can finish while replay remains blocked. Reject an unsatisfied standby_replay, standby_write, or standby_flush wait while recovery is active when the backend already holds a granted heavyweight lock. This conservative restriction covers direct relation-lock cycles and indirect cycles involving advisory locks. It also rejects some write and flush waits that an active receiver could satisfy. Requests whose target is observed as already reached are exempt from this check, as are primary_flush requests and requests issued after recovery has ended. Existing snapshot and recovery-state checks still apply. Report one of the held locks so the user can find it, using the same description the deadlock report uses. Add replay-mode tests for relation and advisory locks and for the already-reached case, and document the restriction along with the recommended usage pattern. Author: Xuneng Zhou <xunengzhou@gmail.com> Discussion: https://postgr.es/m/CABPTF7U0gW5%2B-4oL7-qdML-yerZxUb7ku4QXp7JxCYo0qyJ_Tw%40mail.gmail.com Reviewed-by: Alexander Korotkov <aekorotkov@gmail.com> Backpatch-through: 19
6 daysMake on-access pruning pin visibility map before locking heap pageMelanie Plageman
b46e1e54d078 pinned the VM after acquiring a cleanup lock on the heap page when on-access pruning. This was not correct, as pinning the VM may require I/O. Pin the VM before acquiring the lock. This could mean occasional unneeded pinning when the buffer is under contention, but that should be rare. Reported-by: Melanie Plageman <melanieplageman@gmail.com> Reviewed-by: Chao Li <li.evan.chao@gmail.com> Discussion: https://postgr.es/m/CAAKRu_aR6e2mNVo-DNHDUfBE5i0cbE4%3Du%3D_Qi9%2Bv573qiGtBig%40mail.gmail.com Backpatch-through: 19
6 daysFix option argument lookup in in-tree getopt_long().Nathan Bossart
The in-tree getopt_long() moves each non-option to the end of argv, which might put it right where an option's argument lookup expects to find the argument. For example, "vacuumdb postgres --jobs" takes "postgres" as the number of jobs instead of complaining that --jobs is missing its argument. To fix, stop the argument lookups at the start of the moved non-options, which we already track to know when to stop scanning. Oversight in commit 411b720343. Author: Sehrope Sarkuni <sehrope@jackdb.com> Reviewed-by: solai v <solai.cdac@gmail.com> Discussion: https://postgr.es/m/CAH7T-arxDuVCSkorO%3Dk7%2BM-_JV0JFzMpN_EtKMyD2K0RDqZ2OA%40mail.gmail.com Backpatch-through: 17
6 daysFix logical decoding to ignore updates without a new tuple.Masahiko Sawada
REPACK (CONCURRENTLY) suppresses logical decoding of the changes it applies to the transient heap. For an update, suppression keeps the tuple data out of the WAL record, but the record itself is still written, and decoding turned it into a change carrying neither a new nor an old tuple. An output plugin that asks for the changes made by heap rewrites therefore outputs an UPDATE with no data at all, reported under the name of the table being repacked. Ignore such records, as decoding already does for inserts. Updates on catalog relations don't carry the new tuple either, so we ignore them too. For deletes, REPACK sets XLH_DELETE_NO_LOGICAL instead. Backpatch to v19, where REPACK (CONCURRENTLY) was introduced. Reported-by: Thom Brown <thom@linux.com> Reviewed-by: Zhijie Hou (Fujitsu) <houzj.fnst@fujitsu.com> Reviewed-by: Álvaro Herrera <alvherre@kurilemu.de> Discussion: https://postgr.es/m/CAA-aLv7L_-dOuHXjLh0Di66dExdOb=uTOzR=jtrqCmV0Wxyd2Q@mail.gmail.com Backpatch-through: 19
6 dayspg_ctl: Silence warnings about unused global variablesPeter Eisentraut
Several global variables are only used in Windows build. This causes -Wunused-but-set-global warnings that the new clang 23 enables via -Wall. This commit marks these with an unused attribute to silence the warnings. (In the master branch, this is addressed differently, but for backpatching, this just silences the warnings without any behavior change.) Reviewed-by: Andreas Karlsson <andreas@proxel.se> Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> Discussion: https://www.postgresql.org/message-id/flat/eb013f9d-2247-444e-8815-9d17b4ce78e7%40eisentraut.org
6 daysRemove unused global variablesPeter Eisentraut
The new clang 23 has a new warning about set-but-unused static (internal-linkage) global variables: -Wunused-but-set-global, which is activated in PostgreSQL builds via -Wall. This triggers a few warnings in PostgreSQL code. This commit removes several such variables that were either never used or whose last use was removed some time ago. Reviewed-by: Andreas Karlsson <andreas@proxel.se> Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> Discussion: https://www.postgresql.org/message-id/flat/eb013f9d-2247-444e-8815-9d17b4ce78e7%40eisentraut.org
6 daysFix heap_update() ignoring TABLE_UPDATE_NO_LOGICAL for TOAST tuples.Masahiko Sawada
Previously, heap_update() honored TABLE_UPDATE_NO_LOGICAL for the main tuple but passed a hardcoded 0 to the tuple toaster, so the tuples it wrote to the TOAST relation were logged for decoding anyway. That was harmless until commit 28d534e2ae0a gave updates the flag; the insert path has propagated its own ever since suppression was introduced for heap rewrites. REPACK (CONCURRENTLY), the only user of the flag, relies on it to keep the changes it applies to the transient heap out of the logical stream. Logical decoding therefore reassembled the TOAST value and then dereferenced a new tuple that the suppressed record doesn't carry, crashing the backend. This is reachable only if an output plugin asks for the changes made by heap rewrites. In core that is just test_decoding with include-rewrites. Fix this by passing HEAP_INSERT_NO_LOGICAL down to the tuple toaster when TABLE_UPDATE_NO_LOGICAL is set. Backpatch to v19, where REPACK (CONCURRENTLY) was introduced. Reported-by: Thom Brown <thom@linux.com> Author: Antonin Houska <ah@cybertec.at> Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com> Reviewed-by: Zhijie Hou (Fujitsu) <houzj.fnst@fujitsu.com> Reviewed-by: Álvaro Herrera <alvherre@kurilemu.de> Discussion: https://postgr.es/m/CAA-aLv7L_-dOuHXjLh0Di66dExdOb=uTOzR=jtrqCmV0Wxyd2Q@mail.gmail.com Backpatch-through: 19
6 daysRevert "Don't try to re-order the subcommands of CREATE SCHEMA".Tom Lane
This reverts commit a9c350d9ee66745aadcf7c0c95a567752a762171. While that intentionally changed our semantics for CREATE SCHEMA subcommands, it's being argued that the functionality gain does not justify potentially-subtle compatibility breakage. The most useful bit of functionality gain came from commit 404db8f9e ("Execute foreign key constraints in CREATE SCHEMA at the end"), which we're keeping because it's required by SQL spec and doesn't seem to create a compatibility hazard by itself. This is not an exact revert, partly because we're keeping 404db8f9e, and partly because I kept the API changes that allowed passing down a ParseState (which allows providing an error cursor for many of the errors thrown in CREATE SCHEMA). Author: Tom Lane <tgl@sss.pgh.pa.us> Discussion: https://postgr.es/m/20260904180712.cc.noahmisch@microsoft.com Backpatch-through: 19
6 daysRevert "Support more object types within CREATE SCHEMA".Tom Lane
This reverts commit d516974840f4059d331ae6057ede3e4edd3c6747, along with parts of commit 049b742daad0965be4a846035408ae27ce1f9e14 ("psql: Tighten heuristics for BEGIN/END within CREATE SCHEMA"). While there's nothing particularly wrong with d51697484 in itself, it depends on a9c350d9e ("Don't try to re-order the subcommands of CREATE SCHEMA"), and concerns have been raised that the compatibility impact of that outweighs the benefit of allowing more object types within CREATE SCHEMA. It's not possible to revert 049b742da verbatim, because the CVE-2026-6464 patches 3045a25ba ("Teach psql to skip in-line COPY ... FROM STDIN data after a failure") and cf754f741 ("Save/restore more lexer state when skipping text due to \if") depend on infrastructure it added. Instead, rip out just the bits specifically needed to parse CREATE FUNCTION within CREATE SCHEMA. This results in lexer code that matches v18-and-earlier as modified by CVE-2026-6464. Author: Tom Lane <tgl@sss.pgh.pa.us> Discussion: https://postgr.es/m/20260904180712.cc.noahmisch@microsoft.com Backpatch-through: 19
7 daysDisallow REPACK (CONCURRENTLY) when replica identity index is droppedÁlvaro Herrera
The replica identity determination was "flawed": it fell back to the primary key if the marked index was dropped, which is a defensible choice, but logical decoding has a differing opinion and fails to provide usable tuple identity data in this case. "Fix" REPACK by refusing to use the primary key in that case. This is arguably broken behavior in RelationGetIndexList, but I'll refrain from changing that at this stage. Reported-by: Nathan Bossart <nathandbossart@gmail.com> Author: Matthias van de Meent <boekewurm+postgres@gmail.com> Author: Ewan Young <kdbase.hack@gmail.com> Backpatch-through: 19 Discussion: https://postgr.es/m/apCBRKCH8jwKiaSY@nathan
7 daysFix crash on UPDATE or DELETE of a partition pending detach.Amit Kapila
ALTER TABLE ... DETACH PARTITION ... CONCURRENTLY leaves the partition marked as detach-pending if its wait is interrupted, and only DETACH PARTITION ... FINALIZE clears that mark. In that state pg_class still says relispartition while get_partition_ancestors() already reports nothing, which RelationBuildPublicationDesc() was not ready for. It took relispartition to mean that the ancestor list is not empty and asked for its last element, which is an assertion failure, or a NULL pointer dereference without assertions. CheckCmdReplicaIdentity() needs the descriptor for every UPDATE and DELETE of a publishable relation and builds it on first use, so no publication has to exist for this, and a plain UPDATE crashes the backend. Treat such a partition as a standalone table, as after the detach is finalized. It is then published by FOR ALL TABLES publications, but cannot be added to an EXCEPT clause until the detach completes, which is now reported with a hint to run DETACH PARTITION ... FINALIZE. Oversight in fd366065e06a, which added the exclusion. Author: Mikhail Nikalayeu <mihailnikalayeu@gmail.com> Author: shveta malik <shveta.malik@gmail.com> Author: Nisha Moond <nisha.moond412@gmail.com> Reviewed-by: shveta malik <shveta.malik@gmail.com> Reviewed-by: Amit Kapila <amit.kapila16@gmail.com> Reviewed-by: Zhijie Hou <houzj.fnst@fujitsu.com> Reviewed-by: Álvaro Herrera <alvherre@kurilemu.de> Reviewed-by: Nisha Moond <nisha.moond412@gmail.com> Discussion: https://postgr.es/m/CADzfLwWoFPT%2Ba73%3DA%3DbsNWRMZQ98NpBEMgE%3Dt1FS4O4_%3DQVLfA%40mail.gmail.com Backpatch-through: 19, where it was introduced
7 dayspsql: Schema-qualify catalogs in ALTER DATABASE RESET completionFujii Masao
The tab-completion query used for ALTER DATABASE ... RESET referenced pg_db_role_setting and pg_database without schema qualification, so a same-named relation earlier in search_path could be used instead of the system catalogs. This could make psql offer misleading RESET candidates. Commit dbf5a83d465 schema-qualified the unnest() call in this same query, but the catalog references were still left unqualified. Fix that by referring to pg_catalog.pg_db_role_setting and pg_catalog.pg_database explicitly. Backpatch to 18, where the tab-completion for ALTER DATABASE ... RESET was introduced. Bug: #19523 Reported-by: Zhou Digoal <digoal@126.com> Author: Vismay Tiwari <vismay.t@gmail.com> Reviewed-by: Paul Kim <mok03127@gmail.com> Reviewed-by: Kirill Reshke <reshkekirill@gmail.com> Reviewed-by: Fujii Masao <masao.fujii@gmail.com> Discussion: https://postgr.es/m/19523-424457118202f570@postgresql.org Discussion: https://postgr.es/m/CALHMmB84qkCgv3QAR78YawgfqQZCxSPkRhppxzU=e6fg8RA+AA@mail.gmail.com Backpatch-through: 18
7 daysFall back to SPI for RI checks with mismatched index collationsAmit Langote
The fast path probes using the referenced index's collation. When that collation differs from the referenced column's, it can reject valid references or accept invalid ones. Changing the scan key's collation is not sufficient, since btree navigation must use the ordering under which the index was built. Cache index eligibility lazily after locking the referenced table, reloading the constraint information, and opening the index. Compare index and column collations using the held relation descriptors, and fall back to SPI on a mismatch. Also move the btree eligibility check here, avoiding a lookup of an index that REINDEX CONCURRENTLY could drop before the referenced-table lock is acquired. Cache both acceptance and rejection until the constraint information is reloaded, so subsequent rows need not repeat the comparisons. Check before probing a row, and let the caller use SPI if the index is unsuitable. Add ICU regression coverage for per-row validation, ordinary inserts, reordered index columns, and both directions of collation mismatch. Reported-by: Amit Kapila <amit.kapila16@gmail.com> Discussion: https://postgr.es/m/CAA4eK1Lk1DfgiFPL-HccZm-Nm+exg+FcsODH8KPw6BOBuzfHtA@mail.gmail.com Backpatch-through: 19
7 daysValidate ALTER PUBLICATION after acquiring the publication lock.Amit Kapila
AlterPublicationOptions() can use stale publication state when the publication is modified concurrently while waiting for the publication lock. In particular, a concurrent ALTER PUBLICATION ... SET ALL TABLES can change puballtables, causing the validation to make decisions based on the old value and leads to assertion failure. Likewise, CheckAlterPublication() could miss a table added concurrently, letting SET ALL TABLES EXCEPT (...) leave pg_publication_rel with a mixture of inclusion and exclusion rows. Fix by acquiring the lock and re-reading the publication tuple in AlterPublication() before either path runs, and by calling CheckAlterPublication() only after that. Also fix 037_except.pl, which left one computed result untested and silently reused a subscription created by an earlier test. Author: Vignesh C <vignesh21@gmail.com> Reviewed-by: Amit Kapila <amit.kapila16@gmail.com> Reviewed-by: Chao Li <li.evan.chao@gmail.com> Reviewed-by: shveta malik <shveta.malik@gmail.com> Reviewed-by: Hayato Kuroda <kuroda.hayato@fujitsu.com> Discussion: https://postgr.es/m/CALDaNm1r2MkGu6h8zgU1Kj1sX-FcMQ7wGTeLSnhx-5joiyXEvg@mail.gmail.com Backpatch-through: 19, where it was introduced
7 daysRevert 87b2968df0 and 0a90df58cf.Jeff Davis
Those changes were intended to avoid dependencies on the global libc locale settings by basing identifier casefolding on the default locale. They introduced an unintentional behavior difference for the builtin provider with locale C and a single-byte encoding. Instead of fixing that edge case, just revert the changes. The identifier casefolding behavior has always been based on the global libc locale, and clients make an effort to use the same rules. Until we have a plan to change that, provider-specific identifier casefolding doesn't make sense. Reported-by: Noah Misch <noah@leadboat.com> Discussion: https://postgr.es/m/20260826225510.10.noahmisch@microsoft.com Backpatch-through: 19
7 daysRework REPACK's documentation on clusteringÁlvaro Herrera
Commit ac58465e0618 moved the discussion on clustering from CLUSTER's refpage to REPACK's, but somehow introduced a mistake regarding when exactly can the seqscan-and-sort strategy be used with respect to btrees (spoiler: it was 100% backwards). Fix that, but also restructure and reword the whole subsection more fully to try and make it more coherent. Author: Chao Li <li.evan.chao@gmail.com> Author: Álvaro Herrera <alvherre@kurilemu.de> Reported-by: Antonin Houska <ah@cybertec.at> Backpatch-through: 19 Discussion: https://postgr.es/m/69CA7636-0359-42B6-B971-16A036698187@gmail.com