From 54c6ea8c81db718508eeea50991d3c1c5dff54a5 Mon Sep 17 00:00:00 2001 From: Peter Geoghegan Date: Thu, 5 Jun 2025 14:50:43 -0400 Subject: [PATCH 01/91] nbtree: Remove useless row compare arg. Use of a RowCompare key makes nbtree index scans ineligible to use pstate.forcenonrequired following recent bugfix commit 5f4d98d4. There's no longer any need for _bt_check_rowcompare to accept a forcenonrequired argument, so remove it. --- src/backend/access/nbtree/nbtutils.c | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/src/backend/access/nbtree/nbtutils.c b/src/backend/access/nbtree/nbtutils.c index 1a15dfcb7d357..e0aa83fc8897b 100644 --- a/src/backend/access/nbtree/nbtutils.c +++ b/src/backend/access/nbtree/nbtutils.c @@ -63,7 +63,7 @@ static bool _bt_check_compare(IndexScanDesc scan, ScanDirection dir, bool *continuescan, int *ikey); static bool _bt_check_rowcompare(ScanKey skey, IndexTuple tuple, int tupnatts, TupleDesc tupdesc, - ScanDirection dir, bool forcenonrequired, bool *continuescan); + ScanDirection dir, bool *continuescan); static void _bt_checkkeys_look_ahead(IndexScanDesc scan, BTReadPageState *pstate, int tupnatts, TupleDesc tupdesc); static int _bt_keep_natts(Relation rel, IndexTuple lastleft, @@ -2902,8 +2902,10 @@ _bt_check_compare(IndexScanDesc scan, ScanDirection dir, /* row-comparison keys need special processing */ if (key->sk_flags & SK_ROW_HEADER) { + Assert(!forcenonrequired); /* forbidden by _bt_set_startikey */ + if (_bt_check_rowcompare(key, tuple, tupnatts, tupdesc, dir, - forcenonrequired, continuescan)) + continuescan)) continue; return false; } @@ -3060,8 +3062,7 @@ _bt_check_compare(IndexScanDesc scan, ScanDirection dir, */ static bool _bt_check_rowcompare(ScanKey skey, IndexTuple tuple, int tupnatts, - TupleDesc tupdesc, ScanDirection dir, - bool forcenonrequired, bool *continuescan) + TupleDesc tupdesc, ScanDirection dir, bool *continuescan) { ScanKey subkey = (ScanKey) DatumGetPointer(skey->sk_argument); int32 cmpresult = 0; @@ -3101,11 +3102,7 @@ _bt_check_rowcompare(ScanKey skey, IndexTuple tuple, int tupnatts, if (isNull) { - if (forcenonrequired) - { - /* treating scan's keys as non-required */ - } - else if (subkey->sk_flags & SK_BT_NULLS_FIRST) + if (subkey->sk_flags & SK_BT_NULLS_FIRST) { /* * Since NULLs are sorted before non-NULLs, we know we have @@ -3159,12 +3156,8 @@ _bt_check_rowcompare(ScanKey skey, IndexTuple tuple, int tupnatts, */ Assert(subkey != (ScanKey) DatumGetPointer(skey->sk_argument)); subkey--; - if (forcenonrequired) - { - /* treating scan's keys as non-required */ - } - else if ((subkey->sk_flags & SK_BT_REQFWD) && - ScanDirectionIsForward(dir)) + if ((subkey->sk_flags & SK_BT_REQFWD) && + ScanDirectionIsForward(dir)) *continuescan = false; else if ((subkey->sk_flags & SK_BT_REQBKWD) && ScanDirectionIsBackward(dir)) @@ -3216,7 +3209,7 @@ _bt_check_rowcompare(ScanKey skey, IndexTuple tuple, int tupnatts, break; } - if (!result && !forcenonrequired) + if (!result) { /* * Tuple fails this qual. If it's a required qual for the current From c37be39a74b25cc9c7b052ddae43061a6a2c6019 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Thu, 5 Jun 2025 15:24:15 -0400 Subject: [PATCH 02/91] Doc: improve description of which role runs a trigger. Refine wording from commit 01463e1cc. Author: Noah Misch Reviewed-by: Tom Lane Discussion: https://postgr.es/m/20250605163441.2f.nmisch@google.com --- doc/src/sgml/trigger.sgml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/doc/src/sgml/trigger.sgml b/doc/src/sgml/trigger.sgml index e9214dcf1b1bd..bb1b5faf34e31 100644 --- a/doc/src/sgml/trigger.sgml +++ b/doc/src/sgml/trigger.sgml @@ -129,10 +129,9 @@ In all cases, a trigger is executed as part of the same transaction as the statement that triggered it, so if either the statement or the trigger causes an error, the effects of both will be rolled back. - Also, the trigger will always run in the security context of the role - that executed the statement that caused the trigger to fire, unless - the trigger function is defined as SECURITY DEFINER, - in which case it will run as the function owner. + Also, the trigger will always run as the role that queued the trigger + event, unless the trigger function is marked as SECURITY + DEFINER, in which case it will run as the function owner. From 016e407f4ba10b230f5094c9ba36a1df3d34fb22 Mon Sep 17 00:00:00 2001 From: Robert Haas Date: Fri, 6 Jun 2025 08:18:27 -0400 Subject: [PATCH 03/91] pg_prewarm: Allow autoprewarm to use more than 1GB to dump blocks. Reported-by: Daria Shanina Author: Daria Shanina Author: Robert Haas Backpatch-through: 13 --- contrib/pg_prewarm/autoprewarm.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/contrib/pg_prewarm/autoprewarm.c b/contrib/pg_prewarm/autoprewarm.c index c52f4d4dc9ea2..c01b9c7e6a4d6 100644 --- a/contrib/pg_prewarm/autoprewarm.c +++ b/contrib/pg_prewarm/autoprewarm.c @@ -693,8 +693,15 @@ apw_dump_now(bool is_bgworker, bool dump_unlogged) return 0; } - block_info_array = - (BlockInfoRecord *) palloc(sizeof(BlockInfoRecord) * NBuffers); + /* + * With sufficiently large shared_buffers, allocation will exceed 1GB, so + * allow for a huge allocation to prevent outright failure. + * + * (In the future, it might be a good idea to redesign this to use a more + * memory-efficient data structure.) + */ + block_info_array = (BlockInfoRecord *) + palloc_extended((sizeof(BlockInfoRecord) * NBuffers), MCXT_ALLOC_HUGE); for (num_blocks = 0, i = 0; i < NBuffers; i++) { From e6eed40e44419e3268d01fe0d2daec08a7df68f7 Mon Sep 17 00:00:00 2001 From: Peter Geoghegan Date: Fri, 6 Jun 2025 10:19:44 -0400 Subject: [PATCH 04/91] Avoid BufferGetLSNAtomic() calls during nbtree scans. Delay calling BufferGetLSNAtomic() until we finish reading a page that actually contains items that btgettuple will return to the executor. This reduces the number of calls during plain index scans (we'll only call BufferGetLSNAtomic() when _bt_readpage returns true), and totally eliminates calls during index-only scans, bitmap index scans, and plain index scans of an unlogged relation. Currently, when checksums (or wal_log_hints) are enabled, acquiring a page's LSN in BufferGetLSNAtomic() involves locking the buffer header (which involves the use of spinlocks). Testing has shown that enabling page-level checksums causes large regressions with certain workloads, especially on larger multi-socket systems. The regression isn't tied to any Postgres 18 commit. However, Postgres 18 commit 04bec894 made initdb use checksums by default, so it seems prudent to address the problem now. Author: Peter Geoghegan Reviewed-By: Tomas Vondra Discussion: https://postgr.es/m/941f0190-e3c6-4622-9ac7-c04e936e5fdb@vondra.me Discussion: https://postgr.es/m/CAH2-Wzk-Dg5XWs_jDuiHt4_7ryrSY+n=vxmHY51EVqPDFsKXmg@mail.gmail.com --- src/backend/access/nbtree/nbtree.c | 30 ++++++++++++ src/backend/access/nbtree/nbtsearch.c | 70 ++++++++++++++------------- src/backend/access/nbtree/nbtutils.c | 68 ++++++++++++-------------- src/include/access/nbtree.h | 5 +- 4 files changed, 102 insertions(+), 71 deletions(-) diff --git a/src/backend/access/nbtree/nbtree.c b/src/backend/access/nbtree/nbtree.c index 765659887af73..03a1d7b027afc 100644 --- a/src/backend/access/nbtree/nbtree.c +++ b/src/backend/access/nbtree/nbtree.c @@ -228,6 +228,8 @@ btgettuple(IndexScanDesc scan, ScanDirection dir) BTScanOpaque so = (BTScanOpaque) scan->opaque; bool res; + Assert(scan->heapRelation != NULL); + /* btree indexes are never lossy */ scan->xs_recheck = false; @@ -289,6 +291,8 @@ btgetbitmap(IndexScanDesc scan, TIDBitmap *tbm) int64 ntids = 0; ItemPointer heapTid; + Assert(scan->heapRelation == NULL); + /* Each loop iteration performs another primitive index scan */ do { @@ -393,6 +397,32 @@ btrescan(IndexScanDesc scan, ScanKey scankey, int nscankeys, BTScanPosInvalidate(so->currPos); } + /* + * We prefer to eagerly drop leaf page pins before btgettuple returns. + * This avoids making VACUUM wait to acquire a cleanup lock on the page. + * + * We cannot safely drop leaf page pins during index-only scans due to a + * race condition involving VACUUM setting pages all-visible in the VM. + * It's also unsafe for plain index scans that use a non-MVCC snapshot. + * + * When we drop pins eagerly, the mechanism that marks so->killedItems[] + * index tuples LP_DEAD has to deal with concurrent TID recycling races. + * The scheme used to detect unsafe TID recycling won't work when scanning + * unlogged relations (since it involves saving an affected page's LSN). + * Opt out of eager pin dropping during unlogged relation scans for now + * (this is preferable to opting out of kill_prior_tuple LP_DEAD setting). + * + * Also opt out of dropping leaf page pins eagerly during bitmap scans. + * Pins cannot be held for more than an instant during bitmap scans either + * way, so we might as well avoid wasting cycles on acquiring page LSNs. + * + * See nbtree/README section on making concurrent TID recycling safe. + */ + so->dropPin = (!scan->xs_want_itup && + IsMVCCSnapshot(scan->xs_snapshot) && + RelationNeedsWAL(scan->indexRelation) && + scan->heapRelation != NULL); + so->markItemIndex = -1; so->needPrimScan = false; so->scanBehind = false; diff --git a/src/backend/access/nbtree/nbtsearch.c b/src/backend/access/nbtree/nbtsearch.c index fe9a3886913d8..070f14c8b91f0 100644 --- a/src/backend/access/nbtree/nbtsearch.c +++ b/src/backend/access/nbtree/nbtsearch.c @@ -25,7 +25,7 @@ #include "utils/rel.h" -static void _bt_drop_lock_and_maybe_pin(IndexScanDesc scan, BTScanPos sp); +static inline void _bt_drop_lock_and_maybe_pin(Relation rel, BTScanOpaque so); static Buffer _bt_moveright(Relation rel, Relation heaprel, BTScanInsert key, Buffer buf, bool forupdate, BTStack stack, int access); @@ -57,24 +57,29 @@ static bool _bt_endpoint(IndexScanDesc scan, ScanDirection dir); /* * _bt_drop_lock_and_maybe_pin() * - * Unlock the buffer; and if it is safe to release the pin, do that, too. - * This will prevent vacuum from stalling in a blocked state trying to read a - * page when a cursor is sitting on it. - * - * See nbtree/README section on making concurrent TID recycling safe. + * Unlock so->currPos.buf. If scan is so->dropPin, drop the pin, too. + * Dropping the pin prevents VACUUM from blocking on acquiring a cleanup lock. */ -static void -_bt_drop_lock_and_maybe_pin(IndexScanDesc scan, BTScanPos sp) +static inline void +_bt_drop_lock_and_maybe_pin(Relation rel, BTScanOpaque so) { - _bt_unlockbuf(scan->indexRelation, sp->buf); - - if (IsMVCCSnapshot(scan->xs_snapshot) && - RelationNeedsWAL(scan->indexRelation) && - !scan->xs_want_itup) + if (!so->dropPin) { - ReleaseBuffer(sp->buf); - sp->buf = InvalidBuffer; + /* Just drop the lock (not the pin) */ + _bt_unlockbuf(rel, so->currPos.buf); + return; } + + /* + * Drop both the lock and the pin. + * + * Have to set so->currPos.lsn so that _bt_killitems has a way to detect + * when concurrent heap TID recycling by VACUUM might have taken place. + */ + Assert(RelationNeedsWAL(rel)); + so->currPos.lsn = BufferGetLSNAtomic(so->currPos.buf); + _bt_relbuf(rel, so->currPos.buf); + so->currPos.buf = InvalidBuffer; } /* @@ -866,8 +871,8 @@ _bt_compare(Relation rel, * if backwards scan, the last item) in the tree that satisfies the * qualifications in the scan key. On success exit, data about the * matching tuple(s) on the page has been loaded into so->currPos. We'll - * drop all locks and hold onto a pin on page's buffer, except when - * _bt_drop_lock_and_maybe_pin dropped the pin to avoid blocking VACUUM. + * drop all locks and hold onto a pin on page's buffer, except during + * so->dropPin scans, when we drop both the lock and the pin. * _bt_returnitem sets the next item to return to scan on success exit. * * If there are no matching items in the index, we return false, with no @@ -1610,7 +1615,13 @@ _bt_readpage(IndexScanDesc scan, ScanDirection dir, OffsetNumber offnum, so->currPos.currPage = BufferGetBlockNumber(so->currPos.buf); so->currPos.prevPage = opaque->btpo_prev; so->currPos.nextPage = opaque->btpo_next; + /* delay setting so->currPos.lsn until _bt_drop_lock_and_maybe_pin */ + so->currPos.dir = dir; + so->currPos.nextTupleOffset = 0; + /* either moreRight or moreLeft should be set now (may be unset later) */ + Assert(ScanDirectionIsForward(dir) ? so->currPos.moreRight : + so->currPos.moreLeft); Assert(!P_IGNORE(opaque)); Assert(BTScanPosIsPinned(so->currPos)); Assert(!so->needPrimScan); @@ -1626,14 +1637,6 @@ _bt_readpage(IndexScanDesc scan, ScanDirection dir, OffsetNumber offnum, so->currPos.currPage); } - /* initialize remaining currPos fields related to current page */ - so->currPos.lsn = BufferGetLSNAtomic(so->currPos.buf); - so->currPos.dir = dir; - so->currPos.nextTupleOffset = 0; - /* either moreLeft or moreRight should be set now (may be unset later) */ - Assert(ScanDirectionIsForward(dir) ? so->currPos.moreRight : - so->currPos.moreLeft); - PredicateLockPage(rel, so->currPos.currPage, scan->xs_snapshot); /* initialize local variables */ @@ -2107,10 +2110,9 @@ _bt_returnitem(IndexScanDesc scan, BTScanOpaque so) * * Wrapper on _bt_readnextpage that performs final steps for the current page. * - * On entry, if so->currPos.buf is valid the buffer is pinned but not locked. - * If there's no pin held, it's because _bt_drop_lock_and_maybe_pin dropped - * the pin eagerly earlier on. The scan must have so->currPos.currPage set to - * a valid block, in any case. + * On entry, so->currPos must be valid. Its buffer will be pinned, though + * never locked. (Actually, when so->dropPin there won't even be a pin held, + * though so->currPos.currPage must still be set to a valid block number.) */ static bool _bt_steppage(IndexScanDesc scan, ScanDirection dir) @@ -2251,12 +2253,14 @@ _bt_readfirstpage(IndexScanDesc scan, OffsetNumber offnum, ScanDirection dir) */ if (_bt_readpage(scan, dir, offnum, true)) { + Relation rel = scan->indexRelation; + /* * _bt_readpage succeeded. Drop the lock (and maybe the pin) on * so->currPos.buf in preparation for btgettuple returning tuples. */ Assert(BTScanPosIsPinned(so->currPos)); - _bt_drop_lock_and_maybe_pin(scan, &so->currPos); + _bt_drop_lock_and_maybe_pin(rel, so); return true; } @@ -2294,8 +2298,8 @@ _bt_readfirstpage(IndexScanDesc scan, OffsetNumber offnum, ScanDirection dir) * * On success exit, so->currPos is updated to contain data from the next * interesting page, and we return true. We hold a pin on the buffer on - * success exit, except when _bt_drop_lock_and_maybe_pin decided it was safe - * to eagerly drop the pin (to avoid blocking VACUUM). + * success exit (except during so->dropPin index scans, when we drop the pin + * eagerly to avoid blocking VACUUM). * * If there are no more matching records in the given direction, we drop all * locks and pins, invalidate so->currPos, and return false. @@ -2413,7 +2417,7 @@ _bt_readnextpage(IndexScanDesc scan, BlockNumber blkno, */ Assert(so->currPos.currPage == blkno); Assert(BTScanPosIsPinned(so->currPos)); - _bt_drop_lock_and_maybe_pin(scan, &so->currPos); + _bt_drop_lock_and_maybe_pin(rel, so); return true; } diff --git a/src/backend/access/nbtree/nbtutils.c b/src/backend/access/nbtree/nbtutils.c index e0aa83fc8897b..29f0dca1b08aa 100644 --- a/src/backend/access/nbtree/nbtutils.c +++ b/src/backend/access/nbtree/nbtutils.c @@ -3335,75 +3335,71 @@ _bt_checkkeys_look_ahead(IndexScanDesc scan, BTReadPageState *pstate, * * Note that if we hold a pin on the target page continuously from initially * reading the items until applying this function, VACUUM cannot have deleted - * any items from the page, and so there is no need to search left from the - * recorded offset. (This observation also guarantees that the item is still - * the right one to delete, which might otherwise be questionable since heap - * TIDs can get recycled.) This holds true even if the page has been modified - * by inserts and page splits, so there is no need to consult the LSN. - * - * If the pin was released after reading the page, then we re-read it. If it - * has been modified since we read it (as determined by the LSN), we dare not - * flag any entries because it is possible that the old entry was vacuumed - * away and the TID was re-used by a completely different heap tuple. + * any items on the page, so the page's TIDs can't have been recycled by now. + * There's no risk that we'll confuse a new index tuple that happens to use a + * recycled TID with a now-removed tuple with the same TID (that used to be on + * this same page). We can't rely on that during scans that drop pins eagerly + * (so->dropPin scans), though, so we must condition setting LP_DEAD bits on + * the page LSN having not changed since back when _bt_readpage saw the page. */ void _bt_killitems(IndexScanDesc scan) { + Relation rel = scan->indexRelation; BTScanOpaque so = (BTScanOpaque) scan->opaque; Page page; BTPageOpaque opaque; OffsetNumber minoff; OffsetNumber maxoff; - int i; int numKilled = so->numKilled; bool killedsomething = false; - bool droppedpin PG_USED_FOR_ASSERTS_ONLY; + Assert(numKilled > 0); Assert(BTScanPosIsValid(so->currPos)); + Assert(scan->heapRelation != NULL); /* can't be a bitmap index scan */ - /* - * Always reset the scan state, so we don't look for same items on other - * pages. - */ + /* Always invalidate so->killedItems[] before leaving so->currPos */ so->numKilled = 0; - if (BTScanPosIsPinned(so->currPos)) + if (!so->dropPin) { /* * We have held the pin on this page since we read the index tuples, * so all we need to do is lock it. The pin will have prevented - * re-use of any TID on the page, so there is no need to check the - * LSN. + * concurrent VACUUMs from recycling any of the TIDs on the page. */ - droppedpin = false; - _bt_lockbuf(scan->indexRelation, so->currPos.buf, BT_READ); - - page = BufferGetPage(so->currPos.buf); + Assert(BTScanPosIsPinned(so->currPos)); + _bt_lockbuf(rel, so->currPos.buf, BT_READ); } else { Buffer buf; + XLogRecPtr latestlsn; - droppedpin = true; - /* Attempt to re-read the buffer, getting pin and lock. */ - buf = _bt_getbuf(scan->indexRelation, so->currPos.currPage, BT_READ); + Assert(!BTScanPosIsPinned(so->currPos)); + Assert(RelationNeedsWAL(rel)); + buf = _bt_getbuf(rel, so->currPos.currPage, BT_READ); - page = BufferGetPage(buf); - if (BufferGetLSNAtomic(buf) == so->currPos.lsn) - so->currPos.buf = buf; - else + latestlsn = BufferGetLSNAtomic(buf); + Assert(!XLogRecPtrIsInvalid(so->currPos.lsn)); + Assert(so->currPos.lsn <= latestlsn); + if (so->currPos.lsn != latestlsn) { - /* Modified while not pinned means hinting is not safe. */ - _bt_relbuf(scan->indexRelation, buf); + /* Modified, give up on hinting */ + _bt_relbuf(rel, buf); return; } + + /* Unmodified, hinting is safe */ + so->currPos.buf = buf; } + page = BufferGetPage(so->currPos.buf); opaque = BTPageGetOpaque(page); minoff = P_FIRSTDATAKEY(opaque); maxoff = PageGetMaxOffsetNumber(page); - for (i = 0; i < numKilled; i++) + for (int i = 0; i < numKilled; i++) { int itemIndex = so->killedItems[i]; BTScanPosItem *kitem = &so->currPos.items[itemIndex]; @@ -3435,7 +3431,7 @@ _bt_killitems(IndexScanDesc scan) * correctness. * * Note that the page may have been modified in almost any way - * since we first read it (in the !droppedpin case), so it's + * since we first read it (in the !so->dropPin case), so it's * possible that this posting list tuple wasn't a posting list * tuple when we first encountered its heap TIDs. */ @@ -3451,7 +3447,7 @@ _bt_killitems(IndexScanDesc scan) * though only in the common case where the page can't * have been concurrently modified */ - Assert(kitem->indexOffset == offnum || !droppedpin); + Assert(kitem->indexOffset == offnum || !so->dropPin); /* * Read-ahead to later kitems here. @@ -3518,7 +3514,7 @@ _bt_killitems(IndexScanDesc scan) MarkBufferDirtyHint(so->currPos.buf, true); } - _bt_unlockbuf(scan->indexRelation, so->currPos.buf); + _bt_unlockbuf(rel, so->currPos.buf); } diff --git a/src/include/access/nbtree.h b/src/include/access/nbtree.h index ebca02588d3e2..e709d2e0afe94 100644 --- a/src/include/access/nbtree.h +++ b/src/include/access/nbtree.h @@ -939,7 +939,7 @@ typedef BTVacuumPostingData *BTVacuumPosting; * processing. This approach minimizes lock/unlock traffic. We must always * drop the lock to make it okay for caller to process the returned items. * Whether or not we can also release the pin during this window will vary. - * We drop the pin eagerly (when safe) to avoid blocking progress by VACUUM + * We drop the pin (when so->dropPin) to avoid blocking progress by VACUUM * (see nbtree/README section about making concurrent TID recycling safe). * We'll always release both the lock and the pin on the current page before * moving on to its sibling page. @@ -967,7 +967,7 @@ typedef struct BTScanPosData BlockNumber currPage; /* page referenced by items array */ BlockNumber prevPage; /* currPage's left link */ BlockNumber nextPage; /* currPage's right link */ - XLogRecPtr lsn; /* currPage's LSN */ + XLogRecPtr lsn; /* currPage's LSN (when so->dropPin) */ /* scan direction for the saved position's call to _bt_readpage */ ScanDirection dir; @@ -1070,6 +1070,7 @@ typedef struct BTScanOpaqueData /* info about killed items if any (killedItems is NULL if never used) */ int *killedItems; /* currPos.items indexes of killed items */ int numKilled; /* number of currently stored items */ + bool dropPin; /* drop leaf pin before btgettuple returns? */ /* * If we are doing an index-only scan, these are the tuple storage From 304862973e9a77c31cbf05d10b8b71c1a2870e59 Mon Sep 17 00:00:00 2001 From: Nathan Bossart Date: Fri, 6 Jun 2025 11:40:52 -0500 Subject: [PATCH 05/91] Fixed signed/unsigned mismatch in test_dsm_registry. Oversight in commit 8b2bcf3f28. Reviewed-by: Masahiko Sawada Discussion: https://postgr.es/m/aECi_gSD9JnVWQ8T%40nathan Backpatch-through: 17 --- src/test/modules/test_dsm_registry/test_dsm_registry.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/test/modules/test_dsm_registry/test_dsm_registry.c b/src/test/modules/test_dsm_registry/test_dsm_registry.c index 462a80f8790d9..96a890be22826 100644 --- a/src/test/modules/test_dsm_registry/test_dsm_registry.c +++ b/src/test/modules/test_dsm_registry/test_dsm_registry.c @@ -54,7 +54,7 @@ set_val_in_shmem(PG_FUNCTION_ARGS) tdr_attach_shmem(); LWLockAcquire(&tdr_state->lck, LW_EXCLUSIVE); - tdr_state->val = PG_GETARG_UINT32(0); + tdr_state->val = PG_GETARG_INT32(0); LWLockRelease(&tdr_state->lck); PG_RETURN_VOID(); @@ -72,5 +72,5 @@ get_val_in_shmem(PG_FUNCTION_ARGS) ret = tdr_state->val; LWLockRelease(&tdr_state->lck); - PG_RETURN_UINT32(ret); + PG_RETURN_INT32(ret); } From a31767fc0935bf8dce884ed35dbe644516d0115e Mon Sep 17 00:00:00 2001 From: Nathan Bossart Date: Fri, 6 Jun 2025 12:08:17 -0500 Subject: [PATCH 06/91] Use NULL instead of 0 for pointer arguments. Commit 5fe08c006c fixed this for calls to dshash_create(). This commit fixes calls to dshash_attach() and dsa_create_in_place(). Reviewed-by: Masahiko Sawada Reviewed-by: Michael Paquier Discussion: https://postgr.es/m/aECi_gSD9JnVWQ8T%40nathan --- src/backend/replication/logical/launcher.c | 2 +- src/backend/utils/activity/pgstat_shmem.c | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/backend/replication/logical/launcher.c b/src/backend/replication/logical/launcher.c index 10677da56b2b6..1c3c051403dd6 100644 --- a/src/backend/replication/logical/launcher.c +++ b/src/backend/replication/logical/launcher.c @@ -1016,7 +1016,7 @@ logicalrep_launcher_attach_dshmem(void) last_start_times_dsa = dsa_attach(LogicalRepCtx->last_start_dsa); dsa_pin_mapping(last_start_times_dsa); last_start_times = dshash_attach(last_start_times_dsa, &dsh_params, - LogicalRepCtx->last_start_dsh, 0); + LogicalRepCtx->last_start_dsh, NULL); } MemoryContextSwitchTo(oldcontext); diff --git a/src/backend/utils/activity/pgstat_shmem.c b/src/backend/utils/activity/pgstat_shmem.c index 2e33293b00097..53e7d534270ac 100644 --- a/src/backend/utils/activity/pgstat_shmem.c +++ b/src/backend/utils/activity/pgstat_shmem.c @@ -183,7 +183,7 @@ StatsShmemInit(void) p += MAXALIGN(pgstat_dsa_init_size()); dsa = dsa_create_in_place(ctl->raw_dsa_area, pgstat_dsa_init_size(), - LWTRANCHE_PGSTATS_DSA, 0); + LWTRANCHE_PGSTATS_DSA, NULL); dsa_pin(dsa); /* @@ -255,7 +255,8 @@ pgstat_attach_shmem(void) dsa_pin_mapping(pgStatLocal.dsa); pgStatLocal.shared_hash = dshash_attach(pgStatLocal.dsa, &dsh_params, - pgStatLocal.shmem->hash_handle, 0); + pgStatLocal.shmem->hash_handle, + NULL); MemoryContextSwitchTo(oldcontext); } From 5b40feab594c3019fd6b09e46f97f5b367050cf9 Mon Sep 17 00:00:00 2001 From: Jeff Davis Date: Fri, 6 Jun 2025 15:28:51 -0700 Subject: [PATCH 07/91] Improve CREATE DATABASE error message for invalid libc locale. Discussion: https://postgr.es/m/73959a14-267b-49c1-8293-291b175682cb@manitou-mail.org Reviewed-by: Daniel Verite --- src/backend/commands/dbcommands.c | 41 +++++++++++++++++++++++++------ 1 file changed, 33 insertions(+), 8 deletions(-) diff --git a/src/backend/commands/dbcommands.c b/src/backend/commands/dbcommands.c index 5fbbcdaabb1d2..c95eb94501671 100644 --- a/src/backend/commands/dbcommands.c +++ b/src/backend/commands/dbcommands.c @@ -1065,16 +1065,41 @@ createdb(ParseState *pstate, const CreatedbStmt *stmt) /* Check that the chosen locales are valid, and get canonical spellings */ if (!check_locale(LC_COLLATE, dbcollate, &canonname)) - ereport(ERROR, - (errcode(ERRCODE_WRONG_OBJECT_TYPE), - errmsg("invalid LC_COLLATE locale name: \"%s\"", dbcollate), - errhint("If the locale name is specific to ICU, use ICU_LOCALE."))); + { + if (dblocprovider == COLLPROVIDER_BUILTIN) + ereport(ERROR, + (errcode(ERRCODE_WRONG_OBJECT_TYPE), + errmsg("invalid LC_COLLATE locale name: \"%s\"", dbcollate), + errhint("If the locale name is specific to the builtin provider, use BUILTIN_LOCALE."))); + else if (dblocprovider == COLLPROVIDER_ICU) + ereport(ERROR, + (errcode(ERRCODE_WRONG_OBJECT_TYPE), + errmsg("invalid LC_COLLATE locale name: \"%s\"", dbcollate), + errhint("If the locale name is specific to the ICU provider, use ICU_LOCALE."))); + else + ereport(ERROR, + (errcode(ERRCODE_WRONG_OBJECT_TYPE), + errmsg("invalid LC_COLLATE locale name: \"%s\"", dbcollate))); + } dbcollate = canonname; if (!check_locale(LC_CTYPE, dbctype, &canonname)) - ereport(ERROR, - (errcode(ERRCODE_WRONG_OBJECT_TYPE), - errmsg("invalid LC_CTYPE locale name: \"%s\"", dbctype), - errhint("If the locale name is specific to ICU, use ICU_LOCALE."))); + { + if (dblocprovider == COLLPROVIDER_BUILTIN) + ereport(ERROR, + (errcode(ERRCODE_WRONG_OBJECT_TYPE), + errmsg("invalid LC_CTYPE locale name: \"%s\"", dbctype), + errhint("If the locale name is specific to the builtin provider, use BUILTIN_LOCALE."))); + else if (dblocprovider == COLLPROVIDER_ICU) + ereport(ERROR, + (errcode(ERRCODE_WRONG_OBJECT_TYPE), + errmsg("invalid LC_CTYPE locale name: \"%s\"", dbctype), + errhint("If the locale name is specific to the ICU provider, use ICU_LOCALE."))); + else + ereport(ERROR, + (errcode(ERRCODE_WRONG_OBJECT_TYPE), + errmsg("invalid LC_CTYPE locale name: \"%s\"", dbctype))); + } + dbctype = canonname; check_encoding_locale_matches(encoding, dbcollate, dbctype); From 1a857348e47dc4f1bbf104e746abe542c99004e8 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Sat, 7 Jun 2025 09:03:11 +0200 Subject: [PATCH 08/91] plpython: Remove obsolete test expected file Move plpython_error_5.out to plpython_error.out, since the pre-3.5 version is no longer needed, since we raised the Python requirement to 3.6 (commit 45363fca637). Reviewed-by: Tom Lane Reviewed-by: Jacob Champion Discussion: https://www.postgresql.org/message-id/d620e7c6-becc-4a8e-9b43-eea0da55faf2@eisentraut.org --- src/pl/plpython/expected/README | 3 - src/pl/plpython/expected/plpython_error.out | 2 +- src/pl/plpython/expected/plpython_error_5.out | 460 ------------------ 3 files changed, 1 insertion(+), 464 deletions(-) delete mode 100644 src/pl/plpython/expected/README delete mode 100644 src/pl/plpython/expected/plpython_error_5.out diff --git a/src/pl/plpython/expected/README b/src/pl/plpython/expected/README deleted file mode 100644 index 388c553a5890a..0000000000000 --- a/src/pl/plpython/expected/README +++ /dev/null @@ -1,3 +0,0 @@ -Guide to alternative expected files: - -plpython_error_5.out Python 3.5 and newer diff --git a/src/pl/plpython/expected/plpython_error.out b/src/pl/plpython/expected/plpython_error.out index 68722b00097ed..fd9cd73be743a 100644 --- a/src/pl/plpython/expected/plpython_error.out +++ b/src/pl/plpython/expected/plpython_error.out @@ -243,7 +243,7 @@ $$ plpy.nonexistent $$ LANGUAGE plpython3u; SELECT toplevel_attribute_error(); -ERROR: AttributeError: 'module' object has no attribute 'nonexistent' +ERROR: AttributeError: module 'plpy' has no attribute 'nonexistent' CONTEXT: Traceback (most recent call last): PL/Python function "toplevel_attribute_error", line 2, in plpy.nonexistent diff --git a/src/pl/plpython/expected/plpython_error_5.out b/src/pl/plpython/expected/plpython_error_5.out deleted file mode 100644 index fd9cd73be743a..0000000000000 --- a/src/pl/plpython/expected/plpython_error_5.out +++ /dev/null @@ -1,460 +0,0 @@ --- test error handling, i forgot to restore Warn_restart in --- the trigger handler once. the errors and subsequent core dump were --- interesting. -/* Flat out Python syntax error - */ -CREATE FUNCTION python_syntax_error() RETURNS text - AS -'.syntaxerror' - LANGUAGE plpython3u; -ERROR: could not compile PL/Python function "python_syntax_error" -DETAIL: SyntaxError: invalid syntax (, line 2) -/* With check_function_bodies = false the function should get defined - * and the error reported when called - */ -SET check_function_bodies = false; -CREATE FUNCTION python_syntax_error() RETURNS text - AS -'.syntaxerror' - LANGUAGE plpython3u; -SELECT python_syntax_error(); -ERROR: could not compile PL/Python function "python_syntax_error" -DETAIL: SyntaxError: invalid syntax (, line 2) -/* Run the function twice to check if the hashtable entry gets cleaned up */ -SELECT python_syntax_error(); -ERROR: could not compile PL/Python function "python_syntax_error" -DETAIL: SyntaxError: invalid syntax (, line 2) -RESET check_function_bodies; -/* Flat out syntax error - */ -CREATE FUNCTION sql_syntax_error() RETURNS text - AS -'plpy.execute("syntax error")' - LANGUAGE plpython3u; -SELECT sql_syntax_error(); -ERROR: spiexceptions.SyntaxError: syntax error at or near "syntax" -LINE 1: syntax error - ^ -QUERY: syntax error -CONTEXT: Traceback (most recent call last): - PL/Python function "sql_syntax_error", line 1, in - plpy.execute("syntax error") -PL/Python function "sql_syntax_error" -/* check the handling of uncaught python exceptions - */ -CREATE FUNCTION exception_index_invalid(text) RETURNS text - AS -'return args[1]' - LANGUAGE plpython3u; -SELECT exception_index_invalid('test'); -ERROR: IndexError: list index out of range -CONTEXT: Traceback (most recent call last): - PL/Python function "exception_index_invalid", line 1, in - return args[1] -PL/Python function "exception_index_invalid" -/* check handling of nested exceptions - */ -CREATE FUNCTION exception_index_invalid_nested() RETURNS text - AS -'rv = plpy.execute("SELECT test5(''foo'')") -return rv[0]' - LANGUAGE plpython3u; -SELECT exception_index_invalid_nested(); -ERROR: spiexceptions.UndefinedFunction: function test5(unknown) does not exist -LINE 1: SELECT test5('foo') - ^ -HINT: No function matches the given name and argument types. You might need to add explicit type casts. -QUERY: SELECT test5('foo') -CONTEXT: Traceback (most recent call last): - PL/Python function "exception_index_invalid_nested", line 1, in - rv = plpy.execute("SELECT test5('foo')") -PL/Python function "exception_index_invalid_nested" -/* a typo - */ -CREATE FUNCTION invalid_type_uncaught(a text) RETURNS text - AS -'if "plan" not in SD: - q = "SELECT fname FROM users WHERE lname = $1" - SD["plan"] = plpy.prepare(q, [ "test" ]) -rv = plpy.execute(SD["plan"], [ a ]) -if len(rv): - return rv[0]["fname"] -return None -' - LANGUAGE plpython3u; -SELECT invalid_type_uncaught('rick'); -ERROR: spiexceptions.UndefinedObject: type "test" does not exist -CONTEXT: Traceback (most recent call last): - PL/Python function "invalid_type_uncaught", line 3, in - SD["plan"] = plpy.prepare(q, [ "test" ]) -PL/Python function "invalid_type_uncaught" -/* for what it's worth catch the exception generated by - * the typo, and return None - */ -CREATE FUNCTION invalid_type_caught(a text) RETURNS text - AS -'if "plan" not in SD: - q = "SELECT fname FROM users WHERE lname = $1" - try: - SD["plan"] = plpy.prepare(q, [ "test" ]) - except plpy.SPIError as ex: - plpy.notice(str(ex)) - return None -rv = plpy.execute(SD["plan"], [ a ]) -if len(rv): - return rv[0]["fname"] -return None -' - LANGUAGE plpython3u; -SELECT invalid_type_caught('rick'); -NOTICE: type "test" does not exist - invalid_type_caught ---------------------- - -(1 row) - -/* for what it's worth catch the exception generated by - * the typo, and reraise it as a plain error - */ -CREATE FUNCTION invalid_type_reraised(a text) RETURNS text - AS -'if "plan" not in SD: - q = "SELECT fname FROM users WHERE lname = $1" - try: - SD["plan"] = plpy.prepare(q, [ "test" ]) - except plpy.SPIError as ex: - plpy.error(str(ex)) -rv = plpy.execute(SD["plan"], [ a ]) -if len(rv): - return rv[0]["fname"] -return None -' - LANGUAGE plpython3u; -SELECT invalid_type_reraised('rick'); -ERROR: plpy.Error: type "test" does not exist -CONTEXT: Traceback (most recent call last): - PL/Python function "invalid_type_reraised", line 6, in - plpy.error(str(ex)) -PL/Python function "invalid_type_reraised" -/* no typo no messing about - */ -CREATE FUNCTION valid_type(a text) RETURNS text - AS -'if "plan" not in SD: - SD["plan"] = plpy.prepare("SELECT fname FROM users WHERE lname = $1", [ "text" ]) -rv = plpy.execute(SD["plan"], [ a ]) -if len(rv): - return rv[0]["fname"] -return None -' - LANGUAGE plpython3u; -SELECT valid_type('rick'); - valid_type ------------- - -(1 row) - -/* error in nested functions to get a traceback -*/ -CREATE FUNCTION nested_error() RETURNS text - AS -'def fun1(): - plpy.error("boom") - -def fun2(): - fun1() - -def fun3(): - fun2() - -fun3() -return "not reached" -' - LANGUAGE plpython3u; -SELECT nested_error(); -ERROR: plpy.Error: boom -CONTEXT: Traceback (most recent call last): - PL/Python function "nested_error", line 10, in - fun3() - PL/Python function "nested_error", line 8, in fun3 - fun2() - PL/Python function "nested_error", line 5, in fun2 - fun1() - PL/Python function "nested_error", line 2, in fun1 - plpy.error("boom") -PL/Python function "nested_error" -/* raising plpy.Error is just like calling plpy.error -*/ -CREATE FUNCTION nested_error_raise() RETURNS text - AS -'def fun1(): - raise plpy.Error("boom") - -def fun2(): - fun1() - -def fun3(): - fun2() - -fun3() -return "not reached" -' - LANGUAGE plpython3u; -SELECT nested_error_raise(); -ERROR: plpy.Error: boom -CONTEXT: Traceback (most recent call last): - PL/Python function "nested_error_raise", line 10, in - fun3() - PL/Python function "nested_error_raise", line 8, in fun3 - fun2() - PL/Python function "nested_error_raise", line 5, in fun2 - fun1() - PL/Python function "nested_error_raise", line 2, in fun1 - raise plpy.Error("boom") -PL/Python function "nested_error_raise" -/* using plpy.warning should not produce a traceback -*/ -CREATE FUNCTION nested_warning() RETURNS text - AS -'def fun1(): - plpy.warning("boom") - -def fun2(): - fun1() - -def fun3(): - fun2() - -fun3() -return "you''ve been warned" -' - LANGUAGE plpython3u; -SELECT nested_warning(); -WARNING: boom - nested_warning --------------------- - you've been warned -(1 row) - -/* AttributeError at toplevel used to give segfaults with the traceback -*/ -CREATE FUNCTION toplevel_attribute_error() RETURNS void AS -$$ -plpy.nonexistent -$$ LANGUAGE plpython3u; -SELECT toplevel_attribute_error(); -ERROR: AttributeError: module 'plpy' has no attribute 'nonexistent' -CONTEXT: Traceback (most recent call last): - PL/Python function "toplevel_attribute_error", line 2, in - plpy.nonexistent -PL/Python function "toplevel_attribute_error" -/* Calling PL/Python functions from SQL and vice versa should not lose context. - */ -CREATE OR REPLACE FUNCTION python_traceback() RETURNS void AS $$ -def first(): - second() - -def second(): - third() - -def third(): - plpy.execute("select sql_error()") - -first() -$$ LANGUAGE plpython3u; -CREATE OR REPLACE FUNCTION sql_error() RETURNS void AS $$ -begin - select 1/0; -end -$$ LANGUAGE plpgsql; -CREATE OR REPLACE FUNCTION python_from_sql_error() RETURNS void AS $$ -begin - select python_traceback(); -end -$$ LANGUAGE plpgsql; -CREATE OR REPLACE FUNCTION sql_from_python_error() RETURNS void AS $$ -plpy.execute("select sql_error()") -$$ LANGUAGE plpython3u; -SELECT python_traceback(); -ERROR: spiexceptions.DivisionByZero: division by zero -CONTEXT: Traceback (most recent call last): - PL/Python function "python_traceback", line 11, in - first() - PL/Python function "python_traceback", line 3, in first - second() - PL/Python function "python_traceback", line 6, in second - third() - PL/Python function "python_traceback", line 9, in third - plpy.execute("select sql_error()") -PL/Python function "python_traceback" -SELECT sql_error(); -ERROR: division by zero -CONTEXT: SQL statement "select 1/0" -PL/pgSQL function sql_error() line 3 at SQL statement -SELECT python_from_sql_error(); -ERROR: spiexceptions.DivisionByZero: division by zero -CONTEXT: Traceback (most recent call last): - PL/Python function "python_traceback", line 11, in - first() - PL/Python function "python_traceback", line 3, in first - second() - PL/Python function "python_traceback", line 6, in second - third() - PL/Python function "python_traceback", line 9, in third - plpy.execute("select sql_error()") -PL/Python function "python_traceback" -SQL statement "select python_traceback()" -PL/pgSQL function python_from_sql_error() line 3 at SQL statement -SELECT sql_from_python_error(); -ERROR: spiexceptions.DivisionByZero: division by zero -CONTEXT: Traceback (most recent call last): - PL/Python function "sql_from_python_error", line 2, in - plpy.execute("select sql_error()") -PL/Python function "sql_from_python_error" -/* check catching specific types of exceptions - */ -CREATE TABLE specific ( - i integer PRIMARY KEY -); -CREATE FUNCTION specific_exception(i integer) RETURNS void AS -$$ -from plpy import spiexceptions -try: - plpy.execute("insert into specific values (%s)" % (i or "NULL")); -except spiexceptions.NotNullViolation as e: - plpy.notice("Violated the NOT NULL constraint, sqlstate %s" % e.sqlstate) -except spiexceptions.UniqueViolation as e: - plpy.notice("Violated the UNIQUE constraint, sqlstate %s" % e.sqlstate) -$$ LANGUAGE plpython3u; -SELECT specific_exception(2); - specific_exception --------------------- - -(1 row) - -SELECT specific_exception(NULL); -NOTICE: Violated the NOT NULL constraint, sqlstate 23502 - specific_exception --------------------- - -(1 row) - -SELECT specific_exception(2); -NOTICE: Violated the UNIQUE constraint, sqlstate 23505 - specific_exception --------------------- - -(1 row) - -/* SPI errors in PL/Python functions should preserve the SQLSTATE value - */ -CREATE FUNCTION python_unique_violation() RETURNS void AS $$ -plpy.execute("insert into specific values (1)") -plpy.execute("insert into specific values (1)") -$$ LANGUAGE plpython3u; -CREATE FUNCTION catch_python_unique_violation() RETURNS text AS $$ -begin - begin - perform python_unique_violation(); - exception when unique_violation then - return 'ok'; - end; - return 'not reached'; -end; -$$ language plpgsql; -SELECT catch_python_unique_violation(); - catch_python_unique_violation -------------------------------- - ok -(1 row) - -/* manually starting subtransactions - a bad idea - */ -CREATE FUNCTION manual_subxact() RETURNS void AS $$ -plpy.execute("savepoint save") -plpy.execute("create table foo(x integer)") -plpy.execute("rollback to save") -$$ LANGUAGE plpython3u; -SELECT manual_subxact(); -ERROR: plpy.SPIError: SPI_execute failed: SPI_ERROR_TRANSACTION -CONTEXT: Traceback (most recent call last): - PL/Python function "manual_subxact", line 2, in - plpy.execute("savepoint save") -PL/Python function "manual_subxact" -/* same for prepared plans - */ -CREATE FUNCTION manual_subxact_prepared() RETURNS void AS $$ -save = plpy.prepare("savepoint save") -rollback = plpy.prepare("rollback to save") -plpy.execute(save) -plpy.execute("create table foo(x integer)") -plpy.execute(rollback) -$$ LANGUAGE plpython3u; -SELECT manual_subxact_prepared(); -ERROR: plpy.SPIError: SPI_execute_plan failed: SPI_ERROR_TRANSACTION -CONTEXT: Traceback (most recent call last): - PL/Python function "manual_subxact_prepared", line 4, in - plpy.execute(save) -PL/Python function "manual_subxact_prepared" -/* raising plpy.spiexception.* from python code should preserve sqlstate - */ -CREATE FUNCTION plpy_raise_spiexception() RETURNS void AS $$ -raise plpy.spiexceptions.DivisionByZero() -$$ LANGUAGE plpython3u; -DO $$ -BEGIN - SELECT plpy_raise_spiexception(); -EXCEPTION WHEN division_by_zero THEN - -- NOOP -END -$$ LANGUAGE plpgsql; -/* setting a custom sqlstate should be handled - */ -CREATE FUNCTION plpy_raise_spiexception_override() RETURNS void AS $$ -exc = plpy.spiexceptions.DivisionByZero() -exc.sqlstate = 'SILLY' -raise exc -$$ LANGUAGE plpython3u; -DO $$ -BEGIN - SELECT plpy_raise_spiexception_override(); -EXCEPTION WHEN SQLSTATE 'SILLY' THEN - -- NOOP -END -$$ LANGUAGE plpgsql; -/* test the context stack trace for nested execution levels - */ -CREATE FUNCTION notice_innerfunc() RETURNS int AS $$ -plpy.execute("DO LANGUAGE plpython3u $x$ plpy.notice('inside DO') $x$") -return 1 -$$ LANGUAGE plpython3u; -CREATE FUNCTION notice_outerfunc() RETURNS int AS $$ -plpy.execute("SELECT notice_innerfunc()") -return 1 -$$ LANGUAGE plpython3u; -\set SHOW_CONTEXT always -SELECT notice_outerfunc(); -NOTICE: inside DO -CONTEXT: PL/Python anonymous code block -SQL statement "DO LANGUAGE plpython3u $x$ plpy.notice('inside DO') $x$" -PL/Python function "notice_innerfunc" -SQL statement "SELECT notice_innerfunc()" -PL/Python function "notice_outerfunc" - notice_outerfunc ------------------- - 1 -(1 row) - -/* test error logged with an underlying exception that includes a detail - * string (bug #18070). - */ -CREATE FUNCTION python_error_detail() RETURNS SETOF text AS $$ - plan = plpy.prepare("SELECT to_date('xy', 'DD') d") - for row in plpy.cursor(plan): - yield row['d'] -$$ LANGUAGE plpython3u; -SELECT python_error_detail(); -ERROR: error fetching next item from iterator -DETAIL: spiexceptions.InvalidDatetimeFormat: invalid value "xy" for "DD" -CONTEXT: Traceback (most recent call last): -PL/Python function "python_error_detail" From 37e5f0b61fa8aad82a0b06438ed95c282ace994a Mon Sep 17 00:00:00 2001 From: Bruce Momjian Date: Sat, 7 Jun 2025 11:06:25 -0400 Subject: [PATCH 09/91] doc PG 18 relnotes: adjust wording of initdb item 48814415d5a And move to the top of the incompatibility list. This will impact users more than any other incompatibility item because of pg_upgrade. --- doc/src/sgml/release-18.sgml | 39 +++++++++++++++++------------------- 1 file changed, 18 insertions(+), 21 deletions(-) diff --git a/doc/src/sgml/release-18.sgml b/doc/src/sgml/release-18.sgml index 19e770c65b5dc..268fa88cbe0e7 100644 --- a/doc/src/sgml/release-18.sgml +++ b/doc/src/sgml/release-18.sgml @@ -53,6 +53,24 @@ + + + + +Change initdb default to enable data checksums +§ + + + +Checksums can be disabled with the new initdb option --no-data-checksums. +pg_upgrade requires matching cluster checksum settings, so this new +option can be useful to upgrade non-checksum old clusters. + + + - - - -initdb defaults to enabling data checksums -§ - - - -The previous default behavior (checksums disabled) can be obtained using the -new option --no-data-checksums. Note that pg_upgrade will reject upgrading -between clusters with different checksum settings, so if the old cluster does -not have checksums enabled (the previous default), then the new cluster will -need to be initialized with --no-data-checksums in order to allow pg_upgrade -to succeed. - From 73e26cbeb5927053eea4e209e5eda34a30c353f1 Mon Sep 17 00:00:00 2001 From: Bruce Momjian Date: Sat, 7 Jun 2025 11:25:17 -0400 Subject: [PATCH 10/91] doc PG 18 relnotes: add AFTER trigger user change item Reported-by: Noah Misch Discussion: https://postgr.es/m/20250603172123.5f.nmisch@google.com --- doc/src/sgml/release-18.sgml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/doc/src/sgml/release-18.sgml b/doc/src/sgml/release-18.sgml index 268fa88cbe0e7..c5e60f88fdf15 100644 --- a/doc/src/sgml/release-18.sgml +++ b/doc/src/sgml/release-18.sgml @@ -157,6 +157,22 @@ Previously ALTER TABLE SET [UN]LOGGED did nothing, and the creation of an unlogg + + + + +Execute AFTER triggers as the role that was active when trigger events were queued (Laurenz Albe) + + + +Previously such triggers were run as the role that was active at trigger execution time (e.g., at COMMIT). This is significant for cases where the role is changed between queue time and +transaction commit. + + + @@ -1980,7 +1981,7 @@ Author: Tom Lane -Add function array_sort() which sorts an array's first dimension (Junwang Zhao, Jian He) +Add function array_sort() which sorts an array's first dimension (Junwang Zhao, Jian He) § @@ -1992,7 +1993,7 @@ Author: Michael Paquier -Add function array_reverse() which reverses an array's first dimension (Aleksander Alekseev) +Add function array_reverse() which reverses an array's first dimension (Aleksander Alekseev) § @@ -2004,7 +2005,7 @@ Author: Nathan Bossart -Add function reverse() to reverse bytea bytes (Aleksander Alekseev) +Add function reverse() to reverse bytea bytes (Aleksander Alekseev) § @@ -2016,12 +2017,12 @@ Author: Dean Rasheed -Allow casting between integer types and bytea (Aleksander Alekseev) +Allow casting between integer types and bytea (Aleksander Alekseev) § -The integer values are stored as bytea two's complement values. +The integer values are stored as bytea two's complement values. @@ -2056,12 +2057,12 @@ Author: Tom Lane -Improve the XML error codes to more closely match the SQL standard (Tom Lane) +Improve the XML error codes to more closely match the SQL standard (Tom Lane) § -These errors are reported via SQLSTATE. +These errors are reported via SQLSTATE. @@ -2081,12 +2082,12 @@ Author: Jeff Davis -Add function CASEFOLD() to allow for more sophisticated case-insensitive matching (Jeff Davis) +Add function CASEFOLD() to allow for more sophisticated case-insensitive matching (Jeff Davis) § -Allows more accurate comparison, i.e., a character can have multiple upper or lower case equivalents, or upper or lower case conversion changes the number of characters. +This allows more accurate comparisons, i.e., a character can have multiple upper or lower case equivalents, or upper or lower case conversion changes the number of characters. @@ -2099,7 +2100,7 @@ Author: Tom Lane -Allow MIN()/MAX() aggregates on arrays and composite types (Aleksander Alekseev, Marat Buharov) +Allow MIN()/MAX() aggregates on arrays and composite types (Aleksander Alekseev, Marat Buharov) § § @@ -2112,7 +2113,7 @@ Author: Tom Lane -Add a WEEK option to EXTRACT() (Tom Lane) +Add a WEEK option to EXTRACT() (Tom Lane) § @@ -2124,7 +2125,7 @@ Author: Tom Lane -Improve the output EXTRACT(QUARTER ...) for negative values (Tom Lane) +Improve the output EXTRACT(QUARTER ...) for negative values (Tom Lane) § @@ -2136,12 +2137,12 @@ Author: Tom Lane -Add roman numeral support to to_number() (Hunaid Sohail) +Add roman numeral support to to_number() (Hunaid Sohail) § -This is accessed via the "RN" pattern. +This is accessed via the RN pattern. @@ -2152,12 +2153,12 @@ Author: Masahiko Sawada -Add UUID version 7 generation function uuidv7() (Andrey Borodin) +Add UUID version 7 generation function uuidv7() (Andrey Borodin) § -This UUID value is temporally sortable. Function alias uuidv4() has been added to explicitly generate version 4 UUIDs. +This UUID value is temporally sortable. Function alias uuidv4() has been added to explicitly generate version 4 UUIDs. @@ -2168,7 +2169,7 @@ Author: Nathan Bossart -Add functions crc32() and crc32c() to compute CRC values (Aleksander Alekseev) +Add functions crc32() and crc32c() to compute CRC values (Aleksander Alekseev) § @@ -2180,7 +2181,7 @@ Author: Dean Rasheed -Add math functions gamma() and lgamma() (Dean Rasheed) +Add math functions gamma() and lgamma() (Dean Rasheed) § @@ -2192,12 +2193,12 @@ Author: Tom Lane -Allow "=>" syntax for named cursor arguments in plpgsql (Pavel Stehule) +Allow => syntax for named cursor arguments in plpgsql (Pavel Stehule) § -We previously only accepted ":=". +We previously only accepted :=. @@ -2208,7 +2209,7 @@ Author: Tom Lane -Allow regexp_match[es]/regexp_like/regexp_replace/regexp_count/regexp_instr/regexp_substr/regexp_split_to_table/regexp_split_to_array() to use named arguments (Jian He) +Allow regexp_match[es]()/regexp_like()/regexp_replace()/regexp_count()/regexp_instr()/regexp_substr()/regexp_split_to_table()/regexp_split_to_array() to use named arguments (Jian He) § @@ -2229,7 +2230,7 @@ Author: Robert Haas -Add function PQfullProtocolVersion() to report the full, including minor, protocol version number (Jacob Champion, Jelte Fennema-Nio) +Add function PQfullProtocolVersion() to report the full, including minor, protocol version number (Jacob Champion, Jelte Fennema-Nio) § @@ -2256,7 +2257,7 @@ Author: Michael Paquier -Add libpq function PQservice() to return the connection service name (Michael Banck) +Add libpq function PQservice() to return the connection service name (Michael Banck) § @@ -2270,7 +2271,7 @@ Author: Tomas Vondra -Report search_path changes to the client (Alexander Kukushkin, Jelte Fennema-Nio, Tomas Vondra) +Report search_path changes to the client (Alexander Kukushkin, Jelte Fennema-Nio, Tomas Vondra) § § @@ -2291,7 +2292,7 @@ Author: Álvaro Herrera -Add PQtrace() output for all message types, including authentication (Jelte Fennema-Nio) +Add PQtrace() output for all message types, including authentication (Jelte Fennema-Nio) § § § @@ -2307,7 +2308,7 @@ Author: Daniel Gustafsson -Add libpq connection parameter sslkeylogfile which dumps out SSL key material (Abhishek Chanda, Daniel Gustafsson) +Add libpq connection parameter sslkeylogfile which dumps out SSL key material (Abhishek Chanda, Daniel Gustafsson) § @@ -2323,12 +2324,12 @@ Author: Thomas Munro -Modify some libpq function signatures to use int64_t (Thomas Munro) +Modify some libpq function signatures to use int64_t (Thomas Munro) § -These previously used pg_int64, which is now deprecated. +These previously used pg_int64, which is now deprecated. @@ -2348,12 +2349,12 @@ Author: Michael Paquier -Allow psql to parse, bind, and close named prepared statements (Anthonin Bonnefoy, Michael Paquier) +Allow psql to parse, bind, and close named prepared statements (Anthonin Bonnefoy, Michael Paquier) § -This is accomplished with new commands \parse, \bind_named, and \close. +This is accomplished with new commands \parse, \bind_named, and \close. @@ -2368,14 +2369,14 @@ Author: Michael Paquier -Add psql backslash commands to allowing issuance of pipeline queries (Anthonin Bonnefoy) +Add psql backslash commands to allowing issuance of pipeline queries (Anthonin Bonnefoy) § § § -The new commands are \startpipeline, \syncpipeline, \sendpipeline, \endpipeline, \flushrequest, \flush, and \getresults. +The new commands are \startpipeline, \syncpipeline, \sendpipeline, \endpipeline, \flushrequest, \flush, and \getresults. @@ -2386,12 +2387,12 @@ Author: Michael Paquier -Allow adding pipeline status to the psql prompt and add related state variables (Anthonin Bonnefoy) +Allow adding pipeline status to the psql prompt and add related state variables (Anthonin Bonnefoy) § -The new prompt character is "%P" and the new psql variables are PIPELINE_SYNC_COUNT, PIPELINE_COMMAND_COUNT, and PIPELINE_RESULT_COUNT. +The new prompt character is %P and the new psql variables are PIPELINE_SYNC_COUNT, PIPELINE_COMMAND_COUNT, and PIPELINE_RESULT_COUNT. @@ -2402,7 +2403,7 @@ Author: Michael Paquier -Allow adding the connection service name to the psql prompt or access it via psql variable (Michael Banck) +Allow adding the connection service name to the psql prompt or access it via psql variable (Michael Banck) § @@ -2414,12 +2415,12 @@ Author: Dean Rasheed -Add psql option to use expanded mode on all list commands (Dean Rasheed) +Add psql option to use expanded mode on all list commands (Dean Rasheed) § -Adding 'x' enables this. +Adding backslash suffix x enables this. @@ -2430,7 +2431,7 @@ Author: Álvaro Herrera -Change psql's \conninfo to use tabular format and include more information (Álvaro Herrera, Maiquel Grassi, Hunaid Sohail) +Change psql's \conninfo to use tabular format and include more information (Álvaro Herrera, Maiquel Grassi, Hunaid Sohail) § @@ -2442,7 +2443,7 @@ Author: Dean Rasheed -Add function's leakproof indicator to psql's \df+, \do+, \dAo+, and \dC+ outputs (Yugo Nagata) +Add function's leakproof indicator to psql's \df+, \do+, \dAo+, and \dC+ outputs (Yugo Nagata) § @@ -2454,7 +2455,7 @@ Author: Michael Paquier -Add access method details for partitioned relations in \dP+ (Justin Pryzby) +Add access method details for partitioned relations in \dP+ (Justin Pryzby) § @@ -2466,7 +2467,7 @@ Author: Magnus Hagander -Add "default_version" to the psql \dx extension output (Magnus Hagander) +Add default_version to the psql \dx extension output (Magnus Hagander) § @@ -2478,7 +2479,7 @@ Author: Daniel Gustafsson -Add psql variable WATCH_INTERVAL to set the default \watch wait time (Daniel Gustafsson) +Add psql variable WATCH_INTERVAL to set the default \watch wait time (Daniel Gustafsson) § @@ -2501,13 +2502,13 @@ Author: Peter Eisentraut -Change initdb to default to enabling checksums (Greg Sabino Mullane) +Change initdb to default to enabling checksums (Greg Sabino Mullane) § § -The new initdb option --no-data-checksums disables checksums. +The new initdb option disables checksums. @@ -2518,12 +2519,12 @@ Author: Nathan Bossart -Add initdb option --no-sync-data-files to avoid syncing heap/index files (Nathan Bossart) +Add initdb option to avoid syncing heap/index files (Nathan Bossart) § -initdb --no-sync is still available to avoid syncing any files. +initdb option is still available to avoid syncing any files. @@ -2536,13 +2537,13 @@ Author: Nathan Bossart -Add vacuumdb option --missing-stats-only to compute only missing optimizer statistics (Corey Huinker, Nathan Bossart) +Add vacuumdb option to compute only missing optimizer statistics (Corey Huinker, Nathan Bossart) § § -This option can only be used by --analyze-only and --analyze-in-stages. +This option can only be used by and . @@ -2553,7 +2554,7 @@ Author: Robert Haas -Add pg_combinebackup option -k/--link to enable hard linking (Israel Barth Rubio, Robert Haas) +Add pg_combinebackup option / to enable hard linking (Israel Barth Rubio, Robert Haas) § @@ -2569,7 +2570,7 @@ Author: Robert Haas -Allow pg_verifybackup to verify tar-format backups (Amul Sul) +Allow pg_verifybackup to verify tar-format backups (Amul Sul) § @@ -2581,7 +2582,7 @@ Author: Masahiko Sawada -If pg_rewind's --source-server specifies a database name, use it in --write-recovery-conf output (Masahiko Sawada) +If pg_rewind's specifies a database name, use it in output (Masahiko Sawada) § @@ -2593,7 +2594,7 @@ Author: Masahiko Sawada -Add pg_resetwal option --char-signedness to change the default char signedness (Masahiko Sawada) +Add pg_resetwal option to change the default char signedness (Masahiko Sawada) § @@ -2616,12 +2617,12 @@ Author: Andrew Dunstan -Allow pg_dumpall to dump in the same output formats as pg_dump supports (Mahendra Singh Thalor, Andrew Dunstan) +Allow pg_dumpall to dump in the same output formats as pg_dump supports (Mahendra Singh Thalor, Andrew Dunstan) § -Also modify pg_restore to handle such dumps. Previously pg_dumpall only supported text format. +Also modify pg_restore to handle such dumps. Previously pg_dumpall only supported text format. @@ -2632,7 +2633,7 @@ Author: Jeff Davis -Add pg_dump options --with-schema, --with-data, and --with-statistics (Jeff Davis) +Add pg_dump options , , and (Jeff Davis) § @@ -2646,7 +2647,7 @@ Author: Nathan Bossart -Add pg_dump and pg_dumpall option --sequence-data to dump sequence data that would normally be excluded (Nathan Bossart) +Add pg_dump and pg_dumpall option to dump sequence data that would normally be excluded (Nathan Bossart) § § @@ -2659,7 +2660,7 @@ Author: Jeff Davis -Add pg_dump, pg_dumpall, and pg_restore options --statistics-only, --no-statistics, --no-data, and --no-schema (Corey Huinker, Jeff Davis) +Add pg_dump, pg_dumpall, and pg_restore options , , , and (Corey Huinker, Jeff Davis) § @@ -2671,7 +2672,7 @@ Author: Tom Lane -Add option --no-policies to disable row level security policy processing in pg_dump, pg_dumpall, pg_restore (Nikolay Samokhvalov) +Add option to disable row level security policy processing in pg_dump, pg_dumpall, pg_restore (Nikolay Samokhvalov) § @@ -2702,7 +2703,7 @@ Author: Jeff Davis -Allow pg_upgrade to preserve optimizer statistics (Corey Huinker, Jeff Davis, Nathan Bossart) +Allow pg_upgrade to preserve optimizer statistics (Corey Huinker, Jeff Davis, Nathan Bossart) § § § @@ -2710,7 +2711,7 @@ Allow pg_upgrade to preserve optimizer statistics (Corey Huinker, Jeff Davis, Na -Extended statistics are not preserved. Also add pg_upgrade option --no-statistics to disable statistics preservation. +Extended statistics are not preserved. Also add pg_upgrade option to disable statistics preservation. @@ -2741,7 +2742,7 @@ Author: Nathan Bossart -Allow pg_upgrade to process database checks in parallel (Nathan Bossart) +Allow pg_upgrade to process database checks in parallel (Nathan Bossart) § § § @@ -2756,7 +2757,7 @@ Allow pg_upgrade to process database checks in parallel (Nathan Bossart) -This is controlled by the existing --jobs option. +This is controlled by the existing option. @@ -2767,7 +2768,7 @@ Author: Nathan Bossart -Add pg_upgrade option --swap to swap directories rather than copy, clone, or link files (Nathan Bossart) +Add pg_upgrade option to swap directories rather than copy, clone, or link files (Nathan Bossart) § @@ -2785,13 +2786,13 @@ Author: Masahiko Sawada -Add pg_upgrade option --set-char-signedness to set the default char signedness of new cluster (Masahiko Sawada) +Add pg_upgrade option to set the default char signedness of new cluster (Masahiko Sawada) § § -This is to handle cases where a pre-Postgres 18 cluster's default CPU signedness does not match the new cluster. +This is to handle cases where a pre-PostgreSQL 18 cluster's default CPU signedness does not match the new cluster. @@ -2811,7 +2812,7 @@ Author: Amit Kapila -Add pg_createsubscriber option --all to create logical replicas for all databases (Shubham Khanna) +Add pg_createsubscriber option to create logical replicas for all databases (Shubham Khanna) § @@ -2823,7 +2824,7 @@ Author: Amit Kapila -Add pg_createsubscriber option --remove to remove publications (Shubham Khanna) +Add pg_createsubscriber option to remove publications (Shubham Khanna) § @@ -2835,7 +2836,7 @@ Author: Amit Kapila -Add pg_createsubscriber option --enable-two-phase to enable prepared transactions (Shubham Khanna) +Add pg_createsubscriber option to enable prepared transactions (Shubham Khanna) § @@ -2847,7 +2848,7 @@ Author: Masahiko Sawada -Add pg_recvlogical option --failover to specify failover slots (Hayato Kuroda) +Add pg_recvlogical option to specify failover slots (Hayato Kuroda) § @@ -2859,7 +2860,7 @@ Author: Fujii Masao -Allow pg_recvlogical --drop-slot to work without --dbname (Hayato Kuroda) +Allow pg_recvlogical to work without (Hayato Kuroda) § @@ -2890,7 +2891,7 @@ Separate the loading and running of injection points (Michael Paquier, Heikki Li -Injection points can now be created, but not run, via INJECTION_POINT_LOAD(), and such injection points can be run via INJECTION_POINT_CACHED(). +Injection points can now be created, but not run, via INJECTION_POINT_LOAD(), and such injection points can be run via INJECTION_POINT_CACHED(). @@ -2913,7 +2914,7 @@ Author: Heikki Linnakangas -Allow inline injection point test code with IS_INJECTION_POINT_ATTACHED() (Heikki Linnakangas) +Allow inline injection point test code with IS_INJECTION_POINT_ATTACHED() (Heikki Linnakangas) § @@ -2925,7 +2926,7 @@ Author: David Rowley -Improve the performance of processing long JSON strings using SIMD instructions (David Rowley) +Improve the performance of processing long JSON strings using SIMD instructions (David Rowley) § @@ -2937,7 +2938,7 @@ Author: John Naylor -Speed up CRC32C calculations using x86 AVX-512 instructions (Raghuveer Devulapalli, Paul Amonson) +Speed up CRC32C calculations using x86 AVX-512 instructions (Raghuveer Devulapalli, Paul Amonson) § @@ -2951,7 +2952,7 @@ Author: Nathan Bossart -Add ARM Neon and SVE CPU intrinsics for popcount (integer bit counting) (Chiranmoy Bhattacharya, Devanga Susmitha, Rama Malladi) +Add ARM Neon and SVE CPU intrinsics for popcount (integer bit counting) (Chiranmoy Bhattacharya, Devanga Susmitha, Rama Malladi) § § @@ -2989,15 +2990,15 @@ Author: Tomas Vondra -Add configure option --with-libnuma to enable NUMA awareness (Jakub Wartak, Bertrand Drouvot) +Add configure option to enable NUMA awareness (Jakub Wartak, Bertrand Drouvot) § § § -The function pg_numa_available() reports on NUMA awareness, and system views pg_shmem_allocations_numa and pg_buffercache_numa which report on shared memory distribution across -NUMA nodes. +The function pg_numa_available() reports on NUMA awareness, and system views pg_shmem_allocations_numa and pg_buffercache_numa which report on shared memory distribution across +NUMA nodes. @@ -3008,7 +3009,7 @@ Author: Nathan Bossart -Add TOAST table to pg_index to allow for very large index expression indexes (Nathan Bossart) +Add TOAST table to pg_index to allow for very large expression indexes (Nathan Bossart) § @@ -3020,7 +3021,8 @@ Author: David Rowley -Remove column pg_attribute.attcacheoff (David Rowley) +Remove column +pg_attribute.attcacheoff (David Rowley) § @@ -3032,7 +3034,7 @@ Author: Melanie Plageman -Add column pg_class.relallfrozen (Melanie Plageman) +Add column pg_class.relallfrozen (Melanie Plageman) § @@ -3046,7 +3048,7 @@ Author: Peter Eisentraut -Add amgettreeheight, amconsistentequality, and amconsistentordering to the index access method API (Mark Dilger) +Add amgettreeheight, amconsistentequality, and amconsistentordering to the index access method API (Mark Dilger) § § @@ -3059,7 +3061,7 @@ Author: Peter Eisentraut -Add GiST support function stratnum (Paul A. Jungwirth) +Add GiST support function stratnum() (Paul A. Jungwirth) § @@ -3071,7 +3073,7 @@ Author: Masahiko Sawada -Record the default CPU signedness of "char" in pg_controldata (Masahiko Sawada) +Record the default CPU signedness of char in pg_controldata (Masahiko Sawada) § @@ -3085,13 +3087,13 @@ Author: Peter Eisentraut -Add support for Python "Limited API" in PL/Python (Peter Eisentraut) +Add support for Python "Limited API" in PL/Python (Peter Eisentraut) § § -This helps prevent problems caused by Python 3.x version mismatches. +This helps prevent problems caused by Python 3.x version mismatches. @@ -3102,7 +3104,7 @@ Author: Jacob Champion -Change the minimum supported Python version to 3.6.8 (Jacob Champion) +Change the minimum supported Python version to 3.6.8 (Jacob Champion) § @@ -3116,7 +3118,7 @@ Author: Daniel Gustafsson -Remove support for OpenSSL versions older than 1.1.1 (Daniel Gustafsson) +Remove support for OpenSSL versions older than 1.1.1 (Daniel Gustafsson) § § @@ -3129,7 +3131,7 @@ Author: Peter Eisentraut -If LLVM is enabled, require version 14 or later (Thomas Munro) +If LLVM is enabled, require version 14 or later (Thomas Munro) § @@ -3141,12 +3143,12 @@ Author: Tom Lane -Add macro PG_MODULE_MAGIC_EXT to allow extensions to report their name and version (Andrei Lepikhov) +Add macro PG_MODULE_MAGIC_EXT to allow extensions to report their name and version (Andrei Lepikhov) § -This information can be access via the new function pg_get_loaded_modules(). +This information can be access via the new function pg_get_loaded_modules(). @@ -3157,12 +3159,12 @@ Author: Tom Lane -Document that SPI_connect/SPI_connect_ext() always returns success (SPI_OK_CONNECT) (Stepan Neretin) +Document that SPI_connect()/SPI_connect_ext() always returns success (SPI_OK_CONNECT) (Stepan Neretin) § -Errors are always reported via ereport(). +Errors are always reported via ereport(). @@ -3173,7 +3175,7 @@ Author: Peter Eisentraut -Remove the experimental designation of Meson builds on Windows (Aleksander Alekseev) +Remove the experimental designation of Meson builds on Windows (Aleksander Alekseev) § @@ -3185,7 +3187,7 @@ Author: Peter Eisentraut -Add documentation section about API and ABI compatibility (David Wheeler, Peter Eisentraut) +Add documentation section about API and ABI compatibility (David Wheeler, Peter Eisentraut) § @@ -3199,13 +3201,13 @@ Author: Thomas Munro -Remove configure options --disable-spinlocks and --disable-atomics (Thomas Munro) +Remove configure options and (Thomas Munro) § § -Thirty-two bit atomic operations are now required. +Thirty-two-bit atomic operations are now required. @@ -3216,7 +3218,7 @@ Author: Tom Lane -Remove support for the HPPA/PA-RISC architecture (Tom Lane) +Remove support for the HPPA/PA-RISC architecture (Tom Lane) § @@ -3237,7 +3239,7 @@ Author: Masahiko Sawada -Add extension pg_logicalinspect to inspect logical snapshots (Bertrand Drouvot) +Add extension pg_logicalinspect to inspect logical snapshots (Bertrand Drouvot) § @@ -3249,7 +3251,7 @@ Author: Robert Haas -Add extension pg_overexplain which adds debug details to EXPLAIN output (Robert Haas) +Add extension pg_overexplain which adds debug details to EXPLAIN output (Robert Haas) § @@ -3267,7 +3269,7 @@ Author: Fujii Masao -Add output columns to postgres_fdw_get_connections() (Hayato Kuroda, Sagar Dilip Shedge) +Add output columns to postgres_fdw_get_connections() (Hayato Kuroda, Sagar Dilip Shedge) § § § @@ -3275,8 +3277,8 @@ Add output columns to postgres_fdw_get_connections() (Hayato Kuroda, Sagar Dilip -New output column "used_in_xact" indicates if the foreign data wrapper is being used by a current transaction, "closed" indicates if it is closed, "user_name" indicates the -user name, and "remote_backend_pid" indicates the remote backend process identifier. +New output column used_in_xact indicates if the foreign data wrapper is being used by a current transaction, closed indicates if it is closed, user_name indicates the +user name, and remote_backend_pid indicates the remote backend process identifier. @@ -3287,13 +3289,14 @@ Author: Peter Eisentraut -Allow SCRAM authentication from the client to be passed to postgres_fdw servers (Matheus Alcantara, Peter Eisentraut) +Allow SCRAM authentication from the client to be passed to postgres_fdw servers (Matheus Alcantara, Peter Eisentraut) § -This avoids storing postgres_fdw authentication information in the database, and is enabled with the postgres_fdw "use_scram_passthrough" connection option. libpq uses new connection -parameters scram_client_key and scram_server_key. +This avoids storing postgres_fdw authentication information in the database, and is enabled with the +postgres_fdw use_scram_passthrough connection option. libpq uses new connection +parameters scram_client_key and scram_server_key. @@ -3304,7 +3307,7 @@ Author: Peter Eisentraut -Allow SCRAM authentication from the client to be passed to dblink servers (Matheus Alcantara) +Allow SCRAM authentication from the client to be passed to dblink servers (Matheus Alcantara) § @@ -3316,12 +3319,12 @@ Author: Fujii Masao -Add on_error and log_verbosity options to file_fdw (Atsushi Torikoshi) +Add on_error and log_verbosity options to file_fdw (Atsushi Torikoshi) § -These control how file_fdw handles and reports invalid file rows. +These control how file_fdw handles and reports invalid file rows. @@ -3332,12 +3335,12 @@ Author: Fujii Masao -Add "reject_limit" to control the number of invalid rows file_fdw can ignore (Atsushi Torikoshi) +Add reject_limit to control the number of invalid rows file_fdw can ignore (Atsushi Torikoshi) § -This is active when ON_ERROR = 'ignore'. +This is active when ON_ERROR = 'ignore'. @@ -3348,7 +3351,7 @@ Author: Nathan Bossart -Add configurable variable min_password_length to passwordcheck (Emanuele Musella, Maurizio Boriani) +Add configurable variable min_password_length to passwordcheck (Emanuele Musella, Maurizio Boriani) § @@ -3364,7 +3367,7 @@ Author: Tatsuo Ishii -Have pgbench report the number of failed, retried, or skipped transactions in per-script reports (Yugo Nagata) +Have pgbench report the number of failed, retried, or skipped transactions in per-script reports (Yugo Nagata) § @@ -3376,12 +3379,12 @@ Author: Tom Lane -Add isn server variable "weak" to control invalid check digit acceptance (Viktor Holmberg) +Add isn server variable weak to control invalid check digit acceptance (Viktor Holmberg) § -This was previously only controlled by function isn_weak(). +This was previously only controlled by function isn_weak(). @@ -3392,7 +3395,7 @@ Author: Heikki Linnakangas -Allow values to be sorted to speed btree_gist index builds (Bernd Helmle, Andrey Borodin) +Allow values to be sorted to speed btree_gist index builds (Bernd Helmle, Andrey Borodin) § @@ -3404,7 +3407,7 @@ Author: Tomas Vondra -Add amcheck function gin_index_check() to verify GIN indexes (Grigory Kryachko, Heikki Linnakangas, Andrey Borodin) +Add amcheck function gin_index_check() to verify GIN indexes (Grigory Kryachko, Heikki Linnakangas, Andrey Borodin) § @@ -3416,12 +3419,12 @@ Author: Andres Freund -Add functions pg_buffercache_evict_relation() and pg_buffercache_evict_all() to evict unpinned shared buffers (Nazir Bilal Yavuz) +Add functions pg_buffercache_evict_relation() and pg_buffercache_evict_all() to evict unpinned shared buffers (Nazir Bilal Yavuz) § -The existing function pg_buffercache_evict() now returns the buffer flush status. +The existing function pg_buffercache_evict() now returns the buffer flush status. @@ -3436,7 +3439,7 @@ Author: Robert Haas -Allow extensions to install custom EXPLAIN options (Robert Haas, Sami Imseih) +Allow extensions to install custom EXPLAIN options (Robert Haas, Sami Imseih) § § § @@ -3452,7 +3455,7 @@ Author: Michael Paquier -Allow extensions to use the server's cumulative statistics API (Michael Paquier) +Allow extensions to use the server's cumulative statistics API (Michael Paquier) § § @@ -3472,7 +3475,7 @@ Author: Michael Paquier -Allow the queries of CREATE TABLE AS and DECLARE to be tracked by pg_stat_statements (Anthonin Bonnefoy) +Allow the queries of CREATE TABLE AS and DECLARE to be tracked by pg_stat_statements (Anthonin Bonnefoy) § @@ -3488,12 +3491,12 @@ Author: Michael Paquier -Allow the parameterization of SET values in pg_stat_statements (Greg Sabino Mullane, Michael Paquier) +Allow the parameterization of SET values in pg_stat_statements (Greg Sabino Mullane, Michael Paquier) § -This reduces the bloat caused by SET statements with differing constants. +This reduces the bloat caused by SET statements with differing constants. @@ -3504,12 +3507,12 @@ Author: Michael Paquier -Add pg_stat_statements columns to report parallel activity (Guillaume Lelarge) +Add pg_stat_statements columns to report parallel activity (Guillaume Lelarge) § -The new columns are parallel_workers_to_launch and parallel_workers_launched. +The new columns are parallel_workers_to_launch and parallel_workers_launched. @@ -3520,7 +3523,7 @@ Author: Michael Paquier -Add pg_stat_statements.wal_buffers_full to report full WAL buffers (Bertrand Drouvot) +Add pg_stat_statements.wal_buffers_full to report full WAL buffers (Bertrand Drouvot) § @@ -3541,7 +3544,7 @@ Author: Álvaro Herrera -Add pgcrypto functions sha256crypt() and sha512crypt() (Bernd Helmle) +Add pgcrypto functions sha256crypt() and sha512crypt() (Bernd Helmle) § @@ -3553,7 +3556,7 @@ Author: Daniel Gustafsson -Add CFB mode to pgcrypto encryption and decryption (Umar Hayat) +Add CFB mode to pgcrypto encryption and decryption (Umar Hayat) § @@ -3565,12 +3568,12 @@ Author: Daniel Gustafsson -Add pgcrypto server variable builtin_crypto_enabled to allow disabling builtin non-FIPS mode cryptographic functions (Daniel Gustafsson, Joe Conway) +Add pgcrypto server variable builtin_crypto_enabled to allow disabling builtin non-FIPS mode cryptographic functions (Daniel Gustafsson, Joe Conway) § -This is useful for guaranteeing FIPS mode behavior. +This is useful for guaranteeing FIPS mode behavior. From 428a87607b58949cfc35eeab94825e2de0d541a5 Mon Sep 17 00:00:00 2001 From: Fujii Masao Date: Wed, 18 Jun 2025 09:18:40 +0900 Subject: [PATCH 57/91] doc: Reorder protocol version option descriptions in libpq docs. Commit 285613c60a7 introduced the min_protocol_version and max_protocol_version connection options for libpq, but their descriptions were placed in the middle of the unrelated ssl_min_protocol_version and ssl_max_protocol_version entries. This commit moves the min_protocol_version and max_protocol_version descriptions to appear after the SSL-related options. This improves the logical order and makes it easier for users to locate the relevant settings in the libpq documentation. Author: Fujii Masao Reviewed-by: Jelte Fennema-Nio Discussion: https://postgr.es/m/a3391f36-30f5-4d4a-825b-232476819de8@oss.nttdata.com --- doc/src/sgml/libpq.sgml | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/doc/src/sgml/libpq.sgml b/doc/src/sgml/libpq.sgml index 695fe958c3ed3..08bd51219262d 100644 --- a/doc/src/sgml/libpq.sgml +++ b/doc/src/sgml/libpq.sgml @@ -2168,6 +2168,24 @@ postgresql://%2Fvar%2Flib%2Fpostgresql/dbname + + ssl_max_protocol_version + + + This parameter specifies the maximum SSL/TLS protocol version to allow + for the connection. Valid values are TLSv1, + TLSv1.1, TLSv1.2 and + TLSv1.3. The supported protocols depend on the + version of OpenSSL used, older versions + not supporting the most modern protocol versions. If not set, this + parameter is ignored and the connection will use the maximum bound + defined by the backend, if set. Setting the maximum protocol version + is mainly useful for testing or if some component has issues working + with a newer protocol. + + + + min_protocol_version @@ -2216,24 +2234,6 @@ postgresql://%2Fvar%2Flib%2Fpostgresql/dbname - - ssl_max_protocol_version - - - This parameter specifies the maximum SSL/TLS protocol version to allow - for the connection. Valid values are TLSv1, - TLSv1.1, TLSv1.2 and - TLSv1.3. The supported protocols depend on the - version of OpenSSL used, older versions - not supporting the most modern protocol versions. If not set, this - parameter is ignored and the connection will use the maximum bound - defined by the backend, if set. Setting the maximum protocol version - is mainly useful for testing or if some component has issues working - with a newer protocol. - - - - krbsrvname From 9e1183953f0aee6b8040cd782a8af9996f5ca942 Mon Sep 17 00:00:00 2001 From: Michael Paquier Date: Wed, 18 Jun 2025 11:03:21 +0900 Subject: [PATCH 58/91] Document "relrewrite" at the top of heap_create_with_catalog() This parameter has been introduced in 325f2ec5557f, and it was not documented contrary to all the other arguments of heap_create_with_catalog(). Reviewed-by: Yugo Nagata Reviewed-by: Steven Niu Discussion: https://postgr.es/m/aE--bmEv-gJUTH5v@paquier.xyz --- src/backend/catalog/heap.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/backend/catalog/heap.c b/src/backend/catalog/heap.c index fbaed5359ad7c..10f43c51c5af0 100644 --- a/src/backend/catalog/heap.c +++ b/src/backend/catalog/heap.c @@ -1100,6 +1100,7 @@ AddNewRelationType(const char *typeName, * if false, relacl is always set NULL * allow_system_table_mods: true to allow creation in system namespaces * is_internal: is this a system-generated catalog? + * relrewrite: link to original relation during a table rewrite * * Output parameters: * typaddress: if not null, gets the object address of the new pg_type entry From c2e2589ab969eb802493191c79de844bf7dc3a6e Mon Sep 17 00:00:00 2001 From: Fujii Masao Date: Wed, 18 Jun 2025 14:53:55 +0900 Subject: [PATCH 59/91] pg_dump: Allow pg_dump to dump the statistics for foreign tables. Commit 1fd1bd87101 introduced support for dumping statistics with pg_dump and pg_dumpall, covering tables, materialized views, and indexes. However, it overlooked foreign tables, even though functions like pg_restore_relation_stats() support them. This commit fixes that oversight by allowing pg_dump and pg_dumpall to include statistics for foreign tables. Author: Fujii Masao Reviewed-by: Corey Huinker Reviewed-by: Nathan Bossart Discussion: https://postgr.es/m/3772e4e4-ef39-4deb-bb76-aa8165f33fb6@oss.nttdata.com --- doc/src/sgml/ref/pg_dump.sgml | 7 ++++--- doc/src/sgml/ref/pg_dumpall.sgml | 3 ++- src/bin/pg_dump/pg_dump.c | 4 +++- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/doc/src/sgml/ref/pg_dump.sgml b/doc/src/sgml/ref/pg_dump.sgml index d7595a7e5468d..1e06bd33bdcd1 100644 --- a/doc/src/sgml/ref/pg_dump.sgml +++ b/doc/src/sgml/ref/pg_dump.sgml @@ -1277,8 +1277,8 @@ PostgreSQL documentation The data section contains actual table data, large-object - contents, statistics for tables and materialized views and - sequence values. + contents, sequence values, and statistics for tables, + materialized views, and foriegn tables. Post-data items include definitions of indexes, triggers, rules, statistics for indexes, and constraints other than validated check constraints. @@ -1359,7 +1359,8 @@ PostgreSQL documentation Dump only the statistics, not the schema (data definitions) or data. - Statistics for tables, materialized views, and indexes are dumped. + Statistics for tables, materialized views, foreign tables, + and indexes are dumped. diff --git a/doc/src/sgml/ref/pg_dumpall.sgml b/doc/src/sgml/ref/pg_dumpall.sgml index 723a466cfaad6..43f384ed16a9c 100644 --- a/doc/src/sgml/ref/pg_dumpall.sgml +++ b/doc/src/sgml/ref/pg_dumpall.sgml @@ -690,7 +690,8 @@ exclude database PATTERN Dump only the statistics, not the schema (data definitions) or data. - Statistics for tables, materialized views, and indexes are dumped. + Statistics for tables, materialized views, foreign tables, + and indexes are dumped. diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c index 7bc0724cd301f..a8f0309e8fc1e 100644 --- a/src/bin/pg_dump/pg_dump.c +++ b/src/bin/pg_dump/pg_dump.c @@ -6890,7 +6890,8 @@ getRelationStatistics(Archive *fout, DumpableObject *rel, int32 relpages, (relkind == RELKIND_PARTITIONED_TABLE) || (relkind == RELKIND_INDEX) || (relkind == RELKIND_PARTITIONED_INDEX) || - (relkind == RELKIND_MATVIEW)) + (relkind == RELKIND_MATVIEW || + relkind == RELKIND_FOREIGN_TABLE)) { RelStatsInfo *info = pg_malloc0(sizeof(RelStatsInfo)); DumpableObject *dobj = &info->dobj; @@ -6929,6 +6930,7 @@ getRelationStatistics(Archive *fout, DumpableObject *rel, int32 relpages, case RELKIND_RELATION: case RELKIND_PARTITIONED_TABLE: case RELKIND_MATVIEW: + case RELKIND_FOREIGN_TABLE: info->section = SECTION_DATA; break; case RELKIND_INDEX: From 09f7d36ba16e9665bb25d2c097e71c7439485fd7 Mon Sep 17 00:00:00 2001 From: Bruce Momjian Date: Wed, 18 Jun 2025 16:43:27 -0400 Subject: [PATCH 60/91] doc config.sgml: use "-" and not "_" for varlistentry "id"s Change "id"s of file_copy_method and enable_self_join_elimination for consistency with the rest of the guc "id"s. These are new entries for PG 18. --- doc/src/sgml/config.sgml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml index 7e0e5400ee128..5ea554ad3c36d 100644 --- a/doc/src/sgml/config.sgml +++ b/doc/src/sgml/config.sgml @@ -2363,7 +2363,7 @@ include_dir 'conf.d' - + file_copy_method (enum) file_copy_method configuration parameter @@ -5765,7 +5765,7 @@ ANY num_sync ( + enable_self_join_elimination (boolean) enable_self_join_elimination configuration parameter From d0d1bcb1e8b2e324bc243d69ccfce55b25a79f8c Mon Sep 17 00:00:00 2001 From: Bruce Momjian Date: Wed, 18 Jun 2025 16:48:26 -0400 Subject: [PATCH 61/91] doc: fix for commit 09f7d36ba16 in changing "_" to "-". I thought underscores wouldn't even work in "id"s, so I never checked to see if anything referenced it, but it seems it does work, so adjust the calling site for the dash syntax. --- doc/src/sgml/ref/alter_database.sgml | 2 +- doc/src/sgml/ref/create_database.sgml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/src/sgml/ref/alter_database.sgml b/doc/src/sgml/ref/alter_database.sgml index 9da8920e12eff..1fc051e11a311 100644 --- a/doc/src/sgml/ref/alter_database.sgml +++ b/doc/src/sgml/ref/alter_database.sgml @@ -83,7 +83,7 @@ ALTER DATABASE name RESET ALL must be empty for this database, and no one can be connected to the database. Tables and indexes in non-default tablespaces are unaffected. The method used to copy files to the new tablespace - is affected by the setting. + is affected by the setting. diff --git a/doc/src/sgml/ref/create_database.sgml b/doc/src/sgml/ref/create_database.sgml index 640c0425faec5..4da8aeebb50a2 100644 --- a/doc/src/sgml/ref/create_database.sgml +++ b/doc/src/sgml/ref/create_database.sgml @@ -140,7 +140,7 @@ CREATE DATABASE name after the creation of the new database. In some situations, this may have a noticeable negative impact on overall system performance. The FILE_COPY strategy is affected by the setting. + linkend="guc-file-copy-method"/> setting. From b57d707708181f988fd1fa697976059510fc4f76 Mon Sep 17 00:00:00 2001 From: Fujii Masao Date: Thu, 19 Jun 2025 09:07:19 +0900 Subject: [PATCH 62/91] doc: Fix incorrect description of INCLUDING COMMENTS in CREATE FOREIGN TABLE. Commit 302cf157592 added support for LIKE in CREATE FOREIGN TABLE. In this feature, since indexes are not created for foreign tables, comments on indexes are not copied either. However, the documentation incorrectly stated that index comments would be copied when using INCLUDING COMMENTS. This commit corrects that by removing the mention of index comments. Author: Fujii Masao Reviewed-by: Michael Paquier Discussion: https://postgr.es/m/f86cd84f-a6a3-4451-bae7-5cca9e63b06d@oss.nttdata.com --- doc/src/sgml/ref/create_foreign_table.sgml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/src/sgml/ref/create_foreign_table.sgml b/doc/src/sgml/ref/create_foreign_table.sgml index d08834ac9d291..009fa46532bbe 100644 --- a/doc/src/sgml/ref/create_foreign_table.sgml +++ b/doc/src/sgml/ref/create_foreign_table.sgml @@ -232,7 +232,7 @@ WITH ( MODULUS numeric_literal, REM INCLUDING COMMENTS - Comments for the copied columns, constraints, and indexes will be + Comments for the copied columns and constraints will be copied. The default behavior is to exclude comments, resulting in the copied columns and constraints in the new table having no comments. From db0c93f172a41515734a774f0412ff9557eca8ed Mon Sep 17 00:00:00 2001 From: Fujii Masao Date: Thu, 19 Jun 2025 09:12:34 +0900 Subject: [PATCH 63/91] doc: Mention GIN indexes support parallel builds. Commit 8492feb98f6 added support for parallel CREATE INDEX on GIN indexes. However, previously two places in the documentation and two in the source code comments still stated that only B-tree and BRIN indexes support parallel builds. This commit updates those references to correctly include GIN indexes. Author: Fujii Masao Reviewed-by: Robert Treat Discussion: https://postgr.es/m/7d27d068-90e2-4022-9bd7-09b0fd3d4f47@oss.nttdata.com --- doc/src/sgml/config.sgml | 3 ++- doc/src/sgml/ref/create_index.sgml | 2 +- src/backend/catalog/index.c | 2 +- src/backend/optimizer/plan/planner.c | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml index 5ea554ad3c36d..b265cc89c9d46 100644 --- a/doc/src/sgml/config.sgml +++ b/doc/src/sgml/config.sgml @@ -2894,7 +2894,8 @@ include_dir 'conf.d' Sets the maximum number of parallel workers that can be started by a single utility command. Currently, the parallel utility commands that support the use of parallel workers are - CREATE INDEX when building a B-tree or BRIN index, + CREATE INDEX when building a B-tree, + GIN, or BRIN index, and VACUUM without FULL option. Parallel workers are taken from the pool of processes established by , limited diff --git a/doc/src/sgml/ref/create_index.sgml b/doc/src/sgml/ref/create_index.sgml index 147a8f7587c71..b9c679c41e8db 100644 --- a/doc/src/sgml/ref/create_index.sgml +++ b/doc/src/sgml/ref/create_index.sgml @@ -814,7 +814,7 @@ Indexes: leveraging multiple CPUs in order to process the table rows faster. This feature is known as parallel index build. For index methods that support building indexes - in parallel (currently, B-tree and BRIN), + in parallel (currently, B-tree, GIN, and BRIN), maintenance_work_mem specifies the maximum amount of memory that can be used by each index build operation as a whole, regardless of how many worker processes were started. diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c index 739a92bdcc1ca..aa216683b74fe 100644 --- a/src/backend/catalog/index.c +++ b/src/backend/catalog/index.c @@ -3020,7 +3020,7 @@ index_build(Relation heapRelation, /* * Determine worker process details for parallel CREATE INDEX. Currently, - * only btree and BRIN have support for parallel builds. + * only btree, GIN, and BRIN have support for parallel builds. * * Note that planner considers parallel safety for us. */ diff --git a/src/backend/optimizer/plan/planner.c b/src/backend/optimizer/plan/planner.c index ff65867eebee7..549aedcfa991a 100644 --- a/src/backend/optimizer/plan/planner.c +++ b/src/backend/optimizer/plan/planner.c @@ -6879,7 +6879,7 @@ plan_cluster_use_sort(Oid tableOid, Oid indexOid) * * tableOid is the table on which the index is to be built. indexOid is the * OID of an index to be created or reindexed (which must be an index with - * support for parallel builds - currently btree or BRIN). + * support for parallel builds - currently btree, GIN, or BRIN). * * Return value is the number of parallel worker processes to request. It * may be unsafe to proceed if this is 0. Note that this does not include the From a03805920b36b79b7ddf97c6804117f3296b2900 Mon Sep 17 00:00:00 2001 From: Bruce Momjian Date: Wed, 18 Jun 2025 21:19:42 -0400 Subject: [PATCH 64/91] doc PG 18 relnotes: add links for server variables --- doc/src/sgml/release-18.sgml | 58 ++++++++++++++++++------------------ 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/doc/src/sgml/release-18.sgml b/doc/src/sgml/release-18.sgml index ab83b1554001e..e89a86b1aa813 100644 --- a/doc/src/sgml/release-18.sgml +++ b/doc/src/sgml/release-18.sgml @@ -83,7 +83,7 @@ Change time zone abbreviation handling (Tom Lane) -The system will now favor the current session's time zone abbreviations before checking the server variable timezone_abbreviations. Previously timezone_abbreviations was +The system will now favor the current session's time zone abbreviations before checking the server variable . Previously timezone_abbreviations was checked first. @@ -101,7 +101,7 @@ Deprecate MD5 password authentication (Nathan Bossart) Support for MD5 passwords will be removed in a future major version release. CREATE ROLE and ALTER ROLE now emit deprecation warnings when setting MD5 passwords. -These warnings can be disabled by setting the md5_password_warnings parameter to off. +These warnings can be disabled by setting the parameter to off. @@ -263,7 +263,7 @@ Automatically remove some unnecessary table self-joins (Andrey Lepikhov, Alexand -This optimization can be disabled using server variable enable_self_join_elimination. +This optimization can be disabled using server variable . @@ -324,7 +324,7 @@ Allow the keys of SELECT DISTINCT to be internally reordered -This optimization can be disabled using enable_distinct_reordering. +This optimization can be disabled using . @@ -606,8 +606,8 @@ Add an asynchronous I/O subsystem (Andres Freund, Thomas Munro, Nazir Bilal Yavu This feature allows backends to queue multiple read requests, which allows for more efficient sequential scans, bitmap heap scans, vacuums, etc. -This is enabled by server variable io_method, with server variables io_combine_limit and io_max_combine_limit added to control it. This also enables -effective_io_concurrency and maintenance_io_concurrency values greater than zero for systems without fadvise() support. The new system view pg_aios shows the file handles being used +This is enabled by server variable , with server variables and added to control it. This also enables + and values greater than zero for systems without fadvise() support. The new system view pg_aios shows the file handles being used for asynchronous I/O. @@ -667,7 +667,7 @@ Allow normal vacuums to freeze some pages, even though they are all-visible (Mel -This reduces the overhead of later full-relation freezing. The aggressiveness of this can be controlled by server variable and per-table setting vacuum_max_eager_freeze_failure_rate. +This reduces the overhead of later full-relation freezing. The aggressiveness of this can be controlled by server variable and per-table setting . Previously vacuum never processed all-visible pages until freezing was required. @@ -679,7 +679,7 @@ Author: Nathan Bossart -Add server variable vacuum_truncate to control file truncation during VACUUM (Nathan Bossart, Gurjeet Singh) +Add server variable to control file truncation during VACUUM (Nathan Bossart, Gurjeet Singh) § @@ -697,7 +697,7 @@ Author: Melanie Plageman -Increase server variables effective_io_concurrency's and maintenance_io_concurrency's default values to 16 (Melanie Plageman) +Increase server variables 's and 's default values to 16 (Melanie Plageman) § § @@ -723,7 +723,7 @@ Author: Melanie Plageman -Increase the logging granularity of server variable log_connections (Melanie Plageman) +Increase the logging granularity of server variable (Melanie Plageman) § @@ -751,7 +751,7 @@ Author: Tom Lane -Add log_line_prefix escape %L to output the client IP address (Greg Sabino Mullane) +Add escape %L to output the client IP address (Greg Sabino Mullane) § @@ -763,7 +763,7 @@ Author: Fujii Masao -Add server variable log_lock_failures to log lock acquisition failures (Yuki Seino) +Add server variable to log lock acquisition failures (Yuki Seino) § @@ -804,7 +804,7 @@ Add delay time reporting to VACUUM and ANALYZE This information appears in the autovacuum logs, the system views pg_stat_progress_vacuum and pg_stat_progress_analyze, and the output of VACUUM and ANALYZE when in VERBOSE -mode; tracking must be enabled with the server variable track_cost_delay_timing. +mode; tracking must be enabled with the server variable . @@ -900,7 +900,7 @@ Author: Michael Paquier -Change server variable track_wal_io_timing to control tracking WAL timing in pg_stat_io instead of pg_stat_wal (Bertrand Drouvot) +Change server variable to control tracking WAL timing in pg_stat_io instead of pg_stat_wal (Bertrand Drouvot) § @@ -1144,7 +1144,7 @@ Add support for the OAuth authentication method (Jacob Champion, Daniel Gustafss -This adds an oauth authentication method to pg_hba.conf, libpq OAuth options, a server variable oauth_validator_libraries to load token validation libraries, and +This adds an oauth authentication method to pg_hba.conf, libpq OAuth options, a server variable to load token validation libraries, and a configure flag to add the required compile-time libraries. @@ -1156,7 +1156,7 @@ Author: Daniel Gustafsson -Add server variable ssl_tls13_ciphers to allow specification of multiple colon-separated TLSv1.3 cipher suites (Erica Zhang, Daniel Gustafsson) +Add server variable to allow specification of multiple colon-separated TLSv1.3 cipher suites (Erica Zhang, Daniel Gustafsson) § @@ -1168,7 +1168,7 @@ Author: Daniel Gustafsson -Change server variable ssl_groups's default to include elliptic curve X25519 (Daniel Gustafsson, Jacob Champion) +Change server variable 's default to include elliptic curve X25519 (Daniel Gustafsson, Jacob Champion) § @@ -1180,7 +1180,7 @@ Author: Daniel Gustafsson -Rename server variable ssl_ecdh_curve to ssl_groups and allow multiple colon-separated ECDH curves to be specified (Erica Zhang, Daniel Gustafsson) +Rename server variable ssl_ecdh_curve to and allow multiple colon-separated ECDH curves to be specified (Erica Zhang, Daniel Gustafsson) § @@ -1226,12 +1226,12 @@ Author: Nathan Bossart -Add server variable autovacuum_worker_slots to specify the maximum number of background workers (Nathan Bossart) +Add server variable to specify the maximum number of background workers (Nathan Bossart) § -With this variable set, autovacuum_max_workers can be adjusted at runtime up to this maximum without a server restart. +With this variable set, can be adjusted at runtime up to this maximum without a server restart. @@ -1247,7 +1247,7 @@ Allow specification of the fixed number of dead tuples that will trigger an auto -The server variable is autovacuum_vacuum_max_threshold. Percentages are still used for triggering. +The server variable is . Percentages are still used for triggering. @@ -1258,7 +1258,7 @@ Author: Andres Freund -Change server variable max_files_per_process to limit only files opened by a backend (Andres Freund) +Change server variable to limit only files opened by a backend (Andres Freund) § @@ -1274,7 +1274,7 @@ Author: Nathan Bossart -Add server variable num_os_semaphores to report the required number of semaphores (Nathan Bossart) +Add server variable to report the required number of semaphores (Nathan Bossart) § @@ -1292,7 +1292,7 @@ Author: Peter Eisentraut -Add server variable extension_control_path to specify the location of extension control files (Peter Eisentraut, Matheus Alcantara) +Add server variable to specify the location of extension control files (Peter Eisentraut, Matheus Alcantara) § § @@ -1314,7 +1314,7 @@ Author: Amit Kapila -Allow inactive replication slots to be automatically invalided using server variable idle_replication_slot_timeout (Nisha Moond, Bharath Rupireddy) +Allow inactive replication slots to be automatically invalided using server variable (Nisha Moond, Bharath Rupireddy) § @@ -1326,12 +1326,12 @@ Author: Masahiko Sawada -Add server variable max_active_replication_origins to control the maximum active replication origins (Euler Taveira) +Add server variable to control the maximum active replication origins (Euler Taveira) § -This was previously controlled by max_replication_slots, but this new setting allows a higher origin count in cases where fewer slots are required. +This was previously controlled by , but this new setting allows a higher origin count in cases where fewer slots are required. @@ -1583,7 +1583,7 @@ Author: Thomas Munro -Add server variable file_copy_method to control the file copying method (Nazir Bilal Yavuz) +Add server variable to control the file copying method (Nazir Bilal Yavuz) § @@ -2271,7 +2271,7 @@ Author: Tomas Vondra -Report search_path changes to the client (Alexander Kukushkin, Jelte Fennema-Nio, Tomas Vondra) +Report changes to the client (Alexander Kukushkin, Jelte Fennema-Nio, Tomas Vondra) § § From 1546e17f9d067e714e066fcdd57d5f56c14f4174 Mon Sep 17 00:00:00 2001 From: Amit Kapila Date: Thu, 19 Jun 2025 09:48:08 +0530 Subject: [PATCH 65/91] Improve log messages and docs for slot synchronization. Improve the clarity of LOG messages when a failover logical slot synchronization fails, making the reasons more explicit for easier debugging. Update the documentation to outline scenarios where slot synchronization can fail, especially during the initial sync, and emphasize that pg_sync_replication_slot() is primarily intended for testing and debugging purposes. We also discussed improving the functionality of pg_sync_replication_slot() so that it can be used reliably, but we would take up that work for next version after some more discussion and review. Reported-by: Suraj Kharage Author: shveta malik Reviewed-by: Zhijie Hou Reviewed-by: Peter Smith Reviewed-by: Amit Kapila Backpatch-through: 17, where it was introduced Discussion: https://postgr.es/m/CAF1DzPWTcg+m+x+oVVB=y4q9=PYYsL_mujVp7uJr-_oUtWNGbA@mail.gmail.com --- doc/src/sgml/func.sgml | 6 ++- doc/src/sgml/logicaldecoding.sgml | 54 ++++++++++++++++++++-- src/backend/replication/logical/slotsync.c | 6 +-- 3 files changed, 57 insertions(+), 9 deletions(-) diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml index c67688cbf5f98..8d7d9a2f3e8e8 100644 --- a/doc/src/sgml/func.sgml +++ b/doc/src/sgml/func.sgml @@ -29698,7 +29698,7 @@ postgres=# SELECT '0/0'::pg_lsn + pd.segment_number * ps.setting::int + :offset - + pg_logical_slot_get_binary_changes @@ -29970,7 +29970,9 @@ postgres=# SELECT '0/0'::pg_lsn + pd.segment_number * ps.setting::int + :offset standby server. Temporary synced slots, if any, cannot be used for logical decoding and must be dropped after promotion. See for details. - Note that this function cannot be executed if + Note that this function is primarily intended for testing and + debugging purposes and should be used with caution. Additionaly, + this function cannot be executed if sync_replication_slots is enabled and the slotsync worker is already running to perform the synchronization of slots. diff --git a/doc/src/sgml/logicaldecoding.sgml b/doc/src/sgml/logicaldecoding.sgml index dd9e83b08eaf1..5c5957e0d37a1 100644 --- a/doc/src/sgml/logicaldecoding.sgml +++ b/doc/src/sgml/logicaldecoding.sgml @@ -370,10 +370,10 @@ postgres=# select * from pg_logical_slot_get_changes('regression_slot', NULL, NU pg_create_logical_replication_slot, or by using the failover option of - CREATE SUBSCRIPTION during slot creation, and then calling - - pg_sync_replication_slots - on the standby. By setting + CREATE SUBSCRIPTION during slot creation. + Additionally, enabling + sync_replication_slots on the standby + is required. By enabling sync_replication_slots on the standby, the failover slots can be synchronized periodically in the slotsync worker. For the synchronization to work, it is mandatory to @@ -398,6 +398,52 @@ postgres=# select * from pg_logical_slot_get_changes('regression_slot', NULL, NU receiving the WAL up to the latest flushed position on the primary server. + + + While enabling + sync_replication_slots allows for automatic + periodic synchronization of failover slots, they can also be manually + synchronized using the + pg_sync_replication_slots function on the standby. + However, this function is primarily intended for testing and debugging and + should be used with caution. Unlike automatic synchronization, it does not + include cyclic retries, making it more prone to synchronization failures, + particularly during initial sync scenarios where the required WAL files + or catalog rows for the slot may have already been removed or are at risk + of being removed on the standby. In contrast, automatic synchronization + via sync_replication_slots provides continuous slot + updates, enabling seamless failover and supporting high availability. + Therefore, it is the recommended method for synchronizing slots. + + + + + When slot synchronization is configured as recommended, + and the initial synchronization is performed either automatically or + manually via pg_sync_replication_slot, the standby can persist the + synchronized slot only if the following condition is met: The logical + replication slot on the primary must retain WALs and system catalog + rows that are still available on the standby. This ensures data + integrity and allows logical replication to continue smoothly after + promotion. + If the required WALs or catalog rows have already been purged from the + standby, the slot will not be persisted to avoid data loss. In such + cases, the following log message may appear: + + LOG: could not synchronize replication slot "failover_slot" + DETAIL: Synchronization could lead to data loss as the remote slot needs WAL at LSN 0/3003F28 and catalog xmin 754, but the standby has LSN 0/3003F28 and catalog xmin 756 + + If the logical replication slot is actively used by a consumer, no + manual intervention is needed; the slot will advance automatically, + and synchronization will resume in the next cycle. However, if no + consumer is configured, it is advisable to manually advance the slot + on the primary using + pg_logical_slot_get_changes or + + pg_logical_slot_get_binary_changes, + allowing synchronization to proceed. + + The ability to resume logical replication after failover depends upon the pg_replication_slots.synced diff --git a/src/backend/replication/logical/slotsync.c b/src/backend/replication/logical/slotsync.c index 656e66e0ae0a1..f1dcbebfa1ae7 100644 --- a/src/backend/replication/logical/slotsync.c +++ b/src/backend/replication/logical/slotsync.c @@ -211,9 +211,9 @@ update_local_synced_slot(RemoteSlot *remote_slot, Oid remote_dbid, * impact the users, so we used DEBUG1 level to log the message. */ ereport(slot->data.persistency == RS_TEMPORARY ? LOG : DEBUG1, - errmsg("could not synchronize replication slot \"%s\" because remote slot precedes local slot", + errmsg("could not synchronize replication slot \"%s\"", remote_slot->name), - errdetail("The remote slot has LSN %X/%X and catalog xmin %u, but the local slot has LSN %X/%X and catalog xmin %u.", + errdetail("Synchronization could lead to data loss as the remote slot needs WAL at LSN %X/%X and catalog xmin %u, but the standby has LSN %X/%X and catalog xmin %u.", LSN_FORMAT_ARGS(remote_slot->restart_lsn), remote_slot->catalog_xmin, LSN_FORMAT_ARGS(slot->data.restart_lsn), @@ -593,7 +593,7 @@ update_and_persist_local_synced_slot(RemoteSlot *remote_slot, Oid remote_dbid) { ereport(LOG, errmsg("could not synchronize replication slot \"%s\"", remote_slot->name), - errdetail("Logical decoding could not find consistent point from local slot's LSN %X/%X.", + errdetail("Synchronization could lead to data loss as standby could not build a consistent snapshot to decode WALs at LSN %X/%X.", LSN_FORMAT_ARGS(slot->data.restart_lsn))); return false; From dec6643487bbed8f5d771e9b9aff772e5c711d4d Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Thu, 19 Jun 2025 13:53:12 +0200 Subject: [PATCH 66/91] Improve pg_dump/pg_dumpall help synopses and terminology Increase consistency of --help and man page synopses between pg_dump and pg_dumpall. These should now be very similar, as pg_dumpall can now also produce non-text dump output. But actually, they had drifted further apart. - Use verb "export" consistently, instead of "dump" or "extract". - Use "SQL script" instead of just "script" or "text file". - Maintain consistent distinction between SQL script and other formats/archives (which is relevant for pg_restore). Reviewed-by: Robert Treat Discussion: https://www.postgresql.org/message-id/flat/3f71d8a7-095b-4829-9b0b-fce09e9866b3%40eisentraut.org --- doc/src/sgml/ref/pg_dump.sgml | 2 +- doc/src/sgml/ref/pg_dumpall.sgml | 7 +++++-- doc/src/sgml/ref/pg_restore.sgml | 4 ++-- src/bin/pg_dump/pg_dump.c | 2 +- src/bin/pg_dump/pg_dumpall.c | 2 +- 5 files changed, 10 insertions(+), 7 deletions(-) diff --git a/doc/src/sgml/ref/pg_dump.sgml b/doc/src/sgml/ref/pg_dump.sgml index 1e06bd33bdcd1..0d9270116549a 100644 --- a/doc/src/sgml/ref/pg_dump.sgml +++ b/doc/src/sgml/ref/pg_dump.sgml @@ -18,7 +18,7 @@ PostgreSQL documentation pg_dump - extract a PostgreSQL database into a script file or other archive file + export a PostgreSQL database as an SQL script or to other formats diff --git a/doc/src/sgml/ref/pg_dumpall.sgml b/doc/src/sgml/ref/pg_dumpall.sgml index 43f384ed16a9c..8ca68da5a5560 100644 --- a/doc/src/sgml/ref/pg_dumpall.sgml +++ b/doc/src/sgml/ref/pg_dumpall.sgml @@ -16,7 +16,10 @@ PostgreSQL documentation pg_dumpall - extract a PostgreSQL database cluster using a specified dump format + + + export a PostgreSQL database cluster as an SQL script or to other formats + @@ -33,7 +36,7 @@ PostgreSQL documentation pg_dumpall is a utility for writing out (dumping) all PostgreSQL databases - of a cluster into an archive. The archive contains + of a cluster into an SQL script file or an archive. The output contains SQL commands that can be used as input to to restore the databases. It does this by calling for each database in the cluster. diff --git a/doc/src/sgml/ref/pg_restore.sgml b/doc/src/sgml/ref/pg_restore.sgml index 8c88b07dcc865..b649bd3a5ae0f 100644 --- a/doc/src/sgml/ref/pg_restore.sgml +++ b/doc/src/sgml/ref/pg_restore.sgml @@ -18,8 +18,8 @@ PostgreSQL documentation pg_restore - restore a PostgreSQL database or cluster - from an archive created by pg_dump or + restore PostgreSQL databases from archives + created by pg_dump or pg_dumpall diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c index a8f0309e8fc1e..db944ec223071 100644 --- a/src/bin/pg_dump/pg_dump.c +++ b/src/bin/pg_dump/pg_dump.c @@ -1235,7 +1235,7 @@ main(int argc, char **argv) static void help(const char *progname) { - printf(_("%s dumps a database as a text file or to other formats.\n\n"), progname); + printf(_("%s exports a PostgreSQL database as an SQL script or to other formats.\n\n"), progname); printf(_("Usage:\n")); printf(_(" %s [OPTION]... [DBNAME]\n"), progname); diff --git a/src/bin/pg_dump/pg_dumpall.c b/src/bin/pg_dump/pg_dumpall.c index b1f388cb39160..3cbcad65c5fb5 100644 --- a/src/bin/pg_dump/pg_dumpall.c +++ b/src/bin/pg_dump/pg_dumpall.c @@ -699,7 +699,7 @@ main(int argc, char *argv[]) static void help(void) { - printf(_("%s extracts a PostgreSQL database cluster based on specified dump format.\n\n"), progname); + printf(_("%s exports a PostgreSQL database cluster as an SQL script or to other formats.\n\n"), progname); printf(_("Usage:\n")); printf(_(" %s [OPTION]...\n"), progname); From d8aa21b74ff4e3d767c3344484c3cb22b9f0ec0d Mon Sep 17 00:00:00 2001 From: Bruce Momjian Date: Thu, 19 Jun 2025 11:50:50 -0400 Subject: [PATCH 67/91] doc: add xreflabel text for libpq and PL/Python to be used for PG 18 release notes --- doc/src/sgml/libpq.sgml | 2 +- doc/src/sgml/plpython.sgml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/src/sgml/libpq.sgml b/doc/src/sgml/libpq.sgml index 08bd51219262d..298c4b38ef90a 100644 --- a/doc/src/sgml/libpq.sgml +++ b/doc/src/sgml/libpq.sgml @@ -1,6 +1,6 @@ - + <application>libpq</application> — C Library diff --git a/doc/src/sgml/plpython.sgml b/doc/src/sgml/plpython.sgml index bee817ea822a2..cb065bf5f88db 100644 --- a/doc/src/sgml/plpython.sgml +++ b/doc/src/sgml/plpython.sgml @@ -1,6 +1,6 @@ - + PL/Python — Python Procedural Language PL/Python From ed117c4c6c4feb1362abbb417ac6e6525dd8789b Mon Sep 17 00:00:00 2001 From: Bruce Momjian Date: Thu, 19 Jun 2025 11:59:00 -0400 Subject: [PATCH 68/91] doc PG 18 relnotes: add links for applications --- doc/src/sgml/release-18.sgml | 64 ++++++++++++++++++++---------------- 1 file changed, 35 insertions(+), 29 deletions(-) diff --git a/doc/src/sgml/release-18.sgml b/doc/src/sgml/release-18.sgml index e89a86b1aa813..75e17f1a0c6de 100644 --- a/doc/src/sgml/release-18.sgml +++ b/doc/src/sgml/release-18.sgml @@ -60,13 +60,13 @@ Author: Peter Eisentraut -Change initdb default to enable data checksums (Greg Sabino Mullane) +Change default to enable data checksums (Greg Sabino Mullane) § Checksums can be disabled with the new initdb option . -pg_upgrade requires matching cluster checksum settings, so this new + requires matching cluster checksum settings, so this new option can be useful to upgrade non-checksum old clusters. @@ -136,7 +136,7 @@ Prevent COPY FROM from treating \. as an e -psql will still treat \. as an end-of-file marker when reading CSV files from STDIN. Older psql clients connecting to PostgreSQL 18 servers might + will still treat \. as an end-of-file marker when reading CSV files from STDIN. Older psql clients connecting to PostgreSQL 18 servers might experience \copy problems. This release also enforces that \. must appear alone on a line. @@ -1015,7 +1015,7 @@ Have query jumbling of arrays consider only the first and last array elements (D -Jumbling is used by pg_stat_statements. +Jumbling is used by . @@ -1645,7 +1645,7 @@ Require primary/foreign key relationships to use either deterministic collations -The restore of a pg_dump, also used by pg_upgrade, will fail if these requirements are not met; schema changes must be made for these upgrade methods to succeed. +The restore of a , also used by , will fail if these requirements are not met; schema changes must be made for these upgrade methods to succeed. @@ -1728,7 +1728,7 @@ This was previously erroneously prohibited. - <link linkend="sql-copy"><command>COPY</command></link> + <xref linkend="sql-copy"/> @@ -1796,7 +1796,7 @@ Previously, the COPY worked but the FREEZE - <link linkend="sql-explain"><command>EXPLAIN</command></link> + <xref linkend="sql-explain"/> @@ -2219,7 +2219,7 @@ Allow regexp_match[es]()/regexp_like() - <link linkend="libpq">libpq</link> + <xref linkend="libpq"/> @@ -2502,7 +2502,7 @@ Author: Peter Eisentraut -Change initdb to default to enabling checksums (Greg Sabino Mullane) +Change to default to enabling checksums (Greg Sabino Mullane) § § @@ -2554,7 +2554,7 @@ Author: Robert Haas -Add pg_combinebackup option / to enable hard linking (Israel Barth Rubio, Robert Haas) +Add option / to enable hard linking (Israel Barth Rubio, Robert Haas) § @@ -2582,7 +2582,7 @@ Author: Masahiko Sawada -If pg_rewind's specifies a database name, use it in output (Masahiko Sawada) +If 's specifies a database name, use it in output (Masahiko Sawada) § @@ -2617,12 +2617,12 @@ Author: Andrew Dunstan -Allow pg_dumpall to dump in the same output formats as pg_dump supports (Mahendra Singh Thalor, Andrew Dunstan) +Allow to dump in the same output formats as pg_dump supports (Mahendra Singh Thalor, Andrew Dunstan) § -Also modify pg_restore to handle such dumps. Previously pg_dumpall only supported text format. +Also modify to handle such dumps. Previously pg_dumpall only supported text format. @@ -2633,7 +2633,7 @@ Author: Jeff Davis -Add pg_dump options , , and (Jeff Davis) +Add options , , and (Jeff Davis) § @@ -2647,7 +2647,7 @@ Author: Nathan Bossart -Add pg_dump and pg_dumpall option to dump sequence data that would normally be excluded (Nathan Bossart) +Add pg_dump and option to dump sequence data that would normally be excluded (Nathan Bossart) § § @@ -2660,7 +2660,8 @@ Author: Jeff Davis -Add pg_dump, pg_dumpall, and pg_restore options , , , and (Corey Huinker, Jeff Davis) +Add , , and + options , , , and (Corey Huinker, Jeff Davis) § @@ -2672,7 +2673,9 @@ Author: Tom Lane -Add option to disable row level security policy processing in pg_dump, pg_dumpall, pg_restore (Nikolay Samokhvalov) +Add option to disable row level security policy processing in +, , + (Nikolay Samokhvalov) § @@ -2686,7 +2689,7 @@ This is useful for migrating to systems with different policies. - <link linkend="pgupgrade"><application>pg_upgrade</application></link> + <xref linkend="pgupgrade"/> @@ -2812,7 +2815,7 @@ Author: Amit Kapila -Add pg_createsubscriber option to create logical replicas for all databases (Shubham Khanna) +Add option to create logical replicas for all databases (Shubham Khanna) § @@ -2848,7 +2851,7 @@ Author: Masahiko Sawada -Add pg_recvlogical option to specify failover slots (Hayato Kuroda) +Add option to specify failover slots (Hayato Kuroda) § @@ -3087,7 +3090,7 @@ Author: Peter Eisentraut -Add support for Python "Limited API" in PL/Python (Peter Eisentraut) +Add support for Python "Limited API" in (Peter Eisentraut) § § @@ -3239,7 +3242,7 @@ Author: Masahiko Sawada -Add extension pg_logicalinspect to inspect logical snapshots (Bertrand Drouvot) +Add extension to inspect logical snapshots (Bertrand Drouvot) § @@ -3289,7 +3292,8 @@ Author: Peter Eisentraut -Allow SCRAM authentication from the client to be passed to postgres_fdw servers (Matheus Alcantara, Peter Eisentraut) +Allow SCRAM authentication from the client to be passed to + servers (Matheus Alcantara, Peter Eisentraut) § @@ -3307,7 +3311,8 @@ Author: Peter Eisentraut -Allow SCRAM authentication from the client to be passed to dblink servers (Matheus Alcantara) +Allow SCRAM authentication from the client to be passed to + servers (Matheus Alcantara) § @@ -3319,7 +3324,7 @@ Author: Fujii Masao -Add on_error and log_verbosity options to file_fdw (Atsushi Torikoshi) +Add on_error and log_verbosity options to (Atsushi Torikoshi) § @@ -3351,7 +3356,8 @@ Author: Nathan Bossart -Add configurable variable min_password_length to passwordcheck (Emanuele Musella, Maurizio Boriani) +Add configurable variable min_password_length to + (Emanuele Musella, Maurizio Boriani) § @@ -3379,7 +3385,7 @@ Author: Tom Lane -Add isn server variable weak to control invalid check digit acceptance (Viktor Holmberg) +Add server variable weak to control invalid check digit acceptance (Viktor Holmberg) § @@ -3464,7 +3470,7 @@ Allow extensions to use the server's cumulative statistics API - <link linkend="pgstatstatements"><application>pg_stat_statements</application></link> + <xref linkend="pgstatstatements"/> @@ -3533,7 +3539,7 @@ Add pg_stat_statements.wal_buffers_full - <link linkend="pgcrypto"><application>pgcrypto</application></link> + <xref linkend="pgcrypto"/> From 6c29088fc6e269b7d64797bb62533b82afe03d93 Mon Sep 17 00:00:00 2001 From: Jeff Davis Date: Thu, 19 Jun 2025 12:43:27 -0700 Subject: [PATCH 69/91] Correct docs about partitions and EXCLUDE constraints. In version 17 we added support for cross-partition EXCLUDE constraints, as long as they included all partition key columns and compared them with equality (see 8c852ba9a4). I updated the docs for exclusion constraints, but I missed that the docs for CREATE TABLE still said that they were not supported. This commit fixes that. Author: Paul A. Jungwirth Co-authored-by: Jeff Davis Discussion: https://postgr.es/m/c955d292-b92d-42d1-a2a0-1ec6715a2546@illuminatedcomputing.com Backpatch-through: 17 --- doc/src/sgml/ref/create_table.sgml | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/doc/src/sgml/ref/create_table.sgml b/doc/src/sgml/ref/create_table.sgml index 4a41b2f553007..a581691818278 100644 --- a/doc/src/sgml/ref/create_table.sgml +++ b/doc/src/sgml/ref/create_table.sgml @@ -447,11 +447,6 @@ WITH ( MODULUS numeric_literal, REM the values in the new row, an error will be reported. - - Partitioned tables do not support EXCLUDE constraints; - however, you can define these constraints on individual partitions. - - See for more discussion on table partitioning. @@ -1162,6 +1157,18 @@ WITH ( MODULUS numeric_literal, REM exclusion constraint on a subset of the table; internally this creates a partial index. Note that parentheses are required around the predicate. + + + When establishing an exclusion constraint for a multi-level partition + hierarchy, all the columns in the partition key of the target + partitioned table, as well as those of all its descendant partitioned + tables, must be included in the constraint definition. Additionally, + those columns must be compared using the equality operator. These + restrictions ensure that potentially-conflicting rows will exist in the + same partition. The constraint may also refer to other columns which + are not a part of any partition key, which can be compared using any + appropriate operator. + From a8360f074cc03a7cb73a4aaa6d8caab0e0bf0a0f Mon Sep 17 00:00:00 2001 From: Bruce Momjian Date: Thu, 19 Jun 2025 17:13:58 -0400 Subject: [PATCH 70/91] doc PG 18 relnotes: add links to command and struct tags --- doc/src/sgml/release-18.sgml | 78 ++++++++++++++++++------------------ 1 file changed, 39 insertions(+), 39 deletions(-) diff --git a/doc/src/sgml/release-18.sgml b/doc/src/sgml/release-18.sgml index 75e17f1a0c6de..11a4f99a27236 100644 --- a/doc/src/sgml/release-18.sgml +++ b/doc/src/sgml/release-18.sgml @@ -100,7 +100,7 @@ Deprecate MD5 password authentication (Nathan Bossart) -Support for MD5 passwords will be removed in a future major version release. CREATE ROLE and ALTER ROLE now emit deprecation warnings when setting MD5 passwords. +Support for MD5 passwords will be removed in a future major version release. and now emit deprecation warnings when setting MD5 passwords. These warnings can be disabled by setting the parameter to off. @@ -112,7 +112,7 @@ Author: David Rowley -Change VACUUM and ANALYZE to process the inheritance children of a parent (Michael Harris) +Change and to process the inheritance children of a parent (Michael Harris) § @@ -130,7 +130,7 @@ Author: Tom Lane -Prevent COPY FROM from treating \. as an end-of-file marker when reading CSV files (Daniel Vérité, Tom Lane) +Prevent COPY FROM from treating \. as an end-of-file marker when reading CSV files (Daniel Vérité, Tom Lane) § § @@ -154,7 +154,7 @@ Disallow unlogged partitioned tables (Michael Paquier) -Previously ALTER TABLE SET [UN]LOGGED did nothing, and the creation of an unlogged partitioned table did not cause its children to be unlogged. +Previously ALTER TABLE SET [UN]LOGGED did nothing, and the creation of an unlogged partitioned table did not cause its children to be unlogged. @@ -170,7 +170,7 @@ Execute AFTER triggers as the role that was active when trigg -Previously such triggers were run as the role that was active at trigger execution time (e.g., at COMMIT). This is significant for cases where the role is changed between queue time and +Previously such triggers were run as the role that was active at trigger execution time (e.g., at ). This is significant for cases where the role is changed between queue time and transaction commit. @@ -182,7 +182,7 @@ Author: Fujii Masao -Remove non-functional support for rule privileges in GRANT/REVOKE (Fujii Masao) +Remove non-functional support for rule privileges in / (Fujii Masao) § @@ -198,7 +198,7 @@ Author: David Rowley -Remove column pg_backend_memory_contexts.parent (Melih Mutlu) +Remove column pg_backend_memory_contexts.parent (Melih Mutlu) § @@ -319,7 +319,7 @@ Author: Richard Guo -Allow the keys of SELECT DISTINCT to be internally reordered to avoid sorting (Richard Guo) +Allow the keys of SELECT DISTINCT to be internally reordered to avoid sorting (Richard Guo) § @@ -607,7 +607,7 @@ Add an asynchronous I/O subsystem (Andres Freund, Thomas Munro, Nazir Bilal Yavu This feature allows backends to queue multiple read requests, which allows for more efficient sequential scans, bitmap heap scans, vacuums, etc. This is enabled by server variable , with server variables and added to control it. This also enables - and values greater than zero for systems without fadvise() support. The new system view pg_aios shows the file handles being used + and values greater than zero for systems without fadvise() support. The new system view pg_aios shows the file handles being used for asynchronous I/O. @@ -679,7 +679,7 @@ Author: Nathan Bossart -Add server variable to control file truncation during VACUUM (Nathan Bossart, Gurjeet Singh) +Add server variable to control file truncation during (Nathan Bossart, Gurjeet Singh) § @@ -768,7 +768,7 @@ Add server variable to log lock acquisit -Specifically it reports SELECT ... NOWAIT lock failures. +Specifically it reports SELECT ... NOWAIT lock failures. @@ -779,7 +779,7 @@ Author: Michael Paquier -Modify pg_stat_all_tables and its variants to report the time spent in VACUUM, ANALYZE, and their automatic variants (Sami Imseih) +Modify pg_stat_all_tables and its variants to report the time spent in VACUUM, ANALYZE, and their automatic variants (Sami Imseih) § @@ -797,13 +797,13 @@ Author: Nathan Bossart -Add delay time reporting to VACUUM and ANALYZE (Bertrand Drouvot, Nathan Bossart) +Add delay time reporting to and (Bertrand Drouvot, Nathan Bossart) § § -This information appears in the autovacuum logs, the system views pg_stat_progress_vacuum and pg_stat_progress_analyze, and the output of VACUUM and ANALYZE when in VERBOSE +This information appears in the autovacuum logs, the system views pg_stat_progress_vacuum and pg_stat_progress_analyze, and the output of VACUUM and ANALYZE when in VERBOSE mode; tracking must be enabled with the server variable . @@ -861,7 +861,7 @@ Author: Michael Paquier -Add pg_stat_io columns to report I/O activity in bytes (Nazir Bilal Yavuz) +Add pg_stat_io columns to report I/O activity in bytes (Nazir Bilal Yavuz) § @@ -900,7 +900,7 @@ Author: Michael Paquier -Change server variable to control tracking WAL timing in pg_stat_io instead of pg_stat_wal (Bertrand Drouvot) +Change server variable to control tracking WAL timing in pg_stat_io instead of pg_stat_wal (Bertrand Drouvot) § @@ -959,7 +959,7 @@ Author: Fujii Masao -Add column pg_stat_checkpointer.num_done to report the number of completed checkpoints (Anton A. Melnikov) +Add column pg_stat_checkpointer.num_done to report the number of completed checkpoints (Anton A. Melnikov) § @@ -991,7 +991,7 @@ Author: Michael Paquier -Add columns to pg_stat_database to report parallel workers activity (Benoit Lobréau) +Add columns to pg_stat_database to report parallel workers activity (Benoit Lobréau) § @@ -1042,7 +1042,7 @@ Author: David Rowley -Add column pg_backend_memory_contexts.type to report the type of memory context (David Rowley) +Add column pg_backend_memory_contexts.type to report the type of memory context (David Rowley) § @@ -1102,7 +1102,7 @@ Author: Fujii Masao -Allow ALTER DEFAULT PRIVILEGES to define large object default privileges (Takatsuka Haruka, Yugo Nagata, Laurenz Albe) +Allow to define large object default privileges (Takatsuka Haruka, Yugo Nagata, Laurenz Albe) § @@ -1378,7 +1378,7 @@ Author: Amit Kapila -Change the default CREATE SUBSCRIPTION streaming option from off to parallel (Vignesh C) +Change the default streaming option from off to parallel (Vignesh C) § @@ -1392,7 +1392,7 @@ Author: Amit Kapila -Allow ALTER SUBSCRIPTION to change the replication slot's two-phase commit behavior (Hayato Kuroda, Ajin Cherian, Amit Kapila, Zhijie Hou) +Allow ALTER SUBSCRIPTION to change the replication slot's two-phase commit behavior (Hayato Kuroda, Ajin Cherian, Amit Kapila, Zhijie Hou) § § @@ -1422,7 +1422,7 @@ Log conflicts while applying logical replication changes (Zhijie Hou, Nisha Moon -Also report in new columns of pg_stat_subscription_stats. +Also report in new columns of pg_stat_subscription_stats. @@ -1471,7 +1471,7 @@ Add OLD/NEW support to RETURNING< -Previously RETURNING only returned new values for INSERT and UPDATE, and old values for DELETE; MERGE would return the appropriate value for the internal query executed. This new syntax +Previously RETURNING only returned new values for and , and old values for ; would return the appropriate value for the internal query executed. This new syntax allows the RETURNING list of INSERT/UPDATE/DELETE/MERGE to explicitly return old and new values by using the special aliases old and new. These aliases can be renamed to avoid identifier conflicts. @@ -1489,7 +1489,7 @@ Allow foreign tables to be created like existing local tables (Zhang Mingli) -The syntax is CREATE FOREIGN TABLE ... LIKE. +The syntax is CREATE FOREIGN TABLE ... LIKE. @@ -1544,7 +1544,7 @@ Author: David Rowley -Allow VACUUM and ANALYZE to process partitioned tables without processing their children (Michael Harris) +Allow and to process partitioned tables without processing their children (Michael Harris) § @@ -1588,7 +1588,7 @@ Add server variable to control the file c -This controls whether CREATE DATABASE ... STRATEGY=FILE_COPY and ALTER DATABASE ... SET TABLESPACE uses file copy or clone. +This controls whether CREATE DATABASE ... STRATEGY=FILE_COPY and ALTER DATABASE ... SET TABLESPACE uses file copy or clone. @@ -1630,7 +1630,7 @@ Allow CHECK and foreign key constraints to be specified as -This also adds column pg_constraint.conenforced. +This also adds column pg_constraint.conenforced. - - - -Add function pg_check_fipsmode() to report the server's FIPS mode (Daniel Gustafsson) -§ - - - -Add optional parameter to json{b}_strip_nulls to allow removal of null array elements (Florents Tselai) +Add optional parameter to json{b}_strip_nulls to allow removal of null array elements (Florents Tselai) § @@ -1981,7 +1969,7 @@ Author: Tom Lane -Add function array_sort() which sorts an array's first dimension (Junwang Zhao, Jian He) +Add function array_sort() which sorts an array's first dimension (Junwang Zhao, Jian He) § @@ -1993,7 +1981,7 @@ Author: Michael Paquier -Add function array_reverse() which reverses an array's first dimension (Aleksander Alekseev) +Add function array_reverse() which reverses an array's first dimension (Aleksander Alekseev) § @@ -2005,7 +1993,7 @@ Author: Nathan Bossart -Add function reverse() to reverse bytea bytes (Aleksander Alekseev) +Add function reverse() to reverse bytea bytes (Aleksander Alekseev) § @@ -2017,7 +2005,7 @@ Author: Dean Rasheed -Allow casting between integer types and bytea (Aleksander Alekseev) +Allow casting between integer types and bytea (Aleksander Alekseev) § @@ -2033,7 +2021,7 @@ Author: Peter Eisentraut -Update Unicode data to Unicode 16.0.0 (Peter Eisentraut) +Update Unicode data to Unicode 16.0.0 (Peter Eisentraut) § @@ -2045,7 +2033,7 @@ Author: Tom Lane -Add full text search stemming for Estonian (Tom Lane) +Add full text search stemming for Estonian (Tom Lane) § @@ -2057,12 +2045,12 @@ Author: Tom Lane -Improve the XML error codes to more closely match the SQL standard (Tom Lane) +Improve the XML error codes to more closely match the SQL standard (Tom Lane) § -These errors are reported via SQLSTATE. +These errors are reported via SQLSTATE. @@ -2082,7 +2070,7 @@ Author: Jeff Davis -Add function CASEFOLD() to allow for more sophisticated case-insensitive matching (Jeff Davis) +Add function casefold() to allow for more sophisticated case-insensitive matching (Jeff Davis) § @@ -2100,7 +2088,7 @@ Author: Tom Lane -Allow MIN()/MAX() aggregates on arrays and composite types (Aleksander Alekseev, Marat Buharov) +Allow MIN()/MAX() aggregates on arrays and composite types (Aleksander Alekseev, Marat Buharov) § § @@ -2113,7 +2101,7 @@ Author: Tom Lane -Add a WEEK option to EXTRACT() (Tom Lane) +Add a WEEK option to EXTRACT() (Tom Lane) § @@ -2137,7 +2125,7 @@ Author: Tom Lane -Add roman numeral support to to_number() (Hunaid Sohail) +Add roman numeral support to to_number() (Hunaid Sohail) § @@ -2153,12 +2141,12 @@ Author: Masahiko Sawada -Add UUID version 7 generation function uuidv7() (Andrey Borodin) +Add UUID version 7 generation function uuidv7() (Andrey Borodin) § -This UUID value is temporally sortable. Function alias uuidv4() has been added to explicitly generate version 4 UUIDs. +This UUID value is temporally sortable. Function alias uuidv4() has been added to explicitly generate version 4 UUIDs. @@ -2169,7 +2157,7 @@ Author: Nathan Bossart -Add functions crc32() and crc32c() to compute CRC values (Aleksander Alekseev) +Add functions crc32() and crc32c() to compute CRC values (Aleksander Alekseev) § @@ -2181,7 +2169,7 @@ Author: Dean Rasheed -Add math functions gamma() and lgamma() (Dean Rasheed) +Add math functions gamma() and lgamma() (Dean Rasheed) § @@ -2193,7 +2181,7 @@ Author: Tom Lane -Allow => syntax for named cursor arguments in plpgsql (Pavel Stehule) +Allow => syntax for named cursor arguments in PL/pgSQL (Pavel Stehule) § @@ -2209,7 +2197,7 @@ Author: Tom Lane -Allow regexp_match[es]()/regexp_like()/regexp_replace()/regexp_count()/regexp_instr()/regexp_substr()/regexp_split_to_table()/regexp_split_to_array() to use named arguments (Jian He) +Allow regexp_match[es]()/regexp_like()/regexp_replace()/regexp_count()/regexp_instr()/regexp_substr()/regexp_split_to_table()/regexp_split_to_array() to use named arguments (Jian He) § @@ -2230,7 +2218,7 @@ Author: Robert Haas -Add function PQfullProtocolVersion() to report the full, including minor, protocol version number (Jacob Champion, Jelte Fennema-Nio) +Add function PQfullProtocolVersion() to report the full, including minor, protocol version number (Jacob Champion, Jelte Fennema-Nio) § @@ -2244,7 +2232,7 @@ Author: Heikki Linnakangas -Add libpq connection parameters and environment variables to specify the minimum and maximum acceptable protocol version for connections (Jelte Fennema-Nio) +Add libpq connection parameters and environment variables to specify the minimum and maximum acceptable protocol version for connections (Jelte Fennema-Nio) § § @@ -2257,7 +2245,7 @@ Author: Michael Paquier -Add libpq function PQservice() to return the connection service name (Michael Banck) +Add libpq function PQservice() to return the connection service name (Michael Banck) § @@ -2292,7 +2280,7 @@ Author: Álvaro Herrera -Add PQtrace() output for all message types, including authentication (Jelte Fennema-Nio) +Add PQtrace() output for all message types, including authentication (Jelte Fennema-Nio) § § § @@ -2308,7 +2296,7 @@ Author: Daniel Gustafsson -Add libpq connection parameter sslkeylogfile which dumps out SSL key material (Abhishek Chanda, Daniel Gustafsson) +Add libpq connection parameter sslkeylogfile which dumps out SSL key material (Abhishek Chanda, Daniel Gustafsson) § @@ -2354,7 +2342,7 @@ Allow psql to parse, bind, and close named prepared s -This is accomplished with new commands \parse, \bind_named, and \close. +This is accomplished with new commands \parse, \bind_named, and \close. @@ -2376,7 +2364,7 @@ Add psql backslash commands to allowing issuance of p -The new commands are \startpipeline, \syncpipeline, \sendpipeline, \endpipeline, \flushrequest, \flush, and \getresults. +The new commands are \startpipeline, \syncpipeline, \sendpipeline, \endpipeline, \flushrequest, \flush, and \getresults. @@ -2392,7 +2380,7 @@ Allow adding pipeline status to the psql prompt and a -The new prompt character is %P and the new psql variables are PIPELINE_SYNC_COUNT, PIPELINE_COMMAND_COUNT, and PIPELINE_RESULT_COUNT. +The new prompt character is %P and the new psql variables are PIPELINE_SYNC_COUNT, PIPELINE_COMMAND_COUNT, and PIPELINE_RESULT_COUNT. @@ -2431,7 +2419,7 @@ Author: Álvaro Herrera -Change psql's \conninfo to use tabular format and include more information (Álvaro Herrera, Maiquel Grassi, Hunaid Sohail) +Change psql's to use tabular format and include more information (Álvaro Herrera, Maiquel Grassi, Hunaid Sohail) § @@ -2443,7 +2431,7 @@ Author: Dean Rasheed -Add function's leakproof indicator to psql's \df+, \do+, \dAo+, and \dC+ outputs (Yugo Nagata) +Add function's leakproof indicator to psql's \df+, \do+, \dAo+, and \dC+ outputs (Yugo Nagata) § @@ -2455,7 +2443,7 @@ Author: Michael Paquier -Add access method details for partitioned relations in \dP+ (Justin Pryzby) +Add access method details for partitioned relations in \dP+ (Justin Pryzby) § @@ -2467,7 +2455,7 @@ Author: Magnus Hagander -Add default_version to the psql \dx extension output (Magnus Hagander) +Add default_version to the psql \dx extension output (Magnus Hagander) § @@ -2479,7 +2467,7 @@ Author: Daniel Gustafsson -Add psql variable WATCH_INTERVAL to set the default \watch wait time (Daniel Gustafsson) +Add psql variable to set the default \watch wait time (Daniel Gustafsson) § @@ -2537,7 +2525,7 @@ Author: Nathan Bossart -Add vacuumdb option to compute only missing optimizer statistics (Corey Huinker, Nathan Bossart) +Add option to compute only missing optimizer statistics (Corey Huinker, Nathan Bossart) § § @@ -2570,7 +2558,7 @@ Author: Robert Haas -Allow pg_verifybackup to verify tar-format backups (Amul Sul) +Allow to verify tar-format backups (Amul Sul) § @@ -2594,7 +2582,7 @@ Author: Masahiko Sawada -Add pg_resetwal option to change the default char signedness (Masahiko Sawada) +Add option to change the default char signedness (Masahiko Sawada) § @@ -2888,13 +2876,13 @@ Author: Michael Paquier -Separate the loading and running of injection points (Michael Paquier, Heikki Linnakangas) +Separate the loading and running of injection points (Michael Paquier, Heikki Linnakangas) § § -Injection points can now be created, but not run, via INJECTION_POINT_LOAD(), and such injection points can be run via INJECTION_POINT_CACHED(). +Injection points can now be created, but not run, via INJECTION_POINT_LOAD(), and such injection points can be run via INJECTION_POINT_CACHED(). @@ -2917,7 +2905,7 @@ Author: Heikki Linnakangas -Allow inline injection point test code with IS_INJECTION_POINT_ATTACHED() (Heikki Linnakangas) +Allow inline injection point test code with IS_INJECTION_POINT_ATTACHED() (Heikki Linnakangas) § @@ -2929,7 +2917,7 @@ Author: David Rowley -Improve the performance of processing long JSON strings using SIMD instructions (David Rowley) +Improve the performance of processing long JSON strings using SIMD (Single Instruction Multiple Data) (David Rowley) § @@ -2993,14 +2981,14 @@ Author: Tomas Vondra -Add configure option to enable NUMA awareness (Jakub Wartak, Bertrand Drouvot) +Add configure option to enable NUMA awareness (Jakub Wartak, Bertrand Drouvot) § § § -The function pg_numa_available() reports on NUMA awareness, and system views pg_shmem_allocations_numa and pg_buffercache_numa which report on shared memory distribution across +The function pg_numa_available() reports on NUMA awareness, and system views pg_shmem_allocations_numa and pg_buffercache_numa which report on shared memory distribution across NUMA nodes. @@ -3012,7 +3000,7 @@ Author: Nathan Bossart -Add TOAST table to pg_index to allow for very large expression indexes (Nathan Bossart) +Add TOAST table to pg_index to allow for very large expression indexes (Nathan Bossart) § @@ -3051,7 +3039,7 @@ Author: Peter Eisentraut -Add amgettreeheight, amconsistentequality, and amconsistentordering to the index access method API (Mark Dilger) +Add amgettreeheight, amconsistentequality, and amconsistentordering to the index access method API (Mark Dilger) § § @@ -3064,7 +3052,7 @@ Author: Peter Eisentraut -Add GiST support function stratnum() (Paul A. Jungwirth) +Add GiST support function stratnum() (Paul A. Jungwirth) § @@ -3076,7 +3064,7 @@ Author: Masahiko Sawada -Record the default CPU signedness of char in pg_controldata (Masahiko Sawada) +Record the default CPU signedness of char in (Masahiko Sawada) § @@ -3146,12 +3134,12 @@ Author: Tom Lane -Add macro PG_MODULE_MAGIC_EXT to allow extensions to report their name and version (Andrei Lepikhov) +Add macro PG_MODULE_MAGIC_EXT to allow extensions to report their name and version (Andrei Lepikhov) § -This information can be access via the new function pg_get_loaded_modules(). +This information can be access via the new function pg_get_loaded_modules(). @@ -3162,7 +3150,7 @@ Author: Tom Lane -Document that SPI_connect()/SPI_connect_ext() always returns success (SPI_OK_CONNECT) (Stepan Neretin) +Document that SPI_connect()/SPI_connect_ext() always returns success (SPI_OK_CONNECT) (Stepan Neretin) § @@ -3173,25 +3161,25 @@ Errors are always reported via ereport(). -Remove the experimental designation of Meson builds on Windows (Aleksander Alekseev) -§ +Add documentation section about API and ABI compatibility (David Wheeler, Peter Eisentraut) +§ -Add documentation section about API and ABI compatibility (David Wheeler, Peter Eisentraut) -§ +Remove the experimental designation of Meson builds on Windows (Aleksander Alekseev) +§ @@ -3254,7 +3242,7 @@ Author: Robert Haas -Add extension pg_overexplain which adds debug details to EXPLAIN output (Robert Haas) +Add extension which adds debug details to EXPLAIN output (Robert Haas) § @@ -3272,7 +3260,7 @@ Author: Fujii Masao -Add output columns to postgres_fdw_get_connections() (Hayato Kuroda, Sagar Dilip Shedge) +Add output columns to postgres_fdw_get_connections() (Hayato Kuroda, Sagar Dilip Shedge) § § § @@ -3292,15 +3280,15 @@ Author: Peter Eisentraut -Allow SCRAM authentication from the client to be passed to +Allow SCRAM authentication from the client to be passed to servers (Matheus Alcantara, Peter Eisentraut) § This avoids storing postgres_fdw authentication information in the database, and is enabled with the -postgres_fdw use_scram_passthrough connection option. libpq uses new connection -parameters scram_client_key and scram_server_key. +postgres_fdw use_scram_passthrough connection option. libpq uses new connection +parameters and . @@ -3373,7 +3361,7 @@ Author: Tatsuo Ishii -Have pgbench report the number of failed, retried, or skipped transactions in per-script reports (Yugo Nagata) +Have report the number of failed, retried, or skipped transactions in per-script reports (Yugo Nagata) § @@ -3390,7 +3378,7 @@ Add server variable weak to control inv -This was previously only controlled by function isn_weak(). +This was previously only controlled by function isn_weak(). @@ -3401,7 +3389,7 @@ Author: Heikki Linnakangas -Allow values to be sorted to speed btree_gist index builds (Bernd Helmle, Andrey Borodin) +Allow values to be sorted to speed index builds (Bernd Helmle, Andrey Borodin) § @@ -3413,7 +3401,7 @@ Author: Tomas Vondra -Add amcheck function gin_index_check() to verify GIN indexes (Grigory Kryachko, Heikki Linnakangas, Andrey Borodin) +Add check function gin_index_check() to verify GIN indexes (Grigory Kryachko, Heikki Linnakangas, Andrey Borodin) § @@ -3425,12 +3413,12 @@ Author: Andres Freund -Add functions pg_buffercache_evict_relation() and pg_buffercache_evict_all() to evict unpinned shared buffers (Nazir Bilal Yavuz) +Add functions pg_buffercache_evict_relation() and pg_buffercache_evict_all() to evict unpinned shared buffers (Nazir Bilal Yavuz) § -The existing function pg_buffercache_evict() now returns the buffer flush status. +The existing function pg_buffercache_evict() now returns the buffer flush status. @@ -3445,7 +3433,7 @@ Author: Robert Haas -Allow extensions to install custom EXPLAIN options (Robert Haas, Sami Imseih) +Allow extensions to install custom options (Robert Haas, Sami Imseih) § § § @@ -3550,7 +3538,7 @@ Author: Álvaro Herrera -Add pgcrypto functions sha256crypt() and sha512crypt() (Bernd Helmle) +Add pgcrypto algorithms sha256crypt and sha512crypt (Bernd Helmle) § @@ -3562,11 +3550,23 @@ Author: Daniel Gustafsson -Add CFB mode to pgcrypto encryption and decryption (Umar Hayat) +Add CFB mode to pgcrypto encryption and decryption (Umar Hayat) § + + + + +Add function fips_mode() to report the server's FIPS mode (Daniel Gustafsson) +§ + + + - - -Change default to enable data checksums (Greg Sabino Mullane) -§ - + + + Change default to enable data checksums + (Greg Sabino Mullane) + § + - -Checksums can be disabled with the new initdb option . - requires matching cluster checksum settings, so this new -option can be useful to upgrade non-checksum old clusters. - - + + Checksums can be disabled with the + new initdb option + . + requires matching cluster checksum settings, so this new option can + be useful to upgrade non-checksum old clusters. + + - - -Change time zone abbreviation handling (Tom Lane) -§ - + + + Change time zone abbreviation handling (Tom Lane) + § + - -The system will now favor the current session's time zone abbreviations before checking the server variable . Previously timezone_abbreviations was -checked first. - - + + The system will now favor the current session's time + zone abbreviations before checking the server variable + . Previously + timezone_abbreviations was checked first. + + - - -Deprecate MD5 password authentication (Nathan Bossart) -§ - + + + Deprecate MD5 password + authentication (Nathan Bossart) + § + - -Support for MD5 passwords will be removed in a future major version release. and now emit deprecation warnings when setting MD5 passwords. -These warnings can be disabled by setting the parameter to off. - - + + Support for MD5 passwords will be removed in a future major + version release. and now emit deprecation warnings when + setting MD5 passwords. These warnings can be disabled by setting + the parameter to + off. + + - - -Change and to process the inheritance children of a parent (Michael Harris) -§ - + + + Change and + to process the inheritance children of a parent (Michael Harris) + § + - -The previous behavior can be performed by using the new ONLY option. - - + + The previous behavior can be performed by using the new + ONLY option. + + - - -Prevent COPY FROM from treating \. as an end-of-file marker when reading CSV files (Daniel Vérité, Tom Lane) -§ -§ - + + + Prevent COPY FROM + from treating \. as an end-of-file marker when + reading CSV files (Daniel Vérité, Tom Lane) + § + § + - - will still treat \. as an end-of-file marker when reading CSV files from STDIN. Older psql clients connecting to PostgreSQL 18 servers might -experience \copy problems. This -release also enforces that \. must appear alone on a line. - - + + will still treat + \. as an end-of-file marker when reading + CSV files from STDIN. + Older psql clients connecting to + PostgreSQL 18 servers might experience \copy + problems. This release also enforces that \. + must appear alone on a line. + + - - -Disallow unlogged partitioned tables (Michael Paquier) -§ - + + + Disallow unlogged partitioned tables (Michael Paquier) + § + - -Previously ALTER TABLE SET [UN]LOGGED did nothing, and the creation of an unlogged partitioned table did not cause its children to be unlogged. - - + + Previously ALTER TABLE SET + [UN]LOGGED did nothing, and the creation of an + unlogged partitioned table did not cause its children to be unlogged. + + - - -Execute AFTER triggers as the role that was active when trigger events were queued (Laurenz Albe) -§ - + + + Execute AFTER triggers as the role that was active when + trigger events were queued (Laurenz Albe) + § + - -Previously such triggers were run as the role that was active at trigger execution time (e.g., at ). This is significant for cases where the role is changed between queue time and -transaction commit. - - + + Previously such triggers were run as the role that was active at + trigger execution time (e.g., at ). + This is significant for cases where the role is changed between queue + time and transaction commit. + + - - -Remove non-functional support for rule privileges in / (Fujii Masao) -§ - + + + Remove non-functional support for rule privileges in / (Fujii Masao) + § + - -These have been non-functional since PostgreSQL 8.2. - - + + These have been non-functional since + PostgreSQL 8.2. + + - - -Remove column pg_backend_memory_contexts.parent (Melih Mutlu) -§ - + + + Remove column pg_backend_memory_contexts.parent + (Melih Mutlu) + § + - -This is no longer needed since pg_backend_memory_contexts.path was added. - - + + This is no longer needed since + pg_backend_memory_contexts.path + was added. + + - - -Change pg_backend_memory_contexts.level and pg_log_backend_memory_contexts() to be one-based (Melih Mutlu, Atsushi Torikoshi, David Rowley, Fujii Masao) -§ -§ -§ - + + + Change + pg_backend_memory_contexts.level + and pg_log_backend_memory_contexts() + to be one-based (Melih Mutlu, Atsushi Torikoshi, David Rowley, + Fujii Masao) + § + § + § + - -These were previously zero-based. - - + + These were previously zero-based. + + @@ -256,40 +292,48 @@ Author: Alexander Korotkov 2025-02-17 [fc069a3a6] Implement Self-Join Elimination --> - - -Automatically remove some unnecessary table self-joins (Andrey Lepikhov, Alexander Kuzmenkov, Alexander Korotkov, Alena Rybakina) -§ - + + + Automatically remove some unnecessary table self-joins (Andrey + Lepikhov, Alexander Kuzmenkov, Alexander Korotkov, Alena Rybakina) + § + - -This optimization can be disabled using server variable . - - + + This optimization can be disabled using server variable . + + - - -Convert some IN (VALUES ...) to x = ANY ... for better optimizer statistics (Alena Rybakina, Andrei Lepikhov) -§ - - + + + Convert some IN (VALUES + ...) to x = ANY ... for better + optimizer statistics (Alena Rybakina, Andrei Lepikhov) + § + + - - -Allow transforming OR-clauses to arrays for faster index processing (Alexander Korotkov, Andrey Lepikhov) -§ - - + + + Allow transforming OR-clauses + to arrays for faster index processing (Alexander Korotkov, Andrey + Lepikhov) + § + + - - -Speed up the processing of INTERSECT, EXCEPT, window aggregates, and view column aliases (Tom Lane, David Rowley) -§ -§ -§ -§ - - + + + Speed up the processing of INTERSECT, + EXCEPT, window aggregates, and view column aliases (Tom Lane, + David Rowley) + § + § + § + § + + - - -Allow the keys of SELECT DISTINCT to be internally reordered to avoid sorting (Richard Guo) -§ - + + + Allow the keys of SELECT + DISTINCT to be internally reordered to avoid sorting + (Richard Guo) + § + - -This optimization can be disabled using . - - + + This optimization can be disabled using . + + - - -Ignore GROUP BY columns that are functionally dependent on other columns (Zhang Mingli, Jian He, David Rowley) -§ - + + + Ignore GROUP BY + columns that are functionally dependent on other columns (Zhang + Mingli, Jian He, David Rowley) + § + - -If a GROUP BY clause includes all columns of a unique index, as well as other columns of the same table, those other columns are redundant and can be dropped -from the grouping. This was already true for non-deferred primary keys. - - + + If a GROUP BY clause includes all columns of + a unique index, as well as other columns of the same table, those + other columns are redundant and can be dropped from the grouping. + This was already true for non-deferred primary keys. + + - - -Allow some HAVING clauses on GROUPING SETS to be pushed to WHERE clauses (Richard Guo) -§ -§ -§ -§ - - - -This allows earlier row filtering. This release also fixes some GROUPING SETS queries that used to return incorrect results. - - + + + Allow some HAVING clauses + on GROUPING + SETS to be pushed to WHERE clauses + (Richard Guo) + § + § + § + § + + + + This allows earlier row filtering. This release also fixes some + GROUPING SETS queries that used to return + incorrect results. + + - - -Improve row estimates for generate_series() using numeric and timestamp values (David Rowley, Song Jinzhou) -§ -§ - - + + + Improve row estimates for generate_series() + using numeric + and timestamp + values (David Rowley, Song Jinzhou) + § + § + + - - -Allow the optimizer to use Right Semi Join plans (Richard Guo) -§ - + + + Allow the optimizer to use Right Semi Join plans + (Richard Guo) + § + - -Semi-joins are used when needing to find if there is at least one match. - - + + Semi-joins are used when needing to find if there is at least + one match. + + - - -Allow merge joins to use incremental sorts (Richard Guo) -§ - - + + + Allow merge joins to use incremental sorts + (Richard Guo) + § + + - - -Improve the efficiency of planning queries accessing many partitions (Ashutosh Bapat, Yuya Watari, David Rowley) -§ -§ - - + + + Improve the efficiency of planning queries accessing many partitions + (Ashutosh Bapat, Yuya Watari, David Rowley) + § + § + + - - -Allow partitionwise joins in more cases, and reduce its memory usage (Richard Guo, Tom Lane, Ashutosh Bapat) -§ -§ - - + + + Allow partitionwise + joins in more cases, and reduce its memory usage (Richard Guo, + Tom Lane, Ashutosh Bapat) + § + § + + - - -Improve cost estimates of partition queries (Nikita Malakhov, Andrei Lepikhov) -§ - - + + + Improve cost estimates of partition queries (Nikita Malakhov, + Andrei Lepikhov) + § + + - - -Improve SQL-language function plan caching (Alexander Pyhalov, Tom Lane) -§ -§ - - + + + Improve SQL-language + function plan caching (Alexander Pyhalov, Tom Lane) + § + § + + - - -Improve handling of disabled optimizer features (Robert Haas) -§ - - + + + Improve handling of disabled optimizer features (Robert Haas) + § + + @@ -498,18 +574,19 @@ Author: Peter Geoghegan 2025-04-04 [8a510275d] Further optimize nbtree search scan key comparisons. --> - - -Allow skip scans of btree indexes (Peter Geoghegan) -§ -§ - + + + Allow skip scans of btree indexes + (Peter Geoghegan) + § + § + - -This allows multi-column btree indexes to be used by queries that only -equality-reference the second or later indexed columns. - - + + This allows multi-column btree indexes to be used by queries that + only equality-reference the second or later indexed columns. + + - - -Allow non-btree unique indexes to be used as partition keys and in materialized views (Mark Dilger) -§ -§ - + + + Allow non-btree unique indexes to be used as partition keys and in + materialized views (Mark Dilger) + § + § + - -The index type must still support equality. - - + + The index type must still support equality. + + - - -Allow GIN indexes to be created in parallel (Tomas Vondra, Matthias van de Meent) -§ - - + + + Allow GIN indexes to + be created in parallel (Tomas Vondra, Matthias van de Meent) + § + + - - -Allow values to be sorted to speed range-type GiST and btree index builds (Bernd Helmle) -§ - - + + + Allow values to be sorted to speed range-type GiST and btree + index builds (Bernd Helmle) + § + + @@ -588,41 +669,51 @@ Author: Andres Freund 2025-03-30 [2a5e709e7] Enable IO concurrency on all systems --> - - -Add an asynchronous I/O subsystem (Andres Freund, Thomas Munro, Nazir Bilal Yavuz, Melanie Plageman) -§ -§ -§ -§ -§ -§ -§ -§ -§ -§ -§ - - - -This feature allows backends to queue multiple read requests, which allows for more efficient sequential scans, bitmap heap scans, vacuums, etc. -This is enabled by server variable , with server variables and added to control it. This also enables - and values greater than zero for systems without fadvise() support. The new system view pg_aios shows the file handles being used -for asynchronous I/O. - - + + + Add an asynchronous I/O subsystem (Andres Freund, Thomas Munro, + Nazir Bilal Yavuz, Melanie Plageman) + § + § + § + § + § + § + § + § + § + § + § + + + + This feature allows backends to queue multiple read requests, + which allows for more efficient sequential scans, bitmap + heap scans, vacuums, etc. This is enabled by server + variable , with server + variables and added to control it. + This also enables + and + values greater than zero for systems without + fadvise() support. The new system view pg_aios + shows the file handles being used for asynchronous I/O. + + - - -Improve the locking performance of queries that access many relations (Tomas Vondra) -§ - - + + + Improve the locking performance of queries that access many relations + (Tomas Vondra) + § + + - - -Improve the performance and reduce memory usage of hash joins and GROUP BY (David Rowley, Jeff Davis) -§ -§ -§ -§ -§ - + + + Improve the performance and reduce memory usage of hash joins and + GROUP BY + (David Rowley, Jeff Davis) + § + § + § + § + § + - -This also improves hash set operations used by EXCEPT, and hash lookups of subplan values. - - + + This also improves hash set operations used by EXCEPT, and hash + lookups of subplan values. + + - - -Allow normal vacuums to freeze some pages, even though they are all-visible (Melanie Plageman) -§ -§ - + + + Allow normal vacuums to freeze some pages, even though they are + all-visible (Melanie Plageman) + § + § + - -This reduces the overhead of later full-relation freezing. The aggressiveness of this can be controlled by server variable and per-table setting . -Previously vacuum never processed all-visible pages until freezing was required. - - + + This reduces the overhead of later full-relation + freezing. The aggressiveness of this can be + controlled by server variable and per-table setting . Previously + vacuum never processed all-visible pages until freezing was required. + + - - -Add server variable to control file truncation during (Nathan Bossart, Gurjeet Singh) -§ - + + + Add server variable to control + file truncation during (Nathan Bossart, + Gurjeet Singh) + § + - -A storage-level parameter with the same name and behavior already existed. - - + + A storage-level parameter with the same name and behavior already + existed. + + - - -Increase server variables 's and 's default values to 16 (Melanie Plageman) -§ -§ - + + + Increase server variables 's and 's default values to 16 + (Melanie Plageman) + § + § + - -This more accurately reflects modern hardware. - - + + This more accurately reflects modern hardware. + + @@ -721,72 +826,87 @@ Author: Melanie Plageman 2025-03-12 [9219093ca] Modularize log_connections output --> - - -Increase the logging granularity of server variable (Melanie Plageman) -§ - + + + Increase the logging granularity of server variable (Melanie Plageman) + § + - -This server variable was previously only boolean, which is still supported. - - + + This server variable was previously only boolean, which is still + supported. + + - - -Add log_connections option to report the duration of connection stages (Melanie Plageman) -§ - - + + + Add log_connections option to report the duration + of connection stages (Melanie Plageman) + § + + - - -Add escape %L to output the client IP address (Greg Sabino Mullane) -§ - - + + + Add escape + %L to output the client IP + address (Greg Sabino Mullane) + § + + - - -Add server variable to log lock acquisition failures (Yuki Seino) -§ - + + + Add server variable to log + lock acquisition failures (Yuki Seino) + § + - -Specifically it reports SELECT ... NOWAIT lock failures. - - + + Specifically it reports SELECT + ... NOWAIT lock failures. + + - - -Modify pg_stat_all_tables and its variants to report the time spent in , , and their automatic variants (Sami Imseih) -§ - + + + Modify pg_stat_all_tables + and its variants to report the time spent in , , and their + automatic variants (Sami Imseih) + § + - -The new columns are total_vacuum_time, total_autovacuum_time, total_analyze_time, and total_autoanalyze_time. - - + + The new columns are total_vacuum_time, + total_autovacuum_time, + total_analyze_time, and + total_autoanalyze_time. + + - - -Add delay time reporting to and (Bertrand Drouvot, Nathan Bossart) -§ -§ - + + + Add delay time reporting to and (Bertrand Drouvot, Nathan Bossart) + § + § + - -This information appears in the server log, the system views pg_stat_progress_vacuum and pg_stat_progress_analyze, and the output of and when in VERBOSE -mode; tracking must be enabled with the server variable . - - + + This information appears in the server log, the system views pg_stat_progress_vacuum + and pg_stat_progress_analyze, + and the output of and when in VERBOSE + mode; tracking must be enabled with the server variable . + + - - -Add WAL, CPU, and average read statistics output to ANALYZE VERBOSE (Anthonin Bonnefoy) -§ -§ - - + + + Add WAL, CPU, and average + read statistics output to ANALYZE VERBOSE + (Anthonin Bonnefoy) + § + § + + - - -Add full WAL buffer count to VACUUM/ANALYZE (VERBOSE) and autovacuum log output (Bertrand Drouvot) -§ - - + + + Add full WAL buffer count to + VACUUM/ANALYZE (VERBOSE) + and autovacuum log output (Bertrand Drouvot) + § + + - - -Add per-backend I/O statistics reporting (Bertrand Drouvot) -§ -§ - + + + Add per-backend I/O statistics reporting (Bertrand Drouvot) + § + § + - -The statistics are accessed via pg_stat_get_backend_io(). Per-backend I/O statistics can be cleared via pg_stat_reset_backend_stats(). - - + + The statistics are accessed via pg_stat_get_backend_io(). + Per-backend I/O statistics can be cleared via pg_stat_reset_backend_stats(). + + - - -Add pg_stat_io columns to report I/O activity in bytes (Nazir Bilal Yavuz) -§ - + + + Add pg_stat_io + columns to report I/O activity in bytes (Nazir Bilal Yavuz) + § + - -The new columns are read_bytes, write_bytes, and extend_bytes. The op_bytes column, which always equaled BLCKSZ, has been removed. - - + + The new columns are read_bytes, + write_bytes, and + extend_bytes. The + op_bytes column, which always equaled + BLCKSZ, + has been removed. + + - - -Add WAL I/O activity rows to pg_stat_io (Nazir Bilal Yavuz, Bertrand Drouvot, Michael Paquier) -§ -§ -§ - + + + Add WAL I/O activity rows to + pg_stat_io (Nazir Bilal Yavuz, Bertrand + Drouvot, Michael Paquier) + § + § + § + - -This includes WAL receiver activity and a wait event for such writes. - + + This includes WAL receiver activity and a wait + event for such writes. + - + - - -Change server variable to control tracking WAL timing in pg_stat_io instead of pg_stat_wal (Bertrand Drouvot) -§ - - + + + Change server variable + to control tracking WAL timing + in pg_stat_io instead of pg_stat_wal + (Bertrand Drouvot) + § + + - - -Remove read/sync columns from pg_stat_wal (Bertrand Drouvot) -§ -§ - + + + Remove read/sync columns from pg_stat_wal + (Bertrand Drouvot) + § + § + - -This removes columns wal_write, wal_sync, wal_write_time, and wal_sync_time. - - + + This removes columns wal_write, + wal_sync, + wal_write_time, and + wal_sync_time. + + - - -Add function pg_stat_get_backend_wal() to return per-backend WAL statistics (Bertrand Drouvot) -§ - + + + Add function pg_stat_get_backend_wal() + to return per-backend WAL statistics (Bertrand + Drouvot) + § + - -Per-backend WAL statistics can be cleared via pg_stat_reset_backend_stats(). - - + + Per-backend WAL + statistics can be cleared via pg_stat_reset_backend_stats(). + + - - -Add function pg_ls_summariesdir() to specifically list the contents of PGDATA/pg_wal/summaries (Yushi Ogiwara) -§ - - + + + Add function pg_ls_summariesdir() + to specifically list the contents of PGDATA/pg_wal/summaries + (Yushi Ogiwara) + § + + - - -Add column pg_stat_checkpointer.num_done to report the number of completed checkpoints (Anton A. Melnikov) -§ - + + + Add column pg_stat_checkpointer.num_done + to report the number of completed checkpoints (Anton A. Melnikov) + § + - -Columns num_timed and num_requested count both completed and skipped checkpoints. - - + + Columns num_timed and + num_requested count both completed and + skipped checkpoints. + + - - -Add column pg_stat_checkpointer.slru_written to report SLRU buffers written (Nitin Jadhav) -§ - + + + Add column + pg_stat_checkpointer.slru_written + to report SLRU buffers written (Nitin Jadhav) + § + - -Also, modify the checkpoint server log message to report separate shared buffer and SLRU buffer values. - - + + Also, modify the checkpoint server log message to report separate + shared buffer and SLRU buffer values. + + - - -Add columns to pg_stat_database to report parallel worker activity (Benoit Lobréau) -§ - + + + Add columns to pg_stat_database + to report parallel worker activity (Benoit Lobréau) + § + - -The new columns are parallel_workers_to_launch and parallel_workers_launched. - - + + The new columns are + parallel_workers_to_launch and + parallel_workers_launched. + + - - -Have query id computation of arrays consider only the first and last array elements (Dmitry Dolgov, Sami Imseih) -§ -§ - + + + Have query id computation + of arrays consider only the first and last array elements (Dmitry + Dolgov, Sami Imseih) + § + § + - -Jumbling is used by . - - + + Jumbling is used by . + + - - -Adjust query id computations to group together queries using the same relation name (Michael Paquier, Sami Imseih) -§ - + + + Adjust query id computations to group together queries using the + same relation name (Michael Paquier, Sami Imseih) + § + - -This is true even if the tables in different schemas have different column names. - - + + This is true even if the tables in different schemas have different + column names. + + - - -Add column pg_backend_memory_contexts.type to report the type of memory context (David Rowley) -§ - - + + + Add column pg_backend_memory_contexts.type + to report the type of memory context (David Rowley) + § + + - - -Add column pg_backend_memory_contexts.path to show memory context parents (Melih Mutlu) -§ - - + + + Add column + pg_backend_memory_contexts.path + to show memory context parents (Melih Mutlu) + § + + @@ -1075,53 +1256,61 @@ Author: Michael Paquier 2024-07-10 [d898665bf] Extend pg_get_acl() to handle sub-object IDs --> - - -Add function pg_get_acl() to retrieve database access control details (Joel Jacobson) -§ -§ - - + + + Add function pg_get_acl() + to retrieve database access control details (Joel Jacobson) + § + § + + - - -Add function has_largeobject_privilege() to check large object privileges (Yugo Nagata) -§ - - + + + Add function has_largeobject_privilege() + to check large object privileges (Yugo Nagata) + § + + - - -Allow to define large object default privileges (Takatsuka Haruka, Yugo Nagata, Laurenz Albe) -§ - - + + + Allow to define + large object default privileges (Takatsuka Haruka, Yugo Nagata, + Laurenz Albe) + § + + - - -Add predefined role pg_signal_autovacuum_worker (Kirill Reshke) -§ - + + + Add predefined role pg_signal_autovacuum_worker + (Kirill Reshke) + § + - -This allows sending signals to autovacuum workers. - - + + This allows sending signals to autovacuum workers. + + @@ -1137,56 +1326,69 @@ Author: Daniel Gustafsson 2025-02-20 [b3f0be788] Add support for OAUTHBEARER SASL mechanism --> - - -Add support for the OAuth authentication method (Jacob Champion, Daniel Gustafsson, Thomas Munro) -§ - + + + Add support for the OAuth authentication + method (Jacob Champion, Daniel Gustafsson, Thomas Munro) + § + - -This adds an oauth authentication method to pg_hba.conf, libpq OAuth options, a server variable to load token validation libraries, and -a configure flag to add the required compile-time libraries. - - + + This adds an oauth authentication method to pg_hba.conf, + libpq OAuth options, a server variable to load + token validation libraries, and a configure flag + to add the required compile-time libraries. + + - - -Add server variable to allow specification of multiple colon-separated TLSv1.3 cipher suites (Erica Zhang, Daniel Gustafsson) -§ - - + + + Add server variable to allow + specification of multiple colon-separated TLSv1.3 cipher suites + (Erica Zhang, Daniel Gustafsson) + § + + - - -Change server variable 's default to include elliptic curve X25519 (Daniel Gustafsson, Jacob Champion) -§ - - + + + Change server variable 's default + to include elliptic curve X25519 (Daniel Gustafsson, Jacob Champion) + § + + - - -Rename server variable ssl_ecdh_curve to and allow multiple colon-separated ECDH curves to be specified (Erica Zhang, Daniel Gustafsson) -§ - + + + Rename server variable ssl_ecdh_curve to and allow multiple colon-separated + ECDH curves to be specified (Erica Zhang, + Daniel Gustafsson) + § + -The previous name still works. - - + + The previous name still works. + + - - -Make cancel request keys 256 bits (Heikki Linnakangas, Jelte Fennema-Nio) -§ -§ - + + + Make cancel request + keys 256 bits (Heikki Linnakangas, Jelte Fennema-Nio) + § + § + - -This is only possible when the server and client support wire protocol version 3.2, introduced in this release. - - + + This is only possible when the server and client support wire + protocol version 3.2, introduced in this release. + + - - -Add server variable to specify the maximum number of background workers (Nathan Bossart) -§ - + + + Add server variable + to specify the maximum number of background workers (Nathan Bossart) + § + - -With this variable set, can be adjusted at runtime up to this maximum without a server restart. - - + + With this variable set, + can be adjusted at runtime up to this maximum without a server + restart. + + - - -Allow specification of the fixed number of dead tuples that will trigger an autovacuum (Nathan Bossart, Frédéric Yhuel) -§ - + + + Allow specification of the fixed number of dead tuples that will + trigger an autovacuum (Nathan + Bossart, Frédéric Yhuel) + § + - -The server variable is . Percentages are still used for triggering. - - + + The server variable is . Percentages are + still used for triggering. + + - - -Change server variable to limit only files opened by a backend (Andres Freund) -§ - + + + Change server variable + to limit only files opened by a backend (Andres Freund) + § + - -Previously files opened by the postmaster were also counted toward this limit. - - + + Previously files opened by the postmaster were also counted toward + this limit. + + - - -Add server variable to report the required number of semaphores (Nathan Bossart) -§ - + + + Add server variable to + report the required number of semaphores (Nathan Bossart) + § + - -This is useful for operating system configuration. - - + + This is useful for operating system configuration. + + - - -Add server variable to specify the location of extension control files (Peter Eisentraut, Matheus Alcantara) -§ -§ - - + + + Add server variable to + specify the location of extension control files (Peter Eisentraut, + Matheus Alcantara) + § + § + + - + @@ -1300,28 +1516,34 @@ Author: Amit Kapila 2025-02-19 [ac0e33136] Invalidate inactive replication slots. --> - - -Allow inactive replication slots to be automatically invalided using server variable (Nisha Moond, Bharath Rupireddy) -§ - - + + + Allow inactive replication slots to be automatically invalided using + server variable + (Nisha Moond, Bharath Rupireddy) + § + + - - -Add server variable to control the maximum active replication origins (Euler Taveira) -§ - + + + Add server variable to control the + maximum active replication origins (Euler Taveira) + § + - -This was previously controlled by , but this new setting allows a higher origin count in cases where fewer slots are required. - - + + This was previously controlled by , but this new setting allows + a higher origin count in cases where fewer slots are required. + + @@ -1343,33 +1565,44 @@ Author: Amit Kapila 2025-01-30 [6252b1eaf] Doc: Generated column replication. --> - - -Allow the values of generated columns to be logically replicated (Shubham Khanna, Vignesh C, Zhijie Hou, Shlok Kyal, Peter Smith) -§ -§ -§ -§ - - - -If the publication specifies a column list, all specified columns, generated and non-generated, are published. Without a specified column list, publication option publish_generated_columns -controls whether generated columns are published. Previously generated columns were not replicated and the subscriber had to compute the values if possible; this is particularly -useful for non-PostgreSQL subscribers which lack such a capability. - - + + + Allow the values of generated + columns to be logically replicated (Shubham Khanna, Vignesh C, + Zhijie Hou, Shlok Kyal, Peter Smith) + § + § + § + § + + + + If the publication specifies a column list, all specified + columns, generated and non-generated, are published. + Without a specified column list, publication option + publish_generated_columns controls whether + generated columns are published. Previously generated columns + were not replicated and the subscriber had to compute + the values if possible; this is particularly useful for + non-PostgreSQL subscribers which lack + such a capability. + + - - -Change the default streaming option from off to parallel (Vignesh C) -§ - - + + + Change the default streaming + option from off to parallel + (Vignesh C) + § + + - - -Allow to change the replication slot's two-phase commit behavior (Hayato Kuroda, Ajin Cherian, Amit Kapila, Zhijie Hou) -§ -§ - - + + + Allow to change the + replication slot's two-phase commit behavior (Hayato Kuroda, Ajin + Cherian, Amit Kapila, Zhijie Hou) + § + § + + - - -Log conflicts while applying logical replication changes (Zhijie Hou, Nisha Moond) -§ -§ -§ -§ -§ - + + + Log conflicts while + applying logical replication changes (Zhijie Hou, Nisha Moond) + § + § + § + § + § + - -Also report in new columns of pg_stat_subscription_stats. - - + + Also report in new columns of pg_stat_subscription_stats. + + @@ -1434,112 +1671,136 @@ Author: Richard Guo 2025-02-25 [1e4351af3] Expand virtual generated columns in the planner --> - - -Allow generated columns to be virtual, and make them the default (Peter Eisentraut, Jian He, Richard Guo, Dean Rasheed) -§ -§ -§ - + + + Allow generated + columns to be virtual, and make them the default (Peter + Eisentraut, Jian He, Richard Guo, Dean Rasheed) + § + § + § + - -Virtual generated columns generate their values when the columns are read, not written. The write behavior can still be specified via the STORED option. - - + + Virtual generated columns generate their values when the columns + are read, not written. The write behavior can still be specified + via the STORED option. + + - - -Add OLD/NEW support to RETURNING in DML queries (Dean Rasheed) -§ - + + + Add OLD/NEW support to RETURNING in + DML queries (Dean Rasheed) + § + - -Previously RETURNING only returned new values for and , and old values for ; would return the appropriate value for the internal query executed. This new syntax -allows the RETURNING list of INSERT/UPDATE/DELETE/MERGE to explicitly return old and new values by using the special aliases old and new. These aliases can be renamed to -avoid identifier conflicts. - - + + Previously RETURNING only returned new values for + and , and old + values for ; + would return the appropriate value for the internal query executed. + This new syntax allows the RETURNING list of + INSERT/UPDATE/DELETE/MERGE + to explicitly return old and new values by using the special aliases + old and new. These aliases + can be renamed to avoid identifier conflicts. + + - - -Allow foreign tables to be created like existing local tables (Zhang Mingli) -§ - + + + Allow foreign tables to be created like existing local tables + (Zhang Mingli) + § + - -The syntax is CREATE FOREIGN TABLE ... LIKE. - - + + The syntax is CREATE + FOREIGN TABLE ... LIKE. + + - - -Allow LIKE with nondeterministic collations (Peter Eisentraut) -§ - - + + + Allow LIKE + with nondeterministic + collations (Peter Eisentraut) + § + + - - -Allow text position search functions with nondeterministic collations (Peter Eisentraut) -§ - + + + Allow text position search functions with nondeterministic collations + (Peter Eisentraut) + § + - -These used to generate an error. - - + + These used to generate an error. + + - - -Add builtin collation provider PG_UNICODE_FAST (Jeff Davis) -§ - + + + Add builtin collation provider PG_UNICODE_FAST + (Jeff Davis) + § + - -This locale supports case mapping, but sorts in code point order, not natural language order. - - + + This locale supports case mapping, but sorts in code point order, + not natural language order. + + - - -Allow and to process partitioned tables without processing their children (Michael Harris) -§ - + + + Allow and + to process partitioned tables without processing their children + (Michael Harris) + § + - -This is enabled with the new ONLY option. This is useful since autovacuum does not process partitioned tables, just its children. - - + + This is enabled with the new ONLY option. This is + useful since autovacuum does not process partitioned tables, just + its children. + + - - -Add functions to modify per-relation and per-column optimizer statistics (Corey Huinker) -§ -§ -§ - + + + Add functions to modify per-relation and per-column optimizer + statistics (Corey Huinker) + § + § + § + - -The functions are pg_restore_relation_stats(), pg_restore_attribute_stats(), pg_clear_relation_stats(), and pg_clear_attribute_stats(). - - + + The functions are pg_restore_relation_stats(), + pg_restore_attribute_stats(), + pg_clear_relation_stats(), and + pg_clear_attribute_stats(). + + - - -Add server variable to control the file copying method (Nazir Bilal Yavuz) -§ - + + + Add server variable to control + the file copying method (Nazir Bilal Yavuz) + § + - -This controls whether CREATE DATABASE ... STRATEGY=FILE_COPY and ALTER DATABASE ... SET TABLESPACE uses file copy or clone. - - + + This controls whether CREATE DATABASE + ... STRATEGY=FILE_COPY and ALTER DATABASE ... SET + TABLESPACE uses file copy or clone. + + <link linkend="ddl-constraints">Constraints</link> - + - - -Allow the specification of non-overlapping PRIMARY KEY and UNIQUE constraints (Paul A. Jungwirth) -§ - + + + Allow the specification of non-overlapping PRIMARY + KEY and UNIQUE + constraints (Paul A. Jungwirth) + § + - -This is specified by WITHOUT OVERLAPS on the last specified column. - - + + This is specified by WITHOUT OVERLAPS on the + last specified column. + + - - -Allow CHECK and foreign key constraints to be specified as NOT ENFORCED (Amul Sul) -§ -§ - + + + Allow CHECK + and foreign + key constraints to be specified as NOT + ENFORCED (Amul Sul) + § + § + - -This also adds column pg_constraint.conenforced. - + + This also adds column pg_constraint.conenforced. + + - - -Require primary/foreign key relationships to use either deterministic collations or the the same nondeterministic collations (Peter Eisentraut) -§ - + + + Require primary/foreign key + relationships to use either deterministic collations or the the + same nondeterministic collations (Peter Eisentraut) + § + - -The restore of a , also used by , will fail if these requirements are not met; schema changes must be made for these upgrade methods to succeed. - - + + The restore of a , also used by , will fail if these requirements are not met; + schema changes must be made for these upgrade methods to succeed. + + - - -Store column NOT NULL specifications in pg_constraint (Álvaro Herrera, Bernd Helmle) -§ - + + + Store column NOT + NULL specifications in pg_constraint + (Álvaro Herrera, Bernd Helmle) + § + - -This allows names to be specified for NOT NULL constraint. This also adds NOT NULL constraints to foreign tables and NOT NULL inheritance control to local tables. - - + + This allows names to be specified for NOT NULL + constraint. This also adds NOT NULL constraints + to foreign tables and NOT NULL inheritance + control to local tables. + + - - -Allow to set the NOT VALID attribute of NOT NULL constraints (Rushabh Lathia, Jian He) -§ - - + + + Allow to set the NOT + VALID attribute of NOT NULL constraints + (Rushabh Lathia, Jian He) + § + + - - -Allow modification of the inheritability of NOT NULL constraints (Suraj Kharage, Álvaro Herrera) -§ -§ - + + + Allow modification of the inheritability of NOT + NULL constraints (Suraj Kharage, Álvaro Herrera) + § + § + - -The syntax is ALTER TABLE ... ALTER CONSTRAINT ... [NO] INHERIT. - - + + The syntax is ALTER TABLE + ... ALTER CONSTRAINT ... [NO] INHERIT. + + - - -Allow NOT VALID foreign key constraints on partitioned tables (Amul Sul) -§ - - + + + Allow NOT VALID foreign key constraints on + partitioned tables (Amul Sul) + § + + - - -Allow dropping of constraints ONLY on partitioned tables (Álvaro Herrera) -§ - + + + Allow dropping + of constraints ONLY on partitioned tables + (Álvaro Herrera) + § + - -This was previously erroneously prohibited. - - + + This was previously erroneously prohibited. + + - + <xref linkend="sql-copy"/> - + - - -Add REJECT_LIMIT to control the number of invalid rows COPY FROM can ignore (Atsushi Torikoshi) -§ - + + + Add REJECT_LIMIT to control the number of invalid + rows COPY FROM can ignore (Atsushi Torikoshi) + § + - -This is available when ON_ERROR = 'ignore'. - - + + This is available when ON_ERROR = 'ignore'. + + - - -Allow COPY TO to copy rows from populated materialized views (Jian He) -§ - - + + + Allow COPY TO to copy rows from populated + materialized views (Jian He) + § + + - - -Add COPY LOG_VERBOSITY level silent to suppress log output of ignored rows (Atsushi Torikoshi) -§ - + + + Add COPY LOG_VERBOSITY level + silent to suppress log output of ignored rows + (Atsushi Torikoshi) + § + - -This new level suppresses output for discarded input rows when on_error = 'ignore'. - - + + This new level suppresses output for discarded input rows when + on_error = 'ignore'. + + - - -Disallow COPY FREEZE on foreign tables (Nathan Bossart) -§ - + + + Disallow COPY FREEZE on foreign tables (Nathan + Bossart) + § + - -Previously, the COPY worked but the FREEZE was ignored, so disallow this command. - - + + Previously, the COPY worked but the + FREEZE was ignored, so disallow this command. + + @@ -1793,36 +2102,39 @@ Author: David Rowley 2024-12-11 [c2a4078eb] Enable BUFFERS with EXPLAIN ANALYZE by default --> - - -Automatically include BUFFERS output in EXPLAIN ANALYZE (Guillaume Lelarge, David Rowley) -§ - - + + + Automatically include BUFFERS output in + EXPLAIN ANALYZE (Guillaume Lelarge, David Rowley) + § + + - - -Add full WAL buffer count to EXPLAIN (WAL) output (Bertrand Drouvot) -§ - - + + + Add full WAL buffer count to EXPLAIN + (WAL) output (Bertrand Drouvot) + § + + - - -In EXPLAIN ANALYZE, report the number of index lookups used per index scan node (Peter Geoghegan) -§ - - + + + In EXPLAIN ANALYZE, report the number of index + lookups used per index scan node (Peter Geoghegan) + § + + - - -Modify EXPLAIN to output fractional row counts (Ibrar Ahmed, Ilia Evdokimov, Robert Haas) -§ -§ - - + + + Modify EXPLAIN to output fractional row counts + (Ibrar Ahmed, Ilia Evdokimov, Robert Haas) + § + § + + - - -Add memory and disk usage details to Material, Window Aggregate, and common table expression nodes to EXPLAIN -output (David Rowley, Tatsuo Ishii) -§ -§ -§ -§ - - + + + Add memory and disk usage details to Material, + Window Aggregate, and common table expression + nodes to EXPLAIN output (David Rowley, Tatsuo + Ishii) + § + § + § + § + + - - -Add details about window function arguments to EXPLAIN output (Tom Lane) -§ - - + + + Add details about window function arguments to + EXPLAIN output (Tom Lane) + § + + - - -Add Parallel Bitmap Heap Scan worker cache statistics to EXPLAIN ANALYZE (David Geier, Heikki Linnakangas, Donghang Lin, Alena Rybakina, David Rowley) -§ - - + + + Add Parallel Bitmap Heap Scan worker cache + statistics to EXPLAIN ANALYZE (David Geier, + Heikki Linnakangas, Donghang Lin, Alena Rybakina, David Rowley) + § + + - - -Indicate disabled nodes in EXPLAIN ANALYZE output (Robert Haas, David Rowley, Laurenz Albe) -§ -§ -§ - - + + + Indicate disabled nodes in EXPLAIN ANALYZE output + (Robert Haas, David Rowley, Laurenz Albe) + § + § + § + + @@ -1922,137 +2241,159 @@ Author: Jeff Davis 2025-01-17 [286a365b9] Support Unicode full case mapping and conversion. --> - - -Improve Unicode full case mapping and conversion (Jeff Davis) -§ -§ - + + + Improve Unicode + full case mapping and conversion (Jeff Davis) + § + § + - -This adds the ability to do conditional and title case mapping, and case map single characters to multiple characters. - - + + This adds the ability to do conditional and title case mapping, + and case map single characters to multiple characters. + + - - -Allow jsonb null values to be cast to scalar types as NULL (Tom Lane) -§ - + + + Allow jsonb + null values to be cast to scalar types as + NULL (Tom Lane) + § + - -Previously such casts generated an error. - - + + Previously such casts generated an error. + + - - -Add optional parameter to json{b}_strip_nulls to allow removal of null array elements (Florents Tselai) -§ - - + + + Add optional parameter to json{b}_strip_nulls + to allow removal of null array elements (Florents Tselai) + § + + - - -Add function array_sort() which sorts an array's first dimension (Junwang Zhao, Jian He) -§ - - + + + Add function array_sort() + which sorts an array's first dimension (Junwang Zhao, Jian He) + § + + - - -Add function array_reverse() which reverses an array's first dimension (Aleksander Alekseev) -§ - - + + + Add function array_reverse() + which reverses an array's first dimension (Aleksander Alekseev) + § + + - - -Add function reverse() to reverse bytea bytes (Aleksander Alekseev) -§ - - + + + Add function reverse() + to reverse bytea bytes (Aleksander Alekseev) + § + + - - -Allow casting between integer types and bytea (Aleksander Alekseev) -§ - + + + Allow casting between integer types and bytea (Aleksander + Alekseev) + § + - -The integer values are stored as bytea two's complement values. - - + + The integer values are stored as bytea two's complement + values. + + - - -Update Unicode data to Unicode 16.0.0 (Peter Eisentraut) -§ - - + + + Update Unicode data to Unicode 16.0.0 (Peter + Eisentraut) + § + + - - -Add full text search stemming for Estonian (Tom Lane) -§ - - + + + Add full text search stemming for Estonian + (Tom Lane) + § + + - - -Improve the XML error codes to more closely match the SQL standard (Tom Lane) -§ - + + + Improve the XML + error codes to more closely match the SQL standard + (Tom Lane) + § + - -These errors are reported via SQLSTATE. - - + + These errors are reported via SQLSTATE. + + @@ -2068,16 +2409,20 @@ Author: Jeff Davis 2025-01-24 [bfc599206] Add SQL function CASEFOLD(). --> - - -Add function casefold() to allow for more sophisticated case-insensitive matching (Jeff Davis) -§ - + + + Add function casefold() + to allow for more sophisticated case-insensitive matching (Jeff Davis) + § + - -This allows more accurate comparisons, i.e., a character can have multiple upper or lower case equivalents, or upper or lower case conversion changes the number of characters. - - + + This allows more accurate comparisons, i.e., a character can have + multiple upper or lower case equivalents, or upper or lower case + conversion changes the number of characters. + + - - -Allow MIN()/MAX() aggregates on arrays and composite types (Aleksander Alekseev, Marat Buharov) -§ -§ - - + + + Allow MIN()/MAX() + aggregates on arrays and composite types (Aleksander Alekseev, + Marat Buharov) + § + § + + - - -Add a WEEK option to EXTRACT() (Tom Lane) -§ - - + + + Add a WEEK option to EXTRACT() + (Tom Lane) + § + + - - -Improve the output EXTRACT(QUARTER ...) for negative values (Tom Lane) -§ - - + + + Improve the output EXTRACT(QUARTER ...) for + negative values (Tom Lane) + § + + - - -Add roman numeral support to to_number() (Hunaid Sohail) -§ - + + + Add roman numeral support to to_number() + (Hunaid Sohail) + § + - -This is accessed via the RN pattern. - - + + This is accessed via the RN pattern. + + - - -Add UUID version 7 generation function uuidv7() (Andrey Borodin) -§ - + + + Add UUID + version 7 generation function uuidv7() + (Andrey Borodin) + § + - -This UUID value is temporally sortable. Function alias uuidv4() has been added to explicitly generate version 4 UUIDs. - - + + This UUID value is + temporally sortable. Function alias uuidv4() + has been added to explicitly generate version 4 UUIDs. + + - - -Add functions crc32() and crc32c() to compute CRC values (Aleksander Alekseev) -§ - - + + + Add functions crc32() + and crc32c() + to compute CRC values (Aleksander Alekseev) + § + + - - -Add math functions gamma() and lgamma() (Dean Rasheed) -§ - - + + + Add math functions gamma() + and lgamma() + (Dean Rasheed) + § + + - - -Allow => syntax for named cursor arguments in PL/pgSQL (Pavel Stehule) -§ - + + + Allow => syntax for named cursor arguments in + PL/pgSQL (Pavel Stehule) + § + - -We previously only accepted :=. - - + + We previously only accepted :=. + + - - -Allow regexp_match[es]()/regexp_like()/regexp_replace()/regexp_count()/regexp_instr()/regexp_substr()/regexp_split_to_table()/regexp_split_to_array() to use named arguments (Jian He) -§ - - + + + Allow regexp_match[es]()/regexp_like()/regexp_replace()/regexp_count()/regexp_instr()/regexp_substr()/regexp_split_to_table()/regexp_split_to_array() + to use named arguments (Jian He) + § + + @@ -2216,12 +2594,15 @@ Author: Robert Haas 2024-09-09 [cdb6b0fdb] Add PQfullProtocolVersion() to surface the precise proto --> - - -Add function PQfullProtocolVersion() to report the full, including minor, protocol version number (Jacob Champion, Jelte Fennema-Nio) -§ - - + + + Add function PQfullProtocolVersion() + to report the full, including minor, protocol version number (Jacob + Champion, Jelte Fennema-Nio) + § + + - - -Add libpq connection parameters and environment variables to specify the minimum and maximum acceptable protocol version for connections (Jelte Fennema-Nio) -§ -§ - - + + + Add libpq connection parameters + and environment variables to + specify the minimum and maximum acceptable protocol version for + connections (Jelte Fennema-Nio) + § + § + + - - -Add libpq function PQservice() to return the connection service name (Michael Banck) -§ - - + + + Add libpq function PQservice() + to return the connection service name (Michael Banck) + § + + - - -Report changes to the client (Alexander Kukushkin, Jelte Fennema-Nio, Tomas Vondra) -§ -§ - - + + + Report changes to the client + (Alexander Kukushkin, Jelte Fennema-Nio, Tomas Vondra) + § + § + + - - -Add PQtrace() output for all message types, including authentication (Jelte Fennema-Nio) -§ -§ -§ -§ -§ - - + + + Add PQtrace() output + for all message types, including authentication (Jelte Fennema-Nio) + § + § + § + § + § + + - - -Add libpq connection parameter sslkeylogfile which dumps out SSL key material (Abhishek Chanda, Daniel Gustafsson) -§ - + + + Add libpq connection parameter sslkeylogfile + which dumps out SSL key material (Abhishek Chanda, + Daniel Gustafsson) + § + - -This is useful for debugging. - - + + This is useful for debugging. + + - - -Modify some libpq function signatures to use int64_t (Thomas Munro) -§ - + + + Modify some libpq function signatures to use + int64_t (Thomas Munro) + § + - -These previously used pg_int64, which is now deprecated. - - + + These previously used pg_int64, which is now + deprecated. + + - <xref linkend="app-psql"/> + <xref linkend="app-psql"/> - + - - -Allow psql to parse, bind, and close named prepared statements (Anthonin Bonnefoy, Michael Paquier) -§ - + + + Allow psql to parse, bind, and close + named prepared statements (Anthonin Bonnefoy, Michael Paquier) + § + - -This is accomplished with new commands \parse, \bind_named, and \close. - - + + This is accomplished with new commands \parse, + \bind_named, + and \close. + + - - -Add psql backslash commands to allowing issuance of pipeline queries (Anthonin Bonnefoy) -§ -§ -§ - + + + Add psql backslash commands to allowing + issuance of pipeline queries (Anthonin Bonnefoy) + § + § + § + - -The new commands are \startpipeline, \syncpipeline, \sendpipeline, \endpipeline, \flushrequest, \flush, and \getresults. - - + + The new commands are \startpipeline, + \syncpipeline, \sendpipeline, + \endpipeline, \flushrequest, + \flush, and \getresults. + + - - -Allow adding pipeline status to the psql prompt and add related state variables (Anthonin Bonnefoy) -§ - + + + Allow adding pipeline status to the psql + prompt and add related state variables (Anthonin Bonnefoy) + § + - -The new prompt character is %P and the new psql variables are PIPELINE_SYNC_COUNT, PIPELINE_COMMAND_COUNT, and PIPELINE_RESULT_COUNT. - - + + The new prompt character is %P and + the new psql variables are PIPELINE_SYNC_COUNT, + PIPELINE_COMMAND_COUNT, + and PIPELINE_RESULT_COUNT. + + - - -Allow adding the connection service name to the psql prompt or access it via psql variable (Michael Banck) -§ - - + + + Allow adding the connection service name to the + psql prompt or access it via + psql variable (Michael Banck) + § + + - - -Add psql option to use expanded mode on all list commands (Dean Rasheed) -§ - + + + Add psql option to use expanded mode on + all list commands (Dean Rasheed) + § + - -Adding backslash suffix x enables this. - - + + Adding backslash suffix x enables this. + + - - -Change psql's to use tabular format and include more information (Álvaro Herrera, Maiquel Grassi, Hunaid Sohail) -§ - - + + + Change psql's to use tabular format + and include more information (Álvaro Herrera, Maiquel Grassi, + Hunaid Sohail) + § + + - - -Add function's leakproof indicator to psql's \df+, \do+, \dAo+, and \dC+ outputs (Yugo Nagata) -§ - - + + + Add function's leakproof indicator + to psql's \df+, + \do+, \dAo+, and + \dC+ outputs (Yugo Nagata) + § + + - - -Add access method details for partitioned relations in \dP+ (Justin Pryzby) -§ - - + + + Add access method details for partitioned relations in \dP+ + (Justin Pryzby) + § + + - - -Add default_version to the psql \dx extension output (Magnus Hagander) -§ - - + + + Add default_version + to the psql \dx + extension output (Magnus Hagander) + § + + - - -Add psql variable to set the default \watch wait time (Daniel Gustafsson) -§ - - + + + Add psql variable to set the default \watch + wait time (Daniel Gustafsson) + § + + - + - + - - Server Applications + + Server Applications - + - - -Change to default to enabling checksums (Greg Sabino Mullane) -§ -§ - + + + Change to default to enabling checksums + (Greg Sabino Mullane) + § + § + - -The new initdb option disables checksums. - - + + The new initdb option + disables checksums. + + - - -Add initdb option to avoid syncing heap/index files (Nathan Bossart) -§ - + + + Add initdb option + to avoid syncing heap/index + files (Nathan Bossart) + § + - -initdb option is still available to avoid syncing any files. - - + + initdb option + is still available to avoid syncing any files. + + - - -Add option to compute only missing optimizer statistics (Corey Huinker, Nathan Bossart) -§ -§ - + + + Add option + to compute only missing + optimizer statistics (Corey Huinker, Nathan Bossart) + § + § + - -This option can only be used by and . - - + + This option can only be used by + and . + + - - -Add option / to enable hard linking (Israel Barth Rubio, Robert Haas) -§ - + + + Add option + / to enable hard linking + (Israel Barth Rubio, Robert Haas) + § + - -Only some files can be hard linked. This should not be used if the backups will be used independently. - - + + Only some files can be hard linked. This should not be used if the + backups will be used independently. + + - - -Allow to verify tar-format backups (Amul Sul) -§ - - + + + Allow to verify tar-format + backups (Amul Sul) + § + + - - -If 's specifies a database name, use it in output (Masahiko Sawada) -§ - - + + + If 's + specifies a database name, use it in + output (Masahiko Sawada) + § + + - - -Add option to change the default char signedness (Masahiko Sawada) -§ - - + + + Add option + to change the default + char signedness (Masahiko Sawada) + § + + - + @@ -2603,28 +3050,34 @@ Author: Andrew Dunstan 2025-04-04 [1495eff7b] Non text modes for pg_dumpall, correspondingly change pg --> - - -Allow to dump in the same output formats as pg_dump supports (Mahendra Singh Thalor, Andrew Dunstan) -§ - + + + Allow to dump in the same output + formats as pg_dump supports (Mahendra + Singh Thalor, Andrew Dunstan) + § + - -Also modify to handle such dumps. Previously pg_dumpall only supported text format. - - + + Also modify to handle such dumps. + Previously pg_dumpall only supported + text format. + + - - -Add options , , and (Jeff Davis) -§ - - + + + Add options + , , + and (Jeff Davis) + § + + - - -Add pg_dump and option to dump sequence data that would normally be excluded (Nathan Bossart) -§ -§ - - + + + Add pg_dump and option to + dump sequence data that would normally be excluded (Nathan Bossart) + § + § + + - - -Add , , and - options , , , and (Corey Huinker, Jeff Davis) -§ - - + + + Add , , + and options + , , + , and + (Corey Huinker, Jeff Davis) + § + + - - -Add option to disable row level security policy processing in -, , - (Nikolay Samokhvalov) -§ - + + + Add option to disable row level + security policy processing in , + , + (Nikolay Samokhvalov) + § + - -This is useful for migrating to systems with different policies. - - + + This is useful for migrating to systems with different policies. + + @@ -2692,19 +3151,22 @@ Author: Jeff Davis 2025-02-20 [1fd1bd871] Transfer statistics during pg_upgrade. --> - - -Allow pg_upgrade to preserve optimizer statistics (Corey Huinker, Jeff Davis, Nathan Bossart) -§ -§ -§ -§ - + + + Allow pg_upgrade to preserve optimizer + statistics (Corey Huinker, Jeff Davis, Nathan Bossart) + § + § + § + § + - -Extended statistics are not preserved. Also add pg_upgrade option to disable statistics preservation. - - + + Extended statistics are not preserved. Also add + pg_upgrade option + to disable statistics preservation. + + - - -Allow pg_upgrade to process database checks in parallel (Nathan Bossart) -§ -§ -§ -§ -§ -§ -§ -§ -§ -§ -§ - - - -This is controlled by the existing option. - - + + + Allow pg_upgrade to process database + checks in parallel (Nathan Bossart) + § + § + § + § + § + § + § + § + § + § + § + + + + This is controlled by the existing option. + + - - -Add pg_upgrade option to swap directories rather than copy, clone, or link files (Nathan Bossart) -§ - + + + Add pg_upgrade option + to swap directories rather than copy, clone, + or link files (Nathan Bossart) + § + - -This mode is potentially the fastest. - - + + This mode is potentially the fastest. + + - - -Add pg_upgrade option to set the default char signedness of new cluster (Masahiko Sawada) -§ -§ - + + + Add pg_upgrade option + to set the default + char signedness of new cluster (Masahiko Sawada) + § + § + - -This is to handle cases where a pre-PostgreSQL 18 cluster's default CPU signedness does not match the new cluster. - - + + This is to handle cases where a + pre-PostgreSQL 18 cluster's default + CPU signedness does not match the new cluster. + + @@ -2801,60 +3270,68 @@ Author: Amit Kapila 2025-03-28 [fb2ea12f4] pg_createsubscriber: Add '- -all' option. --> - - -Add option to create logical replicas for all databases (Shubham Khanna) -§ - - + + + Add option + to create logical replicas for all databases + (Shubham Khanna) + § + + - - -Add pg_createsubscriber option to remove publications (Shubham Khanna) -§ - - + + + Add pg_createsubscriber option + to remove publications (Shubham Khanna) + § + + - - -Add pg_createsubscriber option to enable prepared transactions (Shubham Khanna) -§ - - + + + Add pg_createsubscriber option + to enable prepared transactions + (Shubham Khanna) + § + + - - -Add option to specify failover slots (Hayato Kuroda) -§ - - + + + Add option + to specify failover slots (Hayato Kuroda) + § + + - - -Allow pg_recvlogical to work without (Hayato Kuroda) -§ - - + + + Allow pg_recvlogical + to work without + (Hayato Kuroda) + § + + @@ -2874,65 +3351,76 @@ Author: Michael Paquier 2024-07-18 [a0a5869a8] Add INJECTION_POINT_CACHED() to run injection points dir --> - - -Separate the loading and running of injection points (Michael Paquier, Heikki Linnakangas) -§ -§ - + + + Separate the loading and running of injection points + (Michael Paquier, Heikki Linnakangas) + § + § + - -Injection points can now be created, but not run, via INJECTION_POINT_LOAD(), and such injection points can be run via INJECTION_POINT_CACHED(). - - + + Injection points can now be created, but not run, via INJECTION_POINT_LOAD(), + and such injection points can be run via INJECTION_POINT_CACHED(). + + - - -Support runtime arguments in injection points (Michael Paquier) -§ - - + + + Support runtime arguments in injection points (Michael Paquier) + § + + - - -Allow inline injection point test code with IS_INJECTION_POINT_ATTACHED() (Heikki Linnakangas) -§ - - + + + Allow inline injection point test code with IS_INJECTION_POINT_ATTACHED() + (Heikki Linnakangas) + § + + - - -Improve the performance of processing long JSON strings using SIMD (Single Instruction Multiple Data) (David Rowley) -§ - - + + + Improve the performance of processing long JSON strings using + SIMD (Single Instruction Multiple Data) (David + Rowley) + § + + - - -Speed up CRC32C calculations using x86 AVX-512 instructions (Raghuveer Devulapalli, Paul Amonson) -§ - - + + + Speed up CRC32C calculations using x86 AVX-512 + instructions (Raghuveer Devulapalli, Paul Amonson) + § + + - - -Add ARM Neon and SVE CPU intrinsics for popcount (integer bit counting) (Chiranmoy Bhattacharya, Devanga Susmitha, Rama Malladi) -§ -§ - - + + + Add ARM Neon and SVE CPU + intrinsics for popcount (integer bit counting) (Chiranmoy + Bhattacharya, Devanga Susmitha, Rama Malladi) + § + § + + - - -Improve the speed of numeric multiplication and division (Joel Jacobson, Dean Rasheed) -§ -§ -§ -§ - - + + + Improve the speed of numeric multiplication and division (Joel + Jacobson, Dean Rasheed) + § + § + § + § + + - - -Add configure option to enable NUMA awareness (Jakub Wartak, Bertrand Drouvot) -§ -§ -§ - + + + Add configure option + to enable NUMA awareness (Jakub Wartak, Bertrand + Drouvot) + § + § + § + - -The function pg_numa_available() reports on NUMA awareness, and system views pg_shmem_allocations_numa and pg_buffercache_numa which report on shared memory distribution across -NUMA nodes. - - + + The function pg_numa_available() + reports on NUMA awareness, and system views pg_shmem_allocations_numa + and pg_buffercache_numa + which report on shared memory distribution across + NUMA nodes. + + - - -Add TOAST table to pg_index to allow for very large expression indexes (Nathan Bossart) -§ - - + + + Add TOAST table to pg_index + to allow for very large expression indexes (Nathan Bossart) + § + + - - -Remove column -pg_attribute.attcacheoff (David Rowley) -§ - - + + + Remove column pg_attribute.attcacheoff + (David Rowley) + § + + - - -Add column pg_class.relallfrozen (Melanie Plageman) -§ - - + + + Add column pg_class.relallfrozen + (Melanie Plageman) + § + + - - -Add amgettreeheight, amconsistentequality, and amconsistentordering to the index access method API (Mark Dilger) -§ -§ - - + + + Add amgettreeheight, + amconsistentequality, and + amconsistentordering to the index access method + API (Mark Dilger) + § + § + + - - -Add GiST support function stratnum() (Paul A. Jungwirth) -§ - - + + + Add GiST support function stratnum() + (Paul A. Jungwirth) + § + + - - -Record the default CPU signedness of char in (Masahiko Sawada) -§ - - + + + Record the default CPU signedness of + char in + (Masahiko Sawada) + § + + - - -Add support for Python "Limited API" in (Peter Eisentraut) -§ -§ - + + + Add support for Python "Limited API" in (Peter Eisentraut) + § + § + - -This helps prevent problems caused by Python 3.x version mismatches. - - + + This helps prevent problems caused by + Python 3.x version mismatches. + + - - -Change the minimum supported Python version to 3.6.8 (Jacob Champion) -§ - - + + + Change the minimum supported Python + version to 3.6.8 (Jacob Champion) + § + + - - -Remove support for OpenSSL versions older than 1.1.1 (Daniel Gustafsson) -§ -§ - - + + + Remove support for OpenSSL versions older + than 1.1.1 (Daniel Gustafsson) + § + § + + - - -If LLVM is enabled, require version 14 or later (Thomas Munro) -§ - - + + + If LLVM is enabled, require version 14 + or later (Thomas Munro) + § + + - - -Add macro PG_MODULE_MAGIC_EXT to allow extensions to report their name and version (Andrei Lepikhov) -§ - + + + Add macro PG_MODULE_MAGIC_EXT + to allow extensions to report their name and version (Andrei Lepikhov) + § + - -This information can be access via the new function pg_get_loaded_modules(). - - + + This information can be access via the new function pg_get_loaded_modules(). + + - - -Document that SPI_connect()/SPI_connect_ext() always returns success (SPI_OK_CONNECT) (Stepan Neretin) -§ - + + + Document that SPI_connect()/SPI_connect_ext() + always returns success (SPI_OK_CONNECT) (Stepan + Neretin) + § + - -Errors are always reported via ereport(). - - + + Errors are always reported via ereport(). + + - - -Add documentation section about API and ABI compatibility (David Wheeler, Peter Eisentraut) -§ - - + + + Add documentation + section about API and ABI + compatibility (David Wheeler, Peter Eisentraut) + § + + - - -Remove the experimental designation of Meson builds on Windows (Aleksander Alekseev) -§ - - + + + Remove the experimental designation of + Meson builds on Windows (Aleksander Alekseev) + § + + - - -Remove configure options and (Thomas Munro) -§ -§ - + + + Remove configure options and + (Thomas Munro) + § + § + - -Thirty-two-bit atomic operations are now required. - - + + Thirty-two-bit atomic operations are now required. + + - - -Remove support for the HPPA/PA-RISC architecture (Tom Lane) -§ - - + + + Remove support for the + HPPA/PA-RISC architecture + (Tom Lane) + § + + @@ -3228,24 +3761,27 @@ Author: Masahiko Sawada 2024-10-14 [7cdfeee32] Add contrib/pg_logicalinspect. --> - - -Add extension to inspect logical snapshots (Bertrand Drouvot) -§ - - + + + Add extension to inspect logical + snapshots (Bertrand Drouvot) + § + + - - -Add extension which adds debug details to EXPLAIN output (Robert Haas) -§ - - + + + Add extension which adds debug details + to EXPLAIN + output (Robert Haas) + § + + - - -Add output columns to postgres_fdw_get_connections() (Hayato Kuroda, Sagar Dilip Shedge) -§ -§ -§ -§ - + + + Add output columns to postgres_fdw_get_connections() + (Hayato Kuroda, Sagar Dilip Shedge) + § + § + § + § + - -New output column used_in_xact indicates if the foreign data wrapper is being used by a current transaction, closed indicates if it is closed, user_name indicates the -user name, and remote_backend_pid indicates the remote backend process identifier. - - + + New output column used_in_xact indicates + if the foreign data wrapper is being used by a current transaction, + closed indicates if it is closed, + user_name indicates the user name, and + remote_backend_pid indicates the remote + backend process identifier. + + - - -Allow SCRAM authentication from the client to be passed to - servers (Matheus Alcantara, Peter Eisentraut) -§ - + + + Allow SCRAM + authentication from the client to be passed to servers (Matheus Alcantara, Peter Eisentraut) + § + - -This avoids storing postgres_fdw authentication information in the database, and is enabled with the -postgres_fdw use_scram_passthrough connection option. libpq uses new connection -parameters and . - - + + This avoids storing postgres_fdw + authentication information in the database, and is + enabled with the postgres_fdw use_scram_passthrough + connection option. libpq uses new connection parameters + and . + + - - -Allow SCRAM authentication from the client to be passed to - servers (Matheus Alcantara) -§ - - + + + Allow SCRAM authentication from the client to be + passed to servers (Matheus Alcantara) + § + + - - -Add on_error and log_verbosity options to (Atsushi Torikoshi) -§ - + + + Add on_error and log_verbosity + options to (Atsushi Torikoshi) + § + - -These control how file_fdw handles and reports invalid file rows. - - + + These control how file_fdw handles and + reports invalid file rows. + + - - -Add reject_limit to control the number of invalid rows file_fdw can ignore (Atsushi Torikoshi) -§ - + + + Add reject_limit to control the number of + invalid rows file_fdw can ignore (Atsushi + Torikoshi) + § + - -This is active when ON_ERROR = 'ignore'. - - + + This is active when ON_ERROR = 'ignore'. + + - - -Add configurable variable min_password_length to - (Emanuele Musella, Maurizio Boriani) -§ - + + + Add configurable variable min_password_length to + (Emanuele Musella, Maurizio Boriani) + § + - -This controls the minimum password length. - - + + This controls the minimum password length. + + - - -Have report the number of failed, retried, or skipped transactions in per-script reports (Yugo Nagata) -§ - - + + + Have report the number of failed, retried, + or skipped transactions in per-script reports (Yugo Nagata) + § + + - - -Add server variable weak to control invalid check digit acceptance (Viktor Holmberg) -§ - + + + Add server variable weak + to control invalid check digit acceptance (Viktor Holmberg) + § + - -This was previously only controlled by function isn_weak(). - - + + This was previously only controlled by function isn_weak(). + + - - -Allow values to be sorted to speed index builds (Bernd Helmle, Andrey Borodin) -§ - - + + + Allow values to be sorted to speed + index builds (Bernd Helmle, Andrey Borodin) + § + + - - -Add check function gin_index_check() to verify GIN indexes (Grigory Kryachko, Heikki Linnakangas, Andrey Borodin) -§ - - + + + Add check function gin_index_check() + to verify GIN indexes (Grigory Kryachko, Heikki + Linnakangas, Andrey Borodin) + § + + - - -Add functions pg_buffercache_evict_relation() and pg_buffercache_evict_all() to evict unpinned shared buffers (Nazir Bilal Yavuz) -§ - + + + Add functions pg_buffercache_evict_relation() + and pg_buffercache_evict_all() + to evict unpinned shared buffers (Nazir Bilal Yavuz) + § + - -The existing function pg_buffercache_evict() now returns the buffer flush status. - - + + The existing function pg_buffercache_evict() + now returns the buffer flush status. + + - - -Allow extensions to install custom options (Robert Haas, Sami Imseih) -§ -§ -§ - - + + + Allow extensions to install custom + options (Robert Haas, Sami Imseih) + § + § + § + + - - -Allow extensions to use the server's cumulative statistics API (Michael Paquier) -§ -§ - - + + + Allow extensions to use the server's cumulative statistics + API (Michael Paquier) + § + § + + @@ -3467,60 +4033,71 @@ Author: Michael Paquier 2024-10-28 [6b652e6ce] Set query ID for inner queries of CREATE TABLE AS and DE --> - - -Allow the queries of and to be tracked by pg_stat_statements (Anthonin Bonnefoy) -§ - + + + Allow the queries of + and to be tracked by + pg_stat_statements (Anthonin Bonnefoy) + § + - -They are also now assigned query ids. - - + + They are also now assigned query ids. + + - - -Allow the parameterization of values in pg_stat_statements (Greg Sabino Mullane, Michael Paquier) -§ - + + + Allow the parameterization of values in + pg_stat_statements (Greg Sabino Mullane, + Michael Paquier) + § + - -This reduces the bloat caused by SET statements with differing constants. - - + + This reduces the bloat caused by SET statements + with differing constants. + + - - -Add pg_stat_statements columns to report parallel activity (Guillaume Lelarge) -§ - + + + Add pg_stat_statements + columns to report parallel activity (Guillaume Lelarge) + § + - -The new columns are parallel_workers_to_launch and parallel_workers_launched. - - + + The new columns are + parallel_workers_to_launch and + parallel_workers_launched. + + - - -Add pg_stat_statements.wal_buffers_full to report full WAL buffers (Bertrand Drouvot) -§ - - + + + Add + pg_stat_statements.wal_buffers_full + to report full WAL buffers (Bertrand Drouvot) + § + + @@ -3536,52 +4113,65 @@ Author: Álvaro Herrera 2025-04-05 [749a9e20c] Add modern SHA-2 based password hashes to pgcrypto. --> - - -Add pgcrypto algorithms sha256crypt and sha512crypt (Bernd Helmle) -§ - - + + + Add pgcrypto algorithms sha256crypt + and sha512crypt + (Bernd Helmle) + § + + - - -Add CFB mode to pgcrypto encryption and decryption (Umar Hayat) -§ - - + + + Add CFB mode + to pgcrypto encryption and decryption + (Umar Hayat) + § + + - - -Add function fips_mode() to report the server's FIPS mode (Daniel Gustafsson) -§ - - + + + Add function fips_mode() + to report the server's FIPS mode (Daniel + Gustafsson) + § + + - - -Add pgcrypto server variable builtin_crypto_enabled to allow disabling builtin non-FIPS mode cryptographic functions (Daniel Gustafsson, Joe Conway) -§ - + + + Add pgcrypto server variable builtin_crypto_enabled + to allow disabling builtin non-FIPS mode + cryptographic functions (Daniel Gustafsson, Joe Conway) + § + - -This is useful for guaranteeing FIPS mode behavior. - - + + This is useful for guaranteeing FIPS mode behavior. + + From fa638edc74ee4be90e94a45f8489f3be9a926d7e Mon Sep 17 00:00:00 2001 From: Bruce Momjian Date: Fri, 20 Jun 2025 23:53:15 -0400 Subject: [PATCH 77/91] doc PG 18 relnotes: update to current, add one commit --- doc/src/sgml/release-18.sgml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/doc/src/sgml/release-18.sgml b/doc/src/sgml/release-18.sgml index faf9156e18519..662c7d8890f9b 100644 --- a/doc/src/sgml/release-18.sgml +++ b/doc/src/sgml/release-18.sgml @@ -6,7 +6,7 @@ Release date: - 2025-??-??, CURRENT AS OF 2025-05-23 + 2025-??-??, CURRENT AS OF 2025-06-20 @@ -869,13 +869,16 @@ Author: Tom Lane Add server variable to log - lock acquisition failures (Yuki Seino) + lock acquisition failures (Yuki Seino, Fujii Masao) § + § From ea06263c4aa5abadc97a6928c6b2aff0e29698ae Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Sat, 21 Jun 2025 12:52:37 -0400 Subject: [PATCH 78/91] Doc: improve documentation about width_bucket(). Specify whether the bucket bounds are inclusive or exclusive, and improve some other vague language. Explain the behavior that occurs when the "low" bound is greater than the "high" bound. Make width_bucket_numeric's comment more like that for width_bucket_float8, in particular noting that infinite bounds are rejected (since they became possible in v14). Reported-by: Ben Peachey Higdon Author: Robert Treat Co-authored-by: Tom Lane Reviewed-by: Dean Rasheed Discussion: https://postgr.es/m/2BD74F86-5B89-4AC1-8F13-23CED3546AC1@gmail.com Backpatch-through: 13 --- doc/src/sgml/func.sgml | 18 ++++++++++++++---- src/backend/utils/adt/float.c | 4 ++-- src/backend/utils/adt/numeric.c | 7 ++++--- 3 files changed, 20 insertions(+), 9 deletions(-) diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml index 8d7d9a2f3e8e8..a6d79765c1a73 100644 --- a/doc/src/sgml/func.sgml +++ b/doc/src/sgml/func.sgml @@ -1824,13 +1824,23 @@ SELECT NOT(ROW(table.*) IS NOT NULL) FROM TABLE; -- detect at least one null in which operand falls in a histogram having count equal-width buckets spanning the range low to high. - Returns 0 + The buckets have inclusive lower bounds and exclusive upper bounds. + Returns 0 for an input less + than low, or count+1 for an input - outside that range. + greater than or equal to high. + If low > high, + the behavior is mirror-reversed, with bucket 1 + now being the one just below low, and the + inclusive bounds now being on the upper side. width_bucket(5.35, 0.024, 10.06, 5) 3 + + + width_bucket(9, 10, 0, 10) + 2 @@ -1842,8 +1852,8 @@ SELECT NOT(ROW(table.*) IS NOT NULL) FROM TABLE; -- detect at least one null in Returns the number of the bucket in which operand falls given an array listing the - lower bounds of the buckets. Returns 0 for an - input less than the first lower + inclusive lower bounds of the buckets. + Returns 0 for an input less than the first lower bound. operand and the array elements can be of any type having standard comparison operators. The thresholds array must be diff --git a/src/backend/utils/adt/float.c b/src/backend/utils/adt/float.c index 6d20ae07ae7b0..ba66a9c4ce63a 100644 --- a/src/backend/utils/adt/float.c +++ b/src/backend/utils/adt/float.c @@ -4065,8 +4065,8 @@ float84ge(PG_FUNCTION_ARGS) * in the histogram. width_bucket() returns an integer indicating the * bucket number that 'operand' belongs to in an equiwidth histogram * with the specified characteristics. An operand smaller than the - * lower bound is assigned to bucket 0. An operand greater than the - * upper bound is assigned to an additional bucket (with number + * lower bound is assigned to bucket 0. An operand greater than or equal + * to the upper bound is assigned to an additional bucket (with number * count+1). We don't allow "NaN" for any of the float8 inputs, and we * don't allow either of the histogram bounds to be +/- infinity. */ diff --git a/src/backend/utils/adt/numeric.c b/src/backend/utils/adt/numeric.c index 40dcbc7b6710b..58ad1a65ef7b1 100644 --- a/src/backend/utils/adt/numeric.c +++ b/src/backend/utils/adt/numeric.c @@ -1958,9 +1958,10 @@ generate_series_numeric_support(PG_FUNCTION_ARGS) * in the histogram. width_bucket() returns an integer indicating the * bucket number that 'operand' belongs to in an equiwidth histogram * with the specified characteristics. An operand smaller than the - * lower bound is assigned to bucket 0. An operand greater than the - * upper bound is assigned to an additional bucket (with number - * count+1). We don't allow "NaN" for any of the numeric arguments. + * lower bound is assigned to bucket 0. An operand greater than or equal + * to the upper bound is assigned to an additional bucket (with number + * count+1). We don't allow "NaN" for any of the numeric inputs, and we + * don't allow either of the histogram bounds to be +/- infinity. */ Datum width_bucket_numeric(PG_FUNCTION_ARGS) From 2c0d8b95080e1d51c60d9c6f6a2e4460d6dfaf77 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Sun, 22 Jun 2025 14:13:46 +0200 Subject: [PATCH 79/91] meson: Fix meson warning WARNING: You should add the boolean check kwarg to the run_command call. It currently defaults to false, but it will default to true in meson 2.0. Introduced by commit bc46104fc9a. (This only happens in the msvc branch. All the other run_command calls are ok.) Reviewed-by: Andres Freund Discussion: https://www.postgresql.org/message-id/flat/42e13eb0-862a-441e-8d84-4f0fd5f6def0%40eisentraut.org --- meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meson.build b/meson.build index d142e3e408b38..474763ad19f0c 100644 --- a/meson.build +++ b/meson.build @@ -1205,7 +1205,7 @@ if not perlopt.disabled() if cc.get_id() == 'msvc' # prevent binary mismatch between MSVC built plperl and Strawberry or # msys ucrt perl libraries - perl_v = run_command(perl, '-V').stdout() + perl_v = run_command(perl, '-V', check: false).stdout() if not perl_v.contains('USE_THREAD_SAFE_LOCALE') perl_ccflags += ['-DNO_THREAD_SAFE_LOCALE'] endif From 43da394304fba820830da2cef2c0214fe292c037 Mon Sep 17 00:00:00 2001 From: John Naylor Date: Mon, 23 Jun 2025 18:03:56 +0700 Subject: [PATCH 80/91] Properly fix AVX-512 CRC calculation bug The problem that led to the workaround in f83f14881c7 was not in fact a compiler bug, but a failure to zero the upper bits of the vector register containing the initial scalar CRC value. Fix that and revert the workaround. Diagnosed-by: Nathan Bossart Diagnosed-by: Raghuveer Devulapalli Tested-by: Andy Fan Tested-by: Soumyadeep Chakraborty Reviewed-by: Nathan Bossart Reviewed-by: Raghuveer Devulapalli Discussion: https://postgr.es/m/PH8PR11MB82866B07AA6758D12F699C00FB70A@PH8PR11MB8286.namprd11.prod.outlook.com --- src/port/pg_crc32c_sse42.c | 2 +- src/port/pg_crc32c_sse42_choose.c | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/port/pg_crc32c_sse42.c b/src/port/pg_crc32c_sse42.c index 9af3474a6ca95..1a7172553551a 100644 --- a/src/port/pg_crc32c_sse42.c +++ b/src/port/pg_crc32c_sse42.c @@ -123,7 +123,7 @@ pg_comp_crc32c_avx512(pg_crc32c crc, const void *data, size_t len) __m512i k; k = _mm512_broadcast_i32x4(_mm_setr_epi32(0x740eef02, 0, 0x9e4addf8, 0)); - x0 = _mm512_xor_si512(_mm512_castsi128_si512(_mm_cvtsi32_si128(crc0)), x0); + x0 = _mm512_xor_si512(_mm512_zextsi128_si512(_mm_cvtsi32_si128(crc0)), x0); buf += 64; /* Main loop. */ diff --git a/src/port/pg_crc32c_sse42_choose.c b/src/port/pg_crc32c_sse42_choose.c index 802e47788c10c..74d2421ba2be9 100644 --- a/src/port/pg_crc32c_sse42_choose.c +++ b/src/port/pg_crc32c_sse42_choose.c @@ -95,9 +95,7 @@ pg_comp_crc32c_choose(pg_crc32c crc, const void *data, size_t len) __cpuidex(exx, 7, 0); #endif -#if defined(__clang__) && !defined(__OPTIMIZE__) - /* Some versions of clang are broken at -O0 */ -#elif defined(USE_AVX512_CRC32C_WITH_RUNTIME_CHECK) +#ifdef USE_AVX512_CRC32C_WITH_RUNTIME_CHECK if (exx[2] & (1 << 10) && /* VPCLMULQDQ */ exx[1] & (1 << 31)) /* AVX512-VL */ pg_comp_crc32c = pg_comp_crc32c_avx512; From ccd5bc93fdfeae22c935f405b0687be5cfa9caa4 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Mon, 23 Jun 2025 11:50:21 -0400 Subject: [PATCH 81/91] Include _mm512_zextsi128_si512() in AVX-512 configure probes. Commit 43da39430 added a dependency on this intrinsic to our AVX-512 CRC code. It turns out this intrinsic was added to gcc later than the other ones we were using, so that there are platforms where the new code fails to compile. Since only relatively old (pre-gcc-10) compilers are affected, it doesn't seem worth trying to make the AVX-512 CRC code actually work on these platforms. Just add the new intrinsic to the configure probe, so that we'll conclude the code can't be built. Author: Tom Lane Reviewed-by: Nathan Bossart Discussion: https://postgr.es/m/3350336.1750690281@sss.pgh.pa.us --- config/c-compiler.m4 | 1 + configure | 1 + meson.build | 1 + 3 files changed, 3 insertions(+) diff --git a/config/c-compiler.m4 b/config/c-compiler.m4 index 5f3e1d1faf930..da40bd6a64755 100644 --- a/config/c-compiler.m4 +++ b/config/c-compiler.m4 @@ -602,6 +602,7 @@ AC_CACHE_CHECK([for _mm512_clmulepi64_epi128], [Ac_cachevar], { __m128i z; + x = _mm512_xor_si512(_mm512_zextsi128_si512(_mm_cvtsi32_si128(0)), x); y = _mm512_clmulepi64_epi128(x, y, 0); z = _mm_ternarylogic_epi64( _mm512_castsi512_si128(y), diff --git a/configure b/configure index 4f15347cc9503..3d3d3db97a456 100755 --- a/configure +++ b/configure @@ -18227,6 +18227,7 @@ else { __m128i z; + x = _mm512_xor_si512(_mm512_zextsi128_si512(_mm_cvtsi32_si128(0)), x); y = _mm512_clmulepi64_epi128(x, y, 0); z = _mm_ternarylogic_epi64( _mm512_castsi512_si128(y), diff --git a/meson.build b/meson.build index 474763ad19f0c..6ffe7b4727556 100644 --- a/meson.build +++ b/meson.build @@ -2465,6 +2465,7 @@ int main(void) { __m128i z; + x = _mm512_xor_si512(_mm512_zextsi128_si512(_mm_cvtsi32_si128(0)), x); y = _mm512_clmulepi64_epi128(x, y, 0); z = _mm_ternarylogic_epi64( _mm512_castsi512_si128(y), From 70d8a91f82f19d270facd25bb6292a949773dfce Mon Sep 17 00:00:00 2001 From: Alexander Korotkov Date: Mon, 23 Jun 2025 21:27:42 +0300 Subject: [PATCH 82/91] Remove excess assert from InvalidatePossiblyObsoleteSlot() ca307d5cec90 introduced keeping WAL segments by slot's last saved restart LSN. It also added an assertion that the slot's restart LSN never goes backward. However, situations when the restart LSN goes backward have been spotted by buildfarm animals and investigated in the thread. When pg_receivewal starts the replication, it sets the last replayed LSN to the beginning of the segment, which is older than what ReplicationSlotReserveWal() set for the slot. A similar situation can happen to pg_basebackup. When standby reconnects to the primary, it sends the last replayed LSN, which might be older than the last confirmed flush LSN. In both these situations, a concurrent checkpoint may trigger an assert trap. Based on ideas from Vitaly Davydov , Hayato Kuroda (Fujitsu) , Vignesh C , Amit Kapila . Reported-by: Vignesh C Reported-by: Tom Lane Discussion: https://postgr.es/m/CALDaNm3s-jpQTe1MshsvQ8GO%3DTLj233JCdkQ7uZ6pwqRVpxAdw%40mail.gmail.com Reviewed-by: Vignesh C Reviewed-by: Amit Kapila --- src/backend/replication/slot.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/backend/replication/slot.c b/src/backend/replication/slot.c index c64f020742f8f..c11e588d63221 100644 --- a/src/backend/replication/slot.c +++ b/src/backend/replication/slot.c @@ -1810,8 +1810,6 @@ InvalidatePossiblyObsoleteSlot(uint32 possible_causes, */ SpinLockAcquire(&s->mutex); - Assert(s->data.restart_lsn >= s->last_saved_restart_lsn); - restart_lsn = s->data.restart_lsn; /* we do nothing if the slot is already invalid */ From f3ed72ca0765bdd726a31b7fa20219e96baf312c Mon Sep 17 00:00:00 2001 From: Alexander Korotkov Date: Mon, 23 Jun 2025 21:33:50 +0300 Subject: [PATCH 83/91] Temporarily remove 046_checkpoint_logical_slot.pl This new test was intended to check the handling of the replication slot's restart lsn fixed in ca307d5cec90. However, it also reveals another issue related to logical decoding. This commit temporarily removes this test to keep the buildfarm and CFbot green and avoid distorting others' work. This test will be restored once we investigate and fix the issue. Discussion: https://postgr.es/m/CAAKRu_ZCOzQpEumLFgG_%2Biw3FTa%2BhJ4SRpxzaQBYxxM_ZAzWcA%40mail.gmail.com --- src/test/recovery/meson.build | 1 - .../recovery/t/046_checkpoint_logical_slot.pl | 136 ------------------ 2 files changed, 137 deletions(-) delete mode 100644 src/test/recovery/t/046_checkpoint_logical_slot.pl diff --git a/src/test/recovery/meson.build b/src/test/recovery/meson.build index 92429d2840257..28fd9ae8dda0d 100644 --- a/src/test/recovery/meson.build +++ b/src/test/recovery/meson.build @@ -54,7 +54,6 @@ tests += { 't/043_no_contrecord_switch.pl', 't/044_invalidate_inactive_slots.pl', 't/045_archive_restartpoint.pl', - 't/046_checkpoint_logical_slot.pl', 't/047_checkpoint_physical_slot.pl' ], }, diff --git a/src/test/recovery/t/046_checkpoint_logical_slot.pl b/src/test/recovery/t/046_checkpoint_logical_slot.pl deleted file mode 100644 index d67c5108d7800..0000000000000 --- a/src/test/recovery/t/046_checkpoint_logical_slot.pl +++ /dev/null @@ -1,136 +0,0 @@ -# Copyright (c) 2025, PostgreSQL Global Development Group -# -# This test verifies the case when the logical slot is advanced during -# checkpoint. The test checks that the logical slot's restart_lsn still refers -# to an existed WAL segment after immediate restart. -# -use strict; -use warnings FATAL => 'all'; - -use PostgreSQL::Test::Cluster; -use PostgreSQL::Test::Utils; - -use Test::More; - -if ($ENV{enable_injection_points} ne 'yes') -{ - plan skip_all => 'Injection points not supported by this build'; -} - -my ($node, $result); - -$node = PostgreSQL::Test::Cluster->new('mike'); -$node->init; -$node->append_conf('postgresql.conf', "wal_level = 'logical'"); -$node->start; - -# Check if the extension injection_points is available, as it may be -# possible that this script is run with installcheck, where the module -# would not be installed by default. -if (!$node->check_extension('injection_points')) -{ - plan skip_all => 'Extension injection_points not installed'; -} - -$node->safe_psql('postgres', q(CREATE EXTENSION injection_points)); - -# Create the two slots we'll need. -$node->safe_psql('postgres', - q{select pg_create_logical_replication_slot('slot_logical', 'test_decoding')} -); -$node->safe_psql('postgres', - q{select pg_create_physical_replication_slot('slot_physical', true)}); - -# Advance both slots to the current position just to have everything "valid". -$node->safe_psql('postgres', - q{select count(*) from pg_logical_slot_get_changes('slot_logical', null, null)} -); -$node->safe_psql('postgres', - q{select pg_replication_slot_advance('slot_physical', pg_current_wal_lsn())} -); - -# Run checkpoint to flush current state to disk and set a baseline. -$node->safe_psql('postgres', q{checkpoint}); - -# Generate some transactions to get RUNNING_XACTS. -my $xacts = $node->background_psql('postgres'); -$xacts->query_until( - qr/run_xacts/, - q(\echo run_xacts -SELECT 1 \watch 0.1 -\q -)); - -$node->advance_wal(20); - -# Run another checkpoint to set a new restore LSN. -$node->safe_psql('postgres', q{checkpoint}); - -$node->advance_wal(20); - -# Run another checkpoint, this time in the background, and make it wait -# on the injection point) so that the checkpoint stops right before -# removing old WAL segments. -note('starting checkpoint'); - -my $checkpoint = $node->background_psql('postgres'); -$checkpoint->query_safe( - q(select injection_points_attach('checkpoint-before-old-wal-removal','wait')) -); -$checkpoint->query_until( - qr/starting_checkpoint/, - q(\echo starting_checkpoint -checkpoint; -\q -)); - -# Wait until the checkpoint stops right before removing WAL segments. -note('waiting for injection_point'); -$node->wait_for_event('checkpointer', 'checkpoint-before-old-wal-removal'); -note('injection_point is reached'); - -# Try to advance the logical slot, but make it stop when it moves to the next -# WAL segment (this has to happen in the background, too). -my $logical = $node->background_psql('postgres'); -$logical->query_safe( - q{select injection_points_attach('logical-replication-slot-advance-segment','wait');} -); -$logical->query_until( - qr/get_changes/, - q( -\echo get_changes -select count(*) from pg_logical_slot_get_changes('slot_logical', null, null) \watch 1 -\q -)); - -# Wait until the slot's restart_lsn points to the next WAL segment. -note('waiting for injection_point'); -$node->wait_for_event('client backend', - 'logical-replication-slot-advance-segment'); -note('injection_point is reached'); - -# OK, we're in the right situation: time to advance the physical slot, which -# recalculates the required LSN, and then unblock the checkpoint, which -# removes the WAL still needed by the logical slot. -$node->safe_psql('postgres', - q{select pg_replication_slot_advance('slot_physical', pg_current_wal_lsn())} -); - -# Continue the checkpoint. -$node->safe_psql('postgres', - q{select injection_points_wakeup('checkpoint-before-old-wal-removal')}); - -# Abruptly stop the server (1 second should be enough for the checkpoint -# to finish; it would be better). -$node->stop('immediate'); - -$node->start; - -eval { - $node->safe_psql('postgres', - q{select count(*) from pg_logical_slot_get_changes('slot_logical', null, null);} - ); -}; -is($@, '', "Logical slot still valid"); - -done_testing(); From fc39b286ad7262a4aac8ff9a34f244763bed7a53 Mon Sep 17 00:00:00 2001 From: Michael Paquier Date: Tue, 24 Jun 2025 13:12:46 +0900 Subject: [PATCH 84/91] psql: Rename meta-command \close to \close_prepared \close has been introduced in d55322b0da60 to be able to close a prepared statement using the extended protocol in psql. Per discussion, the name "close" is ambiguous. At the SQL level, CLOSE is used to close a cursor. At protocol level, the close message can be used to either close a statement or a portal. This patch renames \close to \close_prepared to avoid any ambiguity and make it clear that this is used to close a prepared statement. This new name has been chosen based on the feedback from the author and the reviewers. Author: Anthonin Bonnefoy Reviewed-by: Peter Eisentraut Reviewed-by: Jelte Fennema-Nio Discussion: https://postgr.es/m/3e694442-0df5-4f92-a08f-c5d4c4346b85@eisentraut.org --- doc/src/sgml/ref/psql-ref.sgml | 8 ++++---- doc/src/sgml/release-18.sgml | 2 +- src/bin/psql/command.c | 12 ++++++------ src/bin/psql/common.c | 2 +- src/bin/psql/help.c | 3 ++- src/bin/psql/tab-complete.in.c | 2 +- src/test/regress/expected/psql.out | 14 +++++++------- src/test/regress/expected/psql_pipeline.out | 6 +++--- src/test/regress/sql/psql.sql | 12 ++++++------ src/test/regress/sql/psql_pipeline.sql | 6 +++--- 10 files changed, 34 insertions(+), 33 deletions(-) diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml index 570ef21d1fce3..95f4cac2467e3 100644 --- a/doc/src/sgml/ref/psql-ref.sgml +++ b/doc/src/sgml/ref/psql-ref.sgml @@ -1067,8 +1067,8 @@ INSERT INTO tbls1 VALUES ($1, $2) \parse stmt1 - - \close prepared_statement_name + + \close_prepared prepared_statement_name @@ -1081,7 +1081,7 @@ INSERT INTO tbls1 VALUES ($1, $2) \parse stmt1 Example: SELECT $1 \parse stmt1 -\close stmt1 +\close_prepared stmt1 @@ -3710,7 +3710,7 @@ testdb=> \setenv LESS -imx4F All queries executed while a pipeline is ongoing use the extended query protocol. Queries are appended to the pipeline when ending with a semicolon. The meta-commands \bind, - \bind_named, \close or + \bind_named, \close_prepared or \parse can be used in an ongoing pipeline. While a pipeline is ongoing, \sendpipeline will append the current query buffer to the pipeline. Other meta-commands like diff --git a/doc/src/sgml/release-18.sgml b/doc/src/sgml/release-18.sgml index 662c7d8890f9b..66a6817a2be0f 100644 --- a/doc/src/sgml/release-18.sgml +++ b/doc/src/sgml/release-18.sgml @@ -2746,7 +2746,7 @@ Author: Michael Paquier \bind_named, and \close. + linkend="app-psql-meta-command-close-prepared">\close_prepared. diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c index 83e84a778411a..9fcd2db832656 100644 --- a/src/bin/psql/command.c +++ b/src/bin/psql/command.c @@ -67,8 +67,8 @@ static backslashResult exec_command_C(PsqlScanState scan_state, bool active_bran static backslashResult exec_command_connect(PsqlScanState scan_state, bool active_branch); static backslashResult exec_command_cd(PsqlScanState scan_state, bool active_branch, const char *cmd); -static backslashResult exec_command_close(PsqlScanState scan_state, bool active_branch, - const char *cmd); +static backslashResult exec_command_close_prepared(PsqlScanState scan_state, + bool active_branch, const char *cmd); static backslashResult exec_command_conninfo(PsqlScanState scan_state, bool active_branch); static backslashResult exec_command_copy(PsqlScanState scan_state, bool active_branch); static backslashResult exec_command_copyright(PsqlScanState scan_state, bool active_branch); @@ -330,8 +330,8 @@ exec_command(const char *cmd, status = exec_command_connect(scan_state, active_branch); else if (strcmp(cmd, "cd") == 0) status = exec_command_cd(scan_state, active_branch, cmd); - else if (strcmp(cmd, "close") == 0) - status = exec_command_close(scan_state, active_branch, cmd); + else if (strcmp(cmd, "close_prepared") == 0) + status = exec_command_close_prepared(scan_state, active_branch, cmd); else if (strcmp(cmd, "conninfo") == 0) status = exec_command_conninfo(scan_state, active_branch); else if (pg_strcasecmp(cmd, "copy") == 0) @@ -728,10 +728,10 @@ exec_command_cd(PsqlScanState scan_state, bool active_branch, const char *cmd) } /* - * \close -- close a previously prepared statement + * \close_prepared -- close a previously prepared statement */ static backslashResult -exec_command_close(PsqlScanState scan_state, bool active_branch, const char *cmd) +exec_command_close_prepared(PsqlScanState scan_state, bool active_branch, const char *cmd) { backslashResult status = PSQL_CMD_SKIP_LINE; diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index b53cd8ab69880..d2c0a49c46c04 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -2628,7 +2628,7 @@ clean_extended_state(void) switch (pset.send_mode) { - case PSQL_SEND_EXTENDED_CLOSE: /* \close */ + case PSQL_SEND_EXTENDED_CLOSE: /* \close_prepared */ free(pset.stmtName); break; case PSQL_SEND_EXTENDED_PARSE: /* \parse */ diff --git a/src/bin/psql/help.c b/src/bin/psql/help.c index db6adec8b692b..a2e009ab9bea7 100644 --- a/src/bin/psql/help.c +++ b/src/bin/psql/help.c @@ -331,7 +331,8 @@ slashUsage(unsigned short int pager) HELP0(" \\bind [PARAM]... set query parameters\n"); HELP0(" \\bind_named STMT_NAME [PARAM]...\n" " set query parameters for an existing prepared statement\n"); - HELP0(" \\close STMT_NAME close an existing prepared statement\n"); + HELP0(" \\close_prepared STMT_NAME\n" + " close an existing prepared statement\n"); HELP0(" \\endpipeline exit pipeline mode\n"); HELP0(" \\flush flush output data to the server\n"); HELP0(" \\flushrequest send request to the server to flush its output buffer\n"); diff --git a/src/bin/psql/tab-complete.in.c b/src/bin/psql/tab-complete.in.c index 2c0b4f28c14dd..908eef97c6e28 100644 --- a/src/bin/psql/tab-complete.in.c +++ b/src/bin/psql/tab-complete.in.c @@ -1875,7 +1875,7 @@ psql_completion(const char *text, int start, int end) static const char *const backslash_commands[] = { "\\a", "\\bind", "\\bind_named", - "\\connect", "\\conninfo", "\\C", "\\cd", "\\close", "\\copy", + "\\connect", "\\conninfo", "\\C", "\\cd", "\\close_prepared", "\\copy", "\\copyright", "\\crosstabview", "\\d", "\\da", "\\dA", "\\dAc", "\\dAf", "\\dAo", "\\dAp", "\\db", "\\dc", "\\dconfig", "\\dC", "\\dd", "\\ddp", "\\dD", diff --git a/src/test/regress/expected/psql.out b/src/test/regress/expected/psql.out index cf48ae6d0c2ee..236eba2540e9d 100644 --- a/src/test/regress/expected/psql.out +++ b/src/test/regress/expected/psql.out @@ -160,12 +160,12 @@ LINE 1: SELECT $1, $2 foo4 | bar4 (1 row) --- \close (extended query protocol) -\close -\close: missing required argument -\close '' -\close stmt2 -\close stmt2 +-- \close_prepared (extended query protocol) +\close_prepared +\close_prepared: missing required argument +\close_prepared '' +\close_prepared stmt2 +\close_prepared stmt2 SELECT name, statement FROM pg_prepared_statements ORDER BY name; name | statement -------+---------------- @@ -4666,7 +4666,7 @@ bar 'bar' "bar" \C arg1 \c arg1 arg2 arg3 arg4 \cd arg1 - \close stmt1 + \close_prepared stmt1 \conninfo \copy arg1 arg2 arg3 arg4 arg5 arg6 \copyright diff --git a/src/test/regress/expected/psql_pipeline.out b/src/test/regress/expected/psql_pipeline.out index e78e6bfa0ad35..a0816fb10b68e 100644 --- a/src/test/regress/expected/psql_pipeline.out +++ b/src/test/regress/expected/psql_pipeline.out @@ -564,7 +564,7 @@ SELECT $1 \bind \sendpipeline SELECT $1 \bind 1 \sendpipeline SELECT $1 \parse a \bind_named a 1 \sendpipeline -\close a +\close_prepared a \flushrequest \getresults ERROR: bind message supplies 0 parameters, but prepared statement "" requires 1 @@ -572,7 +572,7 @@ ERROR: bind message supplies 0 parameters, but prepared statement "" requires 1 SELECT $1 \bind 1 \sendpipeline SELECT $1 \parse a \bind_named a 1 \sendpipeline -\close a +\close_prepared a -- Sync allows pipeline to recover. \syncpipeline \getresults @@ -580,7 +580,7 @@ Pipeline aborted, command did not run SELECT $1 \bind 1 \sendpipeline SELECT $1 \parse a \bind_named a 1 \sendpipeline -\close a +\close_prepared a \flushrequest \getresults ?column? diff --git a/src/test/regress/sql/psql.sql b/src/test/regress/sql/psql.sql index 1a8a83462f022..e2e3124543978 100644 --- a/src/test/regress/sql/psql.sql +++ b/src/test/regress/sql/psql.sql @@ -68,11 +68,11 @@ SELECT $1, $2 \parse stmt3 -- Multiple \g calls mean multiple executions \bind_named stmt2 'foo3' \g \bind_named stmt3 'foo4' 'bar4' \g --- \close (extended query protocol) -\close -\close '' -\close stmt2 -\close stmt2 +-- \close_prepared (extended query protocol) +\close_prepared +\close_prepared '' +\close_prepared stmt2 +\close_prepared stmt2 SELECT name, statement FROM pg_prepared_statements ORDER BY name; -- \bind (extended query protocol) @@ -1035,7 +1035,7 @@ select \if false \\ (bogus \else \\ 42 \endif \\ forty_two; \C arg1 \c arg1 arg2 arg3 arg4 \cd arg1 - \close stmt1 + \close_prepared stmt1 \conninfo \copy arg1 arg2 arg3 arg4 arg5 arg6 \copyright diff --git a/src/test/regress/sql/psql_pipeline.sql b/src/test/regress/sql/psql_pipeline.sql index 5945eca1ef76c..6788dceee2e90 100644 --- a/src/test/regress/sql/psql_pipeline.sql +++ b/src/test/regress/sql/psql_pipeline.sql @@ -306,21 +306,21 @@ SELECT $1 \bind \sendpipeline SELECT $1 \bind 1 \sendpipeline SELECT $1 \parse a \bind_named a 1 \sendpipeline -\close a +\close_prepared a \flushrequest \getresults -- Pipeline is aborted. SELECT $1 \bind 1 \sendpipeline SELECT $1 \parse a \bind_named a 1 \sendpipeline -\close a +\close_prepared a -- Sync allows pipeline to recover. \syncpipeline \getresults SELECT $1 \bind 1 \sendpipeline SELECT $1 \parse a \bind_named a 1 \sendpipeline -\close a +\close_prepared a \flushrequest \getresults \endpipeline From 6531f36283f05219464dd2084a17aab5747f7de8 Mon Sep 17 00:00:00 2001 From: Amit Kapila Date: Tue, 24 Jun 2025 09:51:07 +0530 Subject: [PATCH 85/91] Fix missing comment update in 1462aad2e4. Remove the part of comment that says we don't allow toggling two_phase option as that is supported in commit 1462aad2e4. Author: Hayato Kuroda Author: Amit Kapila Discussion: https://postgr.es/m/OSCPR01MB1496656725F3951AEE8749EBDF579A@OSCPR01MB14966.jpnprd01.prod.outlook.com --- src/backend/replication/logical/worker.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/backend/replication/logical/worker.c b/src/backend/replication/logical/worker.c index a23262957acb5..fd11805a44cf9 100644 --- a/src/backend/replication/logical/worker.c +++ b/src/backend/replication/logical/worker.c @@ -109,13 +109,6 @@ * If ever a user needs to be aware of the tri-state value, they can fetch it * from the pg_subscription catalog (see column subtwophasestate). * - * We don't allow to toggle two_phase option of a subscription because it can - * lead to an inconsistent replica. Consider, initially, it was on and we have - * received some prepare then we turn it off, now at commit time the server - * will send the entire transaction data along with the commit. With some more - * analysis, we can allow changing this option from off to on but not sure if - * that alone would be useful. - * * Finally, to avoid problems mentioned in previous paragraphs from any * subsequent (not READY) tablesyncs (need to toggle two_phase option from 'on' * to 'off' and then again back to 'on') there is a restriction for From 0cb5145a32c1a867a157e18493e24930338f5d6f Mon Sep 17 00:00:00 2001 From: Fujii Masao Date: Tue, 24 Jun 2025 14:21:10 +0900 Subject: [PATCH 86/91] doc: Fix incorrect UUID index entry in function documentation. Previously, the UUID functions documentation defined the "UUID" index entry to link to the UUID data type page, even though that entry already exists there. Instead, the UUID functions page should define its own index entry linking to itself. This commit updates the UUID index entry in the UUID functions documentation to point to the correct section, improving navigation and avoiding duplication. Back-patch to all supported versions. Author: Fujii Masao Reviewed-by: Masahiko Sawada Reviewed-by: Daniel Gustafsson Discussion: https://postgr.es/m/f33e0493-5773-4296-87c5-7ce459054cfe@oss.nttdata.com Backpatch-through: 13 --- doc/src/sgml/func.sgml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml index a6d79765c1a73..224d4fe5a9f95 100644 --- a/doc/src/sgml/func.sgml +++ b/doc/src/sgml/func.sgml @@ -14384,7 +14384,7 @@ CREATE TYPE rainbow AS ENUM ('red', 'orange', 'yellow', 'green', 'blue', 'purple UUID Functions - + UUID generating From 49fe1c83ecf3474776ea9d0db47ae5644d29b67b Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Tue, 24 Jun 2025 11:30:49 +0200 Subject: [PATCH 87/91] Fix virtual generated column type checking for ALTER TABLE Virtual generated columns have some special checks in CheckAttributeType(), mainly to check that domains are not used. But this check was only applied during CREATE TABLE, not during ALTER TABLE. This fixes that. Reported-by: jian he Discussion: https://www.postgresql.org/message-id/CACJufxE0KHR__-h=zHXbhSNZXMMs4LYo4-dbj8H3YoStYBok1Q@mail.gmail.com --- src/backend/commands/tablecmds.c | 4 ++-- src/test/regress/expected/generated_virtual.out | 6 ++++++ src/test/regress/sql/generated_virtual.sql | 5 +++++ 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index ea96947d81305..074ddb6b9cd17 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -7374,7 +7374,7 @@ ATExecAddColumn(List **wqueue, AlteredTableInfo *tab, Relation rel, /* make sure datatype is legal for a column */ CheckAttributeType(NameStr(attribute->attname), attribute->atttypid, attribute->attcollation, list_make1_oid(rel->rd_rel->reltype), - 0); + (attribute->attgenerated == ATTRIBUTE_GENERATED_VIRTUAL ? CHKATYPE_IS_VIRTUAL : 0)); InsertPgAttributeTuples(attrdesc, tupdesc, myrelid, NULL, NULL); @@ -14426,7 +14426,7 @@ ATPrepAlterColumnType(List **wqueue, /* make sure datatype is legal for a column */ CheckAttributeType(colName, targettype, targetcollid, list_make1_oid(rel->rd_rel->reltype), - 0); + (attTup->attgenerated == ATTRIBUTE_GENERATED_VIRTUAL ? CHKATYPE_IS_VIRTUAL : 0)); if (attTup->attgenerated == ATTRIBUTE_GENERATED_VIRTUAL) { diff --git a/src/test/regress/expected/generated_virtual.out b/src/test/regress/expected/generated_virtual.out index 6300e7c1d96e1..ab35a77477445 100644 --- a/src/test/regress/expected/generated_virtual.out +++ b/src/test/regress/expected/generated_virtual.out @@ -800,6 +800,12 @@ CREATE TABLE gtest24r (a int PRIMARY KEY, b gtestdomain1range GENERATED ALWAYS A ERROR: virtual generated column "b" cannot have a domain type --INSERT INTO gtest24r (a) VALUES (4); -- ok --INSERT INTO gtest24r (a) VALUES (6); -- error +CREATE TABLE gtest24at (a int PRIMARY KEY); +ALTER TABLE gtest24at ADD COLUMN b gtestdomain1 GENERATED ALWAYS AS (a * 2) VIRTUAL; -- error +ERROR: virtual generated column "b" cannot have a domain type +CREATE TABLE gtest24ata (a int PRIMARY KEY, b int GENERATED ALWAYS AS (a * 2) VIRTUAL); +ALTER TABLE gtest24ata ALTER COLUMN b TYPE gtestdomain1; -- error +ERROR: virtual generated column "b" cannot have a domain type CREATE DOMAIN gtestdomainnn AS int CHECK (VALUE IS NOT NULL); CREATE TABLE gtest24nn (a int, b gtestdomainnn GENERATED ALWAYS AS (a * 2) VIRTUAL); ERROR: virtual generated column "b" cannot have a domain type diff --git a/src/test/regress/sql/generated_virtual.sql b/src/test/regress/sql/generated_virtual.sql index b4eedeee2fb27..9011c9d26745f 100644 --- a/src/test/regress/sql/generated_virtual.sql +++ b/src/test/regress/sql/generated_virtual.sql @@ -453,6 +453,11 @@ CREATE TABLE gtest24r (a int PRIMARY KEY, b gtestdomain1range GENERATED ALWAYS A --INSERT INTO gtest24r (a) VALUES (4); -- ok --INSERT INTO gtest24r (a) VALUES (6); -- error +CREATE TABLE gtest24at (a int PRIMARY KEY); +ALTER TABLE gtest24at ADD COLUMN b gtestdomain1 GENERATED ALWAYS AS (a * 2) VIRTUAL; -- error +CREATE TABLE gtest24ata (a int PRIMARY KEY, b int GENERATED ALWAYS AS (a * 2) VIRTUAL); +ALTER TABLE gtest24ata ALTER COLUMN b TYPE gtestdomain1; -- error + CREATE DOMAIN gtestdomainnn AS int CHECK (VALUE IS NOT NULL); CREATE TABLE gtest24nn (a int, b gtestdomainnn GENERATED ALWAYS AS (a * 2) VIRTUAL); --INSERT INTO gtest24nn (a) VALUES (4); -- ok From 054beebb7c9fb94ed17bda9381dbd204f32adf42 Mon Sep 17 00:00:00 2001 From: Daniel Gustafsson Date: Tue, 24 Jun 2025 11:49:37 +0200 Subject: [PATCH 88/91] doc: Remove dead link to NewbieDoc Docbook Guide The link returns 404 and no replacement is available in the project on Sourceforge where the content once was. Since we already link to resources for both beginner and experienced docs hackers, remove the the dead link. Backpatch to all supported versions as the link was added in 8.1. Author: Daniel Gustafsson Reviewed-by: Magnus Hagander Reviewed-by: Michael Paquier Reported-by: jian he Discussion: https://postgr.es/m/CACJufxH=YzQPDOe+2WuYZ7seD-BOyjCBmP6JiErpoSiVZWDRnw@mail.gmail.com Backpatch-through: 13 --- doc/src/sgml/docguide.sgml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/doc/src/sgml/docguide.sgml b/doc/src/sgml/docguide.sgml index db4bcce56eac6..7b61b4841aa03 100644 --- a/doc/src/sgml/docguide.sgml +++ b/doc/src/sgml/docguide.sgml @@ -60,9 +60,7 @@ maintained by the OASIS group. The official DocBook site has good introductory and reference documentation and - a complete O'Reilly book for your online reading pleasure. The - - NewbieDoc Docbook Guide is very helpful for beginners. + a complete O'Reilly book for your online reading pleasure. The FreeBSD Documentation Project also uses DocBook and has some good information, including a number of style guidelines that might be From 303ba0573ce656b98620133cd17418dcd217318f Mon Sep 17 00:00:00 2001 From: Melanie Plageman Date: Tue, 24 Jun 2025 09:20:16 -0400 Subject: [PATCH 89/91] Test that vacuum removes tuples older than OldestXmin If vacuum fails to prune a tuple killed before OldestXmin, it will decide to freeze its xmax and later error out in pre-freeze checks. Add a test reproducing this scenario to the recovery suite which creates a table on a primary, updates the table to generate dead tuples for vacuum, and then, during the vacuum, uses a replica to force GlobalVisState->maybe_needed on the primary to move backwards and precede the value of OldestXmin set at the beginning of vacuuming the table. This test is coverage for a case fixed in 83c39a1f7f3. The test was originally committed to master in aa607980aee but later reverted in efcbb76efe4 due to test instability. The test requires multiple index passes. In Postgres 17+, vacuum uses a TID store for the dead TIDs that is very space efficient. With the old minimum maintenance_work_mem of 1 MB, it required a large number of dead rows to generate enough dead TIDs to force multiple index vacuuming passes. Once the source code changes were made to allow a minimum maintenance_work_mem value of 64kB, the test could be made much faster and more stable. Author: Melanie Plageman Reviewed-by: John Naylor Reviewed-by: Peter Geoghegan Discussion: https://postgr.es/m/CAAKRu_ZJBkidusDut6i%3DbDCiXzJEp93GC1%2BNFaZt4eqanYF3Kw%40mail.gmail.com Backpatch-through: 17 --- src/test/recovery/meson.build | 3 +- .../recovery/t/048_vacuum_horizon_floor.pl | 278 ++++++++++++++++++ 2 files changed, 280 insertions(+), 1 deletion(-) create mode 100644 src/test/recovery/t/048_vacuum_horizon_floor.pl diff --git a/src/test/recovery/meson.build b/src/test/recovery/meson.build index 28fd9ae8dda0d..6e78ff1a030b3 100644 --- a/src/test/recovery/meson.build +++ b/src/test/recovery/meson.build @@ -54,7 +54,8 @@ tests += { 't/043_no_contrecord_switch.pl', 't/044_invalidate_inactive_slots.pl', 't/045_archive_restartpoint.pl', - 't/047_checkpoint_physical_slot.pl' + 't/047_checkpoint_physical_slot.pl', + 't/048_vacuum_horizon_floor.pl' ], }, } diff --git a/src/test/recovery/t/048_vacuum_horizon_floor.pl b/src/test/recovery/t/048_vacuum_horizon_floor.pl new file mode 100644 index 0000000000000..d48a6ef7e0f24 --- /dev/null +++ b/src/test/recovery/t/048_vacuum_horizon_floor.pl @@ -0,0 +1,278 @@ +use strict; +use warnings; +use PostgreSQL::Test::Cluster; +use Test::More; + +# Test that vacuum prunes away all dead tuples killed before OldestXmin +# +# This test creates a table on a primary, updates the table to generate dead +# tuples for vacuum, and then, during the vacuum, uses the replica to force +# GlobalVisState->maybe_needed on the primary to move backwards and precede +# the value of OldestXmin set at the beginning of vacuuming the table. + +# Set up nodes +my $node_primary = PostgreSQL::Test::Cluster->new('primary'); +$node_primary->init(allows_streaming => 'physical'); + +# io_combine_limit is set to 1 to avoid pinning more than one buffer at a time +# to ensure test determinism. +$node_primary->append_conf( + 'postgresql.conf', qq[ +hot_standby_feedback = on +autovacuum = off +log_min_messages = INFO +maintenance_work_mem = 64 +io_combine_limit = 1 +]); +$node_primary->start; + +my $node_replica = PostgreSQL::Test::Cluster->new('standby'); + +$node_primary->backup('my_backup'); +$node_replica->init_from_backup($node_primary, 'my_backup', + has_streaming => 1); + +$node_replica->start; + +my $test_db = "test_db"; +$node_primary->safe_psql('postgres', "CREATE DATABASE $test_db"); + +# Save the original connection info for later use +my $orig_conninfo = $node_primary->connstr(); + +my $table1 = "vac_horizon_floor_table"; + +# Long-running Primary Session A +my $psql_primaryA = + $node_primary->background_psql($test_db, on_error_stop => 1); + +# Long-running Primary Session B +my $psql_primaryB = + $node_primary->background_psql($test_db, on_error_stop => 1); + +# Our test relies on two rounds of index vacuuming for reasons elaborated +# later. To trigger two rounds of index vacuuming, we must fill up the +# TIDStore with dead items partway through a vacuum of the table. The number +# of rows is just enough to ensure we exceed maintenance_work_mem on all +# supported platforms, while keeping test runtime as short as we can. +my $nrows = 2000; + +# Because vacuum's first pass, pruning, is where we use the GlobalVisState to +# check tuple visibility, GlobalVisState->maybe_needed must move backwards +# during pruning before checking the visibility for a tuple which would have +# been considered HEAPTUPLE_DEAD prior to maybe_needed moving backwards but +# HEAPTUPLE_RECENTLY_DEAD compared to the new, older value of maybe_needed. +# +# We must not only force the horizon on the primary to move backwards but also +# force the vacuuming backend's GlobalVisState to be updated. GlobalVisState +# is forced to update during index vacuuming. +# +# _bt_pendingfsm_finalize() calls GetOldestNonRemovableTransactionId() at the +# end of a round of index vacuuming, updating the backend's GlobalVisState +# and, in our case, moving maybe_needed backwards. +# +# Then vacuum's first (pruning) pass will continue and pruning will find our +# later inserted and updated tuple HEAPTUPLE_RECENTLY_DEAD when compared to +# maybe_needed but HEAPTUPLE_DEAD when compared to OldestXmin. +# +# Thus, we must force at least two rounds of index vacuuming to ensure that +# some tuple visibility checks will happen after a round of index vacuuming. +# To accomplish this, we set maintenance_work_mem to its minimum value and +# insert and delete enough rows that we force at least one round of index +# vacuuming before getting to a dead tuple which was killed after the standby +# is disconnected. +$node_primary->safe_psql($test_db, qq[ + CREATE TABLE ${table1}(col1 int) + WITH (autovacuum_enabled=false, fillfactor=10); + INSERT INTO $table1 VALUES(7); + INSERT INTO $table1 SELECT generate_series(1, $nrows) % 3; + CREATE INDEX on ${table1}(col1); + DELETE FROM $table1 WHERE col1 = 0; + INSERT INTO $table1 VALUES(7); +]); + +# We will later move the primary forward while the standby is disconnected. +# For now, however, there is no reason not to wait for the standby to catch +# up. +my $primary_lsn = $node_primary->lsn('flush'); +$node_primary->wait_for_catchup($node_replica, 'replay', $primary_lsn); + +# Test that the WAL receiver is up and running. +$node_replica->poll_query_until($test_db, qq[ + SELECT EXISTS (SELECT * FROM pg_stat_wal_receiver);] , 't'); + +# Set primary_conninfo to something invalid on the replica and reload the +# config. Once the config is reloaded, the startup process will force the WAL +# receiver to restart and it will be unable to reconnect because of the +# invalid connection information. +$node_replica->safe_psql($test_db, qq[ + ALTER SYSTEM SET primary_conninfo = ''; + SELECT pg_reload_conf(); + ]); + +# Wait until the WAL receiver has shut down and been unable to start up again. +$node_replica->poll_query_until($test_db, qq[ + SELECT EXISTS (SELECT * FROM pg_stat_wal_receiver);] , 'f'); + +# Now insert and update a tuple which will be visible to the vacuum on the +# primary but which will have xmax newer than the oldest xmin on the standby +# that was recently disconnected. +my $res = $psql_primaryA->query_safe( + qq[ + INSERT INTO $table1 VALUES (99); + UPDATE $table1 SET col1 = 100 WHERE col1 = 99; + SELECT 'after_update'; + ] + ); + +# Make sure the UPDATE finished +like($res, qr/^after_update$/m, "UPDATE occurred on primary session A"); + +# Open a cursor on the primary whose pin will keep VACUUM from getting a +# cleanup lock on the first page of the relation. We want VACUUM to be able to +# start, calculate initial values for OldestXmin and GlobalVisState and then +# be unable to proceed with pruning our dead tuples. This will allow us to +# reconnect the standby and push the horizon back before we start actual +# pruning and vacuuming. +my $primary_cursor1 = "vac_horizon_floor_cursor1"; + +# The first value inserted into the table was a 7, so FETCH FORWARD should +# return a 7. That's how we know the cursor has a pin. +# Disable index scans so the cursor pins heap pages and not index pages. +$res = $psql_primaryB->query_safe( + qq[ + BEGIN; + SET enable_bitmapscan = off; + SET enable_indexscan = off; + SET enable_indexonlyscan = off; + DECLARE $primary_cursor1 CURSOR FOR SELECT * FROM $table1 WHERE col1 = 7; + FETCH $primary_cursor1; + ] + ); + +is($res, 7, qq[Cursor query returned $res. Expected value 7.]); + +# Get the PID of the session which will run the VACUUM FREEZE so that we can +# use it to filter pg_stat_activity later. +my $vacuum_pid = $psql_primaryA->query_safe("SELECT pg_backend_pid();"); + +# Now start a VACUUM FREEZE on the primary. It will call vacuum_get_cutoffs() +# and establish values of OldestXmin and GlobalVisState which are newer than +# all of our dead tuples. Then it will be unable to get a cleanup lock to +# start pruning, so it will hang. +# +# We use VACUUM FREEZE because it will wait for a cleanup lock instead of +# skipping the page pinned by the cursor. Note that works because the target +# tuple's xmax precedes OldestXmin which ensures that lazy_scan_noprune() will +# return false and we will wait for the cleanup lock. +# +# Disable any prefetching, parallelism, or other concurrent I/O by vacuum. The +# pages of the heap must be processed in order by a single worker to ensure +# test stability (PARALLEL 0 shouldn't be necessary but guards against the +# possibility of parallel heap vacuuming). +$psql_primaryA->{stdin} .= qq[ + SET maintenance_io_concurrency = 0; + VACUUM (VERBOSE, FREEZE, PARALLEL 0) $table1; + \\echo VACUUM + ]; + +# Make sure the VACUUM command makes it to the server. +$psql_primaryA->{run}->pump_nb(); + +# Make sure that the VACUUM has already called vacuum_get_cutoffs() and is +# just waiting on the lock to start vacuuming. We don't want the standby to +# re-establish a connection to the primary and push the horizon back until +# we've saved initial values in GlobalVisState and calculated OldestXmin. +$node_primary->poll_query_until($test_db, + qq[ + SELECT count(*) >= 1 FROM pg_stat_activity + WHERE pid = $vacuum_pid + AND wait_event = 'BufferPin'; + ], + 't'); + +# Ensure the WAL receiver is still not active on the replica. +$node_replica->poll_query_until($test_db, qq[ + SELECT EXISTS (SELECT * FROM pg_stat_wal_receiver);] , 'f'); + +# Allow the WAL receiver connection to re-establish. +$node_replica->safe_psql( + $test_db, qq[ + ALTER SYSTEM SET primary_conninfo = '$orig_conninfo'; + SELECT pg_reload_conf(); + ]); + +# Ensure the new WAL receiver has connected. +$node_replica->poll_query_until($test_db, qq[ + SELECT EXISTS (SELECT * FROM pg_stat_wal_receiver);] , 't'); + +# Once the WAL sender is shown on the primary, the replica should have +# connected with the primary and pushed the horizon backward. Primary Session +# A won't see that until the VACUUM FREEZE proceeds and does its first round +# of index vacuuming. +$node_primary->poll_query_until($test_db, qq[ + SELECT EXISTS (SELECT * FROM pg_stat_replication);] , 't'); + +# Move the cursor forward to the next 7. We inserted the 7 much later, so +# advancing the cursor should allow vacuum to proceed vacuuming most pages of +# the relation. Because we set maintanence_work_mem sufficiently low, we +# expect that a round of index vacuuming has happened and that the vacuum is +# now waiting for the cursor to release its pin on the last page of the +# relation. +$res = $psql_primaryB->query_safe("FETCH $primary_cursor1"); +is($res, 7, + qq[Cursor query returned $res from second fetch. Expected value 7.]); + +# Prevent the test from incorrectly passing by confirming that we did indeed +# do a pass of index vacuuming. +$node_primary->poll_query_until($test_db, qq[ + SELECT index_vacuum_count > 0 + FROM pg_stat_progress_vacuum + WHERE datname='$test_db' AND relid::regclass = '$table1'::regclass; + ] , 't'); + +# Commit the transaction with the open cursor so that the VACUUM can finish. +$psql_primaryB->query_until( + qr/^commit$/m, + qq[ + COMMIT; + \\echo commit + ] + ); + +# VACUUM proceeds with pruning and does a visibility check on each tuple. In +# older versions of Postgres, pruning found our final dead tuple +# non-removable (HEAPTUPLE_RECENTLY_DEAD) since its xmax is after the new +# value of maybe_needed. Then heap_prepare_freeze_tuple() would decide the +# tuple xmax should be frozen because it precedes OldestXmin. Vacuum would +# then error out in heap_pre_freeze_checks() with "cannot freeze committed +# xmax". This was fixed by changing pruning to find all +# HEAPTUPLE_RECENTLY_DEAD tuples with xmaxes preceding OldestXmin +# HEAPTUPLE_DEAD and removing them. + +# With the fix, VACUUM should finish successfully, incrementing the table +# vacuum_count. +$node_primary->poll_query_until($test_db, + qq[ + SELECT vacuum_count > 0 + FROM pg_stat_all_tables WHERE relname = '${table1}'; + ] + , 't'); + +$primary_lsn = $node_primary->lsn('flush'); + +# Make sure something causes us to flush +$node_primary->safe_psql($test_db, "INSERT INTO $table1 VALUES (1);"); + +# Nothing on the replica should cause a recovery conflict, so this should +# finish successfully. +$node_primary->wait_for_catchup($node_replica, 'replay', $primary_lsn); + +## Shut down psqls +$psql_primaryA->quit; +$psql_primaryB->quit; + +$node_replica->stop(); +$node_primary->stop(); + +done_testing(); From 11e3d1e1033bb79e3dcb47bdc178ef456bfa6043 Mon Sep 17 00:00:00 2001 From: Jacob Champion Date: Tue, 4 Mar 2025 09:46:13 -0800 Subject: [PATCH 90/91] XXX: Remove manual trigger from new BSDs --- .cirrus.tasks.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.cirrus.tasks.yml b/.cirrus.tasks.yml index 92057006c9309..da53789a7b32f 100644 --- a/.cirrus.tasks.yml +++ b/.cirrus.tasks.yml @@ -239,7 +239,6 @@ task: task: depends_on: SanityCheck - trigger_type: manual env: # Below are experimentally derived to be a decent choice. From be5385a1224a76ca1157c55e5e0bf25a5c223df1 Mon Sep 17 00:00:00 2001 From: Jacob Champion Date: Fri, 13 Jun 2025 15:52:07 -0700 Subject: [PATCH 91/91] oauth: Fix kqueue detection on OpenBSD In b0635bfda, I added an early header check to the Meson OAuth support, which was intended to duplicate the later checks for HAVE_SYS_[EVENT|EPOLL]_H. However, I implemented the new test via check_header() -- which tries to compile -- rather than has_header(), which just looks for the file's existence. The distinction matters on OpenBSD, where can't be compiled without including prerequisite headers, so -Dlibcurl=enabled failed on that platform. Switch to has_header() to fix this. --- meson.build | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/meson.build b/meson.build index 6ffe7b4727556..692b8b8de0be9 100644 --- a/meson.build +++ b/meson.build @@ -943,10 +943,10 @@ if not libcurlopt.disabled() # libcurl and one of either epoll or kqueue. oauth_flow_supported = ( libcurl.found() - and (cc.check_header('sys/event.h', required: false, - args: test_c_args, include_directories: postgres_inc) - or cc.check_header('sys/epoll.h', required: false, - args: test_c_args, include_directories: postgres_inc)) + and (cc.has_header('sys/event.h', + args: test_c_args, include_directories: postgres_inc) + or cc.has_header('sys/epoll.h', + args: test_c_args, include_directories: postgres_inc)) ) if oauth_flow_supported