Fix SUBSTRING() for toasted multibyte characters.
commit : 9f4fd119b2cbb9a41ec0c19a8d6ec9b59b92c125
author : Noah Misch <noah@leadboat.com>
date : Sat, 14 Feb 2026 12:16:16 -0800
committer: Noah Misch <noah@leadboat.com>
date : Sat, 14 Feb 2026 12:16:16 -0800 Commit 1e7fe06c10c0a8da9dd6261a6be8d405dc17c728 changed
pg_mbstrlen_with_len() to ereport(ERROR) if the input ends in an
incomplete character. Most callers want that. text_substring() does
not. It detoasts the most bytes it could possibly need to get the
requested number of characters. For example, to extract up to 2 chars
from UTF8, it needs to detoast 8 bytes. In a string of 3-byte UTF8
chars, 8 bytes spans 2 complete chars and 1 partial char.
Fix this by replacing this pg_mbstrlen_with_len() call with a string
traversal that differs by stopping upon finding as many chars as the
substring could need. This also makes SUBSTRING() stop raising an
encoding error if the incomplete char is past the end of the substring.
This is consistent with the general philosophy of the above commit,
which was to raise errors on a just-in-time basis. Before the above
commit, SUBSTRING() never raised an encoding error.
SUBSTRING() has long been detoasting enough for one more char than
needed, because it did not distinguish exclusive and inclusive end
position. For avoidance of doubt, stop detoasting extra.
Back-patch to v14, like the above commit. For applications using
SUBSTRING() on non-ASCII column values, consider applying this to your
copy of any of the February 12, 2026 releases.
Reported-by: SATŌ Kentarō <ranvis@gmail.com>
Reviewed-by: Thomas Munro <thomas.munro@gmail.com>
Bug: #19406
Discussion: https://postgr.es/m/19406-9867fddddd724fca@postgresql.org
Backpatch-through: 14 M src/backend/utils/adt/varlena.c
M src/test/regress/expected/encoding.out
M src/test/regress/sql/encoding.sql
pg_mblen_range, pg_mblen_with_len: Valgrind after encoding ereport.
commit : 4644f8b23bb8cd5cf3454bcd69bc28a5fd5623a9
author : Noah Misch <noah@leadboat.com>
date : Sat, 14 Feb 2026 12:16:16 -0800
committer: Noah Misch <noah@leadboat.com>
date : Sat, 14 Feb 2026 12:16:16 -0800 The prior order caused spurious Valgrind errors. They're spurious
because the ereport(ERROR) non-local exit discards the pointer in
question. pg_mblen_cstr() ordered the checks correctly, but these other
two did not. Back-patch to v14, like commit
1e7fe06c10c0a8da9dd6261a6be8d405dc17c728.
Reviewed-by: Thomas Munro <thomas.munro@gmail.com>
Discussion: https://postgr.es/m/20260214053821.fa.noahmisch@microsoft.com
Backpatch-through: 14 M src/backend/utils/mb/mbutils.c
Perform radix sort on SortTuples with pass-by-value Datums
commit : ef3c3cf6d021ff9884c513afd850a9fe85cad736
author : John Naylor <john.naylor@postgresql.org>
date : Sat, 14 Feb 2026 13:50:06 +0700
committer: John Naylor <john.naylor@postgresql.org>
date : Sat, 14 Feb 2026 13:50:06 +0700 Radix sort can be much faster than quicksort, but for our purposes it
is limited to sequences of unsigned bytes. To make tuples with other
types amenable to this technique, several features of tuple comparison
must be accounted for, i.e. the sort key must be "normalized":
1. Signedness -- It's possible to modify a signed integer such that
it can be compared as unsigned. For example, a signed char has range
-128 to 127. If we cast that to unsigned char and add 128, the range
of values becomes 0 to 255 while preserving order.
2. Direction -- SQL allows specification of ASC or DESC. The
descending case is easily handled by taking the complement of the
unsigned representation.
3. NULL values -- NULLS FIRST and NULLS LAST must work correctly.
This commmit only handles the case where datum1 is pass-by-value
Datum (possibly abbreviated) that compares like an ordinary
integer. (Abbreviations of values of type "numeric" are a convenient
counterexample.) First, tuples are partitioned by nullness in the
correct NULL ordering. Then the NOT NULL tuples are sorted with radix
sort on datum1. For tiebreaks on subsequent sortkeys (including the
first sort key if abbreviated), we divert to the usual qsort.
ORDER BY queries on pre-warmed buffers are up to 2x faster on high
cardinality inputs with radix sort than the sort specializations added
by commit 697492434, so get rid of them. It's sufficient to fall back
to qsort_tuple() for small arrays. Moderately low cardinality inputs
show more modest improvents. Our qsort is strongly optimized for very
low cardinality inputs, but radix sort is usually equal or very close
in those cases.
The changes to the regression tests are caused by under-specified sort
orders, e.g. "SELECT a, b from mytable order by a;". For unstable
sorts, such as our qsort and this in-place radix sort, there is no
guarantee of the order of "b" within each group of "a".
The implementation is taken from ska_byte_sort() (Boost licensed),
which is similar to American flag sort (an in-place radix sort) with
modifications to make it better suited for modern pipelined CPUs.
The technique of normalization described above can also be extended
to the case of multiple keys. That is left for future work (Thanks
to Peter Geoghegan for the suggestion to look into this area).
Reviewed-by: Chengpeng Yan <chengpeng_yan@outlook.com>
Reviewed-by: zengman <zengman@halodbtech.com>
Reviewed-by: ChangAo Chen <cca5507@qq.com>
Reviewed-by: Álvaro Herrera <alvherre@kurilemu.de>
Reviewed-by: Chao Li <li.evan.chao@gmail.com> (earlier version)
Discussion: https://postgr.es/m/CANWCAZYzx7a7E9AY16Jt_U3+GVKDADfgApZ-42SYNiig8dTnFA@mail.gmail.com M src/backend/utils/sort/tuplesort.c
M src/include/utils/sortsupport.h
M src/include/utils/tuplesort.h
M src/test/regress/expected/tuplesort.out
M src/tools/pgindent/typedefs.list
doc: Mention PASSING support for jsonpath variables
commit : aa082bed0b6433b58815683dde425bce57ed931c
author : Daniel Gustafsson <dgustafsson@postgresql.org>
date : Fri, 13 Feb 2026 12:12:11 +0100
committer: Daniel Gustafsson <dgustafsson@postgresql.org>
date : Fri, 13 Feb 2026 12:12:11 +0100 Commit dfd79e2d added a TODO comment to update this paragraph
when support for PASSING was added. Commit 6185c9737cf added
PASSING but missed resolving this TODO. Fix by expanding the
paragraph with a reference to PASSING.
Author: Aditya Gollamudi <adigollamudi@gmail.com>
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>
Discussion: https://postgr.es/m/20260117051406.sx6pss4ryirn2x4v@pgs M doc/src/sgml/json.sgml
doc: Update docs images README with required ditaa version
commit : 4469fe176118607f1a1dbcbbe5de57f9156e293f
author : Daniel Gustafsson <dgustafsson@postgresql.org>
date : Fri, 13 Feb 2026 11:50:17 +0100
committer: Daniel Gustafsson <dgustafsson@postgresql.org>
date : Fri, 13 Feb 2026 11:50:17 +0100 The URL for Ditaa linked to the old Sourceforge version which is
too old for what we need, the fork over on Github is the correct
version to use for re-generating the SVG files for the docs. The
required Ditaa version is 0.11.0 as it when SVG support as added.
Running the version found on Sourceforge produce the error below:
$ ditaa -E -S --svg in.txt out.txt
Unrecognized option: --svg
usage: ditaa <INPFILE> [OUTFILE] [-A] [-b <BACKGROUND>] [-d] [-E] [-e
<ENCODING>] [-h] [--help] [-o] [-r] [-S] [-s <SCALE>] [-T] [-t
<TABS>] [-v] [-W]
While there, also mention that meson rules exists for building
images.
Author: Nazir Bilal Yavuz <byavuz81@gmail.com>
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>
Reviewed-by: Paul A Jungwirth <pj@illuminatedcomputing.com>
Discussion: https://postgr.es/m/CAN55FZ2O-23xERF2NYcvv9DM_1c9T16y6mi3vyP=O1iuXS0ASA@mail.gmail.com M doc/src/sgml/images/README
meson: Add target for generating docs images
commit : 4ec0e75afd488d41482ae10f6b5df9fa9a586dee
author : Daniel Gustafsson <dgustafsson@postgresql.org>
date : Fri, 13 Feb 2026 11:50:14 +0100
committer: Daniel Gustafsson <dgustafsson@postgresql.org>
date : Fri, 13 Feb 2026 11:50:14 +0100 This adds an 'images' target to the meson build system in order to
be able to regenerate the images used in the docs.
Author: Nazir Bilal Yavuz <byavuz81@gmail.com>
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>
Reported-by: Daniel Gustafsson <daniel@yesql.se>
Discussion: https://postgr.es/m/CAN55FZ0c0Tcjx9=e-YibWGHa1-xmdV63p=THH4YYznz+pYcfig@mail.gmail.com A doc/src/sgml/images/meson.build
M doc/src/sgml/meson.build
M meson.build
pg_dump: Use pg_malloc_object() and pg_malloc_array()
commit : 6736dea14afbe239588dad1c947ceb6e50adbf72
author : Michael Paquier <michael@paquier.xyz>
date : Fri, 13 Feb 2026 19:48:35 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Fri, 13 Feb 2026 19:48:35 +0900 The idea is to encourage more the use of these allocation routines
across the tree, as these offer stronger type safety guarantees than
pg_malloc() & co (type cast in the result, sizeof() embedded). This set
of changes is dedicated to the pg_dump code.
Similar work has been done as of 31d3847a37be, as one example.
Author: Peter Smith <smithpb2250@gmail.com>
Reviewed-by: Aleksander Alekseev <aleksander@tigerdata.com>
Discussion: https://postgr.es/m/CAHut+PvpGPDLhkHAoxw_g3jdrYxA1m16a8uagbgH3TGWSKtXNQ@mail.gmail.com M src/bin/pg_dump/compress_gzip.c
M src/bin/pg_dump/compress_io.c
M src/bin/pg_dump/compress_lz4.c
M src/bin/pg_dump/compress_none.c
M src/bin/pg_dump/compress_zstd.c
M src/bin/pg_dump/connectdb.c
M src/bin/pg_dump/dumputils.c
M src/bin/pg_dump/parallel.c
M src/bin/pg_dump/pg_backup_archiver.c
M src/bin/pg_dump/pg_backup_custom.c
M src/bin/pg_dump/pg_backup_directory.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dump_sort.c
M src/bin/pg_dump/pg_dumpall.c
Restart BackgroundPsql's timer more nicely.
commit : 53c6bd0aa3de58baf828e60c6c8934d0a10a8501
author : Daniel Gustafsson <dgustafsson@postgresql.org>
date : Fri, 13 Feb 2026 11:36:31 +0100
committer: Daniel Gustafsson <dgustafsson@postgresql.org>
date : Fri, 13 Feb 2026 11:36:31 +0100 Use BackgroundPsql's published API for automatically restarting
its timer for each query, rather than manually reaching into it
to achieve the same thing.
010_tab_completion.pl's logic for this predates the invention
of BackgroundPsql (and 664d75753 missed the opportunity to
make it cleaner). 030_pager.pl copied-and-pasted the code.
Author: Daniel Gustafsson <daniel@yesql.se>
Reviewed-by: Heikki Linnakangas <hlinnaka@iki.fi>
Reviewed-by: Andrew Dunstan <andrew@dunslane.net>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/1100715.1712265845@sss.pgh.pa.us M src/bin/psql/t/010_tab_completion.pl
M src/bin/psql/t/030_pager.pl
Improve error message for checksum failures in pgstat_database.c
commit : 775fc014156bdfa6938ef02dce3d85364b1bd220
author : Michael Paquier <michael@paquier.xyz>
date : Fri, 13 Feb 2026 12:17:08 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Fri, 13 Feb 2026 12:17:08 +0900 This log message was referring to conflicts, but it is about checksum
failures. The log message improved in this commit should never show up,
due to the fact that pgstat_prepare_report_checksum_failure() should
always be called before pgstat_report_checksum_failures_in_db(), with a
stats entry already created in the pgstats shared hash table. The three
code paths able to report database-level checksum failures follow
already this requirement.
Oversight in b96d3c389755.
Author: Wang Peng <215722532@qq.com>
Discussion: https://postgr.es/m/tencent_9B6CD6D9D34AE28CDEADEC6188DB3BA1FE07@qq.com
Backpatch-through: 18 M src/backend/utils/activity/pgstat_database.c
Make pg_numa_query_pages() work in frontend programs
commit : d7edcec35c7c28edb3bf283dfe9c892b042ca158
author : Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Thu, 12 Feb 2026 19:41:06 +0200
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Thu, 12 Feb 2026 19:41:06 +0200 It's currently only used in the server, but it was placed in src/port
with the idea that it might be useful in client programs too. However,
it will currently fail to link if used in a client program, because
CHECK_FOR_INTERRUPTS() is not usable in client programs. Fix that by
wrapping it in "#ifndef FRONTEND".
Reviewed-by: Álvaro Herrera <alvherre@kurilemu.de>
Discussion: https://www.postgresql.org/message-id/21cc7a48-99d9-4f69-9a3f-2c2de61ac8e5%40iki.fi
Backpatch-through: 18 M src/port/pg_numa.c
Fix comment neglected in commit ddc3250208
commit : d7a4291bb73e891243de7649ba92e7337a476434
author : Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Thu, 12 Feb 2026 19:41:02 +0200
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Thu, 12 Feb 2026 19:41:02 +0200 I renamed the field in commit ddc3250208, but missed this one
reference. M src/include/replication/slot.h
Remove specialized word-length popcount implementations.
commit : a4688988835f1f5e607040c8d89e52cbfba9369b
author : Nathan Bossart <nathan@postgresql.org>
date : Thu, 12 Feb 2026 11:32:49 -0600
committer: Nathan Bossart <nathan@postgresql.org>
date : Thu, 12 Feb 2026 11:32:49 -0600 The uses of these functions do not justify the level of
micro-optimization we've done and may even hurt performance in some
cases (e.g., due to using function pointers). This commit removes
all architecture-specific implementations of pg_popcount{32,64} and
converts the portable ones to inlined functions in pg_bitutils.h.
These inlined versions should produce the same code as before (but
inlined), so in theory this is a net gain for many machines. A
follow-up commit will replace the remaining loops over these
word-length popcount functions with calls to pg_popcount(), further
reducing the need for architecture-specific implementations.
Suggested-by: John Naylor <johncnaylorls@gmail.com>
Reviewed-by: John Naylor <johncnaylorls@gmail.com>
Reviewed-by: Greg Burd <greg@burd.me>
Discussion: https://postgr.es/m/CANWCAZY7R%2Biy%2Br9YM_sySNydHzNqUirx1xk0tB3ej5HO62GdgQ%40mail.gmail.com M src/include/port/pg_bitutils.h
M src/port/pg_bitutils.c
M src/port/pg_popcount_aarch64.c
M src/port/pg_popcount_x86.c
Remove some unnecessary optimizations in popcount code.
commit : cb7b2e5e8efb3e5fb08052425cd00f067a56f877
author : Nathan Bossart <nathan@postgresql.org>
date : Thu, 12 Feb 2026 11:32:49 -0600
committer: Nathan Bossart <nathan@postgresql.org>
date : Thu, 12 Feb 2026 11:32:49 -0600 Over the past few releases, we've added a huge amount of complexity
to our popcount implementations. Commits fbe327e5b4, 79e232ca01,
8c6653516c, and 25dc485074 did some preliminary refactoring, but
many opportunities remain. In particular, if we disclaim interest
in micro-optimizing this code for 32-bit builds and in unnecessary
alignment checks on x86-64, we can remove a decent chunk of code.
I cannot find public discussion or benchmarks for the code this
commit removes, but it seems unlikely that this change will
noticeably impact performance on affected systems.
Suggested-by: John Naylor <johncnaylorls@gmail.com>
Reviewed-by: John Naylor <johncnaylorls@gmail.com>
Discussion: https://postgr.es/m/CANWCAZY7R%2Biy%2Br9YM_sySNydHzNqUirx1xk0tB3ej5HO62GdgQ%40mail.gmail.com M src/include/port/pg_bitutils.h
M src/port/pg_bitutils.c
M src/port/pg_popcount_x86.c
Add support for INSERT ... ON CONFLICT DO SELECT.
commit : 88327092ff06c48676d2a603420089bf493770f3
author : Dean Rasheed <dean.a.rasheed@gmail.com>
date : Thu, 12 Feb 2026 09:55:06 +0000
committer: Dean Rasheed <dean.a.rasheed@gmail.com>
date : Thu, 12 Feb 2026 09:55:06 +0000 This adds a new ON CONFLICT action DO SELECT [FOR UPDATE/SHARE], which
returns the pre-existing rows when conflicts are detected. The INSERT
statement must have a RETURNING clause, when DO SELECT is specified.
The optional FOR UPDATE/SHARE clause allows the rows to be locked
before they are are returned. As with a DO UPDATE conflict action, an
optional WHERE clause may be used to prevent rows from being selected
for return (but as with a DO UPDATE action, rows filtered out by the
WHERE clause are still locked).
Bumps catversion as stored rules change.
Author: Andreas Karlsson <andreas@proxel.se>
Author: Marko Tiikkaja <marko@joh.to>
Author: Viktor Holmberg <v@viktorh.net>
Reviewed-by: Joel Jacobson <joel@compiler.org>
Reviewed-by: Kirill Reshke <reshkekirill@gmail.com>
Reviewed-by: Dean Rasheed <dean.a.rasheed@gmail.com>
Reviewed-by: Jian He <jian.universality@gmail.com>
Discussion: https://postgr.es/m/d631b406-13b7-433e-8c0b-c6040c4b4663@Spark
Discussion: https://postgr.es/m/5fca222d-62ae-4a2f-9fcb-0eca56277094@Spark
Discussion: https://postgr.es/m/2b5db2e6-8ece-44d0-9890-f256fdca9f7e@proxel.se
Discussion: https://postgr.es/m/CAL9smLCdV-v3KgOJX3mU19FYK82N7yzqJj2HAwWX70E=P98kgQ@mail.gmail.com M contrib/postgres_fdw/postgres_fdw.c
M doc/src/sgml/dml.sgml
M doc/src/sgml/fdwhandler.sgml
M doc/src/sgml/mvcc.sgml
M doc/src/sgml/postgres-fdw.sgml
M doc/src/sgml/ref/create_policy.sgml
M doc/src/sgml/ref/create_view.sgml
M doc/src/sgml/ref/insert.sgml
M doc/src/sgml/ref/merge.sgml
M src/backend/access/heap/heapam.c
M src/backend/commands/explain.c
M src/backend/executor/execIndexing.c
M src/backend/executor/execPartition.c
M src/backend/executor/nodeModifyTable.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/plan/setrefs.c
M src/backend/optimizer/util/plancat.c
M src/backend/parser/analyze.c
M src/backend/parser/gram.y
M src/backend/parser/parse_clause.c
M src/backend/rewrite/rewriteHandler.c
M src/backend/rewrite/rowsecurity.c
M src/backend/utils/adt/ruleutils.c
M src/include/catalog/catversion.h
M src/include/nodes/execnodes.h
M src/include/nodes/lockoptions.h
M src/include/nodes/nodes.h
M src/include/nodes/parsenodes.h
M src/include/nodes/plannodes.h
M src/include/nodes/primnodes.h
A src/test/isolation/expected/insert-conflict-do-select.out
M src/test/isolation/isolation_schedule
A src/test/isolation/specs/insert-conflict-do-select.spec
M src/test/regress/expected/constraints.out
M src/test/regress/expected/insert_conflict.out
M src/test/regress/expected/privileges.out
M src/test/regress/expected/rowsecurity.out
M src/test/regress/expected/rules.out
M src/test/regress/expected/triggers.out
M src/test/regress/expected/updatable_views.out
M src/test/regress/sql/constraints.sql
M src/test/regress/sql/insert_conflict.sql
M src/test/regress/sql/privileges.sql
M src/test/regress/sql/rowsecurity.sql
M src/test/regress/sql/rules.sql
M src/test/regress/sql/triggers.sql
M src/test/regress/sql/updatable_views.sql
M src/tools/pgindent/typedefs.list
Refactor slot synchronization logic in slotsync.c.
commit : 788ec96d591d0a7c916f2f4332765f46410d73b5
author : Amit Kapila <akapila@postgresql.org>
date : Thu, 12 Feb 2026 14:38:31 +0530
committer: Amit Kapila <akapila@postgresql.org>
date : Thu, 12 Feb 2026 14:38:31 +0530 Following e68b6adad9, the reason for skipping slot synchronization is
stored as a slot property. This commit removes redundant function
parameters that previously tracked this state, instead relying directly on
the slot property.
Additionally, this change centralizes the logic for skipping
synchronization when required WAL has not yet been received or flushed. By
consolidating this check, we reduce code duplication and the risk of
inconsistent state updates across different code paths.
In passing, add an assertion to ensure a slot is marked as temporary if a
consistent point has not been reached during synchronization.
Author: Zhijie Hou <houzj.fnst@fujitsu.com>
Reviewed-by: Shveta Malik <shveta.malik@gmail.com>
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>
Discussion: https://postgr.es/m/TY4PR01MB16907DD16098BE3B20486D4569463A@TY4PR01MB16907.jpnprd01.prod.outlook.com
Discussion: https://postgr.es/m/CAFPTHDZAA+gWDntpa5ucqKKba41=tXmoXqN3q4rpjO9cdxgQrw@mail.gmail.com M src/backend/replication/logical/slotsync.c
Remove p_is_insert from struct ParseState.
commit : 706cadde3239842a41a3375d50dda8b33325c008
author : Dean Rasheed <dean.a.rasheed@gmail.com>
date : Thu, 12 Feb 2026 09:01:42 +0000
committer: Dean Rasheed <dean.a.rasheed@gmail.com>
date : Thu, 12 Feb 2026 09:01:42 +0000 The only place that used p_is_insert was transformAssignedExpr(),
which used it to distinguish INSERT from UPDATE when handling
indirection on assignment target columns -- see commit c1ca3a19df3.
However, this information is already available to
transformAssignedExpr() via its exprKind parameter, which is always
either EXPR_KIND_INSERT_TARGET or EXPR_KIND_UPDATE_TARGET.
As noted in the commit message for c1ca3a19df3, this use of
p_is_insert isn't particularly pretty, so have transformAssignedExpr()
use the exprKind parameter instead. This then allows p_is_insert to be
removed entirely, which simplifies state management in a few other
places across the parser.
Author: Viktor Holmberg <v@viktorh.net>
Reviewed-by: Dean Rasheed <dean.a.rasheed@gmail.com>
Discussion: https://postgr.es/m/badc3b4c-da73-4000-b8d3-638a6f53a769@Spark M src/backend/parser/analyze.c
M src/backend/parser/parse_merge.c
M src/backend/parser/parse_target.c
M src/include/parser/parse_node.h
Reduce LEFT JOIN to ANTI JOIN using NOT NULL constraints
commit : cf74558feb8f41b2bc459f59ed3f991024d04893
author : Richard Guo <rguo@postgresql.org>
date : Thu, 12 Feb 2026 15:30:13 +0900
committer: Richard Guo <rguo@postgresql.org>
date : Thu, 12 Feb 2026 15:30:13 +0900 For a LEFT JOIN, if any var from the right-hand side (RHS) is forced
to null by upper-level quals but is known to be non-null for any
matching row, the only way the upper quals can be satisfied is if the
join fails to match, producing a null-extended row. Thus, we can
treat this left join as an anti-join.
Previously, this transformation was limited to cases where the join's
own quals were strict for the var forced to null by upper qual levels.
This patch extends the logic to check table constraints, leveraging
the NOT NULL attribute information already available thanks to the
infrastructure introduced by e2debb643. If a forced-null var belongs
to the RHS and is defined as NOT NULL in the schema (and is not
nullable due to lower-level outer joins), we know that the left join
can be reduced to an anti-join.
Note that to ensure the var is not nullable by any lower-level outer
joins within the current subtree, we collect the relids of base rels
that are nullable within each subtree during the first pass of the
reduce-outer-joins process. This allows us to verify in the second
pass that a NOT NULL var is indeed safe to treat as non-nullable.
Based on a proposal by Nicolas Adenis-Lamarre, but this is not the
original patch.
Suggested-by: Nicolas Adenis-Lamarre <nicolas.adenis.lamarre@gmail.com>
Author: Tender Wang <tndrwang@gmail.com>
Co-authored-by: Richard Guo <guofenglinux@gmail.com>
Discussion: https://postgr.es/m/CACPGbctKMDP50PpRH09in+oWbHtZdahWSroRstLPOoSDKwoFsw@mail.gmail.com M src/backend/optimizer/prep/prepjointree.c
M src/test/regress/expected/join.out
M src/test/regress/sql/join.sql
Fix plpgsql's handling of "return simple_record_variable".
commit : 9863c90759ecb3c200520db9a8b02c33eaec6e17
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Wed, 11 Feb 2026 16:53:14 -0500
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Wed, 11 Feb 2026 16:53:14 -0500 If the variable's value is null, exec_stmt_return() missed filling
in estate->rettype. This is a pretty old bug, but we'd managed not
to notice because that value isn't consulted for a null result ...
unless we have to cast it to a domain. That case led to a failure
with "cache lookup failed for type 0".
The correct way to assign the data type is known by exec_eval_datum.
While we could copy-and-paste that logic, it seems like a better
idea to just invoke exec_eval_datum, as the ROW case already does.
Reported-by: Pavel Stehule <pavel.stehule@gmail.com>
Author: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/CAFj8pRBT_ahexDf-zT-cyH8bMR_qcySKM8D5nv5MvTWPiatYGA@mail.gmail.com
Backpatch-through: 14 M src/pl/plpgsql/src/expected/plpgsql_domain.out
M src/pl/plpgsql/src/pl_exec.c
M src/pl/plpgsql/src/sql/plpgsql_domain.sql
Fix pg_stat_get_backend_wait_event() for aux processes
commit : 78a5e3074b824b4bbcb75ea4dd565ce735f54293
author : Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Wed, 11 Feb 2026 18:50:57 +0200
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Wed, 11 Feb 2026 18:50:57 +0200 The pg_stat_activity view shows information for aux processes, but the
pg_stat_get_backend_wait_event() and
pg_stat_get_backend_wait_event_type() functions did not. To fix, call
AuxiliaryPidGetProc(pid) if BackendPidGetProc(pid) returns NULL, like
we do in pg_stat_get_activity().
In version 17 and above, it's a little silly to use those functions
when we already have the ProcNumber at hand, but it was necessary
before v17 because the backend ID was different from ProcNumber. I
have other plans for wait_event_info on master, so it doesn't seem
worth applying a different fix on different versions now.
Reviewed-by: Sami Imseih <samimseih@gmail.com>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Discussion: https://www.postgresql.org/message-id/c0320e04-6e85-4c49-80c5-27cfb3a58108@iki.fi
Backpatch-through: 14 M src/backend/utils/adt/pgstatfuncs.c
Add password expiration warnings.
commit : 1d92e0c2cc4789255c630d8776bbe85ca9ebc27f
author : Nathan Bossart <nathan@postgresql.org>
date : Wed, 11 Feb 2026 10:36:15 -0600
committer: Nathan Bossart <nathan@postgresql.org>
date : Wed, 11 Feb 2026 10:36:15 -0600 This commit adds a new parameter called
password_expiration_warning_threshold that controls when the server
begins emitting imminent-password-expiration warnings upon
successful password authentication. By default, this parameter is
set to 7 days, but this functionality can be disabled by setting it
to 0. This patch also introduces a new "connection warning"
infrastructure that can be reused elsewhere. For example, we may
want to warn about the use of MD5 passwords for a couple of
releases before removing MD5 password support.
Author: Gilles Darold <gilles@darold.net>
Co-authored-by: Nathan Bossart <nathandbossart@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>
Reviewed-by: songjinzhou <tsinghualucky912@foxmail.com>
Reviewed-by: liu xiaohui <liuxh.zj.cn@gmail.com>
Reviewed-by: Yuefei Shi <shiyuefei1004@gmail.com>
Reviewed-by: Steven Niu <niushiji@gmail.com>
Reviewed-by: Soumya S Murali <soumyamurali.work@gmail.com>
Reviewed-by: Euler Taveira <euler@eulerto.com>
Reviewed-by: Zsolt Parragi <zsolt.parragi@percona.com>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Greg Sabino Mullane <htamfids@gmail.com>
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Discussion: https://postgr.es/m/129bcfbf-47a6-e58a-190a-62fc21a17d03%40migops.com M doc/src/sgml/config.sgml
M src/backend/libpq/crypt.c
M src/backend/utils/init/postinit.c
M src/backend/utils/misc/guc_parameters.dat
M src/backend/utils/misc/postgresql.conf.sample
M src/include/libpq/crypt.h
M src/include/miscadmin.h
M src/test/authentication/t/001_password.pl
Further stabilize a postgres_fdw test case.
commit : a3fd53babb8e8bde688739ec367a6d170495cfb4
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Wed, 11 Feb 2026 11:03:01 -0500
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Wed, 11 Feb 2026 11:03:01 -0500 The buildfarm occasionally shows a variant row order in the output
of this UPDATE ... RETURNING, implying that the preceding INSERT
dropped one of the rows into some free space within the table rather
than appending them all at the end. It's not entirely clear why that
happens some times and not other times, but we have established that
it's affected by concurrent activity in other databases of the
cluster. In any case, the behavior is not wrong; the test is at fault
for presuming that a seqscan will give deterministic row ordering.
Add an ORDER BY atop the update to stop the buildfarm noise.
The buildfarm seems to have shown this only in v18 and master
branches, but just in case the cause is older, back-patch to
all supported branches.
Discussion: https://postgr.es/m/3866274.1770743162@sss.pgh.pa.us
Backpatch-through: 14 M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/sql/postgres_fdw.sql
Cleanup for log_min_messages changes in 38e0190ced71
commit : 1efdd7cc630a963e56f34d44877d2097b98166d6
author : Álvaro Herrera <alvherre@kurilemu.de>
date : Wed, 11 Feb 2026 16:38:18 +0100
committer: Álvaro Herrera <alvherre@kurilemu.de>
date : Wed, 11 Feb 2026 16:38:18 +0100 * Remove an unused variable
* Use "default log level" consistently (instead of "generic")
* Keep the process types in alphabetical order (missed one place in the
SGML docs)
* Since log_min_messages type was changed from enum to string, it
is a good idea to add single quotes when printing it out. Otherwise
it fails if the user copies and pastes from the SHOW output to SET,
except in the simplest case. Using single quotes reduces confusion.
* Use lowercase string for the burned-in default value, to keep the same
output as previous versions.
Author: Euler Taveira <euler@eulerto.com>
Author: Man Zeng <zengman@halodbtech.com>
Author: Noriyoshi Shinoda <noriyoshi.shinoda@hpe.com>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://postgr.es/m/202602091250.genyflm2d5dw@alvherre.pgsql M doc/src/sgml/config.sgml
M src/backend/utils/error/elog.c
M src/backend/utils/misc/guc_parameters.dat
M src/backend/utils/misc/postgresql.conf.sample
M src/include/postmaster/proctypelist.h
M src/include/utils/guc.h
Move ProcStructLock to the ProcGlobal struct
commit : 7984ce7a1d21819865e473f17cb6b928cf58a10d
author : Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Wed, 11 Feb 2026 16:48:45 +0200
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Wed, 11 Feb 2026 16:48:45 +0200 It protects the freeProcs and some other fields in ProcGlobal, so
let's move it there. It's good for cache locality to have it next to
the thing it protects, and just makes more sense anyway. I believe it
was allocated as a separate shared memory area just for historical
reasons.
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>
Discussion: https://www.postgresql.org/message-id/b78719db-0c54-409f-b185-b0d59261143f@iki.fi M src/backend/postmaster/launch_backend.c
M src/backend/storage/lmgr/proc.c
M src/include/storage/proc.h
doc: Mention all SELECT privileges required by INSERT ... ON CONFLICT.
commit : bc953bf52314ca881a18703f86b68743ef6f3a32
author : Dean Rasheed <dean.a.rasheed@gmail.com>
date : Wed, 11 Feb 2026 10:52:58 +0000
committer: Dean Rasheed <dean.a.rasheed@gmail.com>
date : Wed, 11 Feb 2026 10:52:58 +0000 On the INSERT page, mention that SELECT privileges are also required
for any columns mentioned in the arbiter clause, including those
referred to by the constraint, and clarify that this applies to all
forms of ON CONFLICT, not just ON CONFLICT DO UPDATE.
Author: Dean Rasheed <dean.a.rasheed@gmail.com>
Reviewed-by: Viktor Holmberg <v@viktorh.net>
Discussion: https://postgr.es/m/CAEZATCXGwMQ+x00YY9XYG46T0kCajH=21QaYL9Xatz0dLKii+g@mail.gmail.com
Backpatch-through: 14 M doc/src/sgml/ref/insert.sgml
doc: Clarify RLS policies applied for ON CONFLICT DO NOTHING.
commit : 227a6ea65740bb8c5b1f37df016d7861fcba11c5
author : Dean Rasheed <dean.a.rasheed@gmail.com>
date : Wed, 11 Feb 2026 10:25:05 +0000
committer: Dean Rasheed <dean.a.rasheed@gmail.com>
date : Wed, 11 Feb 2026 10:25:05 +0000 On the CREATE POLICY page, the description of per-command policies
stated that SELECT policies are applied when an INSERT has an ON
CONFLICT DO NOTHING clause. However, that is only the case if it
includes an arbiter clause, so clarify that.
While at it, also clarify the comment in the regression tests that
cover this.
Author: Dean Rasheed <dean.a.rasheed@gmail.com>
Reviewed-by: Viktor Holmberg <v@viktorh.net>
Discussion: https://postgr.es/m/CAEZATCXGwMQ+x00YY9XYG46T0kCajH=21QaYL9Xatz0dLKii+g@mail.gmail.com
Backpatch-through: 14 M doc/src/sgml/ref/create_policy.sgml
M src/test/regress/expected/rowsecurity.out
M src/test/regress/sql/rowsecurity.sql
Remove useless store to local variable
commit : ab32a9e21d37ede830635f502283883592ab0a62
author : Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Wed, 11 Feb 2026 11:49:18 +0200
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Wed, 11 Feb 2026 11:49:18 +0200 It was a leftover from commit 5764f611e1, which converted the loop to
use dclist_foreach.
Reviewed-by: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Discussion: https://www.postgresql.org/message-id/3dd6f70c-b94d-4428-8e75-74a7136396be@iki.fi M src/backend/storage/lmgr/lock.c
Store information about Append node consolidation in the final plan.
commit : 7358abcc6076f4b2530d10126ab379f8aea612a5
author : Robert Haas <rhaas@postgresql.org>
date : Tue, 10 Feb 2026 17:55:59 -0500
committer: Robert Haas <rhaas@postgresql.org>
date : Tue, 10 Feb 2026 17:55:59 -0500 An extension (or core code) might want to reconstruct the planner's
decisions about whether and where to perform partitionwise joins from
the final plan. To do so, it must be possible to find all of the RTIs
of partitioned tables appearing in the plan. But when an AppendPath
or MergeAppendPath pulls up child paths from a subordinate AppendPath
or MergeAppendPath, the RTIs of the subordinate path do not appear
in the final plan, making this kind of reconstruction impossible.
To avoid this, propagate the RTI sets that would have been present
in the 'apprelids' field of the subordinate Append or MergeAppend
nodes that would have been created into the surviving Append or
MergeAppend node, using a new 'child_append_relid_sets' field for
that purpose. The value of this field is a list of Bitmapsets,
because each relation whose append-list was pulled up had its own
set of RTIs: just one, if it was a partitionwise scan, or more than
one, if it was a partitionwise join. Since our goal is to see where
partitionwise joins were done, it is essential to avoid losing the
information about how the RTIs were grouped in the pulled-up
relations.
This commit also updates pg_overexplain so that EXPLAIN (RANGE_TABLE)
will display the saved RTI sets.
Co-authored-by: Robert Haas <rhaas@postgresql.org>
Co-authored-by: Lukas Fittl <lukas@fittl.com>
Reviewed-by: Lukas Fittl <lukas@fittl.com>
Reviewed-by: Jakub Wartak <jakub.wartak@enterprisedb.com>
Reviewed-by: Greg Burd <greg@burd.me>
Reviewed-by: Jacob Champion <jacob.champion@enterprisedb.com>
Reviewed-by: Amit Langote <amitlangote09@gmail.com>
Reviewed-by: Haibo Yan <tristan.yim@gmail.com>
Reviewed-by: Alexandra Wang <alexandra.wang.oss@gmail.com>
Discussion: http://postgr.es/m/CA+TgmoZ-Jh1T6QyWoCODMVQdhTUPYkaZjWztzP1En4=ZHoKPzw@mail.gmail.com M contrib/pg_overexplain/expected/pg_overexplain.out
M contrib/pg_overexplain/pg_overexplain.c
M src/backend/optimizer/path/allpaths.c
M src/backend/optimizer/path/joinrels.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/prep/prepunion.c
M src/backend/optimizer/util/pathnode.c
M src/include/nodes/pathnodes.h
M src/include/nodes/plannodes.h
M src/include/optimizer/pathnode.h
M src/tools/pgindent/typedefs.list
Improve type handling of varlena structures
commit : 9181c870bada196711206f3a795bde6b8c43dcd3
author : Michael Paquier <michael@paquier.xyz>
date : Wed, 11 Feb 2026 07:33:24 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Wed, 11 Feb 2026 07:33:24 +0900 This commit changes the definition of varlena to a typedef, so as it
becomes possible to remove "struct" markers from various declarations in
the code base. Historically, "struct" markers are not the project style
for variable declarations, so this update simplifies the code and makes
it more consistent across the board.
This change has an impact on the following structures, simplifying
declarations using them:
- varlena
- varatt_indirect
- varatt_external
This cleanup has come up in a different path set that played with
TOAST and varatt.h, independently worth doing on its own.
Reviewed-by: Álvaro Herrera <alvherre@kurilemu.de>
Reviewed-by: Andreas Karlsson <andreas@proxel.se>
Reviewed-by: Shinya Kato <shinya11.kato@gmail.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://postgr.es/m/aW8xvVbovdhyI4yo@paquier.xyz M contrib/amcheck/verify_heapam.c
M contrib/btree_gist/btree_utils_var.c
M contrib/pageinspect/heapfuncs.c
M doc/src/sgml/storage.sgml
M src/backend/access/brin/brin_tuple.c
M src/backend/access/common/detoast.c
M src/backend/access/common/indextuple.c
M src/backend/access/common/toast_compression.c
M src/backend/access/common/toast_internals.c
M src/backend/access/hash/hashfunc.c
M src/backend/access/heap/heapam.c
M src/backend/access/heap/heaptoast.c
M src/backend/access/table/toast_helper.c
M src/backend/executor/tstoreReceiver.c
M src/backend/replication/logical/reorderbuffer.c
M src/backend/storage/large_object/inv_api.c
M src/backend/utils/adt/datum.c
M src/backend/utils/adt/expandedrecord.c
M src/backend/utils/adt/rowtypes.c
M src/backend/utils/adt/varlena.c
M src/backend/utils/fmgr/fmgr.c
M src/include/access/detoast.h
M src/include/access/heaptoast.h
M src/include/access/tableam.h
M src/include/access/toast_compression.h
M src/include/access/toast_helper.h
M src/include/access/toast_internals.h
M src/include/c.h
M src/include/fmgr.h
M src/include/utils/varbit.h
M src/include/utils/xml.h
M src/include/varatt.h
M src/pl/plpgsql/src/pl_exec.c
M src/test/regress/regress.c
M src/tools/pgindent/typedefs.list
Store information about elided nodes in the final plan.
commit : 0d4391b265f83023d0b7eed71817517410f76e60
author : Robert Haas <rhaas@postgresql.org>
date : Tue, 10 Feb 2026 16:46:05 -0500
committer: Robert Haas <rhaas@postgresql.org>
date : Tue, 10 Feb 2026 16:46:05 -0500 An extension (or core code) might want to reconstruct the planner's
choice of join order from the final plan. To do so, it must be possible
to find all of the RTIs that were part of the join problem in that plan.
Commit adbad833f3d9e9176e8d7005f15ea6056900227d, together with the
earlier work in 8c49a484e8ebb0199fba4bd68eaaedaf49b48ed0, is enough to
let us match up RTIs we see in the final plan with RTIs that we see
during the planning cycle, but we still have a problem if the planner
decides to drop some RTIs out of the final plan altogether.
To fix that, when setrefs.c removes a SubqueryScan, single-child Append,
or single-child MergeAppend from the final Plan tree, record the type of
the removed node and the RTIs that the removed node would have scanned
in the final plan tree. It would be natural to record this information
on the child of the removed plan node, but that would require adding an
additional pointer field to type Plan, which seems undesirable. So,
instead, store the information in a separate list that the executor need
never consult, and use the plan_node_id to identify the plan node with
which the removed node is logically associated.
Also, update pg_overexplain to display these details.
Reviewed-by: Lukas Fittl <lukas@fittl.com>
Reviewed-by: Jakub Wartak <jakub.wartak@enterprisedb.com>
Reviewed-by: Greg Burd <greg@burd.me>
Reviewed-by: Jacob Champion <jacob.champion@enterprisedb.com>
Reviewed-by: Amit Langote <amitlangote09@gmail.com>
Reviewed-by: Haibo Yan <tristan.yim@gmail.com>
Reviewed-by: Alexandra Wang <alexandra.wang.oss@gmail.com>
Discussion: http://postgr.es/m/CA+TgmoZ-Jh1T6QyWoCODMVQdhTUPYkaZjWztzP1En4=ZHoKPzw@mail.gmail.com M contrib/pg_overexplain/expected/pg_overexplain.out
M contrib/pg_overexplain/pg_overexplain.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/plan/setrefs.c
M src/include/nodes/pathnodes.h
M src/include/nodes/plannodes.h
M src/tools/pgindent/typedefs.list
Store information about range-table flattening in the final plan.
commit : adbad833f3d9e9176e8d7005f15ea6056900227d
author : Robert Haas <rhaas@postgresql.org>
date : Tue, 10 Feb 2026 15:33:39 -0500
committer: Robert Haas <rhaas@postgresql.org>
date : Tue, 10 Feb 2026 15:33:39 -0500 Suppose that we're currently planning a query and, when that same
query was previously planned and executed, we learned something about
how a certain table within that query should be planned. We want to
take note when that same table is being planned during the current
planning cycle, but this is difficult to do, because the RTI of the
table from the previous plan won't necessarily be equal to the RTI
that we see during the current planning cycle. This is because each
subquery has a separate range table during planning, but these are
flattened into one range table when constructing the final plan,
changing RTIs.
Commit 8c49a484e8ebb0199fba4bd68eaaedaf49b48ed0 allows us to match up
subqueries seen in the previous planning cycles with the subqueries
currently being planned just by comparing textual names, but that's
not quite enough to let us deduce anything about individual tables,
because we don't know where each subquery's range table appears in
the final, flattened range table.
To fix that, store a list of SubPlanRTInfo objects in the final
planned statement, each including the name of the subplan, the offset
at which it begins in the flattened range table, and whether or not
it was a dummy subplan -- if it was, some RTIs may have been dropped
from the final range table, but also there's no need to control how
a dummy subquery gets planned. The toplevel subquery has no name and
always begins at rtoffset 0, so we make no entry for it.
This commit teaches pg_overexplain's RANGE_TABLE option to make use
of this new data to display the subquery name for each range table
entry.
Reviewed-by: Lukas Fittl <lukas@fittl.com>
Reviewed-by: Jakub Wartak <jakub.wartak@enterprisedb.com>
Reviewed-by: Greg Burd <greg@burd.me>
Reviewed-by: Jacob Champion <jacob.champion@enterprisedb.com>
Reviewed-by: Amit Langote <amitlangote09@gmail.com>
Reviewed-by: Haibo Yan <tristan.yim@gmail.com>
Reviewed-by: Alexandra Wang <alexandra.wang.oss@gmail.com>
Discussion: http://postgr.es/m/CA+TgmoZ-Jh1T6QyWoCODMVQdhTUPYkaZjWztzP1En4=ZHoKPzw@mail.gmail.com M contrib/pg_overexplain/expected/pg_overexplain.out
M contrib/pg_overexplain/pg_overexplain.c
M contrib/pg_overexplain/sql/pg_overexplain.sql
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/plan/setrefs.c
M src/include/nodes/pathnodes.h
M src/include/nodes/plannodes.h
M src/tools/pgindent/typedefs.list
Pass cursorOptions to planner_setup_hook.
commit : 0f4c8d33d49da012a04076159a008c9fa80bcc47
author : Robert Haas <rhaas@postgresql.org>
date : Tue, 10 Feb 2026 11:50:28 -0500
committer: Robert Haas <rhaas@postgresql.org>
date : Tue, 10 Feb 2026 11:50:28 -0500 Commit 94f3ad3961a2cb32d30c79f01a70db4caff13318 failed to do this
because I couldn't think of a use for the information, but this has
proven to be short-sighted. Best to fix it before this code is
officially released.
Now, the only argument to standard_planenr that isn't passed to
planner_setup_hook is boundParams, but that is accessible via
glob->boundParams, and so doesn't need to be passed separately.
Discussion: https://www.postgresql.org/message-id/CA+TgmoYS4ZCVAF2jTce=bMP0Oq_db_srocR4cZyO0OBp9oUoGg@mail.gmail.com M src/backend/optimizer/plan/planner.c
M src/include/optimizer/planner.h
Fix PGS_CONSIDER_NONPARTIAL interaction with Materialize nodes.
commit : cbdf93d4712229fd82d40d823882a5bc84e407e5
author : Robert Haas <rhaas@postgresql.org>
date : Tue, 10 Feb 2026 11:49:07 -0500
committer: Robert Haas <rhaas@postgresql.org>
date : Tue, 10 Feb 2026 11:49:07 -0500 Commit 4020b370f214315b8c10430301898ac21658143f had the idea that it
would be a good idea to handle testing PGS_CONSIDER_NONPARTIAL within
cost_material to save callers the trouble, but that turns out not to be
a very good idea. One concern is that it makes cost_material() dependent
on the caller having initialized certain fields in the MaterialPath,
which is a bit awkward for materialize_finished_plan, which wants to use
a dummy path.
Another problem is that it can result in generated materialized nested
loops where the Materialize node is disabled, contrary to the intention
of joinpath.c's logic in match_unsorted_outer() and
consider_parallel_nestloop(), which aims to consider such paths only
when they would not need to be disabled. In the previous coding, it was
possible for the pgs_mask on the joinrel to have PGS_CONSIDER_NONPARTIAL
set, while the inner rel had the same bit clear. In that case, we'd
generate and then disable a Materialize path.
That seems wrong, so instead, pull up the logic to test the
PGS_CONSIDER_NONPARTIAL bit into joinpath.c, restoring the historical
behavior that either we don't generate a given materialized nested loop
in the first place, or we don't disable it.
Discussion: http://postgr.es/m/CA+TgmoawzvCoZAwFS85tE5+c8vBkqgcS8ZstQ_ohjXQ9wGT9sw@mail.gmail.com
Discussion: http://postgr.es/m/CA+TgmoYS4ZCVAF2jTce=bMP0Oq_db_srocR4cZyO0OBp9oUoGg@mail.gmail.com M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/path/joinpath.c
M src/backend/optimizer/plan/createplan.c
Refactor ProcessRecoveryConflictInterrupt for readability
commit : be5257725d7f65708f5955a3a4beaedaa370e45b
author : Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Tue, 10 Feb 2026 16:23:10 +0200
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Tue, 10 Feb 2026 16:23:10 +0200 Two changes here:
1. Introduce a separate RECOVERY_CONFLICT_BUFFERPIN_DEADLOCK flag to
indicate a suspected deadlock that involves a buffer pin. Previously
the startup process used the same flag for a deadlock involving just
regular locks, and to check for deadlocks involving the buffer
pin. The cases are handled separately in the startup process, but the
receiving backend had to deduce which one it was based on
HoldingBufferPinThatDelaysRecovery(). With a separate flag, the
receiver doesn't need to guess.
2. Rewrite the ProcessRecoveryConflictInterrupt() function to not rely
on fallthrough through the switch-statement. That was difficult to
read.
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://www.postgresql.org/message-id/4cc13ba1-4248-4884-b6ba-4805349e7f39@iki.fi M src/backend/storage/ipc/standby.c
M src/backend/tcop/postgres.c
M src/backend/utils/activity/pgstat_database.c
M src/include/storage/standby.h
Separate RecoveryConflictReasons from procsignals
commit : 17f51ea818753093f929b4c235f3b89ebcc7c5fb
author : Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Tue, 10 Feb 2026 16:23:08 +0200
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Tue, 10 Feb 2026 16:23:08 +0200 Share the same PROCSIG_RECOVERY_CONFLICT flag for all recovery
conflict reasons. To distinguish, have a bitmask in PGPROC to indicate
the reason(s).
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://www.postgresql.org/message-id/4cc13ba1-4248-4884-b6ba-4805349e7f39@iki.fi M src/backend/commands/dbcommands.c
M src/backend/commands/tablespace.c
M src/backend/replication/logical/logicalctl.c
M src/backend/replication/slot.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/ipc/procarray.c
M src/backend/storage/ipc/procsignal.c
M src/backend/storage/ipc/standby.c
M src/backend/storage/lmgr/proc.c
M src/backend/tcop/postgres.c
M src/backend/utils/activity/pgstat_database.c
M src/backend/utils/adt/mcxtfuncs.c
M src/include/storage/proc.h
M src/include/storage/procarray.h
M src/include/storage/procsignal.h
M src/include/storage/standby.h
M src/include/tcop/tcopprot.h
M src/tools/pgindent/typedefs.list
Use ProcNumber rather than pid in ReplicationSlot
commit : ddc3250208bd5980a25b0421d607bae202fef06c
author : Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Tue, 10 Feb 2026 16:23:05 +0200
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Tue, 10 Feb 2026 16:23:05 +0200 This helps the next commit.
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://www.postgresql.org/message-id/4cc13ba1-4248-4884-b6ba-4805349e7f39@iki.fi M src/backend/replication/logical/slotsync.c
M src/backend/replication/slot.c
M src/backend/replication/slotfuncs.c
M src/include/replication/slot.h
Simplify some log messages in extended_stats_funcs.c
commit : f33c585774223757b01c8eddd134d364492ed94c
author : Michael Paquier <michael@paquier.xyz>
date : Tue, 10 Feb 2026 16:59:19 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Tue, 10 Feb 2026 16:59:19 +0900 The log messages used in this file applied too much quoting logic:
- No need for quote_identifier(), which is fine to not use in the
context of a log entry.
- The usual project style is to group the namespace and object together
in a quoted string, when mentioned in an log message. This code quoted
the namespace name and the extended statistics object name separately,
which was confusing.
Reported-by: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Discussion: https://postgr.es/m/20260210.143752.1113524465620875233.horikyota.ntt@gmail.com M src/backend/statistics/extended_stats_funcs.c
M src/test/regress/expected/stats_import.out
Add information about range type stats to pg_stats_ext_exprs
commit : 307447e6dbc035c0e6e7a8ce9cee704a3b710ee9
author : Michael Paquier <michael@paquier.xyz>
date : Tue, 10 Feb 2026 12:36:57 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Tue, 10 Feb 2026 12:36:57 +0900 This commit adds three attributes to the system view pg_stats_ext_exprs,
whose data can exist when involving a range type in an expression:
range_length_histogram
range_empty_frac
range_bounds_histogram
These statistics fields exist since 918eee0c497c, and have become
viewable in pg_stats later in bc3c8db8ae2f. This puts the definition of
pg_stats_ext_exprs on par with pg_stats.
This issue has showed up during the discussion about the restore of
extended statistics for expressions, so as it becomes possible to query
the stats data to restore from the catalogs. Having access to this data
is useful on its own, without the restore part.
Some documentation and some tests are added, written by me. Corey has
authored the part in system_views.sql.
Bump catalog version.
Author: Corey Huinker <corey.huinker@gmail.com>
Co-authored-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://postgr.es/m/aYmCUx9VvrKiZQLL@paquier.xyz M doc/src/sgml/system-views.sgml
M src/backend/catalog/system_views.sql
M src/include/catalog/catversion.h
M src/test/regress/expected/rules.out
M src/test/regress/expected/stats_ext.out
M src/test/regress/sql/stats_ext.sql
Teach planner to transform "x IS [NOT] DISTINCT FROM NULL" to a NullTest
commit : f41ab51573a4c3d11f906b32a068182a1fd8596d
author : Richard Guo <rguo@postgresql.org>
date : Tue, 10 Feb 2026 10:19:25 +0900
committer: Richard Guo <rguo@postgresql.org>
date : Tue, 10 Feb 2026 10:19:25 +0900 In the spirit of 8d19d0e13, this patch teaches the planner about the
principle that NullTest with !argisrow is fully equivalent to SQL's IS
[NOT] DISTINCT FROM NULL.
The parser already performs this transformation for literal NULLs.
However, a DistinctExpr expression with one input evaluating to NULL
during planning (e.g., via const-folding of "1 + NULL" or parameter
substitution in custom plans) currently remains as a DistinctExpr
node.
This patch closes the gap for const-folded NULLs. It specifically
targets the case where one input is a constant NULL and the other is a
nullable non-constant expression. (If the other input were otherwise,
the DistinctExpr node would have already been simplified to a constant
TRUE or FALSE.)
This transformation can be beneficial because NullTest is much more
amenable to optimization than DistinctExpr, since the planner knows a
good deal about the former and next to nothing about the latter.
Author: Richard Guo <guofenglinux@gmail.com>
Reviewed-by: Tender Wang <tndrwang@gmail.com>
Discussion: https://postgr.es/m/CAMbWs49BMAOWvkdSHxpUDnniqJcEcGq3_8dd_5wTR4xrQY8urA@mail.gmail.com M src/backend/optimizer/util/clauses.c
M src/test/regress/expected/predicate.out
M src/test/regress/sql/predicate.sql
Optimize BooleanTest with non-nullable input
commit : 0aaf0de7fed8555114aca766e9cdc836dad763a3
author : Richard Guo <rguo@postgresql.org>
date : Tue, 10 Feb 2026 10:18:47 +0900
committer: Richard Guo <rguo@postgresql.org>
date : Tue, 10 Feb 2026 10:18:47 +0900 The BooleanTest construct (IS [NOT] TRUE/FALSE/UNKNOWN) treats a NULL
input as the logical value "unknown". However, when the input is
proven to be non-nullable, this special handling becomes redundant.
In such cases, the construct can be simplified directly to a boolean
expression or a constant.
Author: Richard Guo <guofenglinux@gmail.com>
Reviewed-by: Tender Wang <tndrwang@gmail.com>
Discussion: https://postgr.es/m/CAMbWs49BMAOWvkdSHxpUDnniqJcEcGq3_8dd_5wTR4xrQY8urA@mail.gmail.com M src/backend/optimizer/util/clauses.c
M src/test/regress/expected/predicate.out
M src/test/regress/sql/predicate.sql
Optimize IS DISTINCT FROM with non-nullable inputs
commit : 0a379612540cc51e54dc1c0cc4b9ef8797d2533c
author : Richard Guo <rguo@postgresql.org>
date : Tue, 10 Feb 2026 10:17:45 +0900
committer: Richard Guo <rguo@postgresql.org>
date : Tue, 10 Feb 2026 10:17:45 +0900 The IS DISTINCT FROM construct compares values acting as though NULL
were a normal data value, rather than "unknown". Semantically, "x IS
DISTINCT FROM y" yields true if the values differ or if exactly one is
NULL, and false if they are equal or both NULL. Unlike ordinary
comparison operators, it never returns NULL.
Previously, the planner only simplified this construct if all inputs
were constants, folding it to a constant boolean result. This patch
extends the optimization to cases where inputs are non-constant but
proven to be non-nullable. Specifically, "x IS DISTINCT FROM NULL"
folds to constant TRUE if "x" is known to be non-nullable. For cases
where both inputs are guaranteed not to be NULL, the expression
becomes semantically equivalent to "x <> y", and the DistinctExpr is
converted into an inequality OpExpr.
This transformation provides several benefits. It converts the
comparison into a standard operator, allowing the use of partial
indexes and constraint exclusion. Furthermore, if the clause is
negated (i.e., "IS NOT DISTINCT FROM"), it simplifies to an equality
operator. This enables the planner to generate better plans using
index scans, merge joins, hash joins, and EC-based qual deduction.
Author: Richard Guo <guofenglinux@gmail.com>
Reviewed-by: Tender Wang <tndrwang@gmail.com>
Discussion: https://postgr.es/m/CAMbWs49BMAOWvkdSHxpUDnniqJcEcGq3_8dd_5wTR4xrQY8urA@mail.gmail.com M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/sql/postgres_fdw.sql
M src/backend/optimizer/util/clauses.c
M src/test/regress/expected/predicate.out
M src/test/regress/sql/predicate.sql
pg_upgrade: Fix handling of pg_largeobject_metadata.
commit : 158408fef8b96907bb14f89654dd2beab27ff030
author : Nathan Bossart <nathan@postgresql.org>
date : Mon, 9 Feb 2026 14:58:02 -0600
committer: Nathan Bossart <nathan@postgresql.org>
date : Mon, 9 Feb 2026 14:58:02 -0600 For binary upgrades from v16 or newer, pg_upgrade transfers the
files for pg_largeobject_metadata from the old cluster, as opposed
to using COPY or ordinary SQL commands to reconstruct its contents.
While this approach adds complexity, it can greatly reduce
pg_upgrade's runtime when there are many large objects.
Large objects with comments or security labels are one source of
complexity for this approach. During pg_upgrade, schema
restoration happens before files are transferred. Comments and
security labels are transferred in the former step, but the COMMENT
and SECURITY LABEL commands will fail if their corresponding large
objects do not exist. To deal with this, pg_upgrade first copies
only the rows of pg_largeobject_metadata that are needed to avoid
failures. Later, pg_upgrade overwrites those rows by replacing
pg_largeobject_metadata's files with its files in the old cluster.
Unfortunately, there's a subtle problem here. Simply put, there's
no guarantee that pg_upgrade will overwrite all of
pg_largeobject_metadata's files on the new cluster. For example,
the new cluster's version might more aggressively extend relations
or create visibility maps, and pg_upgrade's file transfer code is
not sophisticated enough to remove files that lack counterparts in
the old cluster. These extra files could cause problems
post-upgrade.
More fortunately, we can simultaneously fix the aforementioned
problem and further optimize binary upgrades for clusters with many
large objects. If we teach the COMMENT and SECURITY LABEL commands
to allow nonexistent large objects during binary upgrades,
pg_upgrade no longer needs to transfer pg_largeobject_metadata's
contents beforehand. This approach also allows us to remove the
associated dependency tracking from pg_dump, even for upgrades from
v12-v15 that use COPY to transfer pg_largeobject_metadata's
contents.
In addition to what is described in the previous paragraph, this
commit modifies the query in getLOs() to only retrieve LOs with
comments or security labels for upgrades from v12 or newer. We
have long assumed that such usage is rare, so this should reduce
pg_upgrade's memory usage and runtime in many cases. We might also
be able to remove the "upgrades from v12 or newer" restriction on
the recent batch of optimizations by adding special handling for
pg_largeobject_metadata's hidden OID column on older versions
(since this catalog previously used the now-removed WITH OIDS
feature), but that is left as a future exercise.
Reported-by: Andres Freund <andres@anarazel.de>
Reviewed-by: Andres Freund <andres@anarazel.de>
Discussion: https://postgr.es/m/3yd2ss6n7xywo6pmhd7jjh3bqwgvx35bflzgv3ag4cnzfkik7m%40hiyadppqxx6w M src/backend/commands/comment.c
M src/backend/commands/seclabel.c
M src/bin/pg_dump/pg_dump.c
cleanup: Deadlock checker is no longer called from signal handler
commit : 73d60ac385a93684f68297ae0ccb8f75bc6f23e1
author : Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Mon, 9 Feb 2026 20:26:23 +0200
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Mon, 9 Feb 2026 20:26:23 +0200 Clean up a few leftovers from when the deadlock checker was called
from signal handler. We stopped doing that in commit 6753333f55, in
year 2015.
- CheckDeadLock can return a return value directly to the caller,
there's no need to use a global variable for that.
- Remove outdated comments that claimed that CheckDeadLock "signals
ProcSleep".
- It should be OK to ereport() from DeadLockCheck now. I considered
getting rid of InitDeadLockChecking() and moving the workspace
allocations into DeadLockCheck, but it's still good to avoid doing
the allocations while we're holding all the partition locks. So just
update the comment to give that as the reason we do the allocations
up front. M src/backend/storage/lmgr/deadlock.c
M src/backend/storage/lmgr/proc.c
Remove HeapTupleheaderSetXminCommitted/Invalid functions
commit : cbef472558ca50d282414e68083717c44b92ad62
author : Álvaro Herrera <alvherre@kurilemu.de>
date : Mon, 9 Feb 2026 19:15:20 +0100
committer: Álvaro Herrera <alvherre@kurilemu.de>
date : Mon, 9 Feb 2026 19:15:20 +0100 They are not and never have been used by any known code -- apparently we
just cargo-culted them in commit 37484ad2aace (or their ancestor macros
anyway, which begat these functions in commit 34694ec888d6). Allegedly
they're also potentially dangerous; users are better off going through
HeapTupleSetHintBits instead.
Author: Andy Fan <zhihuifan1213@163.com>
Discussion: https://postgr.es/m/87sejogt4g.fsf@163.com M src/include/access/htup_details.h
Fix incorrect iteration type in extension_file_exists()
commit : 18f0afb2a635b433e778684acabffe1e52da8a86
author : Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Mon, 9 Feb 2026 19:15:44 +0200
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Mon, 9 Feb 2026 19:15:44 +0200 Commit f3c9e341cd changed the type of objects in the List that
get_extension_control_directories() returns, from "char *" to
"ExtensionLocation *", but missed adjusting this one caller.
Author: Chao Li <lic@highgo.com>
Discussion: https://www.postgresql.org/message-id/362EA9B3-589B-475A-A16E-F10C30426E28@gmail.com M src/backend/commands/extension.c
Fix test "NUL byte in text decrypt" for --without-zlib builds.
commit : c5dc75479b1525a3aa1daaf79028fa5af159800e
author : Noah Misch <noah@leadboat.com>
date : Mon, 9 Feb 2026 09:08:10 -0800
committer: Noah Misch <noah@leadboat.com>
date : Mon, 9 Feb 2026 09:08:10 -0800 Backpatch-through: 14
Security: CVE-2026-2006 M contrib/pgcrypto/expected/pgp-decrypt.out
M contrib/pgcrypto/expected/pgp-decrypt_1.out
M contrib/pgcrypto/sql/pgp-decrypt.sql
Harden _int_matchsel() against being attached to the wrong operator.
commit : 8ebdf41c262ccd86407ca684aab3113bdbcf2c66
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Mon, 9 Feb 2026 10:14:22 -0500
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Mon, 9 Feb 2026 10:14:22 -0500 While the preceding commit prevented such attachments from occurring
in future, this one aims to prevent further abuse of any already-
created operator that exposes _int_matchsel to the wrong data types.
(No other contrib module has a vulnerable selectivity estimator.)
We need only check that the Const we've found in the query is indeed
of the type we expect (query_int), but there's a difficulty: as an
extension type, query_int doesn't have a fixed OID that we could
hard-code into the estimator.
Therefore, the bulk of this patch consists of infrastructure to let
an extension function securely look up the OID of a datatype
belonging to the same extension. (Extension authors have requested
such functionality before, so we anticipate that this code will
have additional non-security uses, and may soon be extended to allow
looking up other kinds of SQL objects.)
This is done by first finding the extension that owns the calling
function (there can be only one), and then thumbing through the
objects owned by that extension to find a type that has the desired
name. This is relatively expensive, especially for large extensions,
so a simple cache is put in front of these lookups.
Reported-by: Daniel Firer as part of zeroday.cloud
Author: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Noah Misch <noah@leadboat.com>
Security: CVE-2026-2004
Backpatch-through: 14 M contrib/intarray/_int_selfuncs.c
M src/backend/catalog/pg_depend.c
M src/backend/commands/extension.c
M src/include/catalog/dependency.h
M src/include/commands/extension.h
M src/tools/pgindent/typedefs.list
Require superuser to install a non-built-in selectivity estimator.
commit : 841d42cc4e2f9ca1cf59758fc15619b00a11e148
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Mon, 9 Feb 2026 10:07:31 -0500
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Mon, 9 Feb 2026 10:07:31 -0500 Selectivity estimators come in two flavors: those that make specific
assumptions about the data types they are working with, and those
that don't. Most of the built-in estimators are of the latter kind
and are meant to be safely attachable to any operator. If the
operator does not behave as the estimator expects, you might get a
poor estimate, but it won't crash.
However, estimators that do make datatype assumptions can malfunction
if they are attached to the wrong operator, since then the data they
get from pg_statistic may not be of the type they expect. This can
rise to the level of a security problem, even permitting arbitrary
code execution by a user who has the ability to create SQL objects.
To close this hole, establish a rule that built-in estimators are
required to protect themselves against being called on the wrong type
of data. It does not seem practical however to expect estimators in
extensions to reach a similar level of security, at least not in the
near term. Therefore, also establish a rule that superuser privilege
is required to attach a non-built-in estimator to an operator.
We expect that this restriction will have little negative impact on
extensions, since estimators generally have to be written in C and
thus superuser privilege is required to create them in the first
place.
This commit changes the privilege checks in CREATE/ALTER OPERATOR
to enforce the rule about superuser privilege, and fixes a couple
of built-in estimators that were making datatype assumptions without
sufficiently checking that they're valid.
Reported-by: Daniel Firer as part of zeroday.cloud
Author: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Noah Misch <noah@leadboat.com>
Security: CVE-2026-2004
Backpatch-through: 14 M src/backend/commands/operatorcmds.c
M src/backend/tsearch/ts_selfuncs.c
M src/backend/utils/adt/network_selfuncs.c
Guard against unexpected dimensions of oidvector/int2vector.
commit : 60e7ae41a6987ed05dcfe87bddaccac8e1e93126
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Mon, 9 Feb 2026 09:57:43 -0500
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Mon, 9 Feb 2026 09:57:43 -0500 These data types are represented like full-fledged arrays, but
functions that deal specifically with these types assume that the
array is 1-dimensional and contains no nulls. However, there are
cast pathways that allow general oid[] or int2[] arrays to be cast
to these types, allowing these expectations to be violated. This
can be exploited to cause server memory disclosure or SIGSEGV.
Fix by installing explicit checks in functions that accept these
types.
Reported-by: Altan Birler <altan.birler@tum.de>
Author: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Noah Misch <noah@leadboat.com>
Security: CVE-2026-2003
Backpatch-through: 14 M src/backend/access/hash/hashfunc.c
M src/backend/access/nbtree/nbtcompare.c
M src/backend/utils/adt/format_type.c
M src/backend/utils/adt/int.c
M src/backend/utils/adt/oid.c
M src/include/utils/builtins.h
M src/test/regress/expected/arrays.out
M src/test/regress/sql/arrays.sql
Require PGP-decrypted text to pass encoding validation.
commit : d536aee5566354e42a1012da9dd3960e45402af5
author : Noah Misch <noah@leadboat.com>
date : Mon, 9 Feb 2026 06:14:47 -0800
committer: Noah Misch <noah@leadboat.com>
date : Mon, 9 Feb 2026 06:14:47 -0800 pgp_sym_decrypt() and pgp_pub_decrypt() will raise such errors, while
bytea variants will not. The existing "dat3" test decrypted to non-UTF8
text, so switch that query to bytea.
The long-term intent is for type "text" to always be valid in the
database encoding. pgcrypto has long been known as a source of
exceptions to that intent, but a report about exploiting invalid values
of type "text" brought this module to the forefront. This particular
exception is straightforward to fix, with reasonable effect on user
queries. Back-patch to v14 (all supported versions).
Reported-by: Paul Gerste (as part of zeroday.cloud)
Reported-by: Moritz Sanft (as part of zeroday.cloud)
Author: shihao zhong <zhong950419@gmail.com>
Reviewed-by: cary huang <hcary328@gmail.com>
Discussion: https://postgr.es/m/CAGRkXqRZyo0gLxPJqUsDqtWYBbgM14betsHiLRPj9mo2=z9VvA@mail.gmail.com
Backpatch-through: 14
Security: CVE-2026-2006 M contrib/pgcrypto/expected/pgp-decrypt.out
M contrib/pgcrypto/expected/pgp-decrypt_1.out
M contrib/pgcrypto/pgp-pgsql.c
M contrib/pgcrypto/sql/pgp-decrypt.sql
Allow log_min_messages to be set per process type
commit : 38e0190ced714b33c43c9676d768cc6814fc662a
author : Álvaro Herrera <alvherre@kurilemu.de>
date : Mon, 9 Feb 2026 13:23:10 +0100
committer: Álvaro Herrera <alvherre@kurilemu.de>
date : Mon, 9 Feb 2026 13:23:10 +0100 Change log_min_messages from being a single element to a comma-separated
list of type:level elements, with 'type' representing a process type,
and 'level' being a log level to use for that type of process. The list
must also have a freestanding level specification which is used for
process types not listed, which convenientely makes the whole thing
backwards-compatible.
Some choices made here could be contested; for instance, we use the
process type `backend` to affect regular backends as well as dead-end
backends and the standalone backend, and `autovacuum` means both the
launcher and the workers. I think it's largely sensible though, and it
can easily be tweaked if desired.
Author: Euler Taveira <euler@eulerto.com>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>
Reviewed-by: Tan Yang <332696245@qq.com>
Discussion: https://postgr.es/m/e85c6671-1600-4112-8887-f97a8a5d07b2@app.fastmail.com M doc/src/sgml/config.sgml
M src/backend/commands/extension.c
M src/backend/postmaster/launch_backend.c
M src/backend/utils/error/elog.c
M src/backend/utils/init/miscinit.c
M src/backend/utils/misc/guc_parameters.dat
M src/backend/utils/misc/guc_tables.c
M src/backend/utils/misc/postgresql.conf.sample
M src/include/postmaster/proctypelist.h
M src/include/utils/guc.h
M src/include/utils/guc_hooks.h
M src/test/regress/expected/guc.out
M src/test/regress/sql/guc.sql
Code coverage for most pg_mblen* calls.
commit : c67bef3f3252a3a38bf347f9f119944176a796ce
author : Thomas Munro <tmunro@postgresql.org>
date : Mon, 12 Jan 2026 10:20:06 +1300
committer: Thomas Munro <tmunro@postgresql.org>
date : Mon, 12 Jan 2026 10:20:06 +1300 A security patch changed them today, so close the coverage gap now.
Test that buffer overrun is avoided when pg_mblen*() requires more
than the number of bytes remaining.
This does not cover the calls in dict_thesaurus.c or in dict_synonym.c.
That code is straightforward. To change that code's input, one must
have access to modify installed OS files, so low-privilege users are not
a threat. Testing this would likewise require changing installed
share/postgresql/tsearch_data, which was enough of an obstacle to not
bother.
Security: CVE-2026-2006
Backpatch-through: 14
Co-authored-by: Thomas Munro <thomas.munro@gmail.com>
Co-authored-by: Noah Misch <noah@leadboat.com>
Reviewed-by: Heikki Linnakangas <hlinnaka@iki.fi> M contrib/pg_trgm/Makefile
A contrib/pg_trgm/data/trgm_utf8.data
A contrib/pg_trgm/expected/pg_utf8_trgm.out
A contrib/pg_trgm/expected/pg_utf8_trgm_1.out
M contrib/pg_trgm/meson.build
A contrib/pg_trgm/sql/pg_utf8_trgm.sql
M src/backend/utils/adt/arrayfuncs.c
M src/test/regress/expected/copyencoding.out
A src/test/regress/expected/encoding.out
A src/test/regress/expected/encoding_1.out
A src/test/regress/expected/euc_kr.out
A src/test/regress/expected/euc_kr_1.out
M src/test/regress/parallel_schedule
M src/test/regress/regress.c
M src/test/regress/sql/copyencoding.sql
A src/test/regress/sql/encoding.sql
A src/test/regress/sql/euc_kr.sql
Replace pg_mblen() with bounds-checked versions.
commit : 1e7fe06c10c0a8da9dd6261a6be8d405dc17c728
author : Thomas Munro <tmunro@postgresql.org>
date : Wed, 7 Jan 2026 22:14:31 +1300
committer: Thomas Munro <tmunro@postgresql.org>
date : Wed, 7 Jan 2026 22:14:31 +1300 A corrupted string could cause code that iterates with pg_mblen() to
overrun its buffer. Fix, by converting all callers to one of the
following:
1. Callers with a null-terminated string now use pg_mblen_cstr(), which
raises an "illegal byte sequence" error if it finds a terminator in the
middle of the sequence.
2. Callers with a length or end pointer now use either
pg_mblen_with_len() or pg_mblen_range(), for the same effect, depending
on which of the two seems more convenient at each site.
3. A small number of cases pre-validate a string, and can use
pg_mblen_unbounded().
The traditional pg_mblen() function and COPYCHAR macro still exist for
backward compatibility, but are no longer used by core code and are
hereby deprecated. The same applies to the t_isXXX() functions.
Security: CVE-2026-2006
Backpatch-through: 14
Co-authored-by: Thomas Munro <thomas.munro@gmail.com>
Co-authored-by: Noah Misch <noah@leadboat.com>
Reviewed-by: Heikki Linnakangas <hlinnaka@iki.fi>
Reported-by: Paul Gerste (as part of zeroday.cloud)
Reported-by: Moritz Sanft (as part of zeroday.cloud) M contrib/btree_gist/btree_utils_var.c
M contrib/dict_xsyn/dict_xsyn.c
M contrib/hstore/hstore_io.c
M contrib/ltree/crc32.c
M contrib/ltree/lquery_op.c
M contrib/ltree/ltree.h
M contrib/ltree/ltree_io.c
M contrib/ltree/ltxtquery_io.c
M contrib/pageinspect/heapfuncs.c
M contrib/pg_trgm/trgm.h
M contrib/pg_trgm/trgm_op.c
M contrib/pg_trgm/trgm_regexp.c
M contrib/pgcrypto/crypt-sha.c
M contrib/unaccent/unaccent.c
M src/backend/catalog/pg_proc.c
M src/backend/tsearch/dict_synonym.c
M src/backend/tsearch/dict_thesaurus.c
M src/backend/tsearch/regis.c
M src/backend/tsearch/spell.c
M src/backend/tsearch/ts_locale.c
M src/backend/tsearch/ts_utils.c
M src/backend/tsearch/wparser_def.c
M src/backend/utils/adt/encode.c
M src/backend/utils/adt/formatting.c
M src/backend/utils/adt/jsonfuncs.c
M src/backend/utils/adt/jsonpath_gram.y
M src/backend/utils/adt/levenshtein.c
M src/backend/utils/adt/like.c
M src/backend/utils/adt/like_match.c
M src/backend/utils/adt/oracle_compat.c
M src/backend/utils/adt/regexp.c
M src/backend/utils/adt/tsquery.c
M src/backend/utils/adt/tsvector.c
M src/backend/utils/adt/tsvector_op.c
M src/backend/utils/adt/tsvector_parser.c
M src/backend/utils/adt/varbit.c
M src/backend/utils/adt/varlena.c
M src/backend/utils/adt/xml.c
M src/backend/utils/mb/mbutils.c
M src/include/mb/pg_wchar.h
M src/include/tsearch/ts_locale.h
M src/include/tsearch/ts_utils.h
M src/test/modules/test_regex/test_regex.c
Fix mb2wchar functions on short input.
commit : 74ee636cc93d919c845e3e3ad3642e6366ce1802
author : Thomas Munro <tmunro@postgresql.org>
date : Mon, 26 Jan 2026 11:22:32 +1300
committer: Thomas Munro <tmunro@postgresql.org>
date : Mon, 26 Jan 2026 11:22:32 +1300 When converting multibyte to pg_wchar, the UTF-8 implementation would
silently ignore an incomplete final character, while the other
implementations would cast a single byte to pg_wchar, and then repeat
for the remaining byte sequence. While it didn't overrun the buffer, it
was surely garbage output.
Make all encodings behave like the UTF-8 implementation. A later change
for master only will convert this to an error, but we choose not to
back-patch that behavior change on the off-chance that someone is
relying on the existing UTF-8 behavior.
Security: CVE-2026-2006
Backpatch-through: 14
Author: Thomas Munro <thomas.munro@gmail.com>
Reported-by: Noah Misch <noah@leadboat.com>
Reviewed-by: Noah Misch <noah@leadboat.com>
Reviewed-by: Heikki Linnakangas <hlinnaka@iki.fi> M src/common/wchar.c
Fix encoding length for EUC_CN.
commit : af79c30dc3e5369cd6d2bfdccd2c2c0ffbd60ef3
author : Thomas Munro <tmunro@postgresql.org>
date : Thu, 5 Feb 2026 01:04:24 +1300
committer: Thomas Munro <tmunro@postgresql.org>
date : Thu, 5 Feb 2026 01:04:24 +1300 While EUC_CN supports only 1- and 2-byte sequences (CS0, CS1), the
mb<->wchar conversion functions allow 3-byte sequences beginning SS2,
SS3.
Change pg_encoding_max_length() to return 3, not 2, to close a
hypothesized buffer overrun if a corrupted string is converted to wchar
and back again in a newly allocated buffer. We might reconsider that in
master (ie harmonizing in a different direction), but this change seems
better for the back-branches.
Also change pg_euccn_mblen() to report SS2 and SS3 characters as having
length 3 (following the example of EUC_KR). Even though such characters
would not pass verification, it's remotely possible that invalid bytes
could be used to compute a buffer size for use in wchar conversion.
Security: CVE-2026-2006
Backpatch-through: 14
Author: Thomas Munro <thomas.munro@gmail.com>
Reviewed-by: Noah Misch <noah@leadboat.com>
Reviewed-by: Heikki Linnakangas <hlinnaka@iki.fi> M src/common/wchar.c
Fix buffer overflows in pg_trgm due to lower-casing
commit : 00896ddaf41fa7b725991120678d544c18c6af70
author : Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Tue, 20 Jan 2026 11:53:28 +0200
committer: Thomas Munro <tmunro@postgresql.org>
date : Tue, 20 Jan 2026 11:53:28 +0200 The code made a subtle assumption that the lower-cased version of a
string never has more characters than the original. That is not always
true. For example, in a database with the latin9 encoding:
latin9db=# select lower(U&'\00CC' COLLATE "lt-x-icu");
lower
-----------
i\x1A\x1A
(1 row)
In this example, lower-casing expands the single input character into
three characters.
The generate_trgm_only() function relied on that assumption in two
ways:
- It used "slen * pg_database_encoding_max_length() + 4" to allocate
the buffer to hold the lowercased and blank-padded string. That
formula accounts for expansion if the lower-case characters are
longer (in bytes) than the originals, but it's still not enough if
the lower-cased string contains more *characters* than the original.
- Its callers sized the output array to hold the trigrams extracted
from the input string with the formula "(slen / 2 + 1) * 3", where
'slen' is the input string length in bytes. (The formula was
generous to account for the possibility that RPADDING was set to 2.)
That's also not enough if one input byte can turn into multiple
characters.
To fix, introduce a growable trigram array and give up on trying to
choose the correct max buffer sizes ahead of time.
Backpatch to v18, but no further. In previous versions lower-casing was
done character by character, and thus the assumption that lower-casing
doesn't change the character length was valid. That was changed in v18,
commit fb1a18810f.
Security: CVE-2026-2007
Reviewed-by: Noah Misch <noah@leadboat.com>
Reviewed-by: Jeff Davis <pgsql@j-davis.com> M contrib/pg_trgm/trgm_op.c
M src/tools/pgindent/typedefs.list
Remove 'charlen' argument from make_trigrams()
commit : 54598670fe0a191f49848d1a1a8ab09d99616e71
author : Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Tue, 20 Jan 2026 14:34:32 +0200
committer: Thomas Munro <tmunro@postgresql.org>
date : Tue, 20 Jan 2026 14:34:32 +0200 The function assumed that if charlen == bytelen, there are no
multibyte characters in the string. That's sensible, but the callers
were a little careless in how they calculated the lengths. The callers
converted the string to lowercase before calling make_trigram(), and
the 'charlen' value was calculated *before* the conversion to
lowercase while 'bytelen' was calculated after the conversion. If the
lowercased string had a different number of characters than the
original, make_trigram() might incorrectly apply the fastpath and
treat all the bytes as single-byte characters, or fail to apply the
fastpath (which is harmless), or it might hit the "Assert(bytelen ==
charlen)" assertion. I'm not aware of any locale / character
combinations where you could hit that assertion in practice,
i.e. where a string converted to lowercase would have fewer characters
than the original, but it seems best to avoid making that assumption.
To fix, remove the 'charlen' argument. To keep the performance when
there are no multibyte characters, always try the fast path first, but
check the input for multibyte characters as we go. The check on each
byte adds some overhead, but it's close enough. And to compensate, the
find_word() function no longer needs to count the characters.
This fixes one small bug in make_trigrams(): in the multibyte
codepath, it peeked at the byte just after the end of the input
string. When compiled with IGNORECASE, that was harmless because there
is always a NUL byte or blank after the input string. But with
!IGNORECASE, the call from generate_wildcard_trgm() doesn't guarantee
that.
Backpatch to v18, but no further. In previous versions lower-casing was
done character by character, and thus the assumption that lower-casing
doesn't change the character length was valid. That was changed in v18,
commit fb1a18810f.
Security: CVE-2026-2007
Reviewed-by: Noah Misch <noah@leadboat.com> M contrib/pg_trgm/trgm_op.c
pgcrypto: Fix buffer overflow in pgp_pub_decrypt_bytea()
commit : 379695d3cc70d040b547d912ce4842090d917ece
author : Michael Paquier <michael@paquier.xyz>
date : Mon, 9 Feb 2026 08:00:59 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Mon, 9 Feb 2026 08:00:59 +0900 pgp_pub_decrypt_bytea() was missing a safeguard for the session key
length read from the message data, that can be given in input of
pgp_pub_decrypt_bytea(). This can result in the possibility of a buffer
overflow for the session key data, when the length specified is longer
than PGP_MAX_KEY, which is the maximum size of the buffer where the
session data is copied to.
A script able to rebuild the message and key data that can trigger the
overflow is included in this commit, based on some contents provided by
the reporter, heavily editted by me. A SQL test is added, based on the
data generated by the script.
Reported-by: Team Xint Code as part of zeroday.cloud
Author: Michael Paquier <michael@paquier.xyz>
Reviewed-by: Noah Misch <noah@leadboat.com>
Security: CVE-2026-2005
Backpatch-through: 14 M contrib/pgcrypto/Makefile
A contrib/pgcrypto/expected/pgp-pubkey-session.out
M contrib/pgcrypto/meson.build
M contrib/pgcrypto/pgp-pubdec.c
M contrib/pgcrypto/px.c
M contrib/pgcrypto/px.h
A contrib/pgcrypto/scripts/pgp_session_data.py
A contrib/pgcrypto/sql/pgp-pubkey-session.sql
Replace some hard-wired OID constants with corresponding macros.
commit : 73dd7163c5d19f93b629d1ccd9d2a2de6e9667f6
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Sat, 7 Feb 2026 23:15:20 -0500
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Sat, 7 Feb 2026 23:15:20 -0500 Looking again at commit 7cdb633c8, I wondered why we have hard-wired
"1034" for the OID of type aclitem[]. Some other entries in the same
array have numeric type OIDs as well. This seems to be a hangover
from years ago when not every built-in pg_type entry had an OID macro.
But since we made genbki.pl responsible for generating these macros,
there are macros available for all these array types, so there's no
reason not to follow the project policy of never writing numeric OID
constants in C code. M src/backend/bootstrap/bootstrap.c
meson: host_system value for Solaris is 'sunos' not 'solaris'.
commit : c0bf15729f461308f54b7d4d46472c1ad43941a3
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Sat, 7 Feb 2026 20:05:52 -0500
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Sat, 7 Feb 2026 20:05:52 -0500 This thinko caused us to not substitute our own getopt() code,
which results in failing to parse long options for the postmaster
since Solaris' getopt() doesn't do what we expect. This can be seen
in the results of buildfarm member icarus, which is the only one
trying to build via meson on Solaris.
Per consultation with pgsql-release, it seems okay to fix this
now even though we're in release freeze. The fix visibly won't
affect any other platforms, and it can't break Solaris/meson
builds any worse than they're already broken.
Discussion: https://postgr.es/m/2471229.1770499291@sss.pgh.pa.us
Backpatch-through: 16 M meson.build
Further error message fix
commit : 1653ce5236c4948550e52d15d54e4b6bb66a23b1
author : Peter Eisentraut <peter@eisentraut.org>
date : Sat, 7 Feb 2026 22:37:02 +0100
committer: Peter Eisentraut <peter@eisentraut.org>
date : Sat, 7 Feb 2026 22:37:02 +0100 Further fix of error message changed in commit 74a116a79b4. The
initial fix was not quite correct.
Discussion: https://www.postgresql.org/message-id/flat/tencent_1EE1430B1E6C18A663B8990F%40qq.com M src/bin/pg_rewind/file_ops.c
Future-proof sort template against undefined behavior
commit : 7467041cde9ed1966cb3ea18da8ac119b462c2e4
author : John Naylor <john.naylor@postgresql.org>
date : Sat, 7 Feb 2026 17:02:35 +0700
committer: John Naylor <john.naylor@postgresql.org>
date : Sat, 7 Feb 2026 17:02:35 +0700 Commit 176dffdf7 added a NULL array pointer check before performing
a qsort in order to prevent undefined behavior when passing NULL
pointer and zero length. To head off future degenerate cases, check
that there are at least two elements to sort before proceeding with
insertion sort. This has the added advantage of allowing us to remove
four equivalent checks that guarded against recursion/iteration.
There might be a tiny performance penalty from unproductive
recursions, but we can buy that back by increasing the insertion sort
threshold. That is left for future work.
Discussion: https://postgr.es/m/CANWCAZZWvds_35nXc4vXD-eBQa_=mxVtqZf-PM_ps=SD7ghhJg@mail.gmail.com M src/include/lib/sort_template.h
Revert "Change copyObject() to use typeof_unqual"
commit : 0af05b5dbb42387957582e76232dc27138382e5a
author : Peter Eisentraut <peter@eisentraut.org>
date : Sat, 7 Feb 2026 10:08:38 +0100
committer: Peter Eisentraut <peter@eisentraut.org>
date : Sat, 7 Feb 2026 10:08:38 +0100 This reverts commit 4cfce4e62c8f09f5b1f6a7f69760ca46a74406e2.
This implementation fails to compile on newer MSVC that support
__typeof_unqual__. (Older versions did not support it and compiled
fine.) Revert for now and research further.
Reported-by: Bryan Green <dbryan.green@gmail.com>
Discussion: https://www.postgresql.org/message-id/b03ddcd4-2a16-49ee-b105-e7f609f3c514%40gmail.com M config/c-compiler.m4
M configure
M configure.ac
M meson.build
M src/include/nodes/nodes.h
M src/include/pg_config.h.in
Make some minor cleanups in typalign-related code.
commit : 7cdb633c89da82d4c6fdfba007a9ff05a9dff29e
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Fri, 6 Feb 2026 20:46:03 -0500
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Fri, 6 Feb 2026 20:46:03 -0500 Commit 7b378237a widened AclMode to 64 bits, which implies that
the alignment of AclItem is now determined by an int64 field.
That commit correctly set the typalign for SQL type aclitem to
'd', but it missed the hard-wired knowledge about _aclitem in
bootstrap.c. This doesn't seem to have caused any ill effects,
probably because we never try to fill a non-null value into
an aclitem[] column during bootstrap. Nonetheless, it's clearly
a gotcha waiting to happen, so fix it up.
In passing, also fix a couple of typanalyze functions that were
using hard-coded typalign constants when they could just as
easily use greppable TYPALIGN_xxx macros.
Noticed these while working on a patch to expand the set of
typalign values. I doubt we are going to pursue that path,
but these fixes still seem worth a quick commit.
Discussion: https://postgr.es/m/1127261.1769649624@sss.pgh.pa.us M src/backend/bootstrap/bootstrap.c
M src/backend/tsearch/ts_typanalyze.c
M src/backend/utils/adt/rangetypes_typanalyze.c
Adjust style of some debugging macros.
commit : ba1e14134a775e56a76c1537936c61102827507f
author : Nathan Bossart <nathan@postgresql.org>
date : Fri, 6 Feb 2026 16:24:21 -0600
committer: Nathan Bossart <nathan@postgresql.org>
date : Fri, 6 Feb 2026 16:24:21 -0600 This commit adjusts a few debugging macros to match the style of
those in pg_config_manual.h. Like commits 123661427b and
b4cbc106a6, these were discovered while reviewing Aleksander
Alekseev's proposed changes to pgindent.
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://postgr.es/m/aP-H6kSsGOxaB21k%40nathan M src/backend/access/nbtree/nbtsort.c
M src/backend/utils/adt/numeric.c
M src/include/executor/execdebug.h
libpq: Prepare for protocol grease during 19beta
commit : d8d7c5dc8f74506d35c7e8242be997fd5cf388eb
author : Jacob Champion <jchampion@postgresql.org>
date : Fri, 6 Feb 2026 10:31:45 -0800
committer: Jacob Champion <jchampion@postgresql.org>
date : Fri, 6 Feb 2026 10:31:45 -0800 The main reason that libpq doesn't request protocol version 3.2 by
default is because other proxy/server implementations don't implement
the negotiation. This is a bit of a chicken-and-egg problem: We don't
bump the default version that libpq requests, but other implementations
may not be incentivized to implement version negotiation if their users
never run into issues.
One established practice to combat this is to flip Postel's Law on its
head, by sending parameters that the server cannot possibly support. If
the server fails the handshake instead of correctly negotiating, then
the problem is surfaced naturally. If the server instead claims to
support the bogus parameters, then we fail the connection to make the
lie obvious. This is called "grease" (or "greasing"), after the GREASE
mechanism in TLS that popularized the concept:
https://www.rfc-editor.org/rfc/rfc8701.html
This patch reserves 3.9999 as an explicitly unsupported protocol version
number and `_pq_.test_protocol_negotiation` as an explicitly unsupported
protocol extension. A later commit will send these by default in order
to stress-test the ecosystem during the beta period; that commit will
then be reverted before 19 RC1, so that we can decide what to do with
whatever data has been gathered.
The _pq_.test_protocol_negotiation change here is intentionally docs-
only: after its implementation is reverted, the parameter should remain
reserved.
Extracted/adapted from a patch by Jelte Fennema-Nio.
Author: Jelte Fennema-Nio <postgres@jeltef.nl>
Co-authored-by: Jacob Champion <jacob.champion@enterprisedb.com>
Discussion: https://postgr.es/m/DDPR5BPWH1RJ.1LWAK6QAURVAY%40jeltef.nl M doc/src/sgml/protocol.sgml
M src/include/libpq/pqcomm.h
M src/interfaces/libpq/fe-protocol3.c
doc: Expand upon protocol versions and extensions
commit : e3d37853ecd51c87976df7ea5c5d641f45668370
author : Jacob Champion <jchampion@postgresql.org>
date : Fri, 6 Feb 2026 10:25:12 -0800
committer: Jacob Champion <jchampion@postgresql.org>
date : Fri, 6 Feb 2026 10:25:12 -0800 First, split the Protocol Versions table in two, and lead with the list
of versions that are supported today. Reserved and unsupported version
numbers go into the second table.
Second, in anticipation of a new (reserved) protocol extension, document
the extension negotiation process alongside version negotiation, and add
the corresponding tables for future extension parameter registrations.
Reviewed-by: Jelte Fennema-Nio <postgres@jeltef.nl>
Reviewed-by: David G. Johnston <david.g.johnston@gmail.com>
Discussion: https://postgr.es/m/DDPR5BPWH1RJ.1LWAK6QAURVAY%40jeltef.nl M doc/src/sgml/protocol.sgml
Fix use of proc number in pgstat_create_backend()
commit : 072c8421359730149f4eaf861ce55aa78968ba9d
author : Michael Paquier <michael@paquier.xyz>
date : Fri, 6 Feb 2026 19:57:22 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Fri, 6 Feb 2026 19:57:22 +0900 This routine's internals directly used MyProcNumber to choose which
object ID to assign for the hash key of a backend's stats entry, while
the value to use is given as input argument of the function.
The original intention was to pass MyProcNumber as an argument of
pgstat_create_backend() when called in pgstat_bestart_final(),
pgstat_beinit() ensuring that MyProcNumber has been set, not use it
directly in the function. This commit addresses this inconsistency by
using the procnum given by the caller of pgstat_create_backend(), not
MyProcNumber.
This issue is not a cause of bugs currently. However, let's keep the
code in sync across all the branches where this code exists, as it could
matter in a future backpatch.
Oversight in 4feba03d8b92.
Reported-by: Ryo Matsumura <matsumura.ryo@fujitsu.com>
Discussion: https://postgr.es/m/TYCPR01MB11316AD8150C8F470319ACCAEE866A@TYCPR01MB11316.jpnprd01.prod.outlook.com
Backpatch-through: 18 M src/backend/utils/activity/pgstat_backend.c
Fix some error message inconsistencies
commit : 74a116a79b47631e163c9814f39f5d218834e94c
author : Michael Paquier <michael@paquier.xyz>
date : Fri, 6 Feb 2026 15:38:16 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Fri, 6 Feb 2026 15:38:16 +0900 These errors are very unlikely going to show up, but in the event that
they happen, some incorrect information would have been provided:
- In pg_rewind, a stat() failure was reported as an open() failure.
- In pg_combinebackup, a check for the new directory of a tablespace
mapping was referred as the old directory.
- In pg_combinebackup, a failure in reading a source file when copying
blocks referred to the destination file.
The changes for pg_combinebackup affect v17 and newer versions. For
pg_rewind, all the stable branches are affected.
Author: Man Zeng <zengman@halodbtech.com>
Discussion: https://postgr.es/m/tencent_1EE1430B1E6C18A663B8990F@qq.com
Backpatch-through: 14 M src/bin/pg_combinebackup/copy_file.c
M src/bin/pg_combinebackup/pg_combinebackup.c
M src/bin/pg_rewind/file_ops.c
Add file_extend_method=posix_fallocate,write_zeros.
commit : f94e9141a0bbb365f8194517e142746466ee7014
author : Thomas Munro <tmunro@postgresql.org>
date : Sat, 31 May 2025 22:50:22 +1200
committer: Thomas Munro <tmunro@postgresql.org>
date : Sat, 31 May 2025 22:50:22 +1200 Provide a way to disable the use of posix_fallocate() for relation
files. It was introduced by commit 4d330a61bb1. The new setting
file_extend_method=write_zeros can be used as a workaround for problems
reported from the field:
* BTRFS compression is disabled by the use of posix_fallocate()
* XFS could produce spurious ENOSPC errors in some Linux kernel
versions, though that problem is reported to have been fixed
The default is file_extend_method=posix_fallocate if available, as
before. The write_zeros option is similar to PostgreSQL < 16, except
that now it's multi-block.
Backpatch-through: 16
Reviewed-by: Jakub Wartak <jakub.wartak@enterprisedb.com>
Reported-by: Dimitrios Apostolou <jimis@gmx.net>
Discussion: https://postgr.es/m/b1843124-fd22-e279-a31f-252dffb6fbf2%40gmx.net M doc/src/sgml/config.sgml
M src/backend/storage/file/fd.c
M src/backend/storage/smgr/md.c
M src/backend/utils/misc/guc_parameters.dat
M src/backend/utils/misc/guc_tables.c
M src/backend/utils/misc/postgresql.conf.sample
M src/include/storage/fd.h
doc: Move synchronized_standby_slots to "Primary Server" section.
commit : e35add48ccc2e5aa94de360f1a43c6c150bda54a
author : Fujii Masao <fujii@postgresql.org>
date : Fri, 6 Feb 2026 09:40:05 +0900
committer: Fujii Masao <fujii@postgresql.org>
date : Fri, 6 Feb 2026 09:40:05 +0900 synchronized_standby_slots is defined in guc_parameter.dat as part of
the REPLICATION_PRIMARY group and is listed under the "Primary Server"
section in postgresql.conf.sample. However, in the documentation
its description was previously placed under the "Sending Servers" section.
Since synchronized_standby_slots only takes effect on the primary server,
this commit moves its documentation to the "Primary Server" section to
match its behavior and other references.
Backpatch to v17 where synchronized_standby_slots was added.
Author: Fujii Masao <masao.fujii@gmail.com>
Reviewed-by: Shinya Kato <shinya11.kato@gmail.com>
Discussion: https://postgr.es/m/CAHGQGwE_LwgXgCrqd08OFteJqdERiF3noqOKu2vt7Kjk4vMiGg@mail.gmail.com
Backpatch-through: 17 M doc/src/sgml/config.sgml
Fix comment in extended_stats_funcs.c
commit : 9476ef206c64207a4fd2ddcb373759c7ede13a3c
author : Michael Paquier <michael@paquier.xyz>
date : Thu, 5 Feb 2026 15:14:53 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Thu, 5 Feb 2026 15:14:53 +0900 The attribute storing the statistics data for a set of expressions in
pg_statistic_ext_data is stxdexpr. stxdexprs does not exist.
Extracted from a larger patch by the same author. Incorrect as of
efbebb4e8587.
Author: Corey Huinker <corey.huinker@gmail.com>
Discussion: https://postgr.es/m/CADkLM=fPcci6oPyuyEZ0F4bWqAA7HzaWO+ZPptufuX5_uWt6kw@mail.gmail.com M src/backend/statistics/extended_stats_funcs.c
pg_upgrade: Optimize logical replication slot caught-up check.
commit : 7a1f0f8747a7f7491702be88570a8e4d33686d76
author : Masahiko Sawada <msawada@postgresql.org>
date : Wed, 4 Feb 2026 17:11:27 -0800
committer: Masahiko Sawada <msawada@postgresql.org>
date : Wed, 4 Feb 2026 17:11:27 -0800 Commit 29d0a77fa6 improved pg_upgrade to allow migrating logical slots
provided that all logical slots have caught up (i.e., they have no
pending decodable WAL records). Previously, this verification was done
by checking each slot individually, which could be time-consuming if
there were many logical slots to migrate.
This commit optimizes the check to avoid reading the same WAL stream
multiple times. It performs the check only for the slot with the
minimum confirmed_flush_lsn and applies the result to all other slots
in the same database. This limits the check to at most one logical
slot per database.
During the check, we identify the last decodable WAL record's LSN to
report any slots with unconsumed records, consistent with the existing
error reporting behavior. Additionally, the maximum
confirmed_flush_lsn among all logical slots on the database is used as
an early scan cutoff; finding a decodable WAL record beyond this point
implies that no slot has caught up.
Performance testing demonstrated that the execution time remains
stable regardless of the number of slots in the database.
Note that we do not distinguish slots based on their output plugins. A
hypothetical plugin might use a replication origin filter that filters
out changes from a specific origin. In such cases, we might get a
false positive (erroneously considering a slot caught up). However,
this is safe from a data integrity standpoint, such scenarios are
rare, and the impact of a false positive is minimal.
This optimization is applied only when the old cluster is version 19
or later.
Bump catalog version.
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: shveta malik <shveta.malik@gmail.com>
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>
Discussion: https://postgr.es/m/CAD21AoBZ0LAcw1OHGEKdW7S5TRJaURdhEk3CLAW69_siqfqyAg@mail.gmail.com M src/backend/replication/logical/logical.c
M src/backend/utils/adt/pg_upgrade_support.c
M src/bin/pg_upgrade/check.c
M src/bin/pg_upgrade/info.c
M src/bin/pg_upgrade/t/003_logical_slots.pl
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/include/replication/logical.h
oid2name: Add relation path to the information provided by -x/--extended
commit : 3c5ec35dea254892d75d829b5642fc3732c8fcf9
author : Michael Paquier <michael@paquier.xyz>
date : Thu, 5 Feb 2026 09:02:12 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Thu, 5 Feb 2026 09:02:12 +0900 This affects two command patterns, showing information about relations:
* oid2name -x -d DBNAME, applying to all relations on a database.
* oid2name -x -d DBNAME -t TABNAME [-t ..], applying to a subset of
defined relations on a database.
The relative path of a relation is added to the information provided,
using pg_relation_filepath().
Author: David Bidoc <dcbidoc@gmail.com>
Reviewed-by: Laurenz Albe <laurenz.albe@cybertec.at>
Reviewed-by: Guillaume Lelarge <guillaume.lelarge@dalibo.com>
Reviewed-by: Euler Taveira <euler@eulerto.com>
Reviewed-by: Mark Wong <markwkm@gmail.com>
Discussion: https://postgr.es/m/CABour1v2CU1wjjoM86wAFyezJQ3-+ncH43zY1f1uXeVojVN8Ow@mail.gmail.com M contrib/oid2name/oid2name.c
M doc/src/sgml/oid2name.sgml
Assign "backend" type earlier during process start-up
commit : 0c8e082fba8d36434552d3d7800abda54acafd57
author : Álvaro Herrera <alvherre@kurilemu.de>
date : Wed, 4 Feb 2026 16:56:57 +0100
committer: Álvaro Herrera <alvherre@kurilemu.de>
date : Wed, 4 Feb 2026 16:56:57 +0100 Instead of assigning the backend type in the Main function of each
postmaster child, do it right after fork(), by which time it is already
known by postmaster_child_launch(). This reduces the time frame during
which MyBackendType is incorrect.
Before this commit, ProcessStartupPacket would overwrite MyBackendType
to B_BACKEND for dead-end backends, which is quite dubious. Stop that.
We may now see MyBackendType == B_BG_WORKER before setting up
MyBgworkerEntry. As far as I can see this is only a problem if we try
to log a message and %b is in log_line_prefix, so we now have a constant
string to cover that case. Previously, it would print "unrecognized",
which seems strictly worse.
Author: Euler Taveira <euler@eulerto.com>
Discussion: https://postgr.es/m/e85c6671-1600-4112-8887-f97a8a5d07b2@app.fastmail.com M src/backend/postmaster/autovacuum.c
M src/backend/postmaster/bgworker.c
M src/backend/postmaster/bgwriter.c
M src/backend/postmaster/checkpointer.c
M src/backend/postmaster/launch_backend.c
M src/backend/postmaster/pgarch.c
M src/backend/postmaster/startup.c
M src/backend/postmaster/syslogger.c
M src/backend/postmaster/walsummarizer.c
M src/backend/postmaster/walwriter.c
M src/backend/replication/logical/slotsync.c
M src/backend/replication/walreceiver.c
M src/backend/storage/aio/method_worker.c
M src/backend/tcop/backend_startup.c
M src/backend/utils/error/elog.c
Fix logical replication TAP test to read publisher log correctly.
commit : 36ead7123292c2849be9950f3e552325fad7e6b7
author : Fujii Masao <fujii@postgresql.org>
date : Thu, 5 Feb 2026 00:43:06 +0900
committer: Fujii Masao <fujii@postgresql.org>
date : Thu, 5 Feb 2026 00:43:06 +0900 Commit 5f13999aa11 added a TAP test for GUC settings passed via the
CONNECTION string in logical replication, but the buildfarm member
sungazer reported test failures.
The test incorrectly used the subscriber's log file position as the
starting offset when reading the publisher's log. As a result, the test
failed to find the expected log message in the publisher's log and
erroneously reported a failure.
This commit fixes the test to use the publisher's own log file position
when reading the publisher's log.
Also, to avoid similar confusion in the future, this commit splits the single
$log_location variable into $log_location_pub and $log_location_sub,
clearly distinguishing publisher and subscriber log positions.
Backpatched to v15, where commit 5f13999aa11 introduced the test.
Per buildfarm member sungazer.
This issue was reported and diagnosed by Alexander Lakhin.
Reported-by: Alexander Lakhin <exclusion@gmail.com>
Discussion: https://postgr.es/m/966ec3d8-1b6f-4f57-ae59-fc7d55bc9a5a@gmail.com
Backpatch-through: 15 M src/test/subscription/t/001_rep_changes.pl
Fix various instances of undefined behavior
commit : 176dffdf7d2a0ea2615c4e390a2ab7e69d14f90f
author : John Naylor <john.naylor@postgresql.org>
date : Wed, 4 Feb 2026 17:55:49 +0700
committer: John Naylor <john.naylor@postgresql.org>
date : Wed, 4 Feb 2026 17:55:49 +0700 Mostly this involves checking for NULL pointer before doing operations
that add a non-zero offset.
The exception is an overflow warning in heap_fetch_toast_slice(). This
was caused by unneeded parentheses forcing an expression to be
evaluated to a negative integer, which then got cast to size_t.
Per clang 21 undefined behavior sanitizer.
Backpatch to all supported versions.
Co-authored-by: Alexander Lakhin <exclusion@gmail.com>
Reported-by: Alexander Lakhin <exclusion@gmail.com>
Discussion: https://postgr.es/m/777bd201-6e3a-4da0-a922-4ea9de46a3ee@gmail.com
Backpatch-through: 14 M contrib/pg_trgm/trgm_gist.c
M src/backend/access/heap/heaptoast.c
M src/backend/utils/adt/multirangetypes.c
M src/backend/utils/sort/sharedtuplestore.c
Add backendType to PGPROC, replacing isRegularBackend
commit : 084e42bc7109673e46527b0a0f284edf539c3285
author : Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Wed, 4 Feb 2026 13:06:04 +0200
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Wed, 4 Feb 2026 13:06:04 +0200 We can immediately make use of it in pg_signal_backend(), which
previously fetched the process type from the backend status array with
pgstat_get_backend_type_by_proc_number(). That was correct but felt a
little questionable to me: backend status should be for observability
purposes only, not for permission checks.
Reviewed-by: Nathan Bossart <nathandbossart@gmail.com>
Reviewed-by: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://www.postgresql.org/message-id/b77e4962-a64a-43db-81a1-580444b3e8f5@iki.fi M src/backend/access/transam/twophase.c
M src/backend/storage/ipc/procarray.c
M src/backend/storage/ipc/signalfuncs.c
M src/backend/storage/lmgr/proc.c
M src/backend/utils/activity/backend_status.c
M src/include/storage/proc.h
M src/include/utils/backend_status.h
Change copyObject() to use typeof_unqual
commit : 4cfce4e62c8f09f5b1f6a7f69760ca46a74406e2
author : Peter Eisentraut <peter@eisentraut.org>
date : Wed, 4 Feb 2026 08:39:55 +0100
committer: Peter Eisentraut <peter@eisentraut.org>
date : Wed, 4 Feb 2026 08:39:55 +0100 Currently, when the argument of copyObject() is const-qualified, the
return type is also, because the use of typeof carries over all the
qualifiers. This is incorrect, since the point of copyObject() is to
make a copy to mutate. But apparently no code ran into it.
The new implementation uses typeof_unqual, which drops the qualifiers,
making this work correctly.
typeof_unqual is standardized in C23, but all recent versions of all
the usual compilers support it even in non-C23 mode, at least as
__typeof_unqual__. We add a configure/meson test for typeof_unqual
and __typeof_unqual__ and use it if it's available, else we use the
existing fallback of just returning void *.
Reviewed-by: David Geier <geidav.pg@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/92f9750f-c7f6-42d8-9a4a-85a3cbe808f3%40eisentraut.org M config/c-compiler.m4
M configure
M configure.ac
M meson.build
M src/include/nodes/nodes.h
M src/include/pg_config.h.in
pg_resetwal: Fix incorrect error message related to pg_wal/summaries/
commit : c8ec74713bf2c703c19f231ea4d1e6479630c72d
author : Michael Paquier <michael@paquier.xyz>
date : Wed, 4 Feb 2026 16:38:06 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Wed, 4 Feb 2026 16:38:06 +0900 A failure while closing pg_wal/summaries/ incorrectly generated a report
about pg_wal/archive_status/.
While at it, this commit adds #undefs for the macros used in
KillExistingWALSummaries() and KillExistingArchiveStatus() to prevent
those values from being misused in an incorrect function context.
Oversight in dc212340058b.
Author: Tianchen Zhang <zhang_tian_chen@163.com>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Discussion: https://postgr.es/m/SE2P216MB2390C84C23F428A7864EE07FA19BA@SE2P216MB2390.KORP216.PROD.OUTLOOK.COM
Backpatch-through: 17 M src/bin/pg_resetwal/pg_resetwal.c
Docs: consolidate dependency notes in pg_dump and pg_restore
commit : 78bf28e3bf504db0eea5e3bcb3c43e9908108480
author : Álvaro Herrera <alvherre@kurilemu.de>
date : Tue, 3 Feb 2026 19:29:15 +0100
committer: Álvaro Herrera <alvherre@kurilemu.de>
date : Tue, 3 Feb 2026 19:29:15 +0100 The pg_dump documentation had repetitive notes for the --schema,
--table, and --extension switches, noting that dependent database
objects are not automatically included in the dump. This commit removes
these notes and replaces them with a consolidated paragraph in the
"Notes" section.
pg_restore had a similar note for -t but lacked one for -n; do likewise.
Also, add a note to --extension in pg_dump to note that ancillary files
(such as shared libraries and control files) are not included in the
dump and must be present on the destination system.
Author: Florents Tselai <florents.tselai@gmail.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/284C4D55-4F90-4AA0-84C8-1E6A28DDF271@gmail.com M doc/src/sgml/ref/pg_dump.sgml
M doc/src/sgml/ref/pg_restore.sgml
Don't hint that you can reconnect when the database is dropped
commit : 57bff90160fdee56a0d55d7eaa7ec5ad709fda08
author : Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Tue, 3 Feb 2026 15:08:16 +0200
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Tue, 3 Feb 2026 15:08:16 +0200 Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://www.postgresql.org/message-id/4cc13ba1-4248-4884-b6ba-4805349e7f39@iki.fi M src/backend/tcop/postgres.c
Remove useless errdetail_abort()
commit : cd375d5b6d5f7d89375541af444e16dd93d27a03
author : Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Tue, 3 Feb 2026 15:08:13 +0200
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Tue, 3 Feb 2026 15:08:13 +0200 I don't understand how to reach errdetail_abort() with
MyProc->recoveryConflictPending set. If a recovery conflict signal is
received, ProcessRecoveryConflictInterrupt() raises an ERROR or FATAL
error to cancel the query or connection, and abort processing clears
the flag. The error message from ProcessRecoveryConflictInterrupt() is
very clear that the query or connection was terminated because of
recovery conflict.
The only way to reach it AFAICS is with a race condition, if the
startup process sends a recovery conflict signal when the transaction
has just entered aborted state for some other reason. And in that case
the detail would be misleading, as the transaction was already aborted
for some other reason, not because of the recovery conflict.
errdetail_abort() was the only user of the recoveryConflictPending
flag in PGPROC, so we can remove that and all the related code too.
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://www.postgresql.org/message-id/4cc13ba1-4248-4884-b6ba-4805349e7f39@iki.fi M src/backend/storage/ipc/procarray.c
M src/backend/storage/ipc/standby.c
M src/backend/storage/lmgr/proc.c
M src/backend/tcop/postgres.c
M src/include/storage/proc.h
M src/include/storage/procarray.h
Reject ADD CONSTRAINT NOT NULL if name mismatches existing constraint
commit : 96e2af605043974137d84edf5c0a24561956919e
author : Álvaro Herrera <alvherre@kurilemu.de>
date : Tue, 3 Feb 2026 12:33:29 +0100
committer: Álvaro Herrera <alvherre@kurilemu.de>
date : Tue, 3 Feb 2026 12:33:29 +0100 When using ALTER TABLE ... ADD CONSTRAINT to add a not-null constraint
with an explicit name, we have to ensure that if the column is already
marked NOT NULL, the provided name matches the existing constraint name.
Failing to do so could lead to confusion regarding which constraint
object actually enforces the rule.
This patch adds a check to throw an error if the user tries to add a
named not-null constraint to a column that already has one with a
different name.
Reported-by: yanliang lei <msdnchina@163.com>
Co-authored-by: Álvaro Herrera <alvherre@kurilemu.de>
Co-authored-bu: Srinath Reddy Sadipiralla <srinath2133@gmail.com>
Backpatch-through: 18
Discussion: https://postgr.es/m/19351-8f1c523ead498545%40postgresql.org M src/backend/catalog/heap.c
M src/backend/catalog/pg_constraint.c
M src/include/catalog/pg_constraint.h
M src/test/regress/expected/constraints.out
M src/test/regress/sql/constraints.sql
Change StaticAssertVariableIsOfType to be a declaration
commit : 955e50766869a5ccf862d7f8439f5d35b723c0f9
author : Peter Eisentraut <peter@eisentraut.org>
date : Tue, 3 Feb 2026 08:36:47 +0100
committer: Peter Eisentraut <peter@eisentraut.org>
date : Tue, 3 Feb 2026 08:36:47 +0100 This allows moving the uses to more natural and useful positions.
Also, a declaration is the more native use of static assertions in C.
Reviewed-by: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/2273bc2a-045d-4a75-8584-7cd9396e5534%40eisentraut.org M contrib/hstore_plperl/hstore_plperl.c
M contrib/hstore_plpython/hstore_plpython.c
M contrib/jsonb_plpython/jsonb_plpython.c
M contrib/ltree_plpython/ltree_plpython.c
M src/include/c.h
Rename AssertVariableIsOfType to StaticAssertVariableIsOfType
commit : 137d05df2f2014c584b229310b8635fa6a8572ba
author : Peter Eisentraut <peter@eisentraut.org>
date : Tue, 3 Feb 2026 08:36:47 +0100
committer: Peter Eisentraut <peter@eisentraut.org>
date : Tue, 3 Feb 2026 08:36:47 +0100 This keeps run-time assertions and static assertions clearly separate.
Reviewed-by: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/2273bc2a-045d-4a75-8584-7cd9396e5534%40eisentraut.org M contrib/hstore_plperl/hstore_plperl.c
M contrib/hstore_plpython/hstore_plpython.c
M contrib/jsonb_plpython/jsonb_plpython.c
M contrib/ltree_plpython/ltree_plpython.c
M src/backend/executor/execParallel.c
M src/backend/jit/llvm/llvmjit_types.c
M src/include/access/xlogdefs.h
M src/include/c.h
M src/include/lib/ilist.h
M src/include/lib/pairingheap.h
M src/include/postgres.h
M src/include/storage/proclist.h
M src/include/utils/freepage.h
M src/include/utils/relptr.h
Add two IO wait events for COPY FROM/TO on a pipe/file/program
commit : e05a24c2d4eab3dd76741dc6e6c18bb0584771c5
author : Michael Paquier <michael@paquier.xyz>
date : Tue, 3 Feb 2026 12:20:41 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Tue, 3 Feb 2026 12:20:41 +0900 Two wait events are added to the COPY FROM/TO code:
* COPY_FROM_READ: reading data from a copy_file.
* COPY_TO_WRITE: writing data to a copy_file.
In the COPY code, copy_file can be set when processing a command through
the pipe mode (for the non-DestRemote case), the program mode or the
file mode, when processing fread() or fwrite() on it.
Author: Nikolay Samokhvalov <nik@postgres.ai>
Reviewed-by: Dilip Kumar <dilipbalaut@gmail.com>
Reviewed-by: Sami Imseih <samimseih@gmail.com>
Discussion: https://postgr.es/m/CAM527d_iDzz0Kqyi7HOfqa-Xzuq29jkR6AGXqfXLqA5PR5qsng@mail.gmail.com M src/backend/commands/copyfromparse.c
M src/backend/commands/copyto.c
M src/backend/utils/activity/wait_event_names.txt
Fix incorrect errno in OpenWalSummaryFile()
commit : 213fec296f419af8f199a721a9986e879656555c
author : Michael Paquier <michael@paquier.xyz>
date : Tue, 3 Feb 2026 11:25:10 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Tue, 3 Feb 2026 11:25:10 +0900 This routine has an option to bypass an error if a WAL summary file is
opened for read but is missing (missing_ok=true). However, the code
incorrectly checked for EEXIST, that matters when using O_CREAT and
O_EXCL, rather than ENOENT, for this case.
There are currently only two callers of OpenWalSummaryFile() in the
tree, and both use missing_ok=false, meaning that the check based on the
errno is currently dead code. This issue could matter for out-of-core
code or future backpatches that would like to use missing_ok set to
true.
Issue spotted while monitoring this area of the code, after
a9afa021e95f.
Author: Michael Paquier <michael@paquier.xyz>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://postgr.es/m/aYAf8qDHbpBZ3Rml@paquier.xyz
Backpatch-through: 17 M src/backend/backup/walsummary.c
Release synchronous replication waiters immediately on configuration changes.
commit : 21c1125d660617f71b20304150e4a8583299cf86
author : Fujii Masao <fujii@postgresql.org>
date : Tue, 3 Feb 2026 11:14:00 +0900
committer: Fujii Masao <fujii@postgresql.org>
date : Tue, 3 Feb 2026 11:14:00 +0900 Previously, when synchronous_standby_names was changed (for example,
by reducing the number of required synchronous standbys or modifying
the standby list), backends waiting for synchronous replication were not
released immediately, even if the new configuration no longer required them
to wait. They could remain blocked until additional messages arrived from
standbys and triggered their release.
This commit improves walsender so that backends waiting for synchronous
replication are released as soon as the updated configuration takes effect and
the new settings no longer require them to wait, by calling
SyncRepReleaseWaiters() when configuration changes are processed.
As part of this change, the duplicated code that handles configuration changes
in walsender has been refactored into a new helper function, which is now used
at the three existing call places.
Since this is an improvement rather than a bug fix, it is applied only to
the master branch.
Author: Shinya Kato <shinya11.kato@gmail.com>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>
Reviewed-by: Xuneng Zhou <xunengzhou@gmail.com>
Discussion: https://postgr.es/m/CAOzEurSRii0tEYhu5cePmRcvS=ZrxTLEvxm3Kj0d7_uKGdM23g@mail.gmail.com M src/backend/replication/walsender.c
psql: Add %i prompt escape to indicate hot standby status.
commit : dddbbc253b923ef27f724c6abb5a6a39e1254d54
author : Fujii Masao <fujii@postgresql.org>
date : Tue, 3 Feb 2026 10:03:19 +0900
committer: Fujii Masao <fujii@postgresql.org>
date : Tue, 3 Feb 2026 10:03:19 +0900 This commit introduces a new prompt escape %i for psql, which shows
whether the connected server is operating in hot standby mode. It
expands to standby if the server reports in_hot_standby = on, and
primary otherwise.
This is useful for distinguishing standby servers from primary ones
at a glance, especially when working with multiple connections in
replicated environments where libpq's multi-host connection strings
are used.
Author: Jim Jones <jim.jones@uni-muenster.de>
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>
Reviewed-by: Greg Sabino Mullane <htamfids@gmail.com>
Reviewed-by: Srinath Reddy Sadipiralla <srinath2133@gmail.com>
Reviewed-by: Nathan Bossart <nathandbossart@gmail.com>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Andreas Karlsson <andreas@proxel.se>
Discussion: https://www.postgresql.org/message-id/flat/016f6738-f9a9-4e98-bb5a-e1e4b9591d46@uni-muenster.de M doc/src/sgml/ref/psql-ref.sgml
M src/bin/psql/prompt.c
Fix flakiness in the pg_visibility VM-only vacuum test by using a temporary table.
commit : 4a99ef1a0d11ed464295515635a44aad1b000691
author : Melanie Plageman <melanieplageman@gmail.com>
date : Mon, 2 Feb 2026 17:44:37 -0500
committer: Melanie Plageman <melanieplageman@gmail.com>
date : Mon, 2 Feb 2026 17:44:37 -0500 The test relies on VACUUM being able to mark a page all-visible, but
this can fail when autovacuum in other sessions prevents the visibility
horizon from advancing. Making the test table temporary isolates its
horizon from other sessions, including catalog table vacuums, ensuring
reliable test behavior.
Reported-by: Alexander Lakhin <exclusion@gmail.com>
Author: Kirill Reshke <reshkekirill@gmail.com>
Reviewed-by: Melanie Plageman <melanieplageman@gmail.com>
Discussion: https://postgr.es/m/2b09fba6-6b71-497a-96ef-a6947fcc39f6%40gmail.com M contrib/pg_visibility/expected/pg_visibility.out
M contrib/pg_visibility/sql/pg_visibility.sql
test_shm_mq: Set background worker names.
commit : 12451d9d1f5991739540aefdec77694d59567b34
author : Nathan Bossart <nathan@postgresql.org>
date : Mon, 2 Feb 2026 15:43:01 -0600
committer: Nathan Bossart <nathan@postgresql.org>
date : Mon, 2 Feb 2026 15:43:01 -0600 Oversight in commit 5373bc2a08.
Author: Michael Banck <mbanck@gmx.net>
Discussion: https://postgr.es/m/20260202173156.GB17962%40p46.dedyn.io%3Blightning.p46.dedyn.io M src/test/modules/test_shm_mq/setup.c
Refactor att_align_nominal() to improve performance.
commit : da7a1dc0d62ac3141328f4e6ad51d70e918167aa
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Mon, 2 Feb 2026 14:39:50 -0500
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Mon, 2 Feb 2026 14:39:50 -0500 Separate att_align_nominal() into two macros, similarly to what
was already done with att_align_datum() and att_align_pointer().
The inner macro att_nominal_alignby() is really just TYPEALIGN(),
while att_align_nominal() retains its previous API by mapping
TYPALIGN_xxx values to numbers of bytes to align to and then
calling att_nominal_alignby(). In support of this, split out
tupdesc.c's logic to do that mapping into a publicly visible
function typalign_to_alignby().
Having done that, we can replace performance-critical uses of
att_align_nominal() with att_nominal_alignby(), where the
typalign_to_alignby() mapping is done just once outside the loop.
In most places I settled for doing typalign_to_alignby() once
per function. We could in many places pass the alignby value
in from the caller if we wanted to change function APIs for this
purpose; but I'm a bit loath to do that, especially for exported
APIs that extensions might call. Replacing a char typalign
argument by a uint8 typalignby argument would be an API change
that compilers would fail to warn about, thus silently breaking
code in hard-to-debug ways. I did revise the APIs of array_iter_setup
and array_iter_next, moving the element type attribute arguments to
the former; if any external code uses those, the argument-count
change will cause visible compile failures.
Performance testing shows that ExecEvalScalarArrayOp is sped up by
about 10% by this change, when using a simple per-element function
such as int8eq. I did not check any of the other loops optimized
here, but it's reasonable to expect similar gains.
Although the motivation for creating this patch was to avoid a
performance loss if we add some more typalign values, it evidently
is worth doing whether that patch lands or not.
Discussion: https://postgr.es/m/1127261.1769649624@sss.pgh.pa.us M contrib/dblink/dblink.c
M src/backend/access/common/tupdesc.c
M src/backend/executor/execExprInterp.c
M src/backend/utils/adt/array_expanded.c
M src/backend/utils/adt/arrayfuncs.c
M src/backend/utils/adt/multirangetypes.c
M src/backend/utils/adt/varlena.c
M src/include/access/tupmacs.h
M src/include/utils/arrayaccess.h
M src/pl/plpython/plpy_typeio.c
In s_lock.h, use regular labels with %= instead of local labels.
commit : 0c9f46c4280e31a4f49200f5d2cde37727651869
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Mon, 2 Feb 2026 11:13:38 -0500
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Mon, 2 Feb 2026 11:13:38 -0500 Up to now we've used GNU-style local labels for branch targets
in s_lock.h's assembly blocks. But there's an alternative style,
which I for one didn't know about till recently: use regular
assembler labels, and insert a per-asm-block number in them
using %= to ensure they are distinct across multiple TAS calls
within one source file. gcc has had %= since gcc 2.0, and
I've verified that clang knows it too.
While the immediate motivation for changing this is that AIX's
assembler doesn't do local labels, it seems to me that this is a
superior solution anyway. There is nothing mnemonic about "1:",
while a regular label can convey something useful, and at least
to me it feels less error-prone. Therefore let's standardize on
this approach, also converting the one other usage in s_lock.h.
Discussion: https://postgr.es/m/399291.1769998688@sss.pgh.pa.us M src/include/storage/s_lock.h
Fix error message in RemoveWalSummaryIfOlderThan()
commit : a9afa021e95f2b0ffaaf26f3a27e685f634f4ac9
author : Michael Paquier <michael@paquier.xyz>
date : Mon, 2 Feb 2026 10:21:04 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Mon, 2 Feb 2026 10:21:04 +0900 A failing unlink() was reporting an incorrect error message, referring
to stat().
Author: Man Zeng <zengman@halodbtech.com>
Reviewed-by: Junwang Zhao <zhjwpku@gmail.com>
Discussion: https://postgr.es/m/tencent_3BBE865C5F49D452360FF190@qq.com
Backpath-through: 17 M src/backend/backup/walsummary.c
Fix build inconsistency due to the generation of wait-event code
commit : d46aa32ea5ce0c61a464cdc2c74fa9a428df8bc1
author : Michael Paquier <michael@paquier.xyz>
date : Mon, 2 Feb 2026 08:02:39 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Mon, 2 Feb 2026 08:02:39 +0900 The build generates four files based on the wait event contents stored
in wait_event_names.txt:
- wait_event_types.h
- pgstat_wait_event.c
- wait_event_funcs_data.c
- wait_event_types.sgml
The SGML file is generated as part of a documentation build, with its
data stored in doc/src/sgml/ for meson and configure. The three others
are handled differently for meson and configure:
- In configure, all the files are created in src/backend/utils/activity/.
A link to wait_event_types.h is created in src/include/utils/.
- In meson, all the files are created in src/include/utils/.
The two C files, pgstat_wait_event.c and wait_event_funcs_data.c, are
then included in respectively wait_event.c and wait_event_funcs.c,
without the "utils/" path.
For configure, this does not present a problem. For meson, this has to
be combined with a trick in src/backend/utils/activity/meson.build,
where include_directories needs to point to include/utils/ to make the
inclusion of the C files work properly, causing builds to pull in
PostgreSQL headers rather than system headers in some build paths, as
src/include/utils/ would take priority.
In order to fix this issue, this commit reworks the way the C/H files
are generated, becoming consistent with guc_tables.inc.c:
- For meson, basically nothing changes. The files are still generated
in src/include/utils/. The trick with include_directories is removed.
- For configure, the files are now generated in src/backend/utils/, with
links in src/include/utils/ pointing to the ones in src/backend/. This
requires extra rules in src/backend/utils/activity/Makefile so as a
make command in this sub-directory is able to work.
- The three files now fall under header-stamp, which is actually simpler
as guc_tables.inc.c does the same.
- wait_event_funcs_data.c and pgstat_wait_event.c are now included with
"utils/" in their path.
This problem has not been an issue in the buildfarm; it has been noted
with AIX and a conflict with float.h. This issue could, however, create
conflicts in the buildfarm depending on the environment with unexpected
headers pulled in, so this fix is backpatched down to where the
generation of the wait-event files has been introduced.
While on it, this commit simplifies wait_event_names.txt regarding the
paths of the files generated, to mention just the names of the files
generated. The paths where the files are generated became incorrect.
The path of the SGML path was wrong.
This change has been tested in the CI, down to v17. Locally, I have run
tests with configure (with and without VPATH), as well as meson, on the
three branches.
Combo oversight in fa88928470b5 and 1e68e43d3f0f.
Reported-by: Aditya Kamath <aditya.kamath1@ibm.com>
Discussion: https://postgr.es/m/LV8PR15MB64888765A43D229EA5D1CFE6D691A@LV8PR15MB6488.namprd15.prod.outlook.com
Backpatch-through: 17 M src/backend/Makefile
M src/backend/utils/.gitignore
M src/backend/utils/Makefile
D src/backend/utils/activity/.gitignore
M src/backend/utils/activity/Makefile
M src/backend/utils/activity/meson.build
M src/backend/utils/activity/wait_event.c
M src/backend/utils/activity/wait_event_funcs.c
M src/backend/utils/activity/wait_event_names.txt
M src/include/Makefile
M src/include/utils/.gitignore
M src/include/utils/meson.build
Make psql/t/030_pager.pl more robust.
commit : 6918434a4acb2b14535b3c1be30d306666db7c24
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Fri, 30 Jan 2026 15:11:44 -0500
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Fri, 30 Jan 2026 15:11:44 -0500 Similarly to the preceding commit, 030_pager.pl was assuming
that patterns it looks for in interactive psql output would
appear by themselves on a line, but that assumption tends to
fall over in builds made --without-readline: the output we
get might have a psql prompt immediately followed by the
expected line of output.
For several of these tests, just checking for the pattern
followed by newline seems sufficient, because we could not
get a false match against the command echo, nor against the
unreplaced command output if the pager fails to be invoked
when expected. However, that's fairly scary for the test
that was relying on information_schema.referential_constraints:
"\d+" could easily appear at the end of a line in that view.
Let's get rid of that hazard by making a custom test view
instead of using information_schema.referential_constraints.
This test script is new in v19, so no need for back-patch.
Reported-by: Oleg Tselebrovskiy <o.tselebrovskiy@postgrespro.ru>
Author: Oleg Tselebrovskiy <o.tselebrovskiy@postgrespro.ru>
Co-authored-by: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Soumya S Murali <soumyamurali.work@gmail.com>
Discussion: https://postgr.es/m/db6fdb35a8665ad3c18be01181d44b31@postgrespro.ru M src/bin/psql/t/030_pager.pl
Improve guards against false regex matches in BackgroundPsql.pm.
commit : a1d7ae2b2e38dd5d783c91316925f9f395da47e6
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Fri, 30 Jan 2026 14:59:25 -0500
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Fri, 30 Jan 2026 14:59:25 -0500 BackgroundPsql needs to wait for all the output from an interactive
psql command to come back. To make sure that's happened, it issues
the command, then issues \echo and \warn psql commands that echo
a "banner" string (which we assume won't appear in the command's
output), then waits for the banner strings to appear. The hazard
in this approach is that the banner will also appear in the echoed
psql commands themselves, so we need to distinguish those echoes from
the desired output. Commit 8b886a4e3 tried to do that by positing
that the desired output would be directly preceded and followed by
newlines, but it turns out that that assumption is timing-sensitive.
In particular, it tends to fail in builds made --without-readline,
wherein the command echoes will be made by the pty driver and may
be interspersed with prompts issued by psql proper.
It does seem safe to assume that the banner output we want will be
followed by a newline, since that should be the last output before
things quiesce. Therefore, we can improve matters by putting quotes
around the banner strings in the \echo and \warn psql commands, so
that their echoes cannot include banner directly followed by newline,
and then checking for just banner-and-newline in the match pattern.
While at it, spruce up the pump() call in sub query() to look like
the neater version in wait_connect(), and don't die on timeout
until after printing whatever we got.
Reported-by: Oleg Tselebrovskiy <o.tselebrovskiy@postgrespro.ru>
Diagnosed-by: Oleg Tselebrovskiy <o.tselebrovskiy@postgrespro.ru>
Author: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Soumya S Murali <soumyamurali.work@gmail.com>
Discussion: https://postgr.es/m/db6fdb35a8665ad3c18be01181d44b31@postgrespro.ru
Backpatch-through: 14 M src/test/perl/PostgreSQL/Test/BackgroundPsql.pm
Move shmem allocator's fields from PGShmemHeader to its own struct
commit : e2362eb2bd1459319dacaeaa5dc886dbca546b96
author : Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Fri, 30 Jan 2026 18:22:56 +0200
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Fri, 30 Jan 2026 18:22:56 +0200 For readability. It was a slight modularity violation to have fields
in PGShmemHeader that were only used by the allocator code in
shmem.c. And it was inconsistent that ShmemLock was nevertheless not
stored there. Moving all the allocator-related fields to a separate
struct makes it more consistent and modular, and removes the need to
allocate and pass ShmemLock separately via BackendParameters.
Merge InitShmemAccess() and InitShmemAllocation() into a single
function that initializes the struct when called from postmaster, and
when called from backends in EXEC_BACKEND mode, re-establishes the
global variables. That's similar to all the *ShmemInit() functions
that we have.
Co-authored-by: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>
Discussion: https://www.postgresql.org/message-id/CAExHW5uNRB9oT4pdo54qAo025MXFX4MfYrD9K15OCqe-ExnNvg@mail.gmail.com M src/backend/port/sysv_shmem.c
M src/backend/port/win32_shmem.c
M src/backend/postmaster/launch_backend.c
M src/backend/storage/ipc/ipci.c
M src/backend/storage/ipc/shmem.c
M src/include/storage/pg_shmem.h
M src/include/storage/shmem.h
M src/tools/pgindent/typedefs.list
Minor cosmetic tweaks
commit : e76221bd95f0428cc9b5872a4bcbf0b7e40b77b0
author : Álvaro Herrera <alvherre@kurilemu.de>
date : Fri, 30 Jan 2026 14:26:02 +0100
committer: Álvaro Herrera <alvherre@kurilemu.de>
date : Fri, 30 Jan 2026 14:26:02 +0100 These changes should have been done by 2f9661311b83, but were
overlooked. I noticed while reviewing the code for commit b8926a5b4bb8.
Author: Álvaro Herrera <alvherre@kurilemu.de>
Discussion: https://postgr.es/m/18984-0f4778a6599ac3ae@postgresql.org M src/backend/tcop/postgres.c
M src/backend/utils/mmgr/portalmem.c
Use C99 designated designators in a couple of places
commit : 1eb09ed63a8d8063dc6bb75c8f31ec564bf35250
author : Álvaro Herrera <alvherre@kurilemu.de>
date : Fri, 30 Jan 2026 10:11:04 +0100
committer: Álvaro Herrera <alvherre@kurilemu.de>
date : Fri, 30 Jan 2026 10:11:04 +0100 This makes the arrays somewhat easier to read.
Author: Álvaro Herrera <alvherre@kurilemu.de>
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Reviewed-by: Melanie Plageman <melanieplageman@gmail.com>
Reviewed-by: Jelte Fennema-Nio <postgres@jeltef.nl>
Discussion: https://postgr.es/m/202601281204.sdxbr5qvpunk@alvherre.pgsql M src/backend/access/heap/heapam.c
M src/backend/postmaster/bgworker.c
Remove unused argument from ApplyLogicalMappingFile().
commit : bb26a81ee28c9d9c64e6f233fafa2792768ece1b
author : Fujii Masao <fujii@postgresql.org>
date : Fri, 30 Jan 2026 09:05:35 +0900
committer: Fujii Masao <fujii@postgresql.org>
date : Fri, 30 Jan 2026 09:05:35 +0900 Author: Yugo Nagata <nagata@sraoss.co.jp>
Reviewed-by: Hayato Kuroda <kuroda.hayato@fujitsu.com>
Discussion: https://postgr.es/m/20260128120056.b2a3e8184712ab5a537879eb@sraoss.co.jp M src/backend/replication/logical/reorderbuffer.c
tableam: Perform CheckXidAlive check once per scan
commit : 87f7b824f20c1c06884ef0711b4d32dbf4461436
author : Andres Freund <andres@anarazel.de>
date : Thu, 29 Jan 2026 17:27:23 -0500
committer: Andres Freund <andres@anarazel.de>
date : Thu, 29 Jan 2026 17:27:23 -0500 Previously, the CheckXidAlive check was performed within the table_scan*next*
functions. This caused the check to be executed for every fetched tuple, an
unnecessary overhead.
To fix, move the check to table_beginscan* so it is performed once per scan
rather than once per row.
Note: table_tuple_fetch_row_version() does not use a scan descriptor;
therefore, the CheckXidAlive check is retained in that function. The overhead
is unlikely to be relevant for the existing callers.
Reported-by: Andres Freund <andres@anarazel.de>
Author: Dilip Kumar <dilipbalaut@gmail.com>
Suggested-by: Andres Freund <andres@anarazel.de>
Suggested-by: Amit Kapila <akapila@postgresql.org>
Reviewed-by: Andres Freund <andres@anarazel.de>
Discussion: https://www.postgresql.org/message-id/tlpltqm5jjwj7mp66dtebwwhppe4ri36vdypux2zoczrc2i3mp%40dhv4v4nikyfg M src/backend/access/heap/heapam.c
M src/backend/access/index/genam.c
M src/backend/access/table/tableam.c
M src/include/access/tableam.h
bufmgr: Allow conditionally locking of already locked buffer
commit : 333f586372aae764b7ad7e2c975b14fd431ce819
author : Andres Freund <andres@anarazel.de>
date : Thu, 29 Jan 2026 16:49:01 -0500
committer: Andres Freund <andres@anarazel.de>
date : Thu, 29 Jan 2026 16:49:01 -0500 In fcb9c977aa5 I included an assertion in BufferLockConditional() to detect if
a conditional lock acquisition is done on a buffer that we already have
locked. The assertion was added in the course of adding other assertions.
Unfortunately I failed to realize that some of our code relies on such lock
acquisitions to silently fail. E.g. spgist and nbtree may try to conditionally
lock an already locked buffer when acquiring a empty buffer.
LWLockAcquireConditional(), which was previously used to implement
ConditionalLockBuffer(), does not have such an assert.
Instead of just removing the assert, and relying on the lock acquisition to
fail due to the buffer already locked, this commit changes the behaviour of
conditional content lock acquisition to fail if the current backend has any
pre-existing lock on the buffer, even if the lock modes would not
conflict. The reason for that is that we currently do not have space to track
multiple lock acquisitions on a single buffer. Allowing multiple locks on the
same buffer by a backend also seems likely to lead to bugs.
There is only one non-self-exclusive conditional content lock acquisition, in
GetVictimBuffer(), but it only is used if the target buffer is not pinned and
thus can't already be locked by the current backend.
Reported-by: Alexander Lakhin <exclusion@gmail.com>
Discussion: https://postgr.es/m/90bd2cbb-49ce-4092-9f61-5ac2ab782c94@gmail.com M src/backend/storage/buffer/bufmgr.c
Further fix extended alignment for older g++.
commit : bd9dfac8b121e67d7dd4a9bfecb1474fe6811927
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Thu, 29 Jan 2026 16:16:36 -0500
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Thu, 29 Jan 2026 16:16:36 -0500 Commit 6ceef9408 was still one brick shy of a load, because it caused
any usage at all of PGIOAlignedBlock or PGAlignedXLogBlock to fail
under older g++. Notably, this broke "headerscheck --cplusplus".
We can permit references to these structs as abstract structs though;
only actual declaration of such a variable needs to be forbidden.
Discussion: https://www.postgresql.org/message-id/3119480.1769189606@sss.pgh.pa.us M src/include/c.h
Fix theoretical memory leaks in pg_locale_libc.c.
commit : de90bb7db1f8c7ab1289f82f877a6e18f7b3d468
author : Jeff Davis <jdavis@postgresql.org>
date : Thu, 29 Jan 2026 10:14:55 -0800
committer: Jeff Davis <jdavis@postgresql.org>
date : Thu, 29 Jan 2026 10:14:55 -0800 The leaks were hard to reach in practice and the impact was low.
The callers provide a buffer the same number of bytes as the source
string (plus one for NUL terminator) as a starting size, and libc
never increases the number of characters. But, if the byte length of
one of the converted characters is larger, then it might need a larger
destination buffer. Previously, in that case, the working buffers
would be leaked.
Even in that case, the call typically happens within a context that
will soon be reset. Regardless, it's worth fixing to avoid such
assumptions, and the fix is simple so it's worth backporting.
Discussion: https://postgr.es/m/e2b7a0a88aaadded7e2d19f42d5ab03c9e182ad8.camel@j-davis.com
Backpatch-through: 18 M src/backend/utils/adt/pg_locale_libc.c
Replace literal 0 with InvalidXLogRecPtr for XLogRecPtr assignments
commit : ec317440716487753bafa4c0f8adae53e2c32446
author : Álvaro Herrera <alvherre@kurilemu.de>
date : Thu, 29 Jan 2026 18:37:09 +0100
committer: Álvaro Herrera <alvherre@kurilemu.de>
date : Thu, 29 Jan 2026 18:37:09 +0100 Use the proper constant InvalidXLogRecPtr instead of literal 0 when
assigning XLogRecPtr variables and struct fields.
This improves code clarity by making it explicit that these are
invalid LSN values rather than ambiguous zero literals.
Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Discussion: https://postgr.es/m/aRtd2dw8FO1nNX7k@ip-10-97-1-34.eu-west-3.compute.internal M src/backend/access/gist/gist.c
M src/backend/access/transam/parallel.c
M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogprefetcher.c
M src/backend/access/transam/xlogrecovery.c
M src/backend/replication/syncrep.c
M src/backend/replication/walreceiver.c
M src/backend/storage/lmgr/proc.c
M src/bin/pg_resetwal/pg_resetwal.c
M src/bin/pg_rewind/pg_rewind.c
Fix mistakes in commit 4020b370f214315b8c10430301898ac21658143f
commit : 71c1136989b363004357efb54c87b4192749a6a0
author : Robert Haas <rhaas@postgresql.org>
date : Thu, 29 Jan 2026 08:04:23 -0500
committer: Robert Haas <rhaas@postgresql.org>
date : Thu, 29 Jan 2026 08:04:23 -0500 cost_tidrangescan() was setting the disabled_nodes value correctly,
and then immediately resetting it to zero, due to poor code editing on
my part.
materialized_finished_plan correctly set matpath.parent to
zero, but forgot to also set matpath.parallel_workers = 0, causing
an access to uninitialized memory in cost_material. (This shouldn't
result in any real problem, but it makes valgrind unhappy.)
reparameterize_path was dereferencing a variable before verifying that
it was not NULL.
Reported-by: Tom Lane <tgl@sss.pgh.pa.us> (issue #1)
Reported-by: Michael Paquier <michael@paquier.xyz> (issue #1)
Diagnosed-by: Lukas Fittl <lukas@fittl.com> (issue #1)
Reported-by: Zsolt Parragi <zsolt.parragi@percona.com> (issue #2)
Reported-by: Richard Guo <guofenglinux@gmail.com> (issue #3)
Discussion: http://postgr.es/m/CAN4CZFPvwjNJEZ_JT9Y67yR7C=KMNa=LNefOB8ZY7TKDcmAXOA@mail.gmail.com
Discussion: http://postgr.es/m/aXrnPgrq6Gggb5TG@paquier.xyz M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/util/pathnode.c
Wake LSN waiters before recovery target stop
commit : 20a8f783e15c503125c2ed0ae890510879f62801
author : Alexander Korotkov <akorotkov@postgresql.org>
date : Thu, 29 Jan 2026 09:47:09 +0200
committer: Alexander Korotkov <akorotkov@postgresql.org>
date : Thu, 29 Jan 2026 09:47:09 +0200 Move WaitLSNWakeup() immediately after ApplyWalRecord() so waiters are
signaled even when recoveryStopsAfter() breaks out for pause/promotion
targets.
Discussion: https://postgr.es/m/9533608f-f289-44bd-b881-9e5a73203c5b%40iki.fi
Discussion: https://postgr.es/m/CABPTF7Wdq6KbvC3EhLX3Pz%3DODCCPEX7qVQ%2BE%3DcokkB91an2E-A%40mail.gmail.com
Reported-by: Heikki Linnakangas <hlinnaka@iki.fi>
Author: Xuneng Zhou <xunengzhou@gmail.com> M src/backend/access/transam/xlogrecovery.c
psql: Disable %P (pipeline status) for non-active connection
commit : 4b77282f250103f2ecd54b9f45421c742006317b
author : Michael Paquier <michael@paquier.xyz>
date : Thu, 29 Jan 2026 16:20:45 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Thu, 29 Jan 2026 16:20:45 +0900 In the psql prompt, %P prompt shows the current pipeline status. Unlike
most of the other options, its status was showing up in the output
generated even if psql was not connected to a database. This was
confusing, because without a connection a pipeline status makes no
sense.
Like the other options, %P is updated so as its data is now hidden
without an active connection.
Author: Chao Li <li.evan.chao@gmail.com>
Discussion: https://postgr.es/m/86EF76B5-6E62-404D-B9EC-66F4714D7D5F@gmail.com
Backpatch-through: 18 M src/bin/psql/prompt.c
Fix two error messages in extended_stats_funcs.c
commit : 740a1494f4bfb470b16e5b70c79fae473b1a655d
author : Michael Paquier <michael@paquier.xyz>
date : Thu, 29 Jan 2026 14:57:47 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Thu, 29 Jan 2026 14:57:47 +0900 These have been fat-fingered in 0e80f3f88dea and 302879bd68d1. The
error message for ndistinct had an incorrect grammar, while the one for
dependencies had finished with a period (incorrect based on the project
guidelines).
Discussion: https://postgr.es/m/aXrsjZQbVuB6236u@paquier.xyz M src/backend/statistics/extended_stats_funcs.c
M src/test/regress/expected/stats_import.out
Add test doing some cloning of extended statistics data
commit : fc365e4fccc46d2991ab9614198aa6d71b3838d2
author : Michael Paquier <michael@paquier.xyz>
date : Thu, 29 Jan 2026 13:22:07 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Thu, 29 Jan 2026 13:22:07 +0900 The test added in this commit copies the data of an ANALYZE run on one
relation to a secondary relation with the same attribute definitions and
extended statistics objects. Once the clone is done, the target and
origin should have the same extended statistics information, with no
differences.
This test would have been able to catch e3094679b983, for example, as we
expect the full range of statistics to be copied over, with no
differences generated between the results of an ANALYZE and the data
copied to the cloned relation.
Note that this new test should remain at the bottom of stats_import.sql,
so as any additions in the main relation and its clone are automatically
covered when copying their statistics, so as it would work as a sanity
check in the future.
Author: Corey Huinker <corey.huinker@gmail.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://postgr.es/m/CADkLM=dpz3KFnqP-dgJ-zvRvtjsa8UZv8wDAQdqho=qN3kX0Zg@mail.gmail.com M src/test/regress/expected/stats_import.out
M src/test/regress/sql/stats_import.sql
Add test for pg_restore_extended_stats() with multiranges
commit : 0b7beec42ae2924f94410bded81f75f6f4eadd34
author : Michael Paquier <michael@paquier.xyz>
date : Thu, 29 Jan 2026 12:38:10 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Thu, 29 Jan 2026 12:38:10 +0900 The restore of extended statistics has some paths dedicated to
multirange types and expressions for all the stats kinds supported, and
we did not have coverage for the case where an extended stats object
uses a multirange attribute with or without an expression.
Extracted from a larger patch by the same author, with a couple of
tweaks from me regarding the format of the output generated, to make it
more readable to the eye.
Author: Corey Huinker <corey.huinker@gmail.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://postgr.es/m/CADkLM=dpz3KFnqP-dgJ-zvRvtjsa8UZv8wDAQdqho=qN3kX0Zg@mail.gmail.com M src/test/regress/expected/stats_import.out
M src/test/regress/sql/stats_import.sql
Fix CI failure introduced in commit 851f6649cc.
commit : 3a98f989e8e596efb0db942ead90f64800136fac
author : Amit Kapila <akapila@postgresql.org>
date : Thu, 29 Jan 2026 03:22:02 +0000
committer: Amit Kapila <akapila@postgresql.org>
date : Thu, 29 Jan 2026 03:22:02 +0000 The test added in commit 851f6649cc uses a backup taken from a node
created by the previous test to perform standby related checks. On
Windows, however, the standby failed to start with the following error:
FATAL: could not rename file "backup_label" to "backup_label.old": Permission denied
This occurred because some background sessions from the earlier test were
still active. These leftover processes continued accessing the parent
directory of the backup_label file, likely preventing the rename and
causing the failure. Ensuring that these sessions are cleanly terminated
resolves the issue in local testing.
Additionally, the has_restoring => 1 option has been removed, as it was
not required by the new test.
Reported-by: Robert Haas <robertmhaas@gmail.com>
Backpatch-through: 17
Discussion: https://postgr.es/m/CA+TgmobdVhO0ckZfsBZ0wqDO4qHVCwZZx8sf=EinafvUam-dsQ@mail.gmail.com M src/test/recovery/t/046_checkpoint_logical_slot.pl
Add support for "mcv" in pg_restore_extended_stats()
commit : efbebb4e85872b1c4d6bc19c4550e67850b83aab
author : Michael Paquier <michael@paquier.xyz>
date : Thu, 29 Jan 2026 12:14:08 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Thu, 29 Jan 2026 12:14:08 +0900 This commit adds support for the restore of extended statistics of the
kind "mcv", aka most-common values.
This format is different from n_distinct and dependencies stat types in
that it is the combination of three of the four different arrays from the
pg_stats_ext view which in turn require three different input parameters
on pg_restore_extended_statistics(). These are translated into three
input arguments for the function:
- "most_common_vals", acting as a leader of the others. It is a
2-dimension array, that includes the common values.
- "most_common_freqs", 1-dimension array of float8[], with a number of
elements that has to match with "most_common_vals".
- "most_common_base_freqs", 1-dimension array of float8[], with a number
of elements that has to match with "most_common_vals".
All three arrays are required to achieve the restore of this type of
extended statistics (if "most_common_vals" happens to be NULL in the
catalogs, the rest is NULL by design).
Note that "most_common_val_nulls" is not required in input, its data is
rebuilt from the decomposition of the "most_common_vals" array based on
its text[] representation. The initial versions of the patch provided
this option in input, but we do not require it and it simplifies a lot
the result.
Support in pg_dump is added down to v13 which is where the support for
this type of extended statistics has been added, when --statistics is
used. This means that upgrade and dumps can restore extended statistics
data transparently, like "dependencies", "ndistinct", attribute and
relation statistics. For MCV, the values are directly queried from the
relevant catalogs.
Author: Corey Huinker <corey.huinker@gmail.com>
Co-authored-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://postgr.es/m/CADkLM=dpz3KFnqP-dgJ-zvRvtjsa8UZv8wDAQdqho=qN3kX0Zg@mail.gmail.com M doc/src/sgml/func/func-admin.sgml
M src/backend/statistics/extended_stats_funcs.c
M src/backend/statistics/mcv.c
M src/bin/pg_dump/pg_dump.c
M src/include/statistics/extended_stats_internal.h
M src/test/regress/expected/stats_import.out
M src/test/regress/sql/stats_import.sql
Fix whitespace issue in regression test stats_import
commit : e09e5ad69acab315d2fd5c87626de1bdc0482480
author : Michael Paquier <michael@paquier.xyz>
date : Thu, 29 Jan 2026 11:59:43 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Thu, 29 Jan 2026 11:59:43 +0900 Issue noticed while playing this area of the tests for a different
patch. M src/test/regress/expected/stats_import.out
M src/test/regress/sql/stats_import.sql
Add a couple of recent commits to .git-blame-ignore-revs.
commit : ef1c8652065501503ed328249023509798a80df3
author : Nathan Bossart <nathan@postgresql.org>
date : Wed, 28 Jan 2026 15:56:48 -0600
committer: Nathan Bossart <nathan@postgresql.org>
date : Wed, 28 Jan 2026 15:56:48 -0600 M .git-blame-ignore-revs
Consolidate replication origin session globals into a single struct.
commit : 8f1e2dfe033e9a3236265c3b9f61bd226f4a8f54
author : Masahiko Sawada <msawada@postgresql.org>
date : Wed, 28 Jan 2026 12:26:22 -0800
committer: Masahiko Sawada <msawada@postgresql.org>
date : Wed, 28 Jan 2026 12:26:22 -0800 This commit moves the separate global variables for replication origin
state into a single ReplOriginXactState struct. This groups logically
related variables, which improves code readability and simplifies
state management (e.g., resetting the state) by handling them as a
unit.
Author: Chao Li <lic@highgo.com>
Suggested-by: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>
Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com>
Reviewed-by: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>
Discussion: https://postgr.es/m/CAEoWx2=pYvfRthXHTzSrOsf5_FfyY4zJyK4zV2v4W=yjUij1cA@mail.gmail.com M src/backend/access/transam/twophase.c
M src/backend/access/transam/xact.c
M src/backend/access/transam/xloginsert.c
M src/backend/replication/logical/applyparallelworker.c
M src/backend/replication/logical/origin.c
M src/backend/replication/logical/tablesync.c
M src/backend/replication/logical/worker.c
M src/include/replication/origin.h
M src/tools/pgindent/typedefs.list
Refactor replication origin state reset helpers.
commit : 227eb4eea20575d9ef0aac0bdae7b6c2ba261f34
author : Masahiko Sawada <msawada@postgresql.org>
date : Wed, 28 Jan 2026 11:45:26 -0800
committer: Masahiko Sawada <msawada@postgresql.org>
date : Wed, 28 Jan 2026 11:45:26 -0800 Factor out common logic for clearing replorigin_session_* variables
into a dedicated helper function, replorigin_xact_clear().
This removes duplicated assignments of these variables across multiple
call sites, and makes the intended scope of each reset explicit.
Author: Chao Li <lic@highgo.com>
Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com>
Reviewed-by: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>
Reviewed-by: Álvaro Herrera <alvherre@kurilemu.de>
Discussion: https://postgr.es/m/CAEoWx2=pYvfRthXHTzSrOsf5_FfyY4zJyK4zV2v4W=yjUij1cA@mail.gmail.com M src/backend/replication/logical/origin.c
M src/backend/replication/logical/tablesync.c
M src/backend/replication/logical/worker.c
M src/include/replication/origin.h
Standardize replication origin naming to use "ReplOrigin".
commit : 1fdbca159e0055fefc0b391ec09520d0b3bd9248
author : Masahiko Sawada <msawada@postgresql.org>
date : Wed, 28 Jan 2026 11:03:29 -0800
committer: Masahiko Sawada <msawada@postgresql.org>
date : Wed, 28 Jan 2026 11:03:29 -0800 The replication origin code was using inconsistent naming
conventions. Functions were typically prefixed with 'replorigin',
while typedefs and constants used "RepOrigin".
This commit unifies the naming convention by renaming RepOriginId to
ReplOriginId.
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://postgr.es/m/CAD21AoBDgm3hDqUZ+nqu=ViHmkCnJBuJyaxG_yvv27BAi2zBmQ@mail.gmail.com M contrib/test_decoding/test_decoding.c
M doc/src/sgml/logicaldecoding.sgml
M src/backend/access/rmgrdesc/xactdesc.c
M src/backend/access/transam/commit_ts.c
M src/backend/access/transam/twophase.c
M src/backend/access/transam/xact.c
M src/backend/access/transam/xloginsert.c
M src/backend/access/transam/xlogreader.c
M src/backend/commands/subscriptioncmds.c
M src/backend/executor/execReplication.c
M src/backend/replication/logical/applyparallelworker.c
M src/backend/replication/logical/conflict.c
M src/backend/replication/logical/decode.c
M src/backend/replication/logical/logical.c
M src/backend/replication/logical/origin.c
M src/backend/replication/logical/reorderbuffer.c
M src/backend/replication/logical/tablesync.c
M src/backend/replication/logical/worker.c
M src/backend/replication/pgoutput/pgoutput.c
M src/backend/utils/adt/pg_upgrade_support.c
M src/bin/pg_basebackup/pg_createsubscriber.c
M src/bin/pg_upgrade/t/004_subscription.pl
M src/include/access/commit_ts.h
M src/include/access/twophase.h
M src/include/access/xlogdefs.h
M src/include/access/xlogreader.h
M src/include/executor/executor.h
M src/include/replication/conflict.h
M src/include/replication/logical.h
M src/include/replication/origin.h
M src/include/replication/output_plugin.h
M src/include/replication/reorderbuffer.h
M src/tools/pgindent/typedefs.list
Allow for plugin control over path generation strategies.
commit : 4020b370f214315b8c10430301898ac21658143f
author : Robert Haas <rhaas@postgresql.org>
date : Wed, 28 Jan 2026 11:28:34 -0500
committer: Robert Haas <rhaas@postgresql.org>
date : Wed, 28 Jan 2026 11:28:34 -0500 Each RelOptInfo now has a pgs_mask member which is a mask of acceptable
strategies. For most rels, this is populated from PlannerGlobal's
default_pgs_mask, which is computed from the values of the enable_*
GUCs at the start of planning.
For baserels, get_relation_info_hook can be used to adjust pgs_mask for
each new RelOptInfo, at least for rels of type RTE_RELATION. Adjusting
pgs_mask is less useful for other types of rels, but if it proves to
be necessary, we can revisit the way this hook works or add a new one.
For joinrels, two new hooks are added. joinrel_setup_hook is called each
time a joinrel is created, and one thing that can be done from that hook
is to manipulate pgs_mask for the new joinrel. join_path_setup_hook is
called each time we're about to add paths to a joinrel by considering
some particular combination of an outer rel, an inner rel, and a join
type. It can modify the pgs_mask propagated into JoinPathExtraData to
restrict strategy choice for that particular combination of rels.
To make joinrel_setup_hook work as intended, the existing calls to
build_joinrel_partition_info are moved later in the calling functions;
this is because that function checks whether the rel's pgs_mask includes
PGS_CONSIDER_PARTITIONWISE, so we want it to only be called after
plugins have had a chance to alter pgs_mask.
Upper rels currently inherit pgs_mask from the input relation. It's
unclear that this is the most useful behavior, but at the moment there
are no hooks to allow the mask to be set in any other way.
Reviewed-by: Lukas Fittl <lukas@fittl.com>
Reviewed-by: Jakub Wartak <jakub.wartak@enterprisedb.com>
Reviewed-by: Greg Burd <greg@burd.me>
Reviewed-by: Jacob Champion <jacob.champion@enterprisedb.com>
Reviewed-by: Amit Langote <amitlangote09@gmail.com>
Reviewed-by: Haibo Yan <tristan.yim@gmail.com>
Discussion: http://postgr.es/m/CA+TgmoZ-Jh1T6QyWoCODMVQdhTUPYkaZjWztzP1En4=ZHoKPzw@mail.gmail.com M src/backend/optimizer/path/allpaths.c
M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/path/indxpath.c
M src/backend/optimizer/path/joinpath.c
M src/backend/optimizer/path/tidpath.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/util/pathnode.c
M src/backend/optimizer/util/plancat.c
M src/backend/optimizer/util/relnode.c
M src/include/nodes/pathnodes.h
M src/include/optimizer/cost.h
M src/include/optimizer/pathnode.h
M src/include/optimizer/paths.h
Fix duplicate arbiter detection during REINDEX CONCURRENTLY on partitions
commit : e6d6e32f4240bb967460aabdd2db51181cff242f
author : Álvaro Herrera <alvherre@kurilemu.de>
date : Wed, 28 Jan 2026 14:38:53 +0100
committer: Álvaro Herrera <alvherre@kurilemu.de>
date : Wed, 28 Jan 2026 14:38:53 +0100 Commit 90eae926a fixed ON CONFLICT handling during REINDEX CONCURRENTLY
on partitioned tables by treating unparented indexes as potential
arbiters. However, there's a remaining race condition: when pg_inherits
records are swapped between consecutive calls to get_partition_ancestors(),
two different child indexes can appear to have the same parent, causing
duplicate entries in the arbiter list and triggering "invalid arbiter
index list" errors.
Note that this is not a new problem introduced by 90eae926a. The same
error could occur before that commit in a slightly different scenario:
an index is selected during planning, then index_concurrently_swap()
commits, and a subsequent call to get_partition_ancestors() uses a new
catalog snapshot that sees zero ancestors for that index.
Fix by tracking which parent indexes have already been processed. If a
subsequent call to get_partition_ancestors() returns a parent we've
already seen, treat that index as unparented instead, allowing it to be
matched via IsIndexCompatibleAsArbiter() like other concurrent reindex
scenarios.
Author: Mihail Nikalayeu <mihailnikalayeu@gmail.com>
Reported-by: Alexander Lakhin <exclusion@gmail.com>
Reviewed-by: Álvaro Herrera <alvherre@kurilemu.de>
Discussion: https://postgr.es/m/e5a8c1df-04e5-4343-85ef-5df2a7e3d90c@gmail.com M src/backend/executor/execPartition.c
M src/test/modules/test_misc/t/010_index_concurrently_upsert.pl
Fix pg_restore_extended_stats() with expressions
commit : e3094679b9835fed2ea5c7d7877e8ac8e7554d33
author : Michael Paquier <michael@paquier.xyz>
date : Wed, 28 Jan 2026 11:48:45 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Wed, 28 Jan 2026 11:48:45 +0900 This commit fixes an issue with the restore of ndistinct and
dependencies statistics, causing the operation to fail when any of these
kinds included expressions.
In extended statistics, expressions use strictly negative attribute
numbers, decremented from -1. For example, let's imagine an object
defined as follows:
CREATE STATISTICS stats_obj (dependencies) ON lower(name), upper(name)
FROM tab_obj;
This object would generate dependencies stats using -1 and -2 as
attribute numbers, like that:
[{"attributes": [-1], "dependency": -2, "degree": 1.000000},
{"attributes": [-2], "dependency": -1, "degree": 1.000000}]
However, pg_restore_extended_stats() forgot to account for the number of
expressions defined in an extended statistics object. This would cause
the validation step of ndistinct and dependencies data to fail,
preventing a restore of their stats even if the input is valid.
This issue has come up due to an incorrect split of the patch set. Some
tests are included to cover this behavior.
Author: Corey Huinker <corey.huinker@gmail.com>
Co-authored-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://postgr.es/m/aXl4bMfSTQUxM_yy@paquier.xyz M src/backend/statistics/extended_stats_funcs.c
M src/test/regress/expected/stats_import.out
M src/test/regress/sql/stats_import.sql
Add output test for pg_dependencies statistics import
commit : f9562b95c6e8a66b4cd081f09cc600bf7a364c46
author : Michael Paquier <michael@paquier.xyz>
date : Wed, 28 Jan 2026 08:37:46 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Wed, 28 Jan 2026 08:37:46 +0900 Commit 302879bd68d115 has added the ability to restore extended stats of
the type "dependencies", but it has forgotten the addition of a test to
verify that the value restored was actually set.
This test is the pg_dependencies equivalent of the test added for
pg_ndistinct in 0e80f3f88dea.
Author: Corey Huinker <corey.huinker@gmail.com>
Discussion: https://postgr.es/m/CADkLM=dZr_Ut3jKw94_BisyyDtNZPRJWeOALXVzcJz=ZFTAhvQ@mail.gmail.com M src/test/regress/expected/stats_import.out
M src/test/regress/sql/stats_import.sql
oauth: Correct test dependency on oauth_hook_client
commit : c6a10a89feab903b03e2eb664bd6e931b28416a2
author : Jacob Champion <jchampion@postgresql.org>
date : Tue, 27 Jan 2026 11:56:44 -0800
committer: Jacob Champion <jchampion@postgresql.org>
date : Tue, 27 Jan 2026 11:56:44 -0800 The oauth_validator tests missed the lessons of c89525d57 et al, so
certain combinations of command-line build order and `meson test`
options can result in
Command 'oauth_hook_client' not found in [...] at src/test/perl/PostgreSQL/Test/Utils.pm line 427.
Add the missing dependency on the test executable. This fixes, for
example,
$ ninja clean && ninja meson-test-prereq && PG_TEST_EXTRA=oauth meson test --no-rebuild
Reported-by: Jonathan Gonzalez V. <jonathan.abdiel@gmail.com>
Author: Jonathan Gonzalez V. <jonathan.abdiel@gmail.com>
Discussion: https://postgr.es/m/6e8f4f7c23faf77c4b6564c4b7dc5d3de64aa491.camel@gmail.com
Discussion: https://postgr.es/m/qh4c5tvkgjef7jikjig56rclbcdrrotngnwpycukd2n3k25zi2%4044hxxvtwmgum
Backpatch-through: 18 M src/test/modules/oauth_validator/meson.build
pg_waldump: Remove file-level global WalSegSz.
commit : 9a446d0256dc8f4afb4dba97734b46447c08d918
author : Robert Haas <rhaas@postgresql.org>
date : Tue, 27 Jan 2026 08:31:15 -0500
committer: Robert Haas <rhaas@postgresql.org>
date : Tue, 27 Jan 2026 08:31:15 -0500 It's better style to pass the value around to just the places that
need it. This makes it easier to determine whether the value is
always properly initialized before use.
Reviewed-by: Amul Sul <sulamul@gmail.com>
Discussion: http://postgr.es/m/CAAJ_b94+wObPn-z1VECipnSFhjMJ+R2cpTmKVYLjyQuVn+B5QA@mail.gmail.com M src/bin/pg_waldump/pg_waldump.c
Prevent invalidation of newly synced replication slots.
commit : 851f6649cc18c4b482fa2b6afddb65b35d035370
author : Amit Kapila <akapila@postgresql.org>
date : Tue, 27 Jan 2026 05:06:29 +0000
committer: Amit Kapila <akapila@postgresql.org>
date : Tue, 27 Jan 2026 05:06:29 +0000 A race condition could cause a newly synced replication slot to become
invalidated between its initial sync and the checkpoint.
When syncing a replication slot to a standby, the slot's initial
restart_lsn is taken from the publisher's remote_restart_lsn. Because slot
sync happens asynchronously, this value can lag behind the standby's
current redo pointer. Without any interlocking between WAL reservation and
checkpoints, a checkpoint may remove WAL required by the newly synced
slot, causing the slot to be invalidated.
To fix this, we acquire ReplicationSlotAllocationLock before reserving WAL
for a newly synced slot, similar to commit 006dd4b2e5. This ensures that
if WAL reservation happens first, the checkpoint process must wait for
slotsync to update the slot's restart_lsn before it computes the minimum
required LSN.
However, unlike in ReplicationSlotReserveWal(), this lock alone cannot
protect a newly synced slot if a checkpoint has already run
CheckPointReplicationSlots() before slotsync updates the slot. In such
cases, the remote restart_lsn may be stale and earlier than the current
redo pointer. To prevent relying on an outdated LSN, we use the oldest
WAL location available if it is greater than the remote restart_lsn.
This ensures that newly synced slots always start with a safe, non-stale
restart_lsn and are not invalidated by concurrent checkpoints.
Author: Zhijie Hou <houzj.fnst@fujitsu.com>
Reviewed-by: Hayato Kuroda <kuroda.hayato@fujitsu.com>
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>
Reviewed-by: Vitaly Davydov <v.davydov@postgrespro.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Backpatch-through: 17
Discussion: https://postgr.es/m/TY4PR01MB16907E744589B1AB2EE89A31F94D7A%40TY4PR01MB16907.jpnprd01.prod.outlook.com M src/backend/access/transam/xlog.c
M src/backend/replication/logical/slotsync.c
M src/include/access/xlog.h
M src/test/recovery/t/046_checkpoint_logical_slot.pl
Include extended statistics data in pg_dump
commit : c32fb29e979db4a7b92adb29007725eeacf91f64
author : Michael Paquier <michael@paquier.xyz>
date : Tue, 27 Jan 2026 13:42:32 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Tue, 27 Jan 2026 13:42:32 +0900 This commit integrates the new pg_restore_extended_stats() function into
pg_dump, so as the data of extended statistics is detected and included
in dumps when the --statistics switch is specified. Currently, the same
extended stats kinds as the ones supported by the SQL function can be
dumped: "n_distinct" and "dependencies".
The extended statistics data can be dumped down to PostgreSQL 10, with
the following changes depending on the backend version dealt with:
- In v19 and newer versions, the format of pg_ndistinct and
pg_dependencies has changed, catalogs can be directly queried.
- In v18 and older versions, the format is translated to the new format
supported by the backend.
- In v14 and older versions, inherited extended statistics are not
supported.
- In v11 and older versions, the data for ndistinct and dependencies
was stored in pg_statistic_ext. These have been moved to pg_stats_ext
in v12.
- Extended Statistics have been introduced in v10, no support is needed
for versions older than that.
The extended statistics data is dumped if it can be found in the
catalogs. If the catalogs are empty, then no restore of the stats data
is attempted.
Author: Corey Huinker <corey.huinker@gmail.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://postgr.es/m/CADkLM=dpz3KFnqP-dgJ-zvRvtjsa8UZv8wDAQdqho=qN3kX0Zg@mail.gmail.com M src/bin/pg_dump/pg_backup.h
M src/bin/pg_dump/pg_backup_archiver.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/t/002_pg_dump.pl
M src/test/perl/PostgreSQL/Test/AdjustUpgrade.pm
Remove unnecessary abort() from WalSndShutdown().
commit : 1ea44d7ddfb6ebacb6fb8ae2f5d6e904b2394f29
author : Fujii Masao <fujii@postgresql.org>
date : Tue, 27 Jan 2026 11:55:32 +0900
committer: Fujii Masao <fujii@postgresql.org>
date : Tue, 27 Jan 2026 11:55:32 +0900 WalSndShutdown() previously called abort() after proc_exit(0) to
silence compiler warnings. This is no longer needed, because both
WalSndShutdown() and proc_exit() are declared pg_noreturn,
allowing the compiler to recognize that the function does not return.
Also there are already other functions, such as CheckpointerMain(),
that call proc_exit() without an abort(), and they do not produce warnings.
Therefore this abort() call in WalSndShutdown() is useless and
this commit removes it.
Author: Fujii Masao <masao.fujii@gmail.com>
Reviewed-by: Heikki Linnakangas <hlinnaka@iki.fi>
Discussion: https://postgr.es/m/CAHGQGwHPX1yoixq+YB5rF4zL90TMmSEa3FpHURtqW3Jc5+=oSA@mail.gmail.com M src/backend/replication/walsender.c
pgindent fix for 3fccbd94cba
commit : 09c37015d49665c52ae7eabd5852af36851aede4
author : Tomas Vondra <tomas.vondra@postgresql.org>
date : Tue, 27 Jan 2026 00:26:36 +0100
committer: Tomas Vondra <tomas.vondra@postgresql.org>
date : Tue, 27 Jan 2026 00:26:36 +0100 Backpatch-through: 18 M contrib/pg_buffercache/pg_buffercache_pages.c
Handle ENOENT status when querying NUMA node
commit : 3fccbd94cba0e4ee7a28d22eb5eb64b9fa23f234
author : Tomas Vondra <tomas.vondra@postgresql.org>
date : Mon, 26 Jan 2026 22:20:18 +0100
committer: Tomas Vondra <tomas.vondra@postgresql.org>
date : Mon, 26 Jan 2026 22:20:18 +0100 We've assumed that touching the memory is sufficient for a page to be
located on one of the NUMA nodes. But a page may be moved to a swap
after we touch it, due to memory pressure.
We touch the memory before querying the status, but there is no
guarantee it won't be moved to the swap in the meantime. The touching
happens only on the first call, so later calls are more likely to be
affected. And the batching increases the window too.
It's up to the kernel if/when pages get moved to swap. We have to accept
ENOENT (-2) as a valid result, and handle it without failing. This patch
simply treats it as an unknown node, and returns NULL in the two
affected views (pg_shmem_allocations_numa and pg_buffercache_numa).
Hugepages cannot be swapped out, so this affects only regular pages.
Reported by Christoph Berg, investigation and fix by me. Backpatch to
18, where the two views were introduced.
Reported-by: Christoph Berg <myon@debian.org>
Discussion: 18
Backpatch-through: https://postgr.es/m/aTq5Gt_n-oS_QSpL@msg.df7cb.de M contrib/pg_buffercache/pg_buffercache_pages.c
M src/backend/storage/ipc/shmem.c
Add support for "dependencies" in pg_restore_extended_stats()
commit : 302879bd68d1156fa27c38d29763ca9e4a1649c4
author : Michael Paquier <michael@paquier.xyz>
date : Tue, 27 Jan 2026 08:20:13 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Tue, 27 Jan 2026 08:20:13 +0900 This commit adds support for the restore of extended statistics of the
kind "dependencies", for the following input data:
[{"attributes": [2], "dependency": 3, "degree": 1.000000},
{"attributes": [3], "dependency": 2, "degree": 1.000000}]
This relies on the existing routines of "dependencies" to cross-check
the input data with the definition of the extended statistics objects
for the attribute numbers. An input argument of type "pg_dependencies"
is required for this new option.
Thanks to the work done in 0e80f3f88dea for the restore function and
e1405aa5e3ac for the input handling of data type pg_dependencies, this
addition is straight-forward. This will be used so as it is possible to
transfer these statistics across dumps and upgrades, removing the need
for a post-operation ANALYZE for these kinds of statistics.
Author: Corey Huinker <corey.huinker@gmail.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://postgr.es/m/CADkLM=dpz3KFnqP-dgJ-zvRvtjsa8UZv8wDAQdqho=qN3kX0Zg@mail.gmail.com M doc/src/sgml/func/func-admin.sgml
M src/backend/statistics/extended_stats_funcs.c
M src/test/regress/expected/stats_import.out
M src/test/regress/sql/stats_import.sql
Refactor lazy_scan_prune() VM clear logic into helper
commit : 19af794b660e3711d8b698aeedfc33e13dc235d8
author : Melanie Plageman <melanieplageman@gmail.com>
date : Mon, 26 Jan 2026 17:12:05 -0500
committer: Melanie Plageman <melanieplageman@gmail.com>
date : Mon, 26 Jan 2026 17:12:05 -0500 Encapsulating the cases that clear the visibility map after vacuum phase
I, when corruption is detected, into in a helper makes the code cleaner
and enables further refactoring in future commits.
Author: Melanie Plageman <melanieplageman@gmail.com>
Reviewed-by: Andres Freund <andres@anarazel.de>
Reviewed-by: Kirill Reshke <reshkekirill@gmail.com>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Discussion: https://postgr.es/m/7ib3sa55sapwjlaz4sijbiq7iezna27kjvvvar4dpgkmadml6t%40gfpkkwmdnepx M src/backend/access/heap/vacuumlazy.c
Eliminate use of cached VM value in lazy_scan_prune()
commit : 648a7e28d7c28754ca46caa09864435bc45e543d
author : Melanie Plageman <melanieplageman@gmail.com>
date : Mon, 26 Jan 2026 17:00:13 -0500
committer: Melanie Plageman <melanieplageman@gmail.com>
date : Mon, 26 Jan 2026 17:00:13 -0500 lazy_scan_prune() takes a parameter from lazy_scan_heap() indicating
whether the page was marked all-visible in the VM at the time it was
last checked in find_next_unskippable_block(). This behavior is
historical, dating back to commit 608195a3a365, when we did not pin the
VM page until deciding we must read it. Now that the VM page is already
pinned, there is no meaningful benefit to relying on a cached VM status.
Removing this cached value simplifies the logic in both lazy_scan_heap()
and lazy_scan_prune(). It also clarifies future work that will set the
visibility map on-access: such paths will not have a cached value
available, which would make the logic harder to reason about. And
eliminating it enables us to detect and repair VM corruption on-access.
Along with removing the cached value and unconditionally checking the
visibility status of the heap page, this commit also moves the VM
corruption handling to occur first. This reordering should have no
performance impact, since the checks are inexpensive and performed only
once per page. It does, however, make the control flow easier to
understand. The new restructuring also makes it possible to set the VM
after fixing corruption (if pruning found the page all-visible).
Now that no callers of visibilitymap_set() use its return value, change
its (and visibilitymap_set_vmbits()) return type to void.
Author: Melanie Plageman <melanieplageman@gmail.com>
Reviewed-by: Andres Freund <andres@anarazel.de>
Reviewed-by: Kirill Reshke <reshkekirill@gmail.com>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Xuneng Zhou <xunengzhou@gmail.com>
Discussion: https://postgr.es/m/5CEAA162-67B1-44DA-B60D-8B65717E8B05%40gmail.com M src/backend/access/heap/vacuumlazy.c
M src/backend/access/heap/visibilitymap.c
M src/include/access/visibilitymap.h
Combine visibilitymap_set() cases in lazy_scan_prune()
commit : 21796c267d0a6a9c4adbe74189581bf805cf9dc5
author : Melanie Plageman <melanieplageman@gmail.com>
date : Mon, 26 Jan 2026 15:57:51 -0500
committer: Melanie Plageman <melanieplageman@gmail.com>
date : Mon, 26 Jan 2026 15:57:51 -0500 lazy_scan_prune() previously had two separate cases that called
visibilitymap_set() after pruning and freezing. These branches were
nearly identical except that one attempted to avoid dirtying the heap
buffer. However, that situation can never occur — the heap buffer cannot
be clean at that point (and we would hit an assertion if it were).
In lazy_scan_prune(), when we change a previously all-visible page to
all-frozen and the page was recorded as all-visible in the visibility
map by find_next_unskippable_block(), the heap buffer will always be
dirty. Either we have just frozen a tuple and already dirtied the
buffer, or the buffer was modified between find_next_unskippable_block()
and heap_page_prune_and_freeze() and then pruned in
heap_page_prune_and_freeze().
Additionally, XLogRegisterBuffer() asserts that the buffer is dirty, so
attempting to add a clean heap buffer to the WAL chain would assert out
anyway.
Since the “clean heap buffer with already set VM” case is impossible,
the two visibilitymap_set() branches in lazy_scan_prune() can be merged.
Doing so makes the intent clearer and emphasizes that the heap buffer
must always be marked dirty before being added to the WAL chain.
This commit also adds a test case for vacuuming when no heap
modifications are required. Currently this ensures that the heap buffer
is marked dirty before it is added to the WAL chain, but if we later
remove the heap buffer from the VM-set WAL chain or pass it with the
REGBUF_NO_CHANGES flag, this test would guard that behavior.
Author: Melanie Plageman <melanieplageman@gmail.com>
Reviewed-by: Andres Freund <andres@anarazel.de>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Srinath Reddy Sadipiralla <srinath2133@gmail.com>
Reviewed-by: Kirill Reshke <reshkekirill@gmail.com>
Reviewed-by: Xuneng Zhou <xunengzhou@gmail.com>
Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Discussion: https://postgr.es/m/5CEAA162-67B1-44DA-B60D-8B65717E8B05%40gmail.com
Discussion: https://postgr.es/m/flat/CAAKRu_ZWx5gCbeCf7PWCv8p5%3D%3Db7EEws0VD2wksDxpXCvCyHvQ%40mail.gmail.com M contrib/pg_visibility/Makefile
M contrib/pg_visibility/expected/pg_visibility.out
M contrib/pg_visibility/sql/pg_visibility.sql
M src/backend/access/heap/vacuumlazy.c
Exercise parallel GIN builds in regression tests
commit : f6e5d21bf73f9928b878e301805b8184c82e0463
author : Tomas Vondra <tomas.vondra@postgresql.org>
date : Mon, 26 Jan 2026 18:54:12 +0100
committer: Tomas Vondra <tomas.vondra@postgresql.org>
date : Mon, 26 Jan 2026 18:54:12 +0100 Modify two places creating GIN indexes in regression tests, so that the
build is parallel. This provides a basic test coverage, even if the
amounts of data are fairly small.
Reported-by: Kirill Reshke <reshkekirill@gmail.com>
Backpatch-through: 18
Discussion: https://postgr.es/m/CALdSSPjUprTj+vYp1tRKWkcLYzdy=N=O4Cn4y_HoxNSqQwBttg@mail.gmail.com M src/test/regress/expected/jsonb.out
M src/test/regress/expected/tsearch.out
M src/test/regress/sql/jsonb.sql
M src/test/regress/sql/tsearch.sql
Lookup the correct ordering for parallel GIN builds
commit : db14dcdec69d560013b326ca3dea45b83a07ccd6
author : Tomas Vondra <tomas.vondra@postgresql.org>
date : Mon, 26 Jan 2026 18:52:16 +0100
committer: Tomas Vondra <tomas.vondra@postgresql.org>
date : Mon, 26 Jan 2026 18:52:16 +0100 When building a tuplesort during parallel GIN builds, the function
incorrectly looked up the default B-Tree operator, not the function
associated with the GIN opclass (through GIN_COMPARE_PROC).
Fixed by using the same logic as initGinState(), and the other place
in parallel GIN builds.
This could cause two types of issues. First, a data type might not have
a B-Tree opclass, in which case the PrepareSortSupportFromOrderingOp()
fails with an ERROR. Second, a data type might have both B-Tree and GIN
opclasses, defining order/equality in different ways. This could lead to
logical corruption in the index.
Backpatch to 18, where parallel GIN builds were introduced.
Discussion: https://postgr.es/m/73a28b94-43d5-4f77-b26e-0d642f6de777@iki.fi
Reported-by: Heikki Linnakangas <hlinnaka@iki.fi>
Backpatch-through: 18 M src/backend/utils/sort/tuplesortvariants.c
Reduce length of TAP test file name.
commit : 4cbaf4dcd23846f5122356f88305a64329554d21
author : Robert Haas <rhaas@postgresql.org>
date : Mon, 26 Jan 2026 12:43:52 -0500
committer: Robert Haas <rhaas@postgresql.org>
date : Mon, 26 Jan 2026 12:43:52 -0500 Buildfarm member fairywren hit the Windows limitation on the length of a
file path. While there may be other things we should also do to prevent
this from happening, it's certainly the case that the length of this
test file name is much longer than others in the same directory, so make
it shorter.
Reported-by: Alexander Lakhin <exclusion@gmail.com>
Discussion: http://postgr.es/m/274e0a1a-d7d2-4bc8-8b56-dd09f285715e@gmail.com
Backpatch-through: 17 M src/bin/pg_combinebackup/meson.build
R100 src/bin/pg_combinebackup/t/011_incremental_backup_truncation_block.pl src/bin/pg_combinebackup/t/011_ib_truncation.pl
Fix accidentally cast away qualifiers
commit : 5ca5f12c2c62090f747b5a7d1f5e4adf7f0d161e
author : Peter Eisentraut <peter@eisentraut.org>
date : Mon, 26 Jan 2026 16:02:31 +0100
committer: Peter Eisentraut <peter@eisentraut.org>
date : Mon, 26 Jan 2026 16:02:31 +0100 This fixes cases where a qualifier (const, in all cases here) was
dropped by a cast, but the cast was otherwise necessary or desirable,
so the straightforward fix is to add the qualifier into the cast.
Co-authored-by: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/b04f4d3a-5e70-4e73-9ef2-87f777ca4aac%40eisentraut.org M contrib/intarray/_int_selfuncs.c
M contrib/pageinspect/heapfuncs.c
M contrib/uuid-ossp/uuid-ossp.c
M src/backend/access/common/toast_compression.c
M src/backend/access/nbtree/nbtinsert.c
M src/backend/access/spgist/spgquadtreeproc.c
M src/backend/access/transam/xloginsert.c
M src/backend/backup/backup_manifest.c
M src/backend/backup/basebackup.c
M src/backend/backup/basebackup_incremental.c
M src/backend/executor/nodeIndexscan.c
M src/backend/libpq/auth-scram.c
M src/backend/libpq/crypt.c
M src/backend/nodes/nodeFuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/tidbitmap.c
M src/backend/statistics/extended_stats.c
M src/backend/storage/ipc/shm_mq.c
M src/backend/tsearch/spell.c
M src/backend/utils/adt/geo_spgist.c
M src/backend/utils/adt/json.c
M src/backend/utils/adt/pg_locale_builtin.c
M src/backend/utils/adt/rangetypes.c
M src/backend/utils/adt/rangetypes_gist.c
M src/bin/pg_basebackup/walmethods.c
M src/bin/pg_rewind/filemap.c
M src/bin/pg_verifybackup/astreamer_verify.c
M src/bin/pg_walsummary/pg_walsummary.c
M src/common/scram-common.c
M src/common/unicode/case_test.c
M src/common/unicode_case.c
M src/include/access/tupmacs.h
M src/include/common/hashfn_unstable.h
M src/include/utils/memutils.h
M src/include/varatt.h
M src/interfaces/libpq/fe-auth-scram.c
M src/interfaces/libpq/fe-auth.c
M src/port/pg_crc32c_armv8.c
M src/port/pg_popcount_aarch64.c
M src/test/isolation/isolationtester.c
M src/test/modules/libpq_pipeline/libpq_pipeline.c
M src/test/modules/test_tidstore/test_tidstore.c
doc: Clarify that \d and \d+ output lists are illustrative, not exhaustive.
commit : 33a92632b78603271f76b446d23379d44ebc1450
author : Fujii Masao <fujii@postgresql.org>
date : Mon, 26 Jan 2026 20:45:05 +0900
committer: Fujii Masao <fujii@postgresql.org>
date : Mon, 26 Jan 2026 20:45:05 +0900 The psql documentation for the \d and \d+ meta-commands lists objects
that may be shown, but previously the wording could be read as exhaustive
even though additional objects can also appear in the output.
This commit clarifies the description by adding phrasing such as "for example"
or "such as", making it clear that the listed objects are illustrative
rather than a complete list. While the change is small, it helps avoid
potential user confusion.
As this is a documentation clarification rather than a bug fix,
it is not backpatched.
Author: Peter Smith <smithpb2250@gmail.com>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Andreas Karlsson <andreas@proxel.se>
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>
Discussion: https://postgr.es/m/CAHut+Pt1DBtaUqfJftkkaQLJJJenYJBtb6Ec6s6vu82KEMh46A@mail.gmail.com M doc/src/sgml/ref/psql-ref.sgml
Remove deduplication logic from find_window_functions
commit : 7027dd499dd6a31528f9cb27ba872cec8e9b7bbd
author : David Rowley <drowley@postgresql.org>
date : Mon, 26 Jan 2026 23:27:15 +1300
committer: David Rowley <drowley@postgresql.org>
date : Mon, 26 Jan 2026 23:27:15 +1300 This code thought it was optimizing WindowAgg evaluation by getting rid
of duplicate WindowFuncs, but it turns out all it does today is lead to
cost-underestimations and makes it possible that optimize_window_clauses
could miss some of the WindowFuncs that must receive an updated winref.
The deduplication likely was useful when it was first added, but since
the projection code was changed in b8d7f053c, the list of WindowFuncs
gathered by find_window_functions isn't used during execution. Instead,
the expression evaluation code will process the node's targetlist to find
the WindowFuncs.
The reason the deduplication could cause issues for
optimize_window_clauses() is because if a WindowFunc is moved to another
WindowClause, the winref is adjusted to reference the new WindowClause.
If any duplicate WindowFuncs were discarded in find_window_functions()
then the WindowFuncLists may not include all the WindowFuncs that need
their winref adjusted. This could lead to an error message such as:
ERROR: WindowFunc with winref 2 assigned to WindowAgg with winref 1
The back-branches will receive a different fix so that the WindowAgg costs
are not affected.
Author: Meng Zhang <mza117jc@gmail.com>
Reviewed-by: David Rowley <dgrowleyml@gmail.com>
Discussion: https://postgr.es/m/CAErYLFAuxmW0UVdgrz7iiuNrxGQnFK_OP9hBD5CUzRgjrVrz=Q@mail.gmail.com M src/backend/optimizer/util/clauses.c
Disable extended alignment uses on older g++
commit : 6ceef9408c26b6e188ec88c4303e9bad8ce33bff
author : Peter Eisentraut <peter@eisentraut.org>
date : Mon, 26 Jan 2026 10:23:14 +0100
committer: Peter Eisentraut <peter@eisentraut.org>
date : Mon, 26 Jan 2026 10:23:14 +0100 Fix for commit a9bdb63bba8. The previous plan of redefining alignas
didn't work, because it interfered with other C++ header files (e.g.,
LLVM). So now the new workaround is to just disable the affected
typedefs under the affected compilers. These are not typically used
in extensions anyway.
Discussion: https://www.postgresql.org/message-id/3119480.1769189606%40sss.pgh.pa.us M src/include/c.h
Add test for MAINTAIN permission with pg_restore_extended_stats()
commit : d9abd9e1050db4c2fcdce6fcd8dc0ede6769db16
author : Michael Paquier <michael@paquier.xyz>
date : Mon, 26 Jan 2026 16:32:33 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Mon, 26 Jan 2026 16:32:33 +0900 Like its cousin functions for the restore of relation and attribute
stats, pg_restore_extended_stats() needs to be run by a user that is the
database owner or has MAINTAIN privileges on the table whose stats are
restored. This commit adds a regression test ensuring that MAINTAIN is
required when calling the function. This test also checks that a
ShareUpdateExclusive lock is taken on the table whose stats are
restored.
This has been split from the commit that has introduced
pg_restore_extended_stats(), for clarity.
Author: Corey Huinker <corey.huinker@gmail.com>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://postgr.es/m/CADkLM=dpz3KFnqP-dgJ-zvRvtjsa8UZv8wDAQdqho=qN3kX0Zg@mail.gmail.com M src/test/regress/expected/stats_import.out
M src/test/regress/sql/stats_import.sql
Fix missing initialization in pg_restore_extended_stats()
commit : 114e84c532d1493bbabcaf8ab79a3f1830e8bf9e
author : Michael Paquier <michael@paquier.xyz>
date : Mon, 26 Jan 2026 16:13:41 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Mon, 26 Jan 2026 16:13:41 +0900 The tuple data upserted into pg_statistic_ext_data was missing an
initialization for the nulls flag of stxoid and stxdinherit. This would
cause an incorrect handling of the stats data restored.
This issue has been spotted by CatalogTupleCheckConstraints(),
translating to a NOT NULL constraint inconsistency, while playing more
with the follow-up portions of the patch set.
Oversight in 0e80f3f88dea (mea culpa). Surprisingly, the buildfarm did
not complain yet.
Discussion: https://postgr.es/m/CADkLM=c7DY3Jv6ef0n_MGUJ1FyTMUoT697LbkST05nraVGNHYg@mail.gmail.com M src/backend/statistics/extended_stats_funcs.c
Add pg_restore_extended_stats()
commit : 0e80f3f88deaefc03e5fd204190daab6f761e73d
author : Michael Paquier <michael@paquier.xyz>
date : Mon, 26 Jan 2026 15:08:15 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Mon, 26 Jan 2026 15:08:15 +0900 This function closely mirror its relation and attribute counterparts,
but for extended statistics (i.e. CREATE STATISTICS) objects, being
able to restore extended statistics for an extended stats object. Like
the other functions, the goal of this feature is to ease the dump or
upgrade of clusters so as ANALYZE would not be required anymore after
these operations, stats being directly loaded into the target cluster
without any post-dump/upgrade computation.
The caller of this function needs the following arguments for the
extended stats to restore:
- The name of the relation.
- The schema name of the relation.
- The name of the extended stats object.
- The schema name of the extended stats object.
- If the stats are inherited or not.
- One or more extended stats kind with its data.
This commit adds only support for the restore of the extended statistics
kind "n_distinct", building the basic infrastructure for the restore
of more extended statistics kinds in follow-up commits, including MVC
and dependencies.
The support for "n_distinct" is eased in this commit thanks to the
previous work done particularly in commits 1f927cce4498 and
44eba8f06e55, that have added the input function for the type
pg_ndistinct, used as data type in input of this new restore function.
Bump catalog version.
Author: Corey Huinker <corey.huinker@gmail.com>
Co-authored-by: Michael Paquier <michael@paquier.xyz>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://postgr.es/m/CADkLM=dpz3KFnqP-dgJ-zvRvtjsa8UZv8wDAQdqho=qN3kX0Zg@mail.gmail.com M doc/src/sgml/func/func-admin.sgml
M src/backend/statistics/extended_stats_funcs.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/test/regress/expected/stats_import.out
M src/test/regress/sql/stats_import.sql
M src/tools/pgindent/typedefs.list
Add test with multirange type for pg_restore_attribute_stats()
commit : d4504d6f60e07516cd3b0311054e6f8e74496281
author : Michael Paquier <michael@paquier.xyz>
date : Mon, 26 Jan 2026 13:32:17 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Mon, 26 Jan 2026 13:32:17 +0900 This commit adds a test for pg_restore_attribute_stats() with the
injection of statistics related to a multirange type. This case is
supported in statatt_get_type() since its introduction in ce207d2a7901,
but there was no test in the main regression test suite to check for the
case where attribute stats is restored for a multirange type, as done by
multirange_typanalyze().
Author: Corey Huinker <corey.huinker@gmail.com>
Discussion: https://postgr.es/m/CADkLM=c3JivzHNXLt-X_JicYknRYwLTiOCHOPiKagm2_vdrFUg@mail.gmail.com M src/test/regress/expected/stats_import.out
M src/test/regress/sql/stats_import.sql
Remove PG_MMAP_FLAGS from mem.h
commit : c100340729b66dc46d4f9d68a794957bf2c468d8
author : Michael Paquier <michael@paquier.xyz>
date : Mon, 26 Jan 2026 10:52:02 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Mon, 26 Jan 2026 10:52:02 +0900 Based on name of the macro, it was implied that it could be used for all
mmap() calls on portability grounds. However, its use is limited to
sysv_shmem.c, for CreateAnonymousSegment(). This commit removes the
declaration, reducing the confusion around it as a portability tweak,
being limited to SysV-style shared memory.
This macro has been introduced in b0fc0df9364d for sysv_shmem.c,
originally. It has been moved to mem.h in 0ac5e5a7e152 a bit later.
Suggested by: Peter Eisentraut <peter@eisentraut.org>
Author: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>
Discussion: https://postgr.es/m/CAExHW5vTWABxuM5fbQcFkGuTLwaxuZDEE2vtx2WuMUWk6JnF4g@mail.gmail.com
Discussion: https://postgr.es/m/12add41a-7625-4639-a394-a5563e349322@eisentraut.org M src/backend/port/sysv_shmem.c
M src/include/portability/mem.h
Always inline SeqNext and SeqRecheck
commit : 83a53572a6fc9f83276d24d8c2747b3d5ce49440
author : David Rowley <drowley@postgresql.org>
date : Mon, 26 Jan 2026 14:29:10 +1300
committer: David Rowley <drowley@postgresql.org>
date : Mon, 26 Jan 2026 14:29:10 +1300 The intention of the work done in fb9f95502 was that these functions are
inlined. I noticed my compiler isn't doing this on -O2 (gcc version
15.2.0). Also, clang version 20.1.8 isn't inlining either. Fix by
marking both of these functions as pg_attribute_always_inline to avoid
leaving this up to the compiler's heuristics.
A quick test with a Seq Scan on a table with a single int column running
a query that filters all 1 million rows in the WHERE clause yields a
3.9% speedup on my Zen4 machine.
Author: David Rowley <dgrowleyml@gmail.com>
Discussion: https://postgr.es/m/CAApHDvrL7Q41B=gv+3wc8+AJGKZugGegUbBo8FPQ+3+NGTPb+w@mail.gmail.com M src/backend/executor/nodeSeqscan.c
Add more tests with clause STORAGE on table and TOAST interactions
commit : 168765e5d42be7d3ef750e9e292e14ef94b489e1
author : Michael Paquier <michael@paquier.xyz>
date : Mon, 26 Jan 2026 09:30:22 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Mon, 26 Jan 2026 09:30:22 +0900 This commit adds more tests to cover STORAGE MAIN and EXTENDED, checking
how these use TOAST tables. EXTENDED is already widely tested as the
default behavior, but there were no tests where the clause pattern is
directly specified. STORAGE MAIN and its interactions with TOAST was
not covered at all.
This hole in the tests has been noticed for STORAGE MAIN (inline
compressible varlenas), where I have managed to break the backend
without the tests able to notice the breakage while playing with the
varlena structures.
Reviewed-by: Nikhil Kumar Veldanda <veldanda.nikhilkumar17@gmail.com>
Discussion: https://postgr.es/m/aXMdX1UTHnzYPkHk@paquier.xyz M src/test/regress/expected/strings.out
M src/test/regress/sql/strings.sql
Work around buggy alignas in older g++
commit : a9bdb63bba8a631cd4797393307eecf5fcde9167
author : Peter Eisentraut <peter@eisentraut.org>
date : Sun, 25 Jan 2026 11:16:58 +0100
committer: Peter Eisentraut <peter@eisentraut.org>
date : Sun, 25 Jan 2026 11:16:58 +0100 Older g++ (<9.3) mishandle the alignas specifier (raise warnings that
the alignment is too large), but the more or less equivalent attribute
works. So as a workaround, #define alignas to that attribute for
those versions.
see <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89357>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://www.postgresql.org/message-id/3119480.1769189606%40sss.pgh.pa.us M src/include/c.h
pg_stat_statements: Fix test instability with cache-clobbering builds
commit : 72e3abd082c3ae6db4081137a7431fdd05e55d73
author : Michael Paquier <michael@paquier.xyz>
date : Sun, 25 Jan 2026 19:01:23 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Sun, 25 Jan 2026 19:01:23 +0900 Builds with CLOBBER_CACHE_ALWAYS enabled are failing the new test
introduced in 1572ea96e657, checking the nesting level calculation in
the planner hook. The inner query of the function called twice is
registered as normalized, as such builds would register a PGSS entry in
the post-parse-analyse hook due to the cached plans requiring
revalidation.
A trick based on debug_discard_caches cannot work as far as I can, a
normalized query still being registered. This commit takes a different
approach with the addition of a DISCARD PLANS before the first function
call. This forces the use of a normalized query in the PGSS entry for
the inner query of the function with and without CLOBBER_CACHE_ALWAYS,
which should be enough to stabilize the test. Note that the test is
still checking what it should: when removing the nesting level
calculation in the planner hook of PGSS, one still gets a failure for
the PGSS entry of the inner query in the function, with "toplevel" being
flipped to true instead of false (it should be false, as a non-top-level
entry).
Per buildfarm members avocet and trilobite, at least.
Reported-by: Alexander Lakhin <exclusion@gmail.com>
Discussion: https://postgr.es/m/82dd02bb-4e0f-40ad-a60b-baa1763ff0bd@gmail.com M contrib/pg_stat_statements/expected/level_tracking.out
M contrib/pg_stat_statements/sql/level_tracking.sql
Fix trigger transition table capture for MERGE in CTE queries.
commit : b4307ae2e540847f84147d45b258440eaf570536
author : Dean Rasheed <dean.a.rasheed@gmail.com>
date : Sat, 24 Jan 2026 11:30:48 +0000
committer: Dean Rasheed <dean.a.rasheed@gmail.com>
date : Sat, 24 Jan 2026 11:30:48 +0000 When executing a data-modifying CTE query containing MERGE and some
other DML operation on a table with statement-level AFTER triggers,
the transition tables passed to the triggers would fail to include the
rows affected by the MERGE.
The reason is that, when initializing a ModifyTable node for MERGE,
MakeTransitionCaptureState() would create a TransitionCaptureState
structure with a single "tcs_private" field pointing to an
AfterTriggersTableData structure with cmdType == CMD_MERGE. Tuples
captured there would then not be included in the sets of tuples
captured when executing INSERT/UPDATE/DELETE ModifyTable nodes in the
same query.
Since there are no MERGE triggers, we should only create
AfterTriggersTableData structures for INSERT/UPDATE/DELETE. Individual
MERGE actions should then use those, thereby sharing the same capture
tuplestores as any other DML commands executed in the same query.
This requires changing the TransitionCaptureState structure, replacing
"tcs_private" with 3 separate pointers to AfterTriggersTableData
structures, one for each of INSERT, UPDATE, and DELETE. Nominally,
this is an ABI break to a public structure in commands/trigger.h.
However, since this is a private field pointing to an opaque data
structure, the only way to create a valid TransitionCaptureState is by
calling MakeTransitionCaptureState(), and no extensions appear to be
doing that anyway, so it seems safe for back-patching.
Backpatch to v15, where MERGE was introduced.
Bug: #19380
Reported-by: Daniel Woelfel <dwwoelfel@gmail.com>
Author: Dean Rasheed <dean.a.rasheed@gmail.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/19380-4e293be2b4007248%40postgresql.org
Backpatch-through: 15 M src/backend/commands/trigger.c
M src/include/commands/trigger.h
M src/test/regress/expected/triggers.out
M src/test/regress/sql/triggers.sql
libpq_pipeline: Test the default protocol version
commit : 9b9eaf08ab2dc22c691b22e59f1574e0f1bcc822
author : Jacob Champion <jchampion@postgresql.org>
date : Fri, 23 Jan 2026 12:59:03 -0800
committer: Jacob Champion <jchampion@postgresql.org>
date : Fri, 23 Jan 2026 12:59:03 -0800 In preparation for a future change to libpq's default protocol version,
pin today's default (3.0) in the libpq_pipeline tests.
Patch by Jelte Fennema-Nio, with some additional refactoring of the
PQconnectdbParams() logic by me.
Author: Jelte Fennema-Nio <postgres@jeltef.nl>
Discussion: https://postgr.es/m/DDPR5BPWH1RJ.1LWAK6QAURVAY%40jeltef.nl M src/test/modules/libpq_pipeline/libpq_pipeline.c
pqcomm.h: Explicitly reserve protocol v3.1
commit : f7521bf721d169c4a91e765edb52cf4d05a39c16
author : Jacob Champion <jchampion@postgresql.org>
date : Fri, 23 Jan 2026 12:57:15 -0800
committer: Jacob Champion <jchampion@postgresql.org>
date : Fri, 23 Jan 2026 12:57:15 -0800 Document this unused version alongside the other special protocol
numbers.
Reviewed-by: Jelte Fennema-Nio <postgres@jeltef.nl>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/CAOYmi%2BkKyw%3Dh-5NKqqpc7HC5M30_QmzFx3kgq2AdipyNj47nUw%40mail.gmail.com M src/include/libpq/pqcomm.h
M src/interfaces/libpq/fe-protocol3.c
Add missing #include.
commit : 4ce105d9c4bd3d9ac7fb9c858894b778b7a7405c
author : Nathan Bossart <nathan@postgresql.org>
date : Fri, 23 Jan 2026 11:00:06 -0600
committer: Nathan Bossart <nathan@postgresql.org>
date : Fri, 23 Jan 2026 11:00:06 -0600 Oversight in commit 8eef2df189. Per buildfarm. M src/backend/port/sysv_shmem.c
Fix some rounding code for shared memory.
commit : 8eef2df1898cc34dfaa69ff200f5112d7eeb7c67
author : Nathan Bossart <nathan@postgresql.org>
date : Fri, 23 Jan 2026 10:46:49 -0600
committer: Nathan Bossart <nathan@postgresql.org>
date : Fri, 23 Jan 2026 10:46:49 -0600 InitializeShmemGUCs() always added 1 to the value calculated for
shared_memory_size_in_huge_pages, which is unnecessary if the
shared memory size is divisible by the huge page size.
CreateAnonymousSegment() neglected to check for overflow when
rounding up to a multiple of the huge page size.
These are arguably bugs, but they seem extremely unlikely to be
causing problems in practice, so no back-patch.
Author: Anthonin Bonnefoy <anthonin.bonnefoy@datadoghq.com>
Reviewed-by: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://postgr.es/m/CAO6_Xqq2vZbva0R9eQSY0p2kfksX2aP4r%3D%2BZ_q1HBYNU%3Dm8bBg%40mail.gmail.com M src/backend/port/sysv_shmem.c
M src/backend/storage/ipc/ipci.c
Add WALRCV_CONNECTING state to the WAL receiver
commit : a36164e7465fd1e10e94569e9c1c07656e38a9de
author : Michael Paquier <michael@paquier.xyz>
date : Fri, 23 Jan 2026 14:17:28 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Fri, 23 Jan 2026 14:17:28 +0900 Previously, a WAL receiver freshly started would set its state to
WALRCV_STREAMING immediately at startup, before actually establishing a
replication connection.
This commit introduces a new state called WALRCV_CONNECTING, which is
the state used when the WAL receiver freshly starts, or when a restart
is requested, with a switch to WALRCV_STREAMING once the connection to
the upstream server has been established with COPY_BOTH, meaning that
the WAL receiver is ready to stream changes. This change is useful for
monitoring purposes, especially in environments with a high latency
where a connection could take some time to be established, giving some
room between the [re]start phase and the streaming activity.
From the point of view of the startup process, that flips the shared
memory state of the WAL receiver when it needs to be stopped, the
existing WALRCV_STREAMING and the new WALRCV_CONNECTING states have the
same semantics: the WAL receiver has started and it can be stopped.
Based on an initial suggestion from Noah Misch, with some input from me
about the design.
Author: Xuneng Zhou <xunengzhou@gmail.com>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Reviewed-by: Rahila Syed <rahilasyed90@gmail.com>
Discussion: https://postgr.es/m/CABPTF7VQ5tGOSG5TS-Cg+Fb8gLCGFzxJ_eX4qg+WZ3ZPt=FtwQ@mail.gmail.com M doc/src/sgml/monitoring.sgml
M src/backend/replication/walreceiver.c
M src/backend/replication/walreceiverfuncs.c
M src/include/replication/walreceiver.h
Fix bogus ctid requirement for dummy-root partitioned targets
commit : f9a468c664a4605e3080383ffaa302057d56feb1
author : Amit Langote <amitlan@postgresql.org>
date : Fri, 23 Jan 2026 10:17:43 +0900
committer: Amit Langote <amitlan@postgresql.org>
date : Fri, 23 Jan 2026 10:17:43 +0900 ExecInitModifyTable() unconditionally required a ctid junk column even
when the target was a partitioned table. This led to spurious "could
not find junk ctid column" errors when all children were excluded and
only the dummy root result relation remained.
A partitioned table only appears in the result relations list when all
leaf partitions have been pruned, leaving the dummy root as the sole
entry. Assert this invariant (nrels == 1) and skip the ctid requirement.
Also adjust ExecModifyTable() to tolerate invalid ri_RowIdAttNo for
partitioned tables, which is safe since no rows will be processed in
this case.
Bug: #19099
Reported-by: Alexander Lakhin <exclusion@gmail.com>
Author: Amit Langote <amitlangote09@gmail.com>
Reviewed-by: Tender Wang <tndrwang@gmail.com>
Reviewed-by: Kirill Reshke <reshkekirill@gmail.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/19099-e05dcfa022fe553d%40postgresql.org
Backpatch-through: 14 M contrib/file_fdw/expected/file_fdw.out
M contrib/file_fdw/sql/file_fdw.sql
M src/backend/executor/nodeModifyTable.c
Remove faulty Assert in partitioned INSERT...ON CONFLICT DO UPDATE.
commit : 4b760a181ab220f425a6fe8e08335891b0ba62d4
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Thu, 22 Jan 2026 18:35:31 -0500
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Thu, 22 Jan 2026 18:35:31 -0500 Commit f16241bef mistakenly supposed that INSERT...ON CONFLICT DO
UPDATE rejects partitioned target tables. (This may have been
accurate when the patch was written, but it was already obsolete
when committed.) Hence, there's an assertion that we can't see
ItemPointerIndicatesMovedPartitions() in that path, but the assertion
is triggerable.
Some other places throw error if they see a moved-across-partitions
tuple, but there seems no need for that here, because if we just retry
then we get the same behavior as in the update-within-partition case,
as demonstrated by the new isolation test. So fix by deleting the
faulty Assert. (The fact that this is the fix doubtless explains
why we've heard no field complaints: the behavior of a non-assert
build is fine.)
The TM_Deleted case contains a cargo-culted copy of the same Assert,
which I also deleted to avoid confusion, although I believe that one
is actually not triggerable.
Per our code coverage report, neither the TM_Updated nor the
TM_Deleted case were reached at all by existing tests, so this
patch adds tests for both.
Reported-by: Dmitry Koval <d.koval@postgrespro.ru>
Author: Joseph Koshakow <koshy44@gmail.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/f5fffe4b-11b2-4557-a864-3587ff9b4c36@postgrespro.ru
Backpatch-through: 14 M src/backend/executor/nodeModifyTable.c
A src/test/isolation/expected/insert-conflict-do-update-4.out
M src/test/isolation/isolation_schedule
A src/test/isolation/specs/insert-conflict-do-update-4.spec
Make some use of anonymous unions [reloptions]
commit : 69f98fce5bfb82260c66bdae88b6293146cf79ec
author : Álvaro Herrera <alvherre@kurilemu.de>
date : Thu, 22 Jan 2026 17:04:59 +0100
committer: Álvaro Herrera <alvherre@kurilemu.de>
date : Thu, 22 Jan 2026 17:04:59 +0100 In the spirit of commit 4b7e6c73b0df and following, which see for more
details; it appears to have been quite an uncontroversial C11 feature to
use and it makes the code nicer to read.
This commit changes the relopt_value struct.
Author: Peter Eisentraut <peter@eisentraut.org>
Author: Álvaro Herrera <alvherre@kurilemu.de>
Note: Yes, this was written twice independently.
Discussion: https://postgr.es/m/202601192106.zcdi3yu2gzti@alvherre.pgsql M src/backend/access/common/reloptions.c
M src/include/access/reloptions.h
Record range constructor functions in pg_range
commit : c257ba83971892723c5c89955ab0dd1ef7c077d8
author : Peter Eisentraut <peter@eisentraut.org>
date : Thu, 22 Jan 2026 15:17:12 +0100
committer: Peter Eisentraut <peter@eisentraut.org>
date : Thu, 22 Jan 2026 15:17:12 +0100 When a range type is created, several construction functions are also
created, two for the range type and three for the multirange type.
These have an internal dependency, so they "belong" to the range type.
But there was no way to identify those functions when given a range
type. An upcoming patch needs access to the two- or possibly the
three-argument range constructor function for a given range type. The
only way to do that would be with fragile workarounds like matching
names and argument types. The correct way to do that kind of thing is
to record to the links in the system catalogs. This is what this
patch does, it records the OIDs of these five constructor functions in
the pg_range catalog. (Currently, there is no code that makes use of
this.)
Reviewed-by: Paul A Jungwirth <pj@illuminatedcomputing.com>
Reviewed-by: Kirill Reshke <reshkekirill@gmail.com>
Discussion: https://www.postgresql.org/message-id/7d63ddfa-c735-4dfe-8c7a-4f1e2a621058%40eisentraut.org M doc/src/sgml/catalogs.sgml
M src/backend/catalog/pg_range.c
M src/backend/commands/typecmds.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_range.dat
M src/include/catalog/pg_range.h
M src/test/regress/expected/oidjoins.out
M src/test/regress/expected/type_sanity.out
M src/test/regress/sql/type_sanity.sql
Mark commented out code as unused
commit : a5b40d156edaafa4fe93cdae96592f26bc865bd3
author : Peter Eisentraut <peter@eisentraut.org>
date : Thu, 22 Jan 2026 12:41:52 +0100
committer: Peter Eisentraut <peter@eisentraut.org>
date : Thu, 22 Jan 2026 12:41:52 +0100 There were many PG_GETARG_* calls, mostly around gin, gist, spgist
code, that were commented out, presumably to indicate that the
argument was unused and to indicate that it wasn't forgotten or
miscounted. But keeping commented-out code updated with refactorings
and style changes is annoying. So this commit changes them to
#ifdef NOT_USED
blocks, which is a style already in use. That way, at least the
indentation and syntax highlighting works correctly, making some of
these blocks much easier to read.
An alternative would be to just delete that code, but there is some
value in making unused arguments explicit, and some of this arguably
serves as example code for index AM APIs.
Reviewed-by: Heikki Linnakangas <hlinnaka@iki.fi>
Reviewed-by: David Geier <geidav.pg@gmail.com>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Dean Rasheed <dean.a.rasheed@gmail.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://www.postgresql.org/message-id/flat/328e4371-9a4c-4196-9df9-1f23afc900df%40eisentraut.org M contrib/btree_gist/btree_bit.c
M contrib/btree_gist/btree_bool.c
M contrib/btree_gist/btree_bytea.c
M contrib/btree_gist/btree_cash.c
M contrib/btree_gist/btree_date.c
M contrib/btree_gist/btree_enum.c
M contrib/btree_gist/btree_float4.c
M contrib/btree_gist/btree_float8.c
M contrib/btree_gist/btree_inet.c
M contrib/btree_gist/btree_int2.c
M contrib/btree_gist/btree_int4.c
M contrib/btree_gist/btree_int8.c
M contrib/btree_gist/btree_interval.c
M contrib/btree_gist/btree_macaddr.c
M contrib/btree_gist/btree_macaddr8.c
M contrib/btree_gist/btree_numeric.c
M contrib/btree_gist/btree_oid.c
M contrib/btree_gist/btree_text.c
M contrib/btree_gist/btree_time.c
M contrib/btree_gist/btree_ts.c
M contrib/btree_gist/btree_uuid.c
M contrib/cube/cube.c
M contrib/hstore/hstore_gin.c
M contrib/hstore/hstore_gist.c
M contrib/intarray/_int_gin.c
M contrib/intarray/_int_gist.c
M contrib/intarray/_intbig_gist.c
M contrib/ltree/_ltree_gist.c
M contrib/ltree/ltree_gist.c
M contrib/pg_trgm/trgm_gin.c
M contrib/pg_trgm/trgm_gist.c
M contrib/seg/seg.c
M doc/src/sgml/gist.sgml
M src/backend/access/gin/ginarrayproc.c
M src/backend/access/gist/gistproc.c
M src/backend/access/spgist/spgkdtreeproc.c
M src/backend/access/spgist/spgquadtreeproc.c
M src/backend/access/spgist/spgtextproc.c
M src/backend/utils/adt/datum.c
M src/backend/utils/adt/jsonb_gin.c
M src/backend/utils/adt/network_gist.c
M src/backend/utils/adt/network_spgist.c
M src/backend/utils/adt/rangetypes_spgist.c
M src/backend/utils/adt/tsginidx.c
M src/backend/utils/adt/tsgistidx.c
M src/backend/utils/adt/tsquery_gist.c
M src/backend/utils/adt/varlena.c
M src/test/modules/spgist_name_ops/spgist_name_ops.c
Remove incorrect commented out code
commit : 846fb3c7901146a5450c08aeadf50566d5d65d09
author : Peter Eisentraut <peter@eisentraut.org>
date : Thu, 22 Jan 2026 12:41:40 +0100
committer: Peter Eisentraut <peter@eisentraut.org>
date : Thu, 22 Jan 2026 12:41:40 +0100 These calls, if activated, are happening before null checks, so they
are not correct. Also, the "in" variable is shadowed later. Remove
them to avoid confusion and bad examples.
Reviewed-by: Heikki Linnakangas <hlinnaka@iki.fi>
Reviewed-by: David Geier <geidav.pg@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/328e4371-9a4c-4196-9df9-1f23afc900df%40eisentraut.org M src/backend/utils/adt/jsonfuncs.c
Remove redundant AssertVariableIsOfType uses
commit : f3c96c9dff0c727afd1ef2ea976592c77cc809b5
author : Peter Eisentraut <peter@eisentraut.org>
date : Thu, 22 Jan 2026 09:19:13 +0100
committer: Peter Eisentraut <peter@eisentraut.org>
date : Thu, 22 Jan 2026 09:19:13 +0100 The uses of AssertVariableIsOfType in pg_upgrade are unnecessary
because the calls to upgrade_task_add_step() already check the
compatibility of the callback functions.
These were apparently copied from a previous coding style, but similar
removals were already done in commit 30b789eafe.
Reviewed-by: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Reviewed-by: Nathan Bossart <nathandbossart@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/3d289481-7f76-409f-81c7-81824219cc75%40eisentraut.org M src/bin/pg_upgrade/check.c
M src/bin/pg_upgrade/function.c
M src/bin/pg_upgrade/info.c
M src/bin/pg_upgrade/version.c
Detect if flags are needed for C++11 support
commit : ae4fe737aea36eb3a20e567c75cd70a82d1af230
author : Peter Eisentraut <peter@eisentraut.org>
date : Thu, 22 Jan 2026 08:39:39 +0100
committer: Peter Eisentraut <peter@eisentraut.org>
date : Thu, 22 Jan 2026 08:39:39 +0100 Just like we only support compiling with C11, we only support
compiling extensions with C++11 and up. Some compilers support C++11
but don't enable it by default. This detects if flags are needed to
enable C++11 support, in a similar way to how we check the same for
C11 support.
The C++ test extension module added by commit 476b35d4e31 confirmed
that C++11 is effectively required. (This was understood in mailing
list discussions but not recorded anywhere in the source code.)
Author: Jelte Fennema-Nio <postgres@jeltef.nl>
Co-authored-by: Peter Eisentraut <peter@eisentraut.org>
Discussion: https://www.postgresql.org/message-id/flat/E1viDt1-001d7E-2I%40gemulon.postgresql.org M configure
M configure.ac
M meson.build
doc: List all the possible values of pg_stat_wal_receiver.status
commit : 1a1e733b623108ebba8a6e6f55235782edb8f4bb
author : Michael Paquier <michael@paquier.xyz>
date : Thu, 22 Jan 2026 17:03:21 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Thu, 22 Jan 2026 17:03:21 +0900 The possible values of pg_stat_wal_receiver.status have never been
documented. Note that the status "stopped" will never show up in this
view, hence there is no need to document it.
Issue noticed while discussing a patch that aims to add a new status to
WAL receiver.
Author: Xuneng Zhou <xunengzhou@gmail.com>
Discussion: https://postgr.es/m/CABPTF7X_Jgmyk1FBVNf3tyAOKqU55LLpLMzWkGtEAb_jQWVN=g@mail.gmail.com M doc/src/sgml/monitoring.sgml
doc: Mention pg_get_partition_constraintdef()
commit : 25be5e8a33233c59230b9633c14260faa4fbdeed
author : Michael Paquier <michael@paquier.xyz>
date : Thu, 22 Jan 2026 16:35:36 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Thu, 22 Jan 2026 16:35:36 +0900 All the other SQL functions reconstructing definitions or commands are
listed in the documentation, except this one.
Oversight in 1848b73d4576.
Author: Todd Liebenschutz-Jones <todd.liebenschutz-jones@starlingbank.com>
Discussion: https://postgr.es/m/CAGTRfaD6uRQ9iutASDzc_iDoS25sQTLWgXTtR3ta63uwTxq6bA@mail.gmail.com
Backpatch-through: 14 M doc/src/sgml/func/func-info.sgml
jit: Add missing inline pass for LLVM >= 17.
commit : e5d99b4d9ef4b92fb74f05bf783e06766bb661ee
author : Thomas Munro <tmunro@postgresql.org>
date : Thu, 22 Jan 2026 15:43:13 +1300
committer: Thomas Munro <tmunro@postgresql.org>
date : Thu, 22 Jan 2026 15:43:13 +1300 With LLVM >= 17, transform passes are provided as a string to
LLVMRunPasses. Only two strings were used: "default<O3>" and
"default<O0>,mem2reg".
With previous LLVM versions, an additional inline pass was added when
JIT inlining was enabled without optimization. With LLVM >= 17, the code
would go through llvm_inline, prepare the functions for inlining, but
the generated bitcode would be the same due to the missing inline pass.
This patch restores the previous behavior by adding an inline pass when
inlining is enabled but no optimization is done.
This fixes an oversight introduced by 76200e5e when support for LLVM 17
was added.
Backpatch-through: 14
Author: Anthonin Bonnefoy <anthonin.bonnefoy@datadoghq.com>
Reviewed-by: Thomas Munro <thomas.munro@gmail.com>
Reviewed-by: Andreas Karlsson <andreas@proxel.se>
Reviewed-by: Andres Freund <andres@anarazel.de>
Reviewed-by: Álvaro Herrera <alvherre@kurilemu.de>
Reviewed-by: Pierre Ducroquet <p.psql@pinaraf.info>
Reviewed-by: Matheus Alcantara <matheusssilv97@gmail.com>
Discussion: https://postgr.es/m/CAO6_XqrNjJnbn15ctPv7o4yEAT9fWa-dK15RSyun6QNw9YDtKg%40mail.gmail.com M src/backend/jit/llvm/llvmjit.c
file_fdw: Support multi-line HEADER option.
commit : 26cb14aea12a0f0c2f9a49de3865721936b711a7
author : Fujii Masao <fujii@postgresql.org>
date : Thu, 22 Jan 2026 10:14:12 +0900
committer: Fujii Masao <fujii@postgresql.org>
date : Thu, 22 Jan 2026 10:14:12 +0900 Commit bc2f348 introduced multi-line HEADER support for COPY. This commit
extends this capability to file_fdw, allowing multiple header lines to be
skipped.
Because CREATE/ALTER FOREIGN TABLE requires option values to be single-quoted,
this commit also updates defGetCopyHeaderOption() to accept integer values
specified as strings for HEADER option.
Author: Shinya Kato <shinya11.kato@gmail.com>
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>
Reviewed-by: songjinzhou <tsinghualucky912@foxmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://postgr.es/m/CAOzEurT+iwC47VHPMS+uJ4WSzvOLPsZ2F2_wopm8M7O+CZa3Xw@mail.gmail.com A contrib/file_fdw/data/multiline_header.csv
M contrib/file_fdw/expected/file_fdw.out
M contrib/file_fdw/sql/file_fdw.sql
M doc/src/sgml/file-fdw.sgml
M src/backend/commands/copy.c
M src/test/regress/expected/copy.out
M src/test/regress/expected/copy2.out
M src/test/regress/sql/copy.sql
M src/test/regress/sql/copy2.sql
Improve the error message in COPY with HEADER option.
commit : f3da70a805f9a9dd2deada728649b2cfbeae9cb3
author : Fujii Masao <fujii@postgresql.org>
date : Thu, 22 Jan 2026 10:13:07 +0900
committer: Fujii Masao <fujii@postgresql.org>
date : Thu, 22 Jan 2026 10:13:07 +0900 The error message reported for invalid values of the HEADER option in COPY
command previously used the term "non-negative integer", which is
discouraged by the Error Message Style Guide because it is ambiguous about
whether zero is allowed.
This commit improves the error message by replacing "non-negative integer"
there with "an integer value greater than or equal to zero" to make
the accepted values explicit.
Author: Shinya Kato <shinya11.kato@gmail.com>
Reviewed-by: Alvaro Herrera <alvherre@kurilemu.de>
Reviewed-by: Steven Niu <niushiji@gmail.com>
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>
Discussion: https://postgr.es/m/CAHGQGwE86PcuPZbP=aurmW7Oo=eycF10gxjErWq4NmY-5TTX4Q@mail.gmail.com M src/backend/commands/copy.c
M src/test/regress/expected/copy.out
M src/test/regress/expected/copy2.out
Refactor some SIMD and popcount macros.
commit : 25dc4850747bb12e871af3589736463edd1d2aa6
author : Nathan Bossart <nathan@postgresql.org>
date : Wed, 21 Jan 2026 14:21:00 -0600
committer: Nathan Bossart <nathan@postgresql.org>
date : Wed, 21 Jan 2026 14:21:00 -0600 This commit does the following:
* Removes TRY_POPCNT_X86_64. We now assume that the required CPUID
intrinsics are available when HAVE_X86_64_POPCNTQ is defined, as we
have done since v16 for meson builds when
USE_SSE42_CRC32C_WITH_RUNTIME_CHECK is defined and since v17 when
USE_AVX512_POPCNT_WITH_RUNTIME_CHECK is defined.
* Moves the MSVC check for HAVE_X86_64_POPCNTQ to configure-time.
This way, we set it for all relevant platforms in one place.
* Moves the #defines for USE_SSE2 and USE_NEON to c.h so that they
can be used elsewhere without including simd.h. Consequently, we
can remove the POPCNT_AARCH64 macro.
* Moves the #includes for pg_bitutils.h to below the system headers
in pg_popcount_{aarch64,x86}.c, since we no longer depend on macros
from pg_bitutils.h to decide which system headers to use.
Reviewed-by: John Naylor <johncnaylorls@gmail.com>
Discussion: https://postgr.es/m/aWf_InS1VrbeXAfP%40nathan M meson.build
M src/include/c.h
M src/include/port/pg_bitutils.h
M src/include/port/simd.h
M src/port/pg_bitutils.c
M src/port/pg_popcount_aarch64.c
M src/port/pg_popcount_x86.c
Rename "fast" and "slow" popcount functions.
commit : 8c6653516c5ad23628cc50d4cee1e6446e7f758d
author : Nathan Bossart <nathan@postgresql.org>
date : Wed, 21 Jan 2026 14:21:00 -0600
committer: Nathan Bossart <nathan@postgresql.org>
date : Wed, 21 Jan 2026 14:21:00 -0600 Since we now have several implementations of the popcount
functions, let's give them more descriptive names. This commit
replaces "slow" with "portable" and "fast" with "sse42". While the
POPCNT instruction is technically not part of SSE4.2, this naming
scheme is close enough in practice and is arguably easier to
understand than using "popcnt" instead.
Reviewed-by: John Naylor <johncnaylorls@gmail.com>
Reviewed-by: Heikki Linnakangas <hlinnaka@iki.fi>
Discussion: https://postgr.es/m/aWf_InS1VrbeXAfP%40nathan M src/include/port/pg_bitutils.h
M src/port/pg_bitutils.c
M src/port/pg_popcount_x86.c
Move x86-64-specific popcount code to pg_popcount_x86.c.
commit : 79e232ca013c7f357704f8af9782fe72466c216e
author : Nathan Bossart <nathan@postgresql.org>
date : Wed, 21 Jan 2026 14:21:00 -0600
committer: Nathan Bossart <nathan@postgresql.org>
date : Wed, 21 Jan 2026 14:21:00 -0600 This moves the remaining x86-64-specific popcount implementations
in pg_bitutils.c to pg_popcount_x86.c.
Reviewed-by: John Naylor <johncnaylorls@gmail.com>
Discussion: https://postgr.es/m/aWf_InS1VrbeXAfP%40nathan M src/include/port/pg_bitutils.h
M src/port/pg_bitutils.c
M src/port/pg_popcount_x86.c
Rename pg_popcount_avx512.c to pg_popcount_x86.c.
commit : fbe327e5b465dff0fe5ce66ceff08ab9de9ef758
author : Nathan Bossart <nathan@postgresql.org>
date : Wed, 21 Jan 2026 14:21:00 -0600
committer: Nathan Bossart <nathan@postgresql.org>
date : Wed, 21 Jan 2026 14:21:00 -0600 This is preparatory work for a follow-up commit that will move the
rest of the x86-64-specific popcount code to this file.
Reviewed-by: John Naylor <johncnaylorls@gmail.com>
Discussion: https://postgr.es/m/aWf_InS1VrbeXAfP%40nathan M src/port/Makefile
M src/port/meson.build
R098 src/port/pg_popcount_avx512.c src/port/pg_popcount_x86.c
Force standard_conforming_strings to always be ON.
commit : 45762084545ec14dbbe66ace1d69d7e89f8978ac
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Wed, 21 Jan 2026 15:08:38 -0500
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Wed, 21 Jan 2026 15:08:38 -0500 Continuing to support this backwards-compatibility feature has
nontrivial costs; in particular it is potentially a security hazard
if an application somehow gets confused about which setting the
server is using. We changed the default to ON fifteen years ago,
which seems like enough time for applications to have adapted.
Let's remove support for the legacy string syntax.
We should not remove the GUC altogether, since client-side code will
still test it, pg_dump scripts will attempt to set it to ON, etc.
Instead, just prevent it from being set to OFF. There is precedent
for this approach (see commit de66987ad).
This patch does remove the related GUC escape_string_warning, however.
That setting does nothing when standard_conforming_strings is on,
so it's now useless. We could leave it in place as a do-nothing
setting to avoid breaking clients that still set it, if there are any.
But it seems likely that any such client is also trying to turn off
standard_conforming_strings, so it'll need work anyway.
The client-side changes in this patch are pretty minimal, because even
though we are dropping the server's support, most of our clients still
need to be able to talk to older server versions. We could remove
dead client code only once we disclaim compatibility with pre-v19
servers, which is surely years away. One change of note is that
pg_dump/pg_dumpall now set standard_conforming_strings = on in their
source session, rather than accepting the source server's default.
This ensures that literals in view definitions and such will be
printed in a way that's acceptable to v19+. In particular,
pg_upgrade will work transparently even if the source installation has
standard_conforming_strings = off. (However, pg_restore will behave
the same as before if given an archive file containing
standard_conforming_strings = off. Such an archive will not be safely
restorable into v19+, but we shouldn't break the ability to extract
valid data from it for use with an older server.)
Author: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/3279216.1767072538@sss.pgh.pa.us M contrib/hstore/expected/hstore.out
M contrib/hstore/sql/hstore.sql
M contrib/pg_stat_statements/pg_stat_statements.c
M contrib/pg_trgm/expected/pg_trgm.out
M contrib/pg_trgm/sql/pg_trgm.sql
M contrib/test_decoding/test_decoding.c
M doc/src/sgml/config.sgml
M doc/src/sgml/ecpg.sgml
M doc/src/sgml/func/func-matching.sgml
M doc/src/sgml/hstore.sgml
M doc/src/sgml/libpq.sgml
M doc/src/sgml/protocol.sgml
M doc/src/sgml/syntax.sgml
M src/backend/commands/variable.c
M src/backend/parser/scan.l
M src/backend/utils/adt/quote.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/misc/guc_parameters.dat
M src/backend/utils/misc/guc_tables.c
M src/backend/utils/misc/postgresql.conf.sample
M src/bin/pg_dump/pg_backup_archiver.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dumpall.c
M src/fe_utils/string_utils.c
M src/include/parser/parser.h
M src/include/parser/scanner.h
M src/include/utils/guc_hooks.h
M src/interfaces/ecpg/test/expected/sql-quote.c
M src/interfaces/ecpg/test/expected/sql-quote.stderr
M src/interfaces/ecpg/test/expected/sql-quote.stdout
M src/interfaces/ecpg/test/expected/sql-show.c
M src/interfaces/ecpg/test/expected/sql-show.stderr
M src/interfaces/ecpg/test/expected/sql-show.stdout
M src/interfaces/ecpg/test/sql/quote.pgc
M src/interfaces/ecpg/test/sql/show.pgc
M src/test/examples/testlibpq3.c
M src/test/examples/testlibpq3.sql
M src/test/modules/test_regex/expected/test_regex.out
M src/test/modules/test_regex/expected/test_regex_utf8.out
M src/test/modules/test_regex/sql/test_regex.sql
M src/test/modules/test_regex/sql/test_regex_utf8.sql
M src/test/regress/expected/plpgsql.out
M src/test/regress/expected/regex.out
M src/test/regress/expected/strings.out
M src/test/regress/sql/plpgsql.sql
M src/test/regress/sql/regex.sql
M src/test/regress/sql/strings.sql
M src/tutorial/syscat.source
Allow Boolean reloptions to have ternary values
commit : 4d6a66f675815a5d40a650d4dcfb5ddb89c6ad2f
author : Álvaro Herrera <alvherre@kurilemu.de>
date : Wed, 21 Jan 2026 20:06:01 +0100
committer: Álvaro Herrera <alvherre@kurilemu.de>
date : Wed, 21 Jan 2026 20:06:01 +0100 From the user's point of view these are just Boolean values; from the
implementation side we can now distinguish an option that hasn't been
set. Reimplement the vacuum_truncate reloption using this type.
This could also be used for reloptions vacuum_index_cleanup and
buffering, but those additionally need a per-option "alias" for the
state where the variable is unset (currently the value "auto").
Author: Nikolay Shaplov <dhyan@nataraj.su>
Reviewed-by: Timur Magomedov <t.magomedov@postgrespro.ru>
Reviewed-by: Nathan Bossart <nathandbossart@gmail.com>
Discussion: https://postgr.es/m/3474141.usfYGdeWWP@thinkpad-pgpro M src/backend/access/common/reloptions.c
M src/backend/commands/vacuum.c
M src/include/access/reloptions.h
M src/include/postgres.h
M src/include/utils/rel.h
M src/test/modules/dummy_index_am/README
M src/test/modules/dummy_index_am/dummy_index_am.c
M src/test/modules/dummy_index_am/expected/reloptions.out
M src/test/modules/dummy_index_am/sql/reloptions.sql
M src/test/regress/expected/reloptions.out
M src/test/regress/sql/reloptions.sql
M src/tools/pgindent/typedefs.list
Remove useless flag PVC_INCLUDE_CONVERTROWTYPES.
commit : cec5fe0d1e192b3b0005063011f113ac99f6908c
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Wed, 21 Jan 2026 13:26:19 -0500
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Wed, 21 Jan 2026 13:26:19 -0500 This was introduced in the SJE patch (fc069a3a6), but it doesn't
do anything because pull_var_clause() never tests it. Apparently
it snuck in from somebody's private fork. Remove it again, but
only in HEAD -- seems best to let it be in v18.
Author: Alexander Pyhalov <a.pyhalov@postgrespro.ru>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/70008c19d22e3dd1565ca57f8436c0ba@postgrespro.ru M src/backend/optimizer/path/equivclass.c
M src/include/optimizer/optimizer.h
amcheck: Fix snapshot usage in bt_index_parent_check
commit : 1f28982e409451249646910e585469076c43ba8f
author : Álvaro Herrera <alvherre@kurilemu.de>
date : Wed, 21 Jan 2026 18:55:43 +0100
committer: Álvaro Herrera <alvherre@kurilemu.de>
date : Wed, 21 Jan 2026 18:55:43 +0100 We were using SnapshotAny to do some index checks, but that's wrong and
causes spurious errors when used on indexes created by CREATE INDEX
CONCURRENTLY. Fix it to use an MVCC snapshot, and add a test for it.
Backpatch of 6bd469d26aca to branches 14-16. I previously misidentified
the bug's origin: it came in with commit 7f563c09f890 (pg11-era, not
5ae2087202af as claimed previously), so all live branches are affected.
Also take the opportunity to fix some comments that we failed to update
in the original commits and apply pgperltidy. In branch 14, remove the
unnecessary test plan specification (which would have need to have been
changed anyway; c.f. commit 549ec201d613.)
Diagnosed-by: Donghang Lin <donghanglin@gmail.com>
Author: Mihail Nikalayeu <mihailnikalayeu@gmail.com>
Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Backpatch-through: 17
Discussion: https://postgr.es/m/CANtu0ojmVd27fEhfpST7RG2KZvwkX=dMyKUqg0KM87FkOSdz8Q@mail.gmail.com M contrib/amcheck/t/002_cic.pl
M contrib/amcheck/verify_nbtree.c
Remove more leftovers of AIX support
commit : e6bb491bf2aa96e4cfb879641bd765b5f6312c3c
author : Peter Eisentraut <peter@eisentraut.org>
date : Wed, 21 Jan 2026 14:45:20 +0100
committer: Peter Eisentraut <peter@eisentraut.org>
date : Wed, 21 Jan 2026 14:45:20 +0100 The make variables MKLDEXPORT and POSTGRES_IMP were only used for AIX,
so they should have been removed with commit 0b16bb8776b.
Reviewed-by: Heikki Linnakangas <hlinnaka@iki.fi>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://www.postgresql.org/message-id/flat/7a48b624-2236-4e11-9b9d-6a3c658d77a1%40eisentraut.org M src/backend/Makefile
pg_stat_statements: Add more tests for level tracking
commit : 1572ea96e65731eee3227fbc3c119bd9f39e8e50
author : Michael Paquier <michael@paquier.xyz>
date : Wed, 21 Jan 2026 18:18:15 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Wed, 21 Jan 2026 18:18:15 +0900 This commit adds tests to verify the computation of the nesting level
for two code paths: the planner hook and the ExecutorFinish() hook. The
nesting level is essential to save a correct "toplevel" status for the
added PGSS entries.
The author has noticed that removing the manipulations of nesting_level
in these two code paths did not cause the tests to complain, meaning
that we never had coverage for the assumptions taken by the code.
Author: Sami Imseih <samimseih@gmail.com>
Discussion: https://postgr.es/m/CAA5RZ0uK1PSrgf52bWCtDpzaqbWt04o6ZA7zBm6UQyv7vyvf9w@mail.gmail.com M contrib/pg_stat_statements/expected/level_tracking.out
M contrib/pg_stat_statements/sql/level_tracking.sql
Fix for C++ compatibility
commit : b4555cb070f134c04328df54ce31d4ef1970f3bb
author : Peter Eisentraut <peter@eisentraut.org>
date : Wed, 21 Jan 2026 08:32:45 +0100
committer: Peter Eisentraut <peter@eisentraut.org>
date : Wed, 21 Jan 2026 08:32:45 +0100 After commit 476b35d4e31, some buildfarm members are complaining about
not recognizing _Noreturn when building the new C++ module
test_cplusplusext. This is not a C++ feature, but it was gated like
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L
#define pg_noreturn _Noreturn
But apparently that was not sufficient. Some platforms define
__STDC_VERSION__ even in C++ mode. (In this particular case, it was
g++ on Solaris, but apparently this is also done by some other
platforms, and it is allowed by the C++ standard.) To fix, add a
... && !defined(__cplusplus)
Reviewed-by: Andres Freund <andres@anarazel.de>
Discussion: https://www.postgresql.org/message-id/flat/CAGECzQR21OnnKiZO_1rLWO0-16kg1JBxnVq-wymYW0-_1cUNtg@mail.gmail.com M src/include/c.h
Update some comments for fasthash
commit : 7892e25924719097d96940d38e3aec862adc9e59
author : John Naylor <john.naylor@postgresql.org>
date : Wed, 21 Jan 2026 14:11:40 +0700
committer: John Naylor <john.naylor@postgresql.org>
date : Wed, 21 Jan 2026 14:11:40 +0700 - Add advice about hashing multiple inputs with the incremental API
- Generalize statements that were specific to C strings to include
all variable length inputs, where applicable.
- Update comments about the standalone functions and make it easy to
find them.
Reported-by: Robert Haas <robertmhaas@gmail.com>
Reviewed-by: zengman <zengman@halodbtech.com>
Discussion: https://postgr.es/m/CANWCAZZgKnf8dNOd_w03n88NqOfmMnMv2=D8_Oy6ADGyiMq+cg@mail.gmail.com
Discussion: https://postgr.es/m/CANWCAZa-2mEUY27xBw2TpsybpvVu3Ez4ABrHCBqZpAs_UDTj2Q@mail.gmail.com M src/include/common/hashfn_unstable.h
Improve errdetail for logical replication conflict messages.
commit : 48efefa6caacba49ca5b7b84e20c900776e56c50
author : Amit Kapila <akapila@postgresql.org>
date : Wed, 21 Jan 2026 04:58:03 +0000
committer: Amit Kapila <akapila@postgresql.org>
date : Wed, 21 Jan 2026 04:58:03 +0000 This change enhances the clarity and usefulness of error detail messages
generated during logical replication conflicts. The following improvements
have been made:
1. Eliminate redundant output: Avoid printing duplicate remote row and
replica identity values for the multiple_unique_conflicts conflict type.
2. Improve message structure: Append tuple values directly to the main
error message, separated by a colon (:), for better readability.
3. Simplify local row terminology: Remove the word 'existing' when
referring to the local row, as this is already implied by context.
4. General code refinements: Apply miscellaneous code cleanups to improve
how conflict detail messages are constructed and formatted.
Author: Hayato Kuroda <kuroda.hayato@fujitsu.com>
Reviewed-by: Shveta Malik <shveta.malik@gmail.com>
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>
Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com>
Reviewed-by: Zhijie Hou <houzj.fnst@fujitsu.com>
Discussion: https://postgr.es/m/CAHut+Psgkwy5-yGRJC15izecySGGysrbCszv_z93ess8XtCDOQ@mail.gmail.com M doc/src/sgml/logical-replication.sgml
M src/backend/replication/logical/conflict.c
M src/include/replication/conflict.h
M src/test/subscription/t/001_rep_changes.pl
M src/test/subscription/t/013_partition.pl
M src/test/subscription/t/029_on_error.pl
M src/test/subscription/t/030_origin.pl
M src/test/subscription/t/035_conflicts.pl
pg_stat_statements: Clean up REGRESS list in Makefile
commit : 905ef401d5e068a1e6d246f9d96435c9d750c8be
author : Michael Paquier <michael@paquier.xyz>
date : Wed, 21 Jan 2026 11:29:34 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Wed, 21 Jan 2026 11:29:34 +0900 The "wal" and "entry_timestamp" items were still on the same line, which
was not intentional.
Thinko in f9afd56218af.
Reported-by: Man Zeng <zengman@halodbtech.com>
Discussion: https://postgr.es/m/aW6_Xc8auuu5iAPi@paquier.xyz M contrib/pg_stat_statements/Makefile
pg_stat_statements: Rework test order
commit : f9afd56218af0d704c12540a1b5e893d196f6aa7
author : Michael Paquier <michael@paquier.xyz>
date : Wed, 21 Jan 2026 07:47:38 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Wed, 21 Jan 2026 07:47:38 +0900 The test "squashing" was the last item of the REGRESS list, but
"cleanup" should be the second to last, dropping the extension.
"oldextversions" is the last item.
In passing, the REGRESS list is cleaned up to include one item per line,
so as diffs are minimized when adding new test files.
Noticed while playing with this area of the code.
Reviewed-by: Álvaro Herrera <alvherre@kurilemu.de>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Man Zeng <zengman@halodbtech.com>
Discussion: https://postgr.es/m/aW6_Xc8auuu5iAPi@paquier.xyz M contrib/pg_stat_statements/Makefile
M contrib/pg_stat_statements/expected/squashing.out
M contrib/pg_stat_statements/meson.build
M contrib/pg_stat_statements/sql/squashing.sql
tests: Add a test C++ extension module
commit : 476b35d4e311a3d77a550280d93393e518908b27
author : Peter Eisentraut <peter@eisentraut.org>
date : Tue, 20 Jan 2026 16:24:57 +0100
committer: Peter Eisentraut <peter@eisentraut.org>
date : Tue, 20 Jan 2026 16:24:57 +0100 While we already test that our headers are valid C++ using
headerscheck, it turns out that the macros we define might still
expand to invalid C++ code. This adds a minimal test extension that
is compiled using C++ to test that it's actually possible to build and
run extensions written in C++. Future commits will improve C++
compatibility of some of our macros and add usage of them to this
extension make sure that they don't regress in the future.
The test module is for the moment disabled when using MSVC. In
particular, the use of designated initializers in PG_MODULE_MAGIC
would require C++20, for which we are currently not set up. (GCC and
Clang support it as extensions.) It is planned to fix this.
Author: Jelte Fennema-Nio <postgres@jeltef.nl>
Discussion: https://www.postgresql.org/message-id/flat/CAGECzQR21OnnKiZO_1rLWO0-16kg1JBxnVq-wymYW0-_1cUNtg@mail.gmail.com M configure
M configure.ac
M src/Makefile.global.in
M src/makefiles/meson.build
M src/test/modules/Makefile
M src/test/modules/meson.build
A src/test/modules/test_cplusplusext/.gitignore
A src/test/modules/test_cplusplusext/Makefile
A src/test/modules/test_cplusplusext/README
A src/test/modules/test_cplusplusext/expected/test_cplusplusext.out
A src/test/modules/test_cplusplusext/meson.build
A src/test/modules/test_cplusplusext/sql/test_cplusplusext.sql
A src/test/modules/test_cplusplusext/test_cplusplusext–1.0.sql
A src/test/modules/test_cplusplusext/test_cplusplusext.control
A src/test/modules/test_cplusplusext/test_cplusplusext.cpp
Use integer backend type when exec'ing a postmaster child
commit : f1cd34f95272fe62aa9378f9164431399e94a135
author : Álvaro Herrera <alvherre@kurilemu.de>
date : Tue, 20 Jan 2026 16:41:04 +0100
committer: Álvaro Herrera <alvherre@kurilemu.de>
date : Tue, 20 Jan 2026 16:41:04 +0100 This way we don't have to walk the entire process type array and
strcmp() the string with the names therein. The integer value can be
directly used as array index instead.
Author: Álvaro Herrera <alvherre@kurilemu.de>
Reviewed-by: Euler Taveira <euler@eulerto.com>
Discussion: https://postgr.es/m/202512090935.k3xrtr44hxkn@alvherre.pgsql M src/backend/postmaster/launch_backend.c
Remove redundant pg_unreachable() after elog(ERROR) from ExecWaitStmt()
commit : 30776ca46865f9e04ff6eb5cfdd64eb8bf5c4ff1
author : Alexander Korotkov <akorotkov@postgresql.org>
date : Tue, 20 Jan 2026 16:10:25 +0200
committer: Alexander Korotkov <akorotkov@postgresql.org>
date : Tue, 20 Jan 2026 16:10:25 +0200 elog(ERROR) never returns. Compilers don't always understand this. So,
sometimes, we have to append pg_unreachable() to keep the compiler quiet
about returning from a non-void function without a value. But
pg_unreachable() is redundant for ExecWaitStmt(), which is void.
Reported-by: Peter Eisentraut <peter@eisentraut.org>
Author: Xuneng Zhou <xunengzhou@gmail.com>
Discussion: https://postgr.es/m/8d72a2b3-7423-4a15-a981-e130bf60b1a6%40eisentraut.org
Discussion: https://postgr.es/m/CABPTF7UcuVD0L-X%3DjZFfeygjPaZWWkVRwtWOaJw2tcXbEN2xsA%40mail.gmail.com M src/backend/commands/wait.c
Fix concurrent sequence drops during sequence synchronization.
commit : 1ba3eee89a7534a895187f6484f2f5e04f9c3c62
author : Amit Kapila <akapila@postgresql.org>
date : Tue, 20 Jan 2026 09:40:13 +0000
committer: Amit Kapila <akapila@postgresql.org>
date : Tue, 20 Jan 2026 09:40:13 +0000 A recent BF failure showed that commit 7a485bd641 did not handle the case
where a sequence is dropped concurrently during sequence synchronization
on the subscriber. Previously, pg_get_sequence_data() would ERROR out if
the sequence was dropped concurrently. After 7a485bd641, it instead
returns NULL, which leads to an assertion failure on the subscriber.
To handle this change, update sequence synchronization to skip sequences
for which pg_get_sequence_data() returns NULL.
Author: vignesh C <vignesh21@gmail.com>
Reviewed-by: Hayato Kuroda <kuroda.hayato@fujitsu.com>
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>
Discussion: https://postgr.es/m/CALDaNm0FoGdt+1mzua0t-=wYdup5_zmFrvfNf-L=MGBnj9HAcg@mail.gmail.com M src/backend/replication/logical/sequencesync.c
Add routine to free MCVList
commit : 7ebb64c557570647e3fcf6f5f1549e882ed26489
author : Michael Paquier <michael@paquier.xyz>
date : Tue, 20 Jan 2026 13:13:47 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Tue, 20 Jan 2026 13:13:47 +0900 This addition is in the same spirit as 32e27bd32082 for MVNDistinct and
MVDependencies, except that we were missing a free routine for the third
type of extended statistics, MCVList. I was not sure if we needed an
equivalent for MCVList, but after more review of the main patch set for
the import of extended statistics, it has become clear that we do.
This is introduced as its own change as this routine can be useful on
its own. This one is a piece that has not been written by Corey
Huinker, I have just noticed it by myself on the way.
Author: Michael Paquier <michael@paquier.xyz>
Discussion: https://postgr.es/m/CADkLM=dpz3KFnqP-dgJ-zvRvtjsa8UZv8wDAQdqho=qN3kX0Zg@mail.gmail.com M src/backend/statistics/mcv.c
M src/include/statistics/extended_stats_internal.h
doc: revert "xreflabel" used for PL/Python & libpq chapters
commit : 2e937eeb93af7539f2d65abc170d1c0369d46f12
author : Bruce Momjian <bruce@momjian.us>
date : Mon, 19 Jan 2026 22:59:10 -0500
committer: Bruce Momjian <bruce@momjian.us>
date : Mon, 19 Jan 2026 22:59:10 -0500 This reverts d8aa21b74ff, which was added for the PG 18 release notes,
and adjusts the PG 18 release notes for this change. This is necessary
since the "xreflabel" affected other references to these chapters.
Reported-by: Robert Treat
Author: Robert Treat
Discussion: https://postgr.es/m/CABV9wwNEZDdp5QtrW5ut0H+MOf6U1PvrqBqmgSTgcixqk+Q73A@mail.gmail.com
Backpatch-through: 18 M doc/src/sgml/libpq.sgml
M doc/src/sgml/plpython.sgml
pg_stat_statements: Fix crash in list squashing with Vars
commit : 5d95219faa1a95b78202be9e25bdb2aeb30cb4dc
author : Michael Paquier <michael@paquier.xyz>
date : Tue, 20 Jan 2026 08:11:12 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Tue, 20 Jan 2026 08:11:12 +0900 When IN/ANY clauses contain both constants and variable expressions, the
optimizer transforms them into separate structures: constants become
an array expression while variables become individual OR conditions.
This transformation was creating an overlap with the token locations,
causing pg_stat_statements query normalization to crash because it
could not calculate the amount of bytes remaining to write for the
normalized query.
This commit disables squashing for mixed IN list expressions when
constructing a scalar array op, by setting list_start and list_end
to -1 when both variables and non-variables are present. Some
regression tests are added to PGSS to verify these patterns.
Author: Sami Imseih <samimseih@gmail.com>
Reviewed-by: Dmitry Dolgov <9erthalion6@gmail.com>
Discussion: https://postgr.es/m/CAA5RZ0ts9qiONnHjjHxPxtePs22GBo4d3jZ_s2BQC59AN7XbAA@mail.gmail.com
Backpatch-through: 18 M contrib/pg_stat_statements/expected/squashing.out
M contrib/pg_stat_statements/sql/squashing.sql
M src/backend/parser/parse_expr.c
Don't set the truncation block length greater than RELSEG_SIZE.
commit : ecd275718be0908c8f5af871d28052e7e71c729e
author : Robert Haas <rhaas@postgresql.org>
date : Mon, 19 Jan 2026 12:02:08 -0500
committer: Robert Haas <rhaas@postgresql.org>
date : Mon, 19 Jan 2026 12:02:08 -0500 When faced with a relation containing more than 1 physical segment
(i.e. >1GB, with normal settings), the previous code could compute a
truncation block length greater than RELSEG_SIZE, which could lead to
restore failures of this form:
file "%s" has truncation block length %u in excess of segment size %u
The fix is simply to clamp the maximum computed truncation_block_length
to RELSEG_SiZE. I have also added some comments to clarify the logic.
The test case was written by Oleg Tkachenko, but I have rewritten its
comments.
Reported-by: Oleg Tkachenko <oatkachenko@gmail.com>
Diagnosed-by: Oleg Tkachenko <oatkachenko@gmail.com>
Co-authored-by: Robert Haas <rhaas@postgresql.org>
Co-authored-by: Oleg Tkachenko <oatkachenko@gmail.com>
Reviewed-by: Amul Sul <sulamul@gmail.com>
Backpatch-through: 17
Discussion: http://postgr.es/m/00FEFC88-EA1D-4271-B38F-EB741733A84A@gmail.com M src/backend/backup/basebackup_incremental.c
M src/bin/pg_combinebackup/meson.build
A src/bin/pg_combinebackup/t/011_incremental_backup_truncation_block.pl
Fix unsafe pushdown of quals referencing grouping Vars
commit : 34740b90bc123d645a3a71231b765b778bdcf049
author : Richard Guo <rguo@postgresql.org>
date : Mon, 19 Jan 2026 11:13:23 +0900
committer: Richard Guo <rguo@postgresql.org>
date : Mon, 19 Jan 2026 11:13:23 +0900 When checking a subquery's output expressions to see if it's safe to
push down an upper-level qual, check_output_expressions() previously
treated grouping Vars as opaque Vars. This implicitly assumed they
were stable and scalar.
However, a grouping Var's underlying expression corresponds to the
grouping clause, which may be volatile or set-returning. If an
upper-level qual references such an output column, pushing it down
into the subquery is unsafe. This can cause strange results due to
multiple evaluation of a volatile function, or introduce SRFs into
the subquery's WHERE/HAVING quals.
This patch teaches check_output_expressions() to look through grouping
Vars to their underlying expressions. This ensures that any
volatility or set-returning properties in the grouping clause are
detected, preventing the unsafe pushdown.
We do not need to recursively examine the Vars contained in these
underlying expressions. Even if they reference outputs from
lower-level subqueries (at any depth), those references are guaranteed
not to expand to volatile or set-returning functions, because
subqueries containing such functions in their targetlists are never
pulled up.
Backpatch to v18, where this issue was introduced.
Reported-by: Eric Ridge <eebbrr@gmail.com>
Diagnosed-by: Tom Lane <tgl@sss.pgh.pa.us>
Author: Richard Guo <guofenglinux@gmail.com>
Discussion: https://postgr.es/m/7900964C-F99E-481E-BEE5-4338774CEB9F@gmail.com
Backpatch-through: 18 M src/backend/optimizer/path/allpaths.c
M src/backend/optimizer/util/var.c
M src/test/regress/expected/subselect.out
M src/test/regress/sql/subselect.sql
Update time zone data files to tzdata release 2025c.
commit : 228fe0c3e68ef37b7e083fcb513664b9737c4d93
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Sun, 18 Jan 2026 14:54:33 -0500
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Sun, 18 Jan 2026 14:54:33 -0500 This is pretty pro-forma for our purposes, as the only change
is a historical correction for pre-1976 DST laws in
Baja California. (Upstream made this release mostly to update
their leap-second data, which we don't use.) But with minor
releases coming up, we should be up-to-date.
Backpatch-through: 14 M src/timezone/data/tzdata.zi
Fix error message related to end TLI in backup manifest
commit : 6bca4b50d000e840cad17a9dd6cb46785fb2cedb
author : Michael Paquier <michael@paquier.xyz>
date : Sun, 18 Jan 2026 17:24:25 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Sun, 18 Jan 2026 17:24:25 +0900 The code adding the WAL information included in a backup manifest is
cross-checked with the contents of the timeline history file of the end
timeline. A check based on the end timeline, when it fails, reported
the value of the start timeline in the error message. This error is
fixed to show the correct timeline number in the report.
This error report would be confusing for users if seen, because it would
provide an incorrect information, so backpatch all the way down.
Oversight in 0d8c9c1210c4.
Author: Man Zeng <zengman@halodbtech.com>
Discussion: https://postgr.es/m/tencent_0F2949C4594556F672CF4658@qq.com
Backpatch-through: 14 M src/backend/backup/backup_manifest.c
Remove useless asserts in report_namespace_conflict()
commit : 2a6ce34b55e1cbb16a507c2e90c626eef71018b7
author : Michael Paquier <michael@paquier.xyz>
date : Sun, 18 Jan 2026 16:11:46 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Sun, 18 Jan 2026 16:11:46 +0900 An assertion is used in this routine to check that a valid namespace OID
is given by the caller, but it was repeated twice: once at the top of
the routine and a second time multiple times in a switch/case. This
commit removes the assertions within the switch/case.
Thinko in commit 765cbfdc9263.
Author: Man Zeng <zengman@halodbtech.com>
Reviewed-by: Kirill Reshke <reshkekirill@gmail.com>
Discussion: https://postgr.es/m/tencent_40F8C1D82E2EE28065009AAA@qq.com M src/backend/commands/alter.c
Fix PL/Python build on MSVC with older Meson
commit : 6831cd9e3b082d7b830c3196742dd49e3540c49b
author : Peter Eisentraut <peter@eisentraut.org>
date : Fri, 16 Jan 2026 17:21:32 +0100
committer: Peter Eisentraut <peter@eisentraut.org>
date : Fri, 16 Jan 2026 17:21:32 +0100 Amendment for commit 2bc60f86219. With older Meson versions, we need
to specify the Python include directory directly to cc.check_header
instead of relying on the dependency to pass it through.
Author: Bryan Green <dbryan.green@gmail.com>
Discussion: https://www.postgresql.org/message-id/0de98c41-4145-44c1-aac5-087cf5b3e4a9%40gmail.com M meson.build
Fix crash in test function on removable_cutoff(NULL)
commit : 71379663fe25aa90049726e913f48daa30a03ff0
author : Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Fri, 16 Jan 2026 14:42:22 +0200
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Fri, 16 Jan 2026 14:42:22 +0200 The function is part of the injection_points test module and only used
in tests. None of the current tests call it with a NULL argument, but
it is supposed to work.
Backpatch-through: 17 M src/test/modules/injection_points/regress_injection.c
Fix rare test failure in nbtree_half_dead_pages
commit : 1c64d2fcbe7b27758772c7bc335f29263771ba1d
author : Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Fri, 16 Jan 2026 14:09:22 +0200
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Fri, 16 Jan 2026 14:09:22 +0200 If auto-analyze kicks in at just the right moment, it can hold a
snapshot and prevent the VACUUM command in the test from removing the
deleted tuples. The test needs the tuples to be removed, otherwise no
half-dead page is generated. To fix, introduce a helper procedure to
wait for the removable cutoff to advance, like the one used in the
syscache-update-pruned test for similar purposes.
Thanks to Alexander Lakhin for reproducing and analyzing the test
failure, and Tom Lane for the report.
Discussion: https://www.postgresql.org/message-id/307198.1767408023@sss.pgh.pa.us M src/test/modules/nbtree/expected/nbtree_half_dead_pages.out
M src/test/modules/nbtree/sql/nbtree_half_dead_pages.sql
bufmgr: Avoid spurious compiler warning after fcb9c977aa5
commit : 84705b37273da016633fc5c0a06e848bd6e1e71b
author : Andres Freund <andres@anarazel.de>
date : Fri, 16 Jan 2026 06:58:35 -0500
committer: Andres Freund <andres@anarazel.de>
date : Fri, 16 Jan 2026 06:58:35 -0500 Some compilers, e.g. gcc with -Og or -O1, warn about the wait_event in
BufferLockAcquire() possibly being uninitialized. That can't actually happen,
as the switch() covers all legal lock mode values, but we still need to
silence the warning. We could add a default:, but we'd like to get a warning
if we were to get a new lock mode in the future. So just initialize
wait_event to 0.
Reported-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/934395.1768518154@sss.pgh.pa.us M src/backend/storage/buffer/bufmgr.c
Improve pg_clear_extended_stats() with incorrect relation/stats combination
commit : 395b73c045e02bbe5a33c10f57f528a4468a56f4
author : Michael Paquier <michael@paquier.xyz>
date : Fri, 16 Jan 2026 15:24:59 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Fri, 16 Jan 2026 15:24:59 +0900 Issue fat-fingered in d756fa1019ff, noticed while doing more review of
the main patch set proposed. I have missed the fact that this can be
triggered by specifying an extended stats object that does not match
with the relation specified and already locked. Like the cases where
an object defined in input is missing, the code is changed to issue a
WARNING instead of a confusing cache lookup failure.
A regression test is added to cover this case.
Discussion: https://postgr.es/m/CADkLM=dpz3KFnqP-dgJ-zvRvtjsa8UZv8wDAQdqho=qN3kX0Zg@mail.gmail.com M src/backend/statistics/extended_stats_funcs.c
M src/test/regress/expected/stats_import.out
M src/test/regress/sql/stats_import.sql
Fix rowmark handling for non-relation RTEs during executor init
commit : 889676a0d553974d8f46816844e80e5c9deacd0e
author : Amit Langote <amitlan@postgresql.org>
date : Fri, 16 Jan 2026 14:53:50 +0900
committer: Amit Langote <amitlan@postgresql.org>
date : Fri, 16 Jan 2026 14:53:50 +0900 Commit cbc127917e introduced tracking of unpruned relids to skip
processing of pruned partitions. PlannedStmt.unprunableRelids is
computed as the difference between PlannerGlobal.allRelids and
prunableRelids, but allRelids only contains RTE_RELATION entries.
This means non-relation RTEs (VALUES, subqueries, CTEs, etc.) are
never included in unprunableRelids, and consequently not in
es_unpruned_relids at runtime.
As a result, rowmarks attached to non-relation RTEs were incorrectly
skipped during executor initialization. This affects any DML statement
that has rowmarks on such RTEs, including MERGE with a VALUES or
subquery source, and UPDATE/DELETE with joins against subqueries or
CTEs. When a concurrent update triggers an EPQ recheck, the missing
rowmark leads to incorrect results.
Fix by restricting the es_unpruned_relids membership check to
RTE_RELATION entries only, since partition pruning only applies to
actual relations. Rowmarks for other RTE kinds are now always
processed.
Bug: #19355
Reported-by: Bihua Wang <wangbihua.cn@gmail.com>
Diagnosed-by: Dean Rasheed <dean.a.rasheed@gmail.com>
Diagnosed-by: Tender Wang <tndrwang@gmail.com>
Author: Dean Rasheed <dean.a.rasheed@gmail.com>
Discussion: https://postgr.es/m/19355-57d7d52ea4980dc6@postgresql.org
Backpatch-through: 18 M src/backend/executor/execMain.c
M src/backend/executor/nodeLockRows.c
M src/backend/executor/nodeModifyTable.c
M src/test/isolation/expected/eval-plan-qual.out
M src/test/isolation/specs/eval-plan-qual.spec
Fix segfault from releasing locks in detached DSM segments
commit : 9cbb1d21d67ec3cb2d5342073d220a0c1e0ad82c
author : Amit Langote <amitlan@postgresql.org>
date : Fri, 16 Jan 2026 13:01:52 +0900
committer: Amit Langote <amitlan@postgresql.org>
date : Fri, 16 Jan 2026 13:01:52 +0900 If a FATAL error occurs while holding a lock in a DSM segment (such
as a dshash lock) and the process is not in a transaction, a
segmentation fault can occur during process exit.
The problem sequence is:
1. Process acquires a lock in a DSM segment (e.g., via dshash)
2. FATAL error occurs outside transaction context
3. proc_exit() begins, calling before_shmem_exit callbacks
4. dsm_backend_shutdown() detaches all DSM segments
5. Later, on_shmem_exit callbacks run
6. ProcKill() calls LWLockReleaseAll()
7. Segfault: the lock being released is in unmapped memory
This only manifests outside transaction contexts because
AbortTransaction() calls LWLockReleaseAll() during transaction
abort, releasing locks before DSM cleanup. Background workers and
other non-transactional code paths are vulnerable.
Fix by calling LWLockReleaseAll() unconditionally at the start of
shmem_exit(), before any callbacks run. Releasing locks before
callbacks prevents the segfault - locks must be released before
dsm_backend_shutdown() detaches their memory. This is safe because
after an error, held locks are protecting potentially inconsistent
data anyway, and callbacks can acquire fresh locks if needed.
Also add a comment noting that LWLockReleaseAll() must be safe to
call before LWLock initialization (which it is, since
num_held_lwlocks will be 0), plus an Assert for the post-condition.
This fix aligns with the original design intent from commit
001a573a2, which noted that backends must clean up shared memory
state (including releasing lwlocks) before unmapping dynamic shared
memory segments.
Reported-by: Rahila Syed <rahilasyed90@gmail.com>
Author: Rahila Syed <rahilasyed90@gmail.com>
Reviewed-by: Amit Langote <amitlangote09@gmail.com>
Reviewed-by: Dilip Kumar <dilipbalaut@gmail.com>
Reviewed-by: Andres Freund <andres@anarazel.de>
Reviewed-by: Álvaro Herrera <alvherre@kurilemu.de>
Discussion: https://postgr.es/m/CAH2L28uSvyiosL+kaic9249jRVoQiQF6JOnaCitKFq=xiFzX3g@mail.gmail.com
Backpatch-through: 14 M src/backend/storage/ipc/ipc.c
M src/backend/storage/lmgr/lwlock.c
pg_recvlogical: remove unnecessary OutputFsync() return value checks.
commit : b98cc4a14e538d0bc139f50606249b99cc9215cd
author : Fujii Masao <fujii@postgresql.org>
date : Fri, 16 Jan 2026 12:37:05 +0900
committer: Fujii Masao <fujii@postgresql.org>
date : Fri, 16 Jan 2026 12:37:05 +0900 Commit 1e2fddfa33d changed OutputFsync() so that it always returns true.
However, pg_recvlogical.c still contained checks of its boolean return
value, which are now redundant.
This commit removes those checks and changes the type of return value of
OutputFsync() to void, simplifying the code.
Suggested-by: Yilin Zhang <jiezhilove@126.com>
Author: Fujii Masao <masao.fujii@gmail.com>
Reviewed-by: Mircea Cadariu <cadariu.mircea@gmail.com>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://postgr.es/m/CAHGQGwFeTymZQ7RLvMU6WuDGar8bUQCazg=VOfA-9GeBkg-FzA@mail.gmail.com M src/bin/pg_basebackup/pg_recvlogical.c
Add test for pg_recvlogical reconnection behavior.
commit : d89b1d817513025e2c1f821090c4262fcedf5be2
author : Fujii Masao <fujii@postgresql.org>
date : Fri, 16 Jan 2026 12:36:34 +0900
committer: Fujii Masao <fujii@postgresql.org>
date : Fri, 16 Jan 2026 12:36:34 +0900 This commit adds a test to verify that data already received and flushed by
pg_recvlogical is not streamed again even after the connection is lost,
reestablished, and logical replication is restarted.
Author: Mircea Cadariu <cadariu.mircea@gmail.com>
Co-authored-by: Fujii Masao <masao.fujii@gmail.com>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://postgr.es/m/CAHGQGwFeTymZQ7RLvMU6WuDGar8bUQCazg=VOfA-9GeBkg-FzA@mail.gmail.com M src/bin/pg_basebackup/t/030_pg_recvlogical.pl
Add a new helper function wait_for_file() to Utils.pm.
commit : 0b10969db610c607227b23710d556b595d7eb34a
author : Fujii Masao <fujii@postgresql.org>
date : Fri, 16 Jan 2026 12:35:56 +0900
committer: Fujii Masao <fujii@postgresql.org>
date : Fri, 16 Jan 2026 12:35:56 +0900 wait_for_file() waits for the contents of a specified file, starting at an
optional offset, to match a given regular expression. If no offset is
provided, the entire file is checked. The function times out after
$PostgreSQL::Test::Utils::timeout_default seconds. It returns the total
file length on success.
The existing wait_for_log() function contains almost identical logic, but
is limited to reading the cluster's log file. This commit also refactors
wait_for_log() to call wait_for_file() instead, avoiding code duplication.
This helper will be used by upcoming changes.
Suggested-by: Mircea Cadariu <cadariu.mircea@gmail.com>
Author: Fujii Masao <masao.fujii@gmail.com>
Reviewed-by: Mircea Cadariu <cadariu.mircea@gmail.com>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://postgr.es/m/CAHGQGwFeTymZQ7RLvMU6WuDGar8bUQCazg=VOfA-9GeBkg-FzA@mail.gmail.com M src/test/perl/PostgreSQL/Test/Cluster.pm
M src/test/perl/PostgreSQL/Test/Utils.pm
pg_recvlogical: Prevent flushed data from being re-sent.
commit : 41cbdab0ab6d04e8ec42d10335ef9635eb9c2c67
author : Fujii Masao <fujii@postgresql.org>
date : Fri, 16 Jan 2026 12:35:26 +0900
committer: Fujii Masao <fujii@postgresql.org>
date : Fri, 16 Jan 2026 12:35:26 +0900 Previously, when pg_recvlogical lost connection, reconnected, and restarted
replication, data that had already been flushed could be streamed again.
This happened because the replication start position used when restarting
replication was taken from the last standby status message, which could be
older than the position of the last flushed data. As a result, some flushed
data newer than the replication start position could exist and be re-sent.
This commit fixes the issue by ensuring all written data is flushed to disk
before restarting replication, and by using the last flushed position as
the replication start point. This prevents already flushed data from being
re-sent.
Additionally, previously when the --no-loop option was used, pg_recvlogical
could exit without flushing written data, potentially losing data. To fix
this issue, this commit also ensures all data is flushed to disk before
exiting due to --no-loop.
Author: Fujii Masao <masao.fujii@gmail.com>
Reviewed-by: Mircea Cadariu <cadariu.mircea@gmail.com>
Reviewed-by: Yilin Zhang <jiezhilove@126.com>
Reviewed-by: Dewei Dai <daidewei1970@163.com>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://postgr.es/m/CAHGQGwFeTymZQ7RLvMU6WuDGar8bUQCazg=VOfA-9GeBkg-FzA@mail.gmail.com M src/bin/pg_basebackup/pg_recvlogical.c
Fix stability issue with new TAP test of pg_createsubscriber
commit : a7c63e486050636925f81123b1427f1cb49644a2
author : Michael Paquier <michael@paquier.xyz>
date : Fri, 16 Jan 2026 12:12:26 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Fri, 16 Jan 2026 12:12:26 +0900 The test introduced in 639352d904c8 has added a direct pg_ctl command to
start a node, a method that is incompatible with the teardown() routine
used at the end of the test as the PID saved in the Cluster object would
prevent the node to be shut down. This can ultimately prevent the test
to perform its cleanup, failing on timeout.
Like pg_ctl's 001_start_stop or ssl_passphrase_callback's 001_testfunc,
this commit changes the test so a direct pg_ctl command is used to stop
the rogue node. That should be hopefully enough to cool down the
buildfarm.
Per report from buildfarm member fairywren, which is the only animal
that is showing this issue.
Author: Hayato Kuroda <kuroda.hayato@fujitsu.com>
Discussion: https://postgr.es/m/TY7PR01MB1455452AE9053DD2B77B74FEAF58CA@TY7PR01MB14554.jpnprd01.prod.outlook.com M src/bin/pg_basebackup/t/040_pg_createsubscriber.pl
Add pg_clear_extended_stats()
commit : d756fa1019ff6131944ab263a93a14c4e3b68c39
author : Michael Paquier <michael@paquier.xyz>
date : Fri, 16 Jan 2026 08:13:30 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Fri, 16 Jan 2026 08:13:30 +0900 This function is able to clear the data associated to an extended
statistics object, making things so as the object looks as
newly-created.
The caller of this function needs the following arguments for the
extended stats to clear:
- The name of the relation.
- The schema name of the relation.
- The name of the extended stats object.
- The schema name of the extended stats object.
- If the stats are inherited or not.
The first two parameters are especially important to ensure a consistent
lookup and ACL checks for the relation on which is based the extended
stats object that will be cleared, relying first on a RangeVar lookup
where permissions are checked without locking a relation, critical to
prevent denial-of-service attacks when using this kind of function (see
also 688dc6299a5b for a similar concern). The third to fifth arguments
give a way to target the extended stats records to clear.
This has been extracted from a larger patch by the same author, for a
piece which is again useful on its own. I have rewritten large portions
of it. The tests have been extended while discussing this piece,
resulting on what this commit includes. The intention behind this
feature is to add support for the import of extended statistics across
dumps and upgrades, this change building one piece that we will be able
to rely on for the rest of the changes.
Bump catalog version.
Author: Corey Huinker <corey.huinker@gmail.com>
Co-authored-by: Michael Paquier <michael@paquier.xyz>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://postgr.es/m/CADkLM=dpz3KFnqP-dgJ-zvRvtjsa8UZv8wDAQdqho=qN3kX0Zg@mail.gmail.com M doc/src/sgml/func/func-admin.sgml
M src/backend/statistics/Makefile
A src/backend/statistics/extended_stats_funcs.c
M src/backend/statistics/meson.build
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/test/regress/expected/stats_import.out
M src/test/regress/sql/stats_import.sql
lwlock: Remove support for disowned lwlwocks
commit : d40fd85187d06f7bd16fb4d0067bad0b1d248718
author : Andres Freund <andres@anarazel.de>
date : Thu, 15 Jan 2026 14:54:16 -0500
committer: Andres Freund <andres@anarazel.de>
date : Thu, 15 Jan 2026 14:54:16 -0500 This reverts commit f8d7f29b3e81db59b95e4b5baaa6943178c89fd8, plus parts of
subsequent commits fixing a typo in a parameter name.
Support for disowned lwlocks was added for the benefit of AIO, to be able to
have content locks "owned" by the AIO subsystem. But as of commit fcb9c977aa5,
content locks do not use lwlocks anymore.
It does not seem particularly likely that we need this facility outside of the
AIO use-case, therefore remove the now unused functions.
I did choose to keep the comment added in the aforementioned commit about
lock->owner intentionally being left pointing to the last owner.
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://postgr.es/m/cj5mcjdpucvw4a54hehslr3ctukavrbnxltvuzzhqnimvpju5e@cy3g3mnsefwz M src/backend/storage/lmgr/lwlock.c
M src/include/storage/lwlock.h
lwlock: Remove ForEachLWLockHeldByMe
commit : 55fbfb738b00be8779949595065cb85aa471ea80
author : Andres Freund <andres@anarazel.de>
date : Thu, 15 Jan 2026 14:54:16 -0500
committer: Andres Freund <andres@anarazel.de>
date : Thu, 15 Jan 2026 14:54:16 -0500 As of commit fcb9c977aa5, ForEachLWLockHeldByMe(), introduced in f4ece891fc2f,
is not used anymore, as content locks are now implemented in bufmgr.c. It
doesn't seem that likely that a new user of the functionality will appear all
that soon, making removal of the function seem like the most sensible path. It
can easily be added back if necessary.
Discussion: https://postgr.es/m/lneuyxqxamqoayd2ntau3lqjblzdckw6tjgeu4574ezwh4tzlg%40noioxkquezdw M src/backend/storage/lmgr/lwlock.c
M src/include/storage/lwlock.h
pgindent fix for 8077649907d
commit : 335f2231a30cb5002219888eef14f4dfce5b0391
author : Andres Freund <andres@anarazel.de>
date : Thu, 15 Jan 2026 14:54:16 -0500
committer: Andres Freund <andres@anarazel.de>
date : Thu, 15 Jan 2026 14:54:16 -0500 Per buildfarm member koel.
Backpatch-through: 18 M src/backend/storage/aio/method_io_uring.c
bufmgr: Implement buffer content locks independently of lwlocks
commit : fcb9c977aa5f1eefe7444e423e833ff64a5d1d8f
author : Andres Freund <andres@anarazel.de>
date : Thu, 15 Jan 2026 14:09:08 -0500
committer: Andres Freund <andres@anarazel.de>
date : Thu, 15 Jan 2026 14:09:08 -0500 Until now buffer content locks were implemented using lwlocks. That has the
obvious advantage of not needing a separate efficient implementation of
locks. However, the time for a dedicated buffer content lock implementation
has come:
1) Hint bits are currently set while holding only a share lock. This leads to
having to copy pages while they are being written out if checksums are
enabled, which is not cheap. We would like to add AIO writes, however once
many buffers can be written out at the same time, it gets a lot more
expensive to copy them, particularly because that copy needs to reside in
shared buffers (for worker mode to have access to the buffer).
In addition, modifying buffers while they are being written out can cause
issues with unbuffered/direct-IO, as some filesystems (like btrfs) do not
like that, due to filesystem internal checksums getting corrupted.
The solution to this is to require a new share-exclusive lock-level to set
hint bits and to write out buffers, making those operations mutually
exclusive. We could introduce such a lock-level into the generic lwlock
implementation, however it does not look like there would be other users,
and it does add some overhead into important code paths.
2) For AIO writes we need to be able to race-freely check whether a buffer is
undergoing IO and whether an exclusive lock on the page can be acquired. That
is rather hard to do efficiently when the buffer state and the lock state
are separate atomic variables. This is a major hindrance to allowing writes
to be done asynchronously.
3) Buffer locks are by far the most frequently taken locks. Optimizing them
specifically for their use case is worth the effort. E.g. by merging
content locks into buffer locks we will be able to release a buffer lock
and pin in one atomic operation.
4) There are more complicated optimizations, like long-lived "super pinned &
locked" pages, that cannot realistically be implemented with the generic
lwlock implementation.
Therefore implement content locks inside bufmgr.c. The lockstate is stored as
part of BufferDesc.state. The implementation of buffer content locks is fairly
similar to lwlocks, with a few important differences:
1) An additional lock-level share-exclusive has been added. This lock-level
conflicts with exclusive locks and itself, but not share locks.
2) Error recovery for content locks is implemented as part of the already
existing private-refcount tracking mechanism in combination with resowners,
instead of a bespoke mechanism as the case for lwlocks. This means we do
not need to add dedicated error-recovery code paths to release all content
locks (like done with LWLockReleaseAll() for lwlocks).
3) The lock state is embedded in BufferDesc.state instead of having its own
struct.
4) The wakeup logic is a tad more complicated due to needing to support the
additional lock-level
This commit unfortunately introduces some code that is very similar to the
code in lwlock.c, however the code is not equivalent enough to easily merge
it. The future wins that this commit makes possible seem worth the cost.
As of this commit nothing uses the new share-exclusive lock mode. It will be
used in a future commit. It seemed too complicated to introduce the lock-level
in a separate commit.
It's worth calling out one wart in this commit: Despite content locks not
being lwlocks anymore, they continue to use PGPROC->lw* - that seemed better
than duplicating the relevant infrastructure.
Another thing worth pointing out is that, after this change, content locks are
not reported as LWLock wait events anymore, but as new wait events in the
"Buffer" wait event class (see also 6c5c393b740). The old BufferContent lwlock
tranche has been removed.
Reviewed-by: Melanie Plageman <melanieplageman@gmail.com>
Reviewed-by: Heikki Linnakangas <heikki.linnakangas@iki.fi>
Reviewed-by: Greg Burd <greg@burd.me>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://postgr.es/m/fvfmkr5kk4nyex56ejgxj3uzi63isfxovp2biecb4bspbjrze7@az2pljabhnff M src/backend/storage/buffer/buf_init.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/utils/activity/wait_event_names.txt
M src/include/storage/buf_internals.h
M src/include/storage/bufmgr.h
M src/include/storage/lwlocklist.h
M src/include/storage/proc.h
bufmgr: Change BufferDesc.state to be a 64-bit atomic
commit : dac328c8a682d38b509b8fd966b280c5f47ea287
author : Andres Freund <andres@anarazel.de>
date : Thu, 15 Jan 2026 12:53:50 -0500
committer: Andres Freund <andres@anarazel.de>
date : Thu, 15 Jan 2026 12:53:50 -0500 This is motivated by wanting to merge buffer content locks into
BufferDesc.state in a future commit, rather than having a separate lwlock (see
commit c75ebc657ff for more details). As this change is rather mechanical, it
seems to make sense to split it out into a separate commit, for easier review.
Reviewed-by: Melanie Plageman <melanieplageman@gmail.com>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://postgr.es/m/fvfmkr5kk4nyex56ejgxj3uzi63isfxovp2biecb4bspbjrze7@az2pljabhnff M contrib/pg_buffercache/pg_buffercache_pages.c
M contrib/pg_prewarm/autoprewarm.c
M src/backend/storage/buffer/buf_init.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/buffer/freelist.c
M src/backend/storage/buffer/localbuf.c
M src/include/storage/buf_internals.h
M src/include/storage/procnumber.h
M src/test/modules/test_aio/test_aio.c
Optimize LISTEN/NOTIFY via shared channel map and direct advancement.
commit : 282b1cde9dedf456ecf02eb27caf086023a7bb71
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Thu, 15 Jan 2026 14:12:03 -0500
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Thu, 15 Jan 2026 14:12:03 -0500 This patch reworks LISTEN/NOTIFY to avoid waking backends that have
no need to process the notification messages we just sent.
The primary change is to create a shared hash table that tracks
which processes are listening to which channels (where a "channel" is
defined by a database OID and channel name). This allows a notifying
process to accurately determine which listeners are interested,
replacing the previous weak approximation that listeners in other
databases couldn't be interested.
Secondly, if a listener is known not to be interested and is
currently stopped at the old queue head, we avoid waking it at all
and just directly advance its queue pointer past the notifications
we inserted.
These changes permit very significant improvements (integer multiples)
in NOTIFY throughput, as well as a noticeable reduction in latency,
when there are many listeners but only a few are interested in any
specific message. There is no improvement for the simplest case where
every listener reads every message, but any loss seems below the noise
level.
Author: Joel Jacobson <joel@compiler.org>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/6899c044-4a82-49be-8117-e6f669765f7e@app.fastmail.com M src/backend/commands/async.c
M src/backend/utils/activity/wait_event_names.txt
M src/include/storage/lwlocklist.h
M src/test/isolation/expected/async-notify.out
M src/test/isolation/specs/async-notify.spec
M src/tools/pgindent/typedefs.list
Fix 'unexpected data beyond EOF' on replica restart
commit : 23b25586dccfe81b6ac46ba8b4e505d48192732b
author : Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Thu, 15 Jan 2026 20:57:12 +0200
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Thu, 15 Jan 2026 20:57:12 +0200 On restart, a replica can fail with an error like 'unexpected data
beyond EOF in block 200 of relation T/D/R'. These are the steps to
reproduce it:
- A relation has a size of 400 blocks.
- Blocks 201 to 400 are empty.
- Block 200 has two rows.
- Blocks 100 to 199 are empty.
- A restartpoint is done
- Vacuum truncates the relation to 200 blocks
- A FPW deletes a row in block 200
- A checkpoint is done
- A FPW deletes the last row in block 200
- Vacuum truncates the relation to 100 blocks
- The replica restarts
When the replica restarts:
- The relation on disk starts at 100 blocks, because all the
truncations were applied before restart.
- The first truncate to 200 blocks is replayed. It silently fails, but
it will still (incorrectly!) update the cache size to 200 blocks
- The first FPW on block 200 is applied. XLogReadBufferForRead relies
on the cached size and incorrectly assumes that the page already
exists in the file, and thus won't extend the relation.
- The online checkpoint record is replayed, calling smgrdestroyall
which causes the cached size to be discarded
- The second FPW on block 200 is applied. This time, the detected size
is 100 blocks, an extend is attempted. However, the block 200 is
already present in the buffer cache due to the first FPW. This
triggers the 'unexpected data beyond EOF'.
To fix, update the cached size in SmgrRelation with the current size
rather than the requested new size, when the requested new size is
greater.
Author: Anthonin Bonnefoy <anthonin.bonnefoy@datadoghq.com>
Discussion: https://www.postgresql.org/message-id/CAO6_Xqrv-snNJNhbj1KjQmWiWHX3nYGDgAc=vxaZP3qc4g1Siw@mail.gmail.com
Backpatch-through: 14 M src/backend/storage/smgr/md.c
M src/backend/storage/smgr/smgr.c
Remove #include <math.h> where not needed
commit : 35e3fae738e63f4154814dd51d3806d8d8b7b673
author : Álvaro Herrera <alvherre@kurilemu.de>
date : Thu, 15 Jan 2026 19:09:47 +0100
committer: Álvaro Herrera <alvherre@kurilemu.de>
date : Thu, 15 Jan 2026 19:09:47 +0100 Liujinyang reported the one in binaryheap.c, I then found and analyzed
the rest.
For future patches, we require git archaelogical analysis before we
accept patches of this nature.
Co-authored-by: liujinyang <21043272@qq.com>
Co-authored-by: Álvaro Herrera <alvherre@kurilemu.de>
Discussion: https://postgr.es/m/tencent_6B302BFCAF6F010E00AB5C2C0ECB7AA3F205@qq.com M contrib/btree_gist/btree_numeric.c
M contrib/btree_gist/btree_utils_var.c
M contrib/intarray/_intbig_gist.c
M contrib/ltree/_ltree_gist.c
M src/backend/access/heap/vacuumlazy.c
M src/backend/access/transam/xlogrecovery.c
M src/backend/access/transam/xlogwait.c
M src/backend/commands/define.c
M src/backend/executor/nodeBitmapHeapscan.c
M src/backend/executor/nodeSubplan.c
M src/backend/lib/knapsack.c
M src/backend/nodes/readfuncs.c
M src/backend/optimizer/geqo/geqo_eval.c
M src/backend/optimizer/geqo/geqo_pool.c
M src/backend/optimizer/path/indxpath.c
M src/backend/optimizer/path/joinpath.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/util/pathnode.c
M src/backend/statistics/mcv.c
M src/backend/utils/adt/numutils.c
M src/backend/utils/adt/tid.c
M src/common/binaryheap.c
M src/include/utils/date.h
aio: io_uring: Fix danger of completion getting reused before being read
commit : 8077649907d40b9831358d0c5121a8c58267a988
author : Andres Freund <andres@anarazel.de>
date : Thu, 15 Jan 2026 10:17:51 -0500
committer: Andres Freund <andres@anarazel.de>
date : Thu, 15 Jan 2026 10:17:51 -0500 We called io_uring_cqe_seen(..., cqe) before reading cqe->res. That allows the
completion to be reused, which in turn could lead to cqe->res being
overwritten. The window for that is very narrow and the likelihood of it
happening is very low, as we should never actually utilize all CQEs, but the
consequences would be bad.
This bug was reported to me privately.
Backpatch-through: 18
Discussion: https://postgr.es/m/bwo3e5lj2dgi2wzq4yvbyzu7nmwueczvvzioqsqo6azu6lm5oy@pbx75g2ach3p M src/backend/storage/aio/method_io_uring.c
Wake up autovacuum launcher from postmaster when a worker exits
commit : d9c3c943653740d1df44385c3cd658ed67bb4fb2
author : Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Thu, 15 Jan 2026 18:02:25 +0200
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Thu, 15 Jan 2026 18:02:25 +0200 When an autovacuum worker exits, the launcher needs to be notified
with SIGUSR2, so that it can rebalance and possibly launch a new
worker. The launcher must be notified only after the worker has
finished ProcKill(), so that the worker slot is available for a new
worker. Before this commit, the autovacuum worker was responsible for
that, which required a slightly complicated dance to pass the
launcher's PID from FreeWorkerInfo() to ProcKill() in a global
variable.
Simplify that by moving the responsibility of the signaling to the
postmaster. The postmaster was already doing it when it failed to fork
a worker process, so it seems logical to make it responsible for
notifying the launcher on worker exit too. That's also how the
notification on background worker exit is done.
Reviewed-by: Nathan Bossart <nathandbossart@gmail.com>
Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com>
Reviewed-by: li carol <carol.li2025@outlook.com>
Discussion: https://www.postgresql.org/message-id/a5e27d25-c7e7-45d5-9bac-a17c8f462def@iki.fi M src/backend/postmaster/autovacuum.c
M src/backend/postmaster/postmaster.c
M src/backend/storage/lmgr/proc.c
M src/include/postmaster/autovacuum.h
Add check for invalid offset at multixid truncation
commit : 102bdaa9be13e65de898991f69ddeea517789fb3
author : Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Thu, 15 Jan 2026 16:48:45 +0200
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Thu, 15 Jan 2026 16:48:45 +0200 If a multixid with zero offset is left behind after a crash, and that
multixid later becomes the oldest multixid, truncation might try to
look up its offset and read the zero value. In the worst case, we
might incorrectly use the zero offset to truncate valid SLRU segments
that are still needed. I'm not sure if that can happen in practice, or
if there are some other lower-level safeguards or incidental reasons
that prevent the caller from passing an unwritten multixid as the
oldest multi. But better safe than sorry, so let's add an explicit
check for it.
In stable branches, we should perhaps do the same check for
'oldestOffset', i.e. the offset of the old oldest multixid (in master,
'oldestOffset' is gone). But if the old oldest multixid has an invalid
offset, the damage has been done already, and we would never advance
past that point. It's not clear what we should do in that case. The
check that this commit adds will prevent such an multixid with invalid
offset from becoming the oldest multixid in the first place, which
seems enough for now.
Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Discussion: Discussion: https://www.postgresql.org/message-id/000301b2-5b81-4938-bdac-90f6eb660843@iki.fi
Backpatch-through: 14 M src/backend/access/transam/multixact.c
Remove some unnecessary code from multixact truncation
commit : c4b71e6f60c005b54bd025ee30aaee3f22496622
author : Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Thu, 15 Jan 2026 13:34:50 +0200
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Thu, 15 Jan 2026 13:34:50 +0200 With 64-bit multixact offsets, PerformMembersTruncation() doesn't need
the starting offset anymore. The 'oldestOffset' value that
TruncateMultiXact() calculates is no longer used for anything. Remove
it, and the code to calculate it.
'oldestOffset' was included in the WAL record as 'startTruncMemb',
which sounds nice if you e.g. look at the WAL with pg_waldump, but it
was also confusing because we didn't actually use the value for
determining what to truncate. Replaying the WAL would remove all
segments older than 'endTruncMemb', regardless of
'startTruncMemb'. The 'startTruncOff' stored in the WAL record was
similarly unnecessary even before 64-bit multixid offsets, it was
stored just for the sake of symmetry with 'startTruncMemb'. Remove
both from the WAL record, and rename the remaining 'endTruncOff' to
'oldestMulti' and 'endTruncMemb' to 'oldestOffset', for consistency
with the variable names used for them in other places.
Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Discussion: https://www.postgresql.org/message-id/000301b2-5b81-4938-bdac-90f6eb660843@iki.fi M src/backend/access/rmgrdesc/mxactdesc.c
M src/backend/access/transam/multixact.c
M src/include/access/multixact.h
M src/include/access/xlog_internal.h
plpython: Streamline initialization
commit : da265a87175be469db6c178b57862ad1fb26dd04
author : Peter Eisentraut <peter@eisentraut.org>
date : Thu, 15 Jan 2026 12:11:52 +0100
committer: Peter Eisentraut <peter@eisentraut.org>
date : Thu, 15 Jan 2026 12:11:52 +0100 The initialization of PL/Python (the Python interpreter, the global
state, the plpy module) was arranged confusingly across different
functions with unclear and confusing boundaries. For example,
PLy_init_interp() said "Initialize the Python interpreter ..." but it
didn't actually do this, and PLy_init_plpy() said "initialize plpy
module" but it didn't do that either. After this change, all the
global initialization is called directly from _PG_init(), and the plpy
module initialization is all called from its registered initialization
function PyInit_plpy().
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Matheus Alcantara <matheusssilv97@gmail.com>
Reviewed-by: li carol <carol.li2025@outlook.com>
Reviewed-by: Kirill Reshke <reshkekirill@gmail.com>
Discussion: https://www.postgresql.org/message-id/f31333f1-fbb7-4098-b209-bf2d71fbd4f3%40eisentraut.org M src/pl/plpython/plpy_main.c
M src/pl/plpython/plpy_plpymodule.c
M src/pl/plpython/plpy_plpymodule.h
plpython: Remove duplicate PyModule_Create()
commit : 3263a893fb1d2b36a44c13da701e44c805ed03f6
author : Peter Eisentraut <peter@eisentraut.org>
date : Thu, 15 Jan 2026 10:24:49 +0100
committer: Peter Eisentraut <peter@eisentraut.org>
date : Thu, 15 Jan 2026 10:24:49 +0100 This seems to have existed like this since Python 3 support was
added (commit dd4cd55c158), but it's unclear what this second call is
supposed to accomplish.
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Matheus Alcantara <matheusssilv97@gmail.com>
Reviewed-by: li carol <carol.li2025@outlook.com>
Reviewed-by: Kirill Reshke <reshkekirill@gmail.com>
Discussion: https://www.postgresql.org/message-id/f31333f1-fbb7-4098-b209-bf2d71fbd4f3%40eisentraut.org M src/pl/plpython/plpy_plpymodule.c
plpython: Clean up PyModule_AddObject() uses
commit : 34d8111c3abe97daea014f5587f405cde00d9e48
author : Peter Eisentraut <peter@eisentraut.org>
date : Thu, 15 Jan 2026 10:24:49 +0100
committer: Peter Eisentraut <peter@eisentraut.org>
date : Thu, 15 Jan 2026 10:24:49 +0100 The comments "PyModule_AddObject does not add a refcount to the
object, for some odd reason" seem distracting. Arguably, this
behavior is expected, not odd. Also, the additional references
created by the existing code are apparently not necessary. But we
should clean up the reference in the error case, as suggested by the
Python documentation.
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Matheus Alcantara <matheusssilv97@gmail.com>
Reviewed-by: li carol <carol.li2025@outlook.com>
Reviewed-by: Kirill Reshke <reshkekirill@gmail.com>
Discussion: https://www.postgresql.org/message-id/f31333f1-fbb7-4098-b209-bf2d71fbd4f3%40eisentraut.org M src/pl/plpython/plpy_plpymodule.c
plpython: Remove commented out code
commit : 8cb95a06455446ebc25c6e3b169881955afc3887
author : Peter Eisentraut <peter@eisentraut.org>
date : Thu, 15 Jan 2026 10:24:49 +0100
committer: Peter Eisentraut <peter@eisentraut.org>
date : Thu, 15 Jan 2026 10:24:49 +0100 This code has been commented out since the first commit of plpython.
It doesn't seem worth keeping.
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Matheus Alcantara <matheusssilv97@gmail.com>
Reviewed-by: li carol <carol.li2025@outlook.com>
Reviewed-by: Kirill Reshke <reshkekirill@gmail.com>
Discussion: https://www.postgresql.org/message-id/f31333f1-fbb7-4098-b209-bf2d71fbd4f3%40eisentraut.org M src/pl/plpython/plpy_plpymodule.c
Introduce routines to validate and free MVNDistinct and MVDependencies
commit : 32e27bd320821df49dd212912b9e90d3d98e24f1
author : Michael Paquier <michael@paquier.xyz>
date : Thu, 15 Jan 2026 09:36:05 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Thu, 15 Jan 2026 09:36:05 +0900 These routines are useful to perform some basic validation checks on
each object structure, working currently on attribute numbers for
non-expression and expression attnums. These checks could be extended
in the future.
Note that this code is not used yet in the tree, and that these
functions will become handy for an upcoming patch for the import of
extended statistics data. However, they are worth their own independent
change as they are actually useful by themselves, with at least the
extension code argument in mind (or perhaps I am just feeling more
pedantic today).
Extracted from a larger patch by the same author, with many adjustments
and fixes by me.
Author: Corey Huinker <corey.huinker@gmail.com>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://postgr.es/m/CADkLM=dpz3KFnqP-dgJ-zvRvtjsa8UZv8wDAQdqho=qN3kX0Zg@mail.gmail.com M src/backend/statistics/dependencies.c
M src/backend/statistics/mvdistinct.c
M src/include/statistics/extended_stats_internal.h
Remove redundant assignment in CreateWorkExprContext
commit : ed425b5a200ac00488940f2354d3cf9f11091926
author : Jeff Davis <jdavis@postgresql.org>
date : Wed, 14 Jan 2026 12:01:36 -0800
committer: Jeff Davis <jdavis@postgresql.org>
date : Wed, 14 Jan 2026 12:01:36 -0800 In CreateWorkExprContext(), maxBlockSize is initialized to
ALLOCSET_DEFAULT_MAXSIZE, and it then immediately reassigned,
thus the initialization is a redundant.
Author: Andreas Karlsson <andreas@proxel.se>
Reported-by: Chao Li <lic@highgo.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/83a14f3c-f347-4769-9c01-30030b31f1eb@gmail.com M src/backend/executor/execUtils.c
lwlock: Improve local variable name
commit : 556c92a68972818b24d31d060175ae8131d3297b
author : Andres Freund <andres@anarazel.de>
date : Wed, 14 Jan 2026 11:15:38 -0500
committer: Andres Freund <andres@anarazel.de>
date : Wed, 14 Jan 2026 11:15:38 -0500 In 9a385f61666 I used the variable name new_release_in_progress, but
new_wake_in_progress makes more sense given the flag name.
Suggested-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://postgr.es/m/AC5E365D-7AD9-47AE-B2C6-25756712B188@gmail.com M src/backend/storage/lmgr/lwlock.c
Revert "Replace pg_restrict by standard restrict"
commit : fa16e7fd84886643f480c36614fa11d45fc6d26f
author : Peter Eisentraut <peter@eisentraut.org>
date : Wed, 14 Jan 2026 15:12:25 +0100
committer: Peter Eisentraut <peter@eisentraut.org>
date : Wed, 14 Jan 2026 15:12:25 +0100 This reverts commit f0f2c0c1aef95757c4e7f144d5577e2b0d814279.
The original problem that led to the use of pg_restrict was that MSVC
couldn't handle plain restrict, and defining it to something else
would conflict with its __declspec(restrict) that is used in system
header files. In C11 mode, this is no longer a problem, as MSVC
handles plain restrict. This led to the commit to replace pg_restrict
with restrict. But this did not take C++ into account. Standard C++
does not have restrict, so we defined it as something else (for
example, MSVC supports __restrict). But this then again conflicts
with __declspec(restrict) in system header files. So we have to
revert this attempt. The comments are updated to clarify that the
reason for this is now C++ only.
Reported-by: Jelte Fennema-Nio <postgres@jeltef.nl>
Reviewed-by: Andres Freund <andres@anarazel.de>
Discussion: https://www.postgresql.org/message-id/CAGECzQRoD7chJP1-dneSrhxUJv%2BBRcigoGOO4UwGzaShLot2Yw%40mail.gmail.com M configure
M configure.ac
M meson.build
M src/bin/pg_verifybackup/pg_verifybackup.c
M src/bin/pg_verifybackup/pg_verifybackup.h
M src/common/logging.c
M src/common/string.c
M src/include/c.h
M src/include/common/logging.h
M src/include/common/string.h
M src/include/libpq/pqformat.h
M src/include/pg_config.h.in
doc: Slightly correct advice on C/C++ linkage
commit : 794ba8b6a4c8ce409a37e84444c9519f7f1e5385
author : Peter Eisentraut <peter@eisentraut.org>
date : Wed, 14 Jan 2026 15:05:29 +0100
committer: Peter Eisentraut <peter@eisentraut.org>
date : Wed, 14 Jan 2026 15:05:29 +0100 The documentation was writing that <literal>extern C</literal> should
be used, but it should be <literal>extern "C"</literal>. M doc/src/sgml/xfunc.sgml
Enable Python Limited API for PL/Python on MSVC
commit : 2bc60f86219b00a9ba23efab8f4bb8de21e64e2a
author : Peter Eisentraut <peter@eisentraut.org>
date : Wed, 14 Jan 2026 10:17:36 +0100
committer: Peter Eisentraut <peter@eisentraut.org>
date : Wed, 14 Jan 2026 10:17:36 +0100 Previously, the Python Limited API was disabled on MSVC due to build
failures caused by Meson not knowing to link against python3.lib
instead of python3XX.lib when using the Limited API.
This commit works around the Meson limitation by explicitly finding
and linking against python3.lib on MSVC, and removes the preprocessor
guard that was disabling the Limited API on MSVC in plpython.h.
This requires python3.lib to be present in the Python installation,
which is included when Python is installed.
Author: Bryan Green <dbryan.green@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/ee410de1-1e0b-4770-b125-eeefd4726a24%40eisentraut.org M meson.build
M src/pl/plpython/plpython.h
Reword confusing comment to avoid "typo fixes"
commit : 4196d6178a125f2e80863a7ecd1d918207a9fe7b
author : Álvaro Herrera <alvherre@kurilemu.de>
date : Wed, 14 Jan 2026 10:07:44 +0100
committer: Álvaro Herrera <alvherre@kurilemu.de>
date : Wed, 14 Jan 2026 10:07:44 +0100 Author: Álvaro Herrera <alvherre@kurilemu.de>
Reviewed-by: David Rowley <dgrowleyml@gmail.com>
Reviewed-by: John Naylor <johncnaylorls@gmail.com>
Discussion: https://postgr.es/m/CAApHDvqPmpa53jcTmfU8arFFm7=hB5cFoXX5dcUH=1qV0tRFHA@mail.gmail.com M src/backend/utils/sort/tuplesort.c
Use more consistent *GetDatum() macros for some unsigned numbers
commit : 6dcfac9696cbb72a975ec964e88b78e6e90870c0
author : Michael Paquier <michael@paquier.xyz>
date : Wed, 14 Jan 2026 17:07:49 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Wed, 14 Jan 2026 17:07:49 +0900 This patch switches some code paths to use GetDatum() macros more in
line with the data types of the variables they manipulate. This set of
changes does not fix a problem, but it is always nice to be more
consistent across the board.
Author: Kirill Reshke <reshkekirill@gmail.com>
Reviewed-by: Roman Khapov <rkhapov@yandex-team.ru>
Reviewed-by: Yuan Li <carol.li2025@outlook.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Reviewed-by: Man Zeng <zengman@halodbtech.com>
Discussion: https://postgr.es/m/CALdSSPidtC7j3MwhkqRj0K2hyp36ztnnjSt6qzGxQtiePR1dzw@mail.gmail.com M contrib/pageinspect/btreefuncs.c
M contrib/pageinspect/ginfuncs.c
M contrib/pageinspect/gistfuncs.c
M contrib/pg_buffercache/pg_buffercache_pages.c
M src/backend/access/brin/brin_inclusion.c
M src/backend/access/brin/brin_minmax.c
M src/backend/access/brin/brin_minmax_multi.c
M src/backend/access/gist/gistget.c
M src/backend/utils/adt/lockfuncs.c
Prevent unintended dropping of active replication origins.
commit : e385a4e2fd8ead796014a82dd6165f6027255b46
author : Amit Kapila <akapila@postgresql.org>
date : Wed, 14 Jan 2026 07:13:35 +0000
committer: Amit Kapila <akapila@postgresql.org>
date : Wed, 14 Jan 2026 07:13:35 +0000 Commit 5b148706c5 exposed functionality that allows multiple processes to
use the same replication origin, enabling non-builtin logical replication
solutions to implement parallel apply for large transactions.
With this functionality, if two backends acquire the same replication
origin and one of them resets it first, the acquired_by flag is cleared
without acknowledging that another backend is still actively using the
origin. This can lead to the origin being unintentionally dropped. If the
shared memory for that dropped origin is later reused for a newly created
origin, the remaining backend that still holds a pointer to the old memory
may inadvertently advance the LSN of a completely different origin,
causing unpredictable behavior.
Although the underlying issue predates commit 5b148706c5, it did not
surface earlier because the internal parallel apply worker mechanism
correctly coordinated origin resets and drops.
This commit resolves the problem by introducing a reference counter for
replication origins. The reference count increases when a backend sets the
origin and decreases when it resets it. Additionally, the backend that
first acquires the origin will not release it until all other backends
using the origin have released it as well.
The patch also prevents dropping a replication origin when acquired_by is
zero but the reference counter is nonzero, covering the scenario where the
first session exits without properly releasing the origin.
Author: Hou Zhijie <houzj.fnst@fujitsu.com>
Author: Hayato Kuroda <kuroda.hayato@fujitsu.com>
Reviewed-by: Shveta Malik <shveta.malik@gmail.com>
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>
Discussion: https://postgr.es/m/TY4PR01MB169077EE72ABE9E55BAF162D494B5A@TY4PR01MB16907.jpnprd01.prod.outlook.com
Discussion: https://postgr.es/m/CAMPB6wfe4zLjJL8jiZV5kjjpwBM2=rTRme0UCL7Ra4L8MTVdOg@mail.gmail.com M contrib/test_decoding/expected/parallel_session_origin.out
M contrib/test_decoding/specs/parallel_session_origin.spec
M src/backend/replication/logical/origin.c
pg_waldump: Relax LSN comparison check in TAP test
commit : 4fe1ea7777c8161c655364345d0429cf74f21db4
author : Michael Paquier <michael@paquier.xyz>
date : Wed, 14 Jan 2026 16:02:30 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Wed, 14 Jan 2026 16:02:30 +0900 The test 002_save_fullpage.pl, checking --save-fullpage fails with
wal_consistency_checking enabled, due to the fact that the block saved
in the file has the same LSN as the LSN used in the file name. The test
required that the block LSN is stritly lower than file LSN. This commit
relaxes the check a bit, by allowing the LSNs to match.
While on it, the test name is reworded to include some information about
the file and block LSNs, which is useful for debugging.
Author: Andrey Borodin <x4mmm@yandex-team.ru>
Discussion: https://postgr.es/m/4226AED7-E38F-419B-AAED-9BC853FB55DE@yandex-team.ru
Backpatch-through: 16 M src/bin/pg_waldump/t/002_save_fullpage.pl
bufmgr: Make definitions related to buffer descriptor easier to modify
commit : ff219c19878960d6af3fb8e08789018745f91895
author : Andres Freund <andres@anarazel.de>
date : Tue, 13 Jan 2026 19:38:29 -0500
committer: Andres Freund <andres@anarazel.de>
date : Tue, 13 Jan 2026 19:38:29 -0500 This is in preparation to widening the buffer state to 64 bits, which in turn
is preparation for implementing content locks in bufmgr. This commit aims to
make the subsequent commits a bit easier to review, by separating out
reformatting etc from the actual changes.
Reviewed-by: Melanie Plageman <melanieplageman@gmail.com>
Discussion: https://postgr.es/m/4csodkvvfbfloxxjlkgsnl2lgfv2mtzdl7phqzd4jxjadxm4o5@usw7feyb5bzf M src/include/storage/buf_internals.h
lwlock: Invert meaning of LW_FLAG_RELEASE_OK
commit : 9a385f61666c426f595a953499d5dc9c6e142c9a
author : Andres Freund <andres@anarazel.de>
date : Tue, 13 Jan 2026 19:38:29 -0500
committer: Andres Freund <andres@anarazel.de>
date : Tue, 13 Jan 2026 19:38:29 -0500 Previously, a flag was set to indicate that a lock release should wake up
waiters. Since waking waiters is the default behavior in the majority of
cases, this logic has been inverted. The new LW_FLAG_WAKE_IN_PROGRESS flag is
now set iff wakeups are explicitly inhibited.
The motivation for this change is that in an upcoming commit, content locks
will be implemented independently of lwlocks, with the lock state stored as
part of BufferDesc.state. As all of a buffer's flags are cleared when the
buffer is invalidated, without this change we would have to re-add the
RELEASE_OK flag after clearing the flags; otherwise, the next lock release
would not wake waiters.
It seems good to keep the implementation of lwlocks and buffer content locks
as similar as reasonably possible.
Reviewed-by: Melanie Plageman <melanieplageman@gmail.com>
Discussion: https://postgr.es/m/4csodkvvfbfloxxjlkgsnl2lgfv2mtzdl7phqzd4jxjadxm4o5@usw7feyb5bzf M src/backend/storage/lmgr/lwlock.c
Fix query jumbling with GROUP BY clauses
commit : e217dc7484e5e46f4b9bcef1e1bb03acc4a1834a
author : Michael Paquier <michael@paquier.xyz>
date : Wed, 14 Jan 2026 08:44:12 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Wed, 14 Jan 2026 08:44:12 +0900 RangeTblEntry.groupexprs was marked with the node attribute
query_jumble_ignore, causing a list of GROUP BY expressions to be
ignored during the query jumbling. For example, these two queries could
be grouped together within the same query ID:
SELECT count(*) FROM t GROUP BY a;
SELECT count(*) FROM t GROUP BY b;
However, as such queries use different GROUP BY clauses, they should be
split across multiple entries.
This fixes an oversight in 247dea89f761, that has introduced an RTE for
GROUP BY clauses. Query IDs are documented as being stable across minor
releases, but as this is a regression new to v18 and that we are still
early in its support cycle, a backpatch is exceptionally done as this
has broken a behavior that exists since query jumbling is supported in
core, since its introduction in pg_stat_statements.
The tests of pg_stat_statements are expanded to cover this area, with
patterns involving GROUP BY and GROUPING clauses.
Author: Jian He <jian.universality@gmail.com>
Discussion: https://postgr.es/m/CACJufxEy2W+tCqC7XuJ94r3ivWsM=onKJp94kRFx3hoARjBeFQ@mail.gmail.com
Backpatch-through: 18 M contrib/pg_stat_statements/expected/select.out
M contrib/pg_stat_statements/sql/select.sql
M src/include/nodes/parsenodes.h
doc: Document DEFAULT option in file_fdw.
commit : ad381d0d9244b1490efccca2126ba3f82e144605
author : Fujii Masao <fujii@postgresql.org>
date : Tue, 13 Jan 2026 22:54:45 +0900
committer: Fujii Masao <fujii@postgresql.org>
date : Tue, 13 Jan 2026 22:54:45 +0900 Commit 9f8377f7a introduced the DEFAULT option for file_fdw but did not
update the documentation. This commit adds the missing description of
the DEFAULT option to the file_fdw documentation.
Backpatch to v16, where the DEFAULT option was introduced.
Author: Shinya Kato <shinya11.kato@gmail.com>
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>
Discussion: https://postgr.es/m/CAOzEurT_PE7QEh5xAdb7Cja84Rur5qPv2Fzt3Tuqi=NU0WJsbg@mail.gmail.com
Backpatch-through: 16 M doc/src/sgml/file-fdw.sgml
Fix test_misc/010_index_concurrently_upsert for cache-clobbering builds
commit : 8a47d9ee7fa25bb10b8cde46dc7a4d28e95e354e
author : Álvaro Herrera <alvherre@kurilemu.de>
date : Tue, 13 Jan 2026 10:03:33 +0100
committer: Álvaro Herrera <alvherre@kurilemu.de>
date : Tue, 13 Jan 2026 10:03:33 +0100 The test script added by commit e1c971945d62 failed to handle the case
of cache-clobbering builds (CLOBBER_CACHE_ALWAYS and
CATCACHE_FORCE_RELEASE) properly -- it would only exit a loop on
timeout, which is slow, and unfortunate because I (Álvaro) increased the
timeout for that loop to the complete default TAP test timeout, causing
the buildfarm to report the whole test run as a timeout failure. We can
be much quicker: exit the loop as soon as the backend is seen as waiting
on the injection point.
In this commit we still reduce the timeout (of that loop and a nearby
one just to be safe) to half of the default.
I (Álvaro) had also changed Mihail's "sleep(1)" to "sleep(0.1)", which
apparently turns a 1s sleep into a 0s sleep, because Perl -- probably
making this a busy loop. Use Time::HiRes::usleep instead, like we do in
other tests.
Author: Mihail Nikalayeu <mihailnikalayeu@gmail.com>
Reviewed-by: Álvaro Herrera <alvherre@kurilemu.de>
Discussion: https://postgr.es/m/CADzfLwWOVyJygX6BFuyuhTKkJ7uw2e8OcVCDnf6iqnOFhMPE%2BA%40mail.gmail.com M src/test/modules/test_misc/t/010_index_concurrently_upsert.pl
Improve some comment wording and grammar in extension.c
commit : 94a24b4ee5aa42a80a1aacc8eec1fc6a6938894f
author : John Naylor <john.naylor@postgresql.org>
date : Tue, 13 Jan 2026 12:33:08 +0700
committer: John Naylor <john.naylor@postgresql.org>
date : Tue, 13 Jan 2026 12:33:08 +0700 Noted while looking at reports of grammatical errors.
Reported-by: albert tan <alterttan1223@gmail.com>
Reported-by: Yuan Li(carol) <carol.li2025@outlook.com>
Discussion: https://postgr.es/m/CAEzortnJB7aue6miGT_xU2KLb3okoKgkBe4EzJ6yJ%3DY8LMB7gw%40mail.gmail.com M src/backend/commands/extension.c
Fix error message typo.
commit : a00a25b6ce4e75314e8ba399c69dd9c86e96a99d
author : Jeff Davis <jdavis@postgresql.org>
date : Mon, 12 Jan 2026 19:05:29 -0800
committer: Jeff Davis <jdavis@postgresql.org>
date : Mon, 12 Jan 2026 19:05:29 -0800 Reported-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://postgr.es/m/CAEoWx2mMmm9fTZYgE-r_T-KPTFR1rKO029QV-S-6n=7US_9EMA@mail.gmail.com M src/backend/utils/adt/formatting.c
heapam: Add batch mode mvcc check and use it in page mode
commit : 0b96e734c5904ee26b8f622b3348620dda4bfee5
author : Andres Freund <andres@anarazel.de>
date : Mon, 12 Jan 2026 13:14:58 -0500
committer: Andres Freund <andres@anarazel.de>
date : Mon, 12 Jan 2026 13:14:58 -0500 There are two reasons for doing so:
1) It is generally faster to perform checks in a batched fashion and making
sequential scans faster is nice.
2) We would like to stop setting hint bits while pages are being written
out. The necessary locking becomes visible for page mode scans, if done for
every tuple. With batching, the overhead can be amortized to only happen
once per page.
There are substantial further optimization opportunities along these
lines:
- Right now HeapTupleSatisfiesMVCCBatch() simply uses the single-tuple
HeapTupleSatisfiesMVCC(), relying on the compiler to inline it. We could
instead write an explicitly optimized version that avoids repeated xid
tests.
- Introduce batched version of the serializability test
- Introduce batched version of HeapTupleSatisfiesVacuum
Reviewed-by: Melanie Plageman <melanieplageman@gmail.com>
Discussion: https://postgr.es/m/6rgb2nvhyvnszz4ul3wfzlf5rheb2kkwrglthnna7qhe24onwr@vw27225tkyar M src/backend/access/heap/heapam.c
M src/backend/access/heap/heapam_visibility.c
M src/include/access/heapam.h
M src/tools/pgindent/typedefs.list
heapam: Use exclusive lock on old page in CLUSTER
commit : 852558b9ec9d54194195a7b7418d57e83a2fda70
author : Andres Freund <andres@anarazel.de>
date : Mon, 12 Jan 2026 11:50:05 -0500
committer: Andres Freund <andres@anarazel.de>
date : Mon, 12 Jan 2026 11:50:05 -0500 To be able to guarantee that we can set the hint bit, acquire an exclusive
lock on the old buffer. This is required as a future commit will only allow
hint bits to be set with a new lock level, which is acquired as-needed in a
non-blocking fashion.
We need the hint bits, set in heapam_relation_copy_for_cluster() ->
HeapTupleSatisfiesVacuum(), to be set, as otherwise reform_and_rewrite_tuple()
-> rewrite_heap_tuple() will get confused. Specifically, rewrite_heap_tuple()
checks for HEAP_XMAX_INVALID in the old tuple to determine whether to check
the old-to-new mapping hash table.
It'd be better if we somehow could avoid setting hint bits on the old page. A
common reason to use VACUUM FULL is very bloated tables - rewriting most of
the old table during VACUUM FULL doesn't exactly help.
Reviewed-by: Heikki Linnakangas <heikki.linnakangas@iki.fi>
Reviewed-by: Kirill Reshke <reshkekirill@gmail.com>
Discussion: https://postgr.es/m/4wggb7purufpto6x35fd2kwhasehnzfdy3zdcu47qryubs2hdz@fa5kannykekr M src/backend/access/heap/heapam_handler.c
M src/backend/access/heap/heapam_visibility.c
M src/backend/access/heap/rewriteheap.c
freespace: Don't modify page without any lock
commit : 45f658dacb9c2d333893fcf0d6b5a5e4f8ee5752
author : Andres Freund <andres@anarazel.de>
date : Mon, 12 Jan 2026 11:32:17 -0500
committer: Andres Freund <andres@anarazel.de>
date : Mon, 12 Jan 2026 11:32:17 -0500 Before this commit fsm_vacuum_page() modified the page without any lock on the
page. Historically that was kind of ok, as we didn't rely on the freespace to
really stay consistent and we did not have checksums. But these days pages are
checksummed and there are ways for FSM pages to be included in WAL records,
even if the FSM itself is still not WAL logged. If a FSM page ever were
modified while a WAL record referenced that page, we'd be in trouble, as the
WAL CRC could end up getting corrupted.
The reason to address this right now is a series of patches with the goal to
only allow modifications of pages with an appropriate lock level. Obviously
not having any lock is not appropriate :)
Reviewed-by: Kirill Reshke <reshkekirill@gmail.com>
Discussion: https://postgr.es/m/4wggb7purufpto6x35fd2kwhasehnzfdy3zdcu47qryubs2hdz@fa5kannykekr
Discussion: https://postgr.es/m/e6a8f734-2198-4958-a028-aba863d4a204@iki.fi M src/backend/storage/freespace/freespace.c
Stop including {brin,gin}_tuple.h in tuplesort.h
commit : 225d1df1d299061498182714d207fae77436702c
author : Álvaro Herrera <alvherre@kurilemu.de>
date : Mon, 12 Jan 2026 18:09:36 +0100
committer: Álvaro Herrera <alvherre@kurilemu.de>
date : Mon, 12 Jan 2026 18:09:36 +0100 Doing this meant that those two headers, which are supposed to be
internal to their corresponding index AMs, were being included pretty
much universally, because tuplesort.h is included by execnodes.h which
is very widely used. Stop that, and fix fallout.
We also change indexing.h to no longer include execnodes.h (tuptable.h
is sufficient), and relscan.h to no longer include buf.h (pointless
since c2fe139c201c).
Author: Mario González <gonzalemario@gmail.com>
Discussion: https://postgr.es/m/CAFsReFUcBFup=Ohv_xd7SNQ=e73TXi8YNEkTsFEE2BW7jS1noQ@mail.gmail.com M contrib/pageinspect/gistfuncs.c
M src/backend/access/gin/gininsert.c
M src/backend/catalog/pg_attrdef.c
M src/backend/catalog/pg_largeobject.c
M src/backend/commands/collationcmds.c
M src/backend/commands/user.c
M src/backend/executor/execReplication.c
M src/backend/parser/parse_expr.c
M src/backend/replication/logical/relation.c
M src/backend/replication/logical/sequencesync.c
M src/backend/statistics/stat_utils.c
M src/include/access/relscan.h
M src/include/catalog/indexing.h
M src/include/nodes/execnodes.h
M src/include/utils/tuplesort.h
fuzzystrmatch: use pg_ascii_toupper().
commit : b96a9fd76f321b638e5d4b566718189dc42fc532
author : Jeff Davis <jdavis@postgresql.org>
date : Mon, 12 Jan 2026 08:54:04 -0800
committer: Jeff Davis <jdavis@postgresql.org>
date : Mon, 12 Jan 2026 08:54:04 -0800 fuzzystrmatch is designed for ASCII, so no need to rely on the global
LC_CTYPE setting.
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Discussion: https://postgr.es/m/dd0cdd1f-e786-426e-b336-1ffa9b2f1fc6%40eisentraut.org M contrib/fuzzystrmatch/fuzzystrmatch.c
Move instrumentation-related structs to instrument_node.h
commit : 2defd00062555c03f7ac4d8f004b98b36b876c5d
author : Álvaro Herrera <alvherre@kurilemu.de>
date : Mon, 12 Jan 2026 16:59:28 +0100
committer: Álvaro Herrera <alvherre@kurilemu.de>
date : Mon, 12 Jan 2026 16:59:28 +0100 Some structs and enums related to parallel query instrumentation had
organically grown scattered across various files, and were causing
header pollution especially through execnodes.h. Create a single file
where they can live together.
This only moves the structs to the new file; cleaning up the pollution
by removing no-longer-necessary cross-header inclusion will be done in
future commits.
Co-authored-by: Álvaro Herrera <alvherre@kurilemu.de>
Co-authored-by: Mario González <gonzalemario@gmail.com>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://postgr.es/m/202510051642.wwmn4mj77wch@alvherre.pgsql
Discussion: https://postgr.es/m/CAFsReFUr4KrQ60z+ck9cRM4WuUw1TCghN7EFwvV0KvuncTRc2w@mail.gmail.com M contrib/bloom/blscan.c
M src/backend/access/gin/ginscan.c
M src/backend/access/gist/gistget.c
M src/backend/access/hash/hashsearch.c
M src/backend/access/nbtree/nbtsearch.c
M src/backend/access/spgist/spgscan.c
M src/backend/utils/sort/tuplesort.c
M src/include/access/genam.h
A src/include/executor/instrument_node.h
M src/include/nodes/execnodes.h
M src/include/utils/tuplesort.h
Avoid casting void * function arguments
commit : c3c240537f6da498186bfb07017a7b01b9a2c24f
author : Peter Eisentraut <peter@eisentraut.org>
date : Mon, 12 Jan 2026 16:12:56 +0100
committer: Peter Eisentraut <peter@eisentraut.org>
date : Mon, 12 Jan 2026 16:12:56 +0100 In many cases, the cast would silently drop a const qualifier. To
fix, drop the unnecessary cast and let the compiler check the types
and qualifiers. Add const to read-only local variables, preserving
the const qualifiers from the function signatures.
Co-authored-by: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Co-authored-by: Peter Eisentraut <peter@eisentraut.org>
Discussion: https://postgr.es/m/aUQHy/MmWq7c97wK%40ip-10-97-1-34.eu-west-3.compute.internal M src/backend/access/brin/brin_minmax_multi.c
M src/backend/access/common/heaptuple.c
M src/backend/access/heap/pruneheap.c
M src/backend/access/nbtree/nbtpage.c
M src/backend/access/nbtree/nbtpreprocesskeys.c
M src/backend/access/nbtree/nbtsplitloc.c
M src/backend/access/spgist/spgkdtreeproc.c
M src/backend/statistics/extended_stats.c
M src/backend/statistics/mcv.c
M src/backend/tsearch/spell.c
M src/backend/utils/adt/rangetypes_gist.c
M src/backend/utils/adt/rangetypes_spgist.c
M src/backend/utils/adt/rangetypes_typanalyze.c
M src/backend/utils/cache/typcache.c
M src/bin/pg_dump/pg_dump.c
M src/test/modules/injection_points/injection_points.c
Add const to read only TableInfo pointers in pg_dump
commit : 707f905399b4e47c295fe247f76fbbe53c737984
author : Peter Eisentraut <peter@eisentraut.org>
date : Mon, 12 Jan 2026 14:26:26 +0100
committer: Peter Eisentraut <peter@eisentraut.org>
date : Mon, 12 Jan 2026 14:26:26 +0100 Functions that dump table data receive their parameters through const
void * but were casting away const. Add const qualifiers to functions
that only read the table information.
Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Discussion: https://postgr.es/m/aUQHy/MmWq7c97wK%40ip-10-97-1-34.eu-west-3.compute.internal M src/bin/pg_dump/pg_dump.c
Make dmetaphone collation-aware
commit : e39ece0343fef7bf5a689d75bbafff9386e6e3da
author : Peter Eisentraut <peter@eisentraut.org>
date : Mon, 12 Jan 2026 08:35:48 +0100
committer: Peter Eisentraut <peter@eisentraut.org>
date : Mon, 12 Jan 2026 08:35:48 +0100 The dmetaphone() SQL function internally upper-cases the argument
string. It did this using the toupper() function. That way, it has a
dependency on the global LC_CTYPE locale setting, which we want to get
rid of.
The "double metaphone" algorithm specifically supports the "C with
cedilla" letter, so just using ASCII case conversion wouldn't work.
To fix that, use the passed-in collation and use the str_toupper()
function, which has full awareness of collations and collation
providers.
Note that this does not change the fact that this function only works
correctly with single-byte encodings. The change to str_toupper()
makes the case conversion multibyte-enabled, but the rest of the
function is still not ready.
Reviewed-by: Jeff Davis <pgsql@j-davis.com>
Discussion: https://www.postgresql.org/message-id/108e07a2-0632-4f00-984d-fe0e0d0ec726%40eisentraut.org M contrib/fuzzystrmatch/dmetaphone.c
pg_dump: Fix memory leak in dumpSequenceData().
commit : 5d1f5079ab5308373420f0995864c09216de4e8f
author : Nathan Bossart <nathan@postgresql.org>
date : Sun, 11 Jan 2026 13:52:50 -0600
committer: Nathan Bossart <nathan@postgresql.org>
date : Sun, 11 Jan 2026 13:52:50 -0600 Oversight in commit 7a485bd641. Per Coverity.
Backpatch-through: 18 M src/bin/pg_dump/pg_dump.c
doc: Improve description of pg_restore --jobs
commit : 540c39cc56f51b27bff9a6fc78d6524564953c6c
author : Michael Paquier <michael@paquier.xyz>
date : Sun, 11 Jan 2026 15:24:02 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Sun, 11 Jan 2026 15:24:02 +0900 The parameter name used for the option value was named "number-of-jobs",
which was inconsistent with what all the other tools with an option
called --jobs use. This commit updates the parameter name to "njobs".
Author: Tatsuro Yamada <yamatattsu@gmail.com>
Discussion: https://postgr.es/m/CAOKkKFvHqA6Tny0RKkezWVfVV91nPJyj4OGtMi3C1RznDVXqrg@mail.gmail.com M doc/src/sgml/ref/pg_restore.sgml
Fix some typos across the board
commit : 1c0f6c387928a27f6c84cc0b79e141a3b97f4504
author : Michael Paquier <michael@paquier.xyz>
date : Sun, 11 Jan 2026 08:16:46 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Sun, 11 Jan 2026 08:16:46 +0900 Found while browsing the code. M src/test/authentication/t/006_login_trigger.pl
M src/test/regress/expected/sysviews.out
M src/test/regress/sql/sysviews.sql
instrumentation: Keep time fields as instrtime, convert in callers
commit : e5a5e0a90750d665cab417322b9f85c806430d85
author : Andres Freund <andres@anarazel.de>
date : Fri, 9 Jan 2026 12:10:53 -0500
committer: Andres Freund <andres@anarazel.de>
date : Fri, 9 Jan 2026 12:10:53 -0500 Previously the instrumentation logic always converted to seconds, only for
many of the callers to do unnecessary division to get to milliseconds. As an
upcoming refactoring will split the Instrumentation struct, utilize instrtime
always to keep things simpler. It's also a bit faster to not have to first
convert to a double in functions like InstrEndLoop(), InstrAggNode().
Author: Lukas Fittl <lukas@fittl.com>
Reviewed-by: Andres Freund <andres@anarazel.de>
Discussion: https://postgr.es/m/CAP53PkzZ3UotnRrrnXWAv=F4avRq9MQ8zU+bxoN9tpovEu6fGQ@mail.gmail.com M contrib/auto_explain/auto_explain.c
M contrib/pg_stat_statements/pg_stat_statements.c
M src/backend/commands/explain.c
M src/backend/executor/instrument.c
M src/include/executor/instrument.h
M src/include/portability/instr_time.h
Inline ginCompareAttEntries for speed
commit : bba81f9d3d4f512280bd55751a450dac6f02d406
author : Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Fri, 9 Jan 2026 20:31:43 +0200
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Fri, 9 Jan 2026 20:31:43 +0200 It is called in tight loops during GIN index build.
Author: David Geier <geidav.pg@gmail.com>
Discussion: https://www.postgresql.org/message-id/5d366878-2007-4d31-861e-19294b7a583b@gmail.com M src/backend/access/gin/ginutil.c
M src/include/access/gin_private.h
doc: Improve description of publish_via_partition_root
commit : e2aae8d68f6ba13a9ed9b2bd5d324a72a77ebe0b
author : Jacob Champion <jchampion@postgresql.org>
date : Fri, 9 Jan 2026 09:59:15 -0800
committer: Jacob Champion <jchampion@postgresql.org>
date : Fri, 9 Jan 2026 09:59:15 -0800 Reword publish_via_partition_root's opening paragraph. Describe its
behavior more clearly, and directly state that its default is false.
Per complaint by Peter Smith; final text of the patch made in
collaboration with Chao Li.
Author: Chao Li <li.evan.chao@gmail.com>
Author: Peter Smith <peter.b.smith@fujitsu.com>
Reported-by: Peter Smith <peter.b.smith@fujitsu.com>
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>
Discussion: https://postgr.es/m/CAHut%2BPu7SpK%2BctOYoqYR3V4w5LKc9sCs6c_qotk9uTQJQ4zp6g%40mail.gmail.com
Backpatch-through: 14 M doc/src/sgml/ref/create_publication.sgml
Improve "constraint must include all partitioning columns" message.
commit : 7a1d422e39baac3627f5a67e7e16dcc6110830dc
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Fri, 9 Jan 2026 12:59:35 -0500
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Fri, 9 Jan 2026 12:59:35 -0500 This formerly said "unique constraint must ...", which was accurate
enough when it only applied to UNIQUE and PRIMARY KEY constraints.
However, now we use it for exclusion constraints too, and in that
case it's a tad confusing. Do what we already did in the errdetail
message: print the constraint_type, so that it looks like "UNIQUE
constraint ...", "EXCLUDE constraint ...", etc.
Author: jian he <jian.universality@gmail.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/CACJufxH6VhAf65Vghg4T2q315gY=Rt4BUfMyunkfRj0n2S9n-g@mail.gmail.com M src/backend/commands/indexcmds.c
M src/test/regress/expected/indexing.out
pg_dump: Fix gathering of sequence information.
commit : 7a485bd641b7bbf072146b97f70f9eb2c89f606a
author : Nathan Bossart <nathan@postgresql.org>
date : Fri, 9 Jan 2026 10:12:54 -0600
committer: Nathan Bossart <nathan@postgresql.org>
date : Fri, 9 Jan 2026 10:12:54 -0600 Since commit bd15b7db48, pg_dump uses pg_get_sequence_data() (née
pg_sequence_read_tuple()) to gather all sequence data in a single
query as opposed to a query per sequence. Two related bugs have
been identified:
* If the user lacks appropriate privileges on the sequence, pg_dump
generates a setval() command with garbage values instead of
failing as expected.
* pg_dump can fail due to a concurrently dropped sequence, even if
the dropped sequence's data isn't part of the dump.
This commit fixes the above issues by 1) teaching
pg_get_sequence_data() to return nulls instead of erroring for a
missing sequence and 2) teaching pg_dump to fail if it tries to
dump the data of a sequence for which pg_get_sequence_data()
returned nulls. Note that pg_dump may still fail due to a
concurrently dropped sequence, but it should now only do so when
the sequence data is part of the dump. This matches the behavior
before commit bd15b7db48.
Bug: #19365
Reported-by: Paveł Tyślacki <pavel.tyslacki@gmail.com>
Suggested-by: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/19365-6245240d8b926327%40postgresql.org
Discussion: https://postgr.es/m/2885944.1767029161%40sss.pgh.pa.us
Backpatch-through: 18 M src/backend/commands/sequence.c
M src/bin/pg_dump/pg_dump.c
Use IsA() macro in define.c, for sake of consistency.
commit : 24cb3a08a43b5a48f5fba4a83d297218e2e748c5
author : Fujii Masao <fujii@postgresql.org>
date : Fri, 9 Jan 2026 20:24:00 +0900
committer: Fujii Masao <fujii@postgresql.org>
date : Fri, 9 Jan 2026 20:24:00 +0900 Commit 63d1b1cf7f1 replaced a direct nodeTag() comparison with the IsA()
macro in copy.c, but a similar direct comparison remained in define.c.
This commit replaces that comparison with IsA() for consistency.
Author: Fujii Masao <masao.fujii@gmail.com>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Shinya Kato <shinya11.kato@gmail.com>
Reviewed-by: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Discussion: https://postgr.es/m/CAHGQGwGjWGS89_sTx=sbPm0FQemyQQrfTKm=taUhAJFV5k-9cw@mail.gmail.com M src/backend/commands/define.c
Decouple C++ support in Meson's PGXS from LLVM enablement
commit : 69d76fb2ab788d1715c82aece7b1dff10f483882
author : Peter Eisentraut <peter@eisentraut.org>
date : Fri, 9 Jan 2026 10:25:02 +0100
committer: Peter Eisentraut <peter@eisentraut.org>
date : Fri, 9 Jan 2026 10:25:02 +0100 This is important for Postgres extensions that are written in C++,
such as pg_duckdb, which uses PGXS as the build system currently. In
the autotools build, C++ is not coupled to LLVM. If the autotools
build is configured without --with-llvm, the C++ compiler and the
various flags get persisted into the Makefile.global.
Author: Tristan Partin <tristan@partin.io>
Author: Jelte Fennema-Nio <postgres@jeltef.nl>
Discussion: https://www.postgresql.org/message-id/flat/D98JHQF7H2A8.VSE3I4CJBTAB%40partin.io M meson.build
M src/include/meson.build
M src/makefiles/meson.build
ci: Configure g++ with 32-bit for 32-bit build
commit : 831bbb9bf50561283ffb0bb0af1a0871dc227034
author : Peter Eisentraut <peter@eisentraut.org>
date : Fri, 9 Jan 2026 08:58:50 +0100
committer: Peter Eisentraut <peter@eisentraut.org>
date : Fri, 9 Jan 2026 08:58:50 +0100 In future commits, we'll start to make improvements to C++
infrastructure. This requires that for our 32-bit builds we also
build C++ code for the 32-bit architecture.
Author: Jelte Fennema-Nio <postgres@jeltef.nl>
Discussion: https://www.postgresql.org/message-id/flat/D98JHQF7H2A8.VSE3I4CJBTAB%40partin.io M .cirrus.tasks.yml
meson: Rename cpp variable to cxx
commit : 1f08d687c39607d8dfa4bfd0fcb1a6ad47a1ef56
author : Peter Eisentraut <peter@eisentraut.org>
date : Fri, 9 Jan 2026 08:58:23 +0100
committer: Peter Eisentraut <peter@eisentraut.org>
date : Fri, 9 Jan 2026 08:58:23 +0100 Since CPP is also used to mean C PreProcessor in our meson.build
files, it's confusing to use it to also mean C PlusPlus. This uses
the non-ambiguous cxx wherever possible.
Author: Jelte Fennema-Nio <postgres@jeltef.nl>
Discussion: https://www.postgresql.org/message-id/flat/D98JHQF7H2A8.VSE3I4CJBTAB%40partin.io M meson.build
M src/backend/meson.build
Fix possible incorrect column reference in ERROR message
commit : 349107537d22a04c94c6fec5b993461178b39c13
author : David Rowley <drowley@postgresql.org>
date : Fri, 9 Jan 2026 11:01:36 +1300
committer: David Rowley <drowley@postgresql.org>
date : Fri, 9 Jan 2026 11:01:36 +1300 When creating a partition for a RANGE partitioned table, the reporting
of errors relating to converting the specified range values into
constant values for the partition key's type could display the name of a
previous partition key column when an earlier range was specified as
MINVALUE or MAXVALUE.
This was caused by the code not correctly incrementing the index that
tracks which partition key the foreach loop was working on after
processing MINVALUE/MAXVALUE ranges.
Fix by using foreach_current_index() to ensure the index variable is
always set to the List element being worked on.
Author: myzhen <zhenmingyang@yeah.net>
Reviewed-by: zhibin wang <killerwzb@gmail.com>
Discussion: https://postgr.es/m/273cab52.978.19b96fc75e7.Coremail.zhenmingyang@yeah.net
Backpatch-through: 14 M src/backend/parser/parse_utilcmd.c
Remove now-useless btree_gist--1.2.sql script.
commit : b8ccd29152f5e00250869499daab226f6ce55fdd
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Thu, 8 Jan 2026 14:09:58 -0500
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Thu, 8 Jan 2026 14:09:58 -0500 In the wake of the previous commit, this script will fail
if executed via CREATE EXTENSION, so it's useless. Remove it,
but keep the delta scripts, allowing old (even very old)
versions of the btree_gist SQL objects to be upgraded to 1.9
via ALTER EXTENSION UPDATE after a pg_upgrade.
Author: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Matthias van de Meent <boekewurm+postgres@gmail.com>
Reviewed-by: Heikki Linnakangas <hlinnaka@iki.fi>
Discussion: https://postgr.es/m/2483812.1754072263@sss.pgh.pa.us M contrib/btree_gist/Makefile
D contrib/btree_gist/btree_gist–1.2.sql
M contrib/btree_gist/meson.build
Mark GiST inet_ops as opcdefault, and deal with ensuing fallout.
commit : b352d3d80b94269be6e627b5223902fe785d766f
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Thu, 8 Jan 2026 14:03:56 -0500
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Thu, 8 Jan 2026 14:03:56 -0500 This patch completes the transition to making inet_ops be default for
inet/cidr columns, rather than btree_gist's opclasses. Once we do
that, though, pg_upgrade has a big problem. A dump from an older
version will see btree_gist's opclasses as being default, so it will
not mention the opclass explicitly in CREATE INDEX commands, which
would cause the restore to create the indexes using inet_ops. Since
that's not compatible with what's actually in the files, havoc would
ensue.
This isn't readily fixable, because the CREATE INDEX command strings
are built by the older server's pg_get_indexdef() function; pg_dump
hasn't nearly enough knowledge to modify those strings successfully.
Even if we cared to put in the work to make that happen in pg_dump,
it would be counterproductive because the end goal here is to get
people off of these opclasses. Allowing such indexes to persist
through pg_upgrade wouldn't advance that goal.
Therefore, this patch just adds code to pg_upgrade to detect indexes
that would be problematic and refuse to upgrade.
There's another issue too: even without any indexes to worry about,
pg_dump in binary-upgrade mode will reproduce the "CREATE OPERATOR
CLASS ... DEFAULT" commands for btree_gist's opclasses, and those
will fail because now we have a built-in opclass that provides a
conflicting default. We could ask users to drop the btree_gist
extension altogether before upgrading, but that would carry very
severe penalties. It would affect perfectly-valid indexes for other
data types, and it would drop operators that might be relied on in
views or other database objects. Instead, put a hack in DefineOpClass
to ignore the DEFAULT clauses for these opclasses when in
binary-upgrade mode. This will result in installing a version of
btree_gist that isn't quite the version it claims to be, but that can
be fixed by issuing ALTER EXTENSION UPDATE afterwards.
Since we don't apply that hack when not in binary-upgrade mode,
it is now impossible to install any version of btree_gist
less than 1.9 via CREATE EXTENSION.
Author: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Matthias van de Meent <boekewurm+postgres@gmail.com>
Reviewed-by: Heikki Linnakangas <hlinnaka@iki.fi>
Discussion: https://postgr.es/m/2483812.1754072263@sss.pgh.pa.us M doc/src/sgml/btree-gist.sgml
M src/backend/commands/opclasscmds.c
M src/bin/pg_upgrade/check.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_opclass.dat
M src/test/perl/PostgreSQL/Test/AdjustUpgrade.pm
Create btree_gist v1.9, in which inet/cidr opclasses aren't default.
commit : b3b0b45717ef37205b301ae78e288ebeb43fe486
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Thu, 8 Jan 2026 13:56:08 -0500
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Thu, 8 Jan 2026 13:56:08 -0500 btree_gist's gist_inet_ops and gist_cidr_ops opclasses are
fundamentally broken: they rely on an approximate representation of
the inet values and hence sometimes miss rows they should return.
We want to eventually get rid of them altogether, but as the first
step on that journey, we should mark them not-opcdefault.
To do that, roll up the preceding deltas since 1.2 into a new base
script btree_gist--1.9.sql. This will allow installing 1.9 without
going through a transient situation where gist_inet_ops and
gist_cidr_ops are marked as opcdefault; trying to create them that
way will fail if there's already a matching default opclass in the
core system. Additionally provide btree_gist--1.8--1.9.sql, so
that a database that's been pg_upgraded from an older version can
be migrated to 1.9.
I noted along the way that commit 57e3c5160 had missed marking the
gist_bool_ops support functions as PARALLEL SAFE. While that probably
has little harmful effect (since AFAIK we don't check that when
calling index support functions), this seems like a good time to make
things consistent.
Readers will also note that I removed the former habit of installing
some opclass operators/functions with ALTER OPERATOR FAMILY, instead
just rolling them all into the CREATE OPERATOR CLASS steps. The
comment in btree_gist--1.2.sql that it's necessary to use ALTER for
pg_upgrade reproducibility has been obsolete since we invented the
amadjustmembers infrastructure. Nowadays, gistadjustmembers will
force all operators and non-required support functions to have "soft"
opfamily dependencies, regardless of whether they are installed by
CREATE or ALTER.
Author: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Matthias van de Meent <boekewurm+postgres@gmail.com>
Reviewed-by: Heikki Linnakangas <hlinnaka@iki.fi>
Discussion: https://postgr.es/m/2483812.1754072263@sss.pgh.pa.us M contrib/btree_gist/Makefile
A contrib/btree_gist/btree_gist–1.8–1.9.sql
A contrib/btree_gist/btree_gist–1.9.sql
M contrib/btree_gist/btree_gist.control
M contrib/btree_gist/expected/cidr.out
M contrib/btree_gist/expected/inet.out
M contrib/btree_gist/meson.build
M contrib/btree_gist/sql/cidr.sql
M contrib/btree_gist/sql/inet.sql
Use IsA macro, for sake of consistency
commit : 63d1b1cf7f1e3d7834d3914114c23c27023e6840
author : Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Thu, 8 Jan 2026 18:58:28 +0200
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Thu, 8 Jan 2026 18:58:28 +0200 Reported-by: Shinya Kato <shinya11.kato@gmail.com>
Discussion: https://www.postgresql.org/message-id/CAOzEurS=PzRzGba3mpNXgEhbnQFA0dxXaU0ujCJ0aa9yMSH6Pw@mail.gmail.com M src/backend/commands/copy.c
Fix misc typos, mostly in comments
commit : ad853bb877370d406864380491dfe95672867c98
author : Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Thu, 8 Jan 2026 18:10:08 +0200
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Thu, 8 Jan 2026 18:10:08 +0200 The only user-visible change is the fix in the "malformed
pg_dependencies" error detail. That one is new in commit e1405aa5e3ac,
so no backpatching required. M src/backend/replication/slot.c
M src/backend/storage/aio/aio_init.c
M src/backend/storage/ipc/waiteventset.c
M src/backend/tcop/postgres.c
M src/backend/utils/adt/pg_dependencies.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/cache/typcache.c
M src/backend/utils/init/postinit.c
M src/common/unicode_norm.c
M src/include/lib/ilist.h
M src/interfaces/libpq/t/004_load_balance_dns.pl
M src/test/regress/expected/foreign_key.out
M src/test/regress/expected/lock.out
M src/test/regress/expected/partition_join.out
M src/test/regress/expected/pg_dependencies.out
M src/test/regress/expected/without_overlaps.out
M src/test/regress/sql/foreign_key.sql
M src/test/regress/sql/lock.sql
M src/test/regress/sql/partition_join.sql
M src/test/regress/sql/without_overlaps.sql
Improve comments around _bt_checkkeys
commit : d3304921db3022b531208b59581ee02ed0b1e695
author : Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Thu, 8 Jan 2026 18:10:05 +0200
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Thu, 8 Jan 2026 18:10:05 +0200 Discussion: https://www.postgresql.org/message-id/f5388839-99da-465a-8744-23cdfa8ce4db@iki.fi M src/backend/access/nbtree/nbtreadpage.c
Fix typos in the code.
commit : 31ddbb38eeff60ad5353768c7416fea3a0ecafce
author : Amit Kapila <akapila@postgresql.org>
date : Thu, 8 Jan 2026 09:43:50 +0000
committer: Amit Kapila <akapila@postgresql.org>
date : Thu, 8 Jan 2026 09:43:50 +0000 Author: "Dewei Dai" <daidewei1970@163.com>
Author: zengman <zengman@halodbtech.com>
Author: Zhiyuan Su <suzhiyuan_pg@126.com>
Discussion: https://postgr.es/m/2026010719201902382410@163.com
Discussion: https://postgr.es/m/tencent_4DC563C83443A4B1082D2BFF@qq.com
Discussion: https://postgr.es/m/44656d72.2a63.19b9b92b0a3.Coremail.suzhiyuan_pg@126.com M src/backend/replication/logical/origin.c
M src/backend/utils/activity/pgstat_replslot.c
M src/backend/utils/cache/lsyscache.c
Remove use of rindex() function
commit : 6ade3cd459f5d310a248be2047b2d321015058c3
author : Peter Eisentraut <peter@eisentraut.org>
date : Thu, 8 Jan 2026 08:45:59 +0100
committer: Peter Eisentraut <peter@eisentraut.org>
date : Thu, 8 Jan 2026 08:45:59 +0100 rindex() has been removed from POSIX 2008. Replace the one remaining
use with the equivalent and more standard strrchr().
Reviewed-by: Jelte Fennema-Nio <postgres@jeltef.nl>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://www.postgresql.org/message-id/flat/98ce805c-6103-421b-adc3-fcf8f3dddbe3%40eisentraut.org M src/backend/jit/llvm/llvmjit.c
strnlen() is now required
commit : 5e7abdac99136c63850a23c0dfdec24d81f503f1
author : Peter Eisentraut <peter@eisentraut.org>
date : Thu, 8 Jan 2026 08:45:59 +0100
committer: Peter Eisentraut <peter@eisentraut.org>
date : Thu, 8 Jan 2026 08:45:59 +0100 Remove all configure checks and workarounds for strnlen() missing. It
is required by POSIX 2008.
Reviewed-by: Jelte Fennema-Nio <postgres@jeltef.nl>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://www.postgresql.org/message-id/flat/98ce805c-6103-421b-adc3-fcf8f3dddbe3%40eisentraut.org M configure
M configure.ac
M meson.build
M src/include/pg_config.h.in
M src/include/port.h
M src/port/meson.build
D src/port/strnlen.c
pg_createsubscriber: Improve handling of automated recovery configuration
commit : 639352d904c8a3d233989253f569cccbea0be123
author : Michael Paquier <michael@paquier.xyz>
date : Thu, 8 Jan 2026 10:12:33 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Thu, 8 Jan 2026 10:12:33 +0900 When repurposing a standby to a logical replica, pg_createsubscriber
uses for the new replica a set of configuration parameters saved into
postgresql.auto.conf, to force recovery patterns when the physical
replica is promoted.
While not wrong in practice, this approach can cause issues when forcing
again recovery on a logical replica or its base backup as the recovery
parameters are not reset on the target server once pg_createsubscriber
is done with the node.
This commit aims at improving the situation, by changing the way
recovery parameters are saved on the target node. Instead of writing
all the configuration to postgresql.auto.conf, this file now uses an
include_if_exists, that points to a pg_createsubscriber.conf. This new
file contains all the recovery configuration, and is renamed to
pg_createsubscriber.conf.disabled when pg_createsubscriber exits. This
approach resets the recovery parameters, and offers the benefit to keep
a trace of the setup used when the target node got promoted, for
debugging purposes. If pg_createsubscriber.conf cannot be renamed
(unlikely scenario), a warning is issued to inform users that a manual
intervention may be required to reset this configuration.
This commit includes a test case to demonstrate the problematic case: a
standby node created from a base backup of what was the target node of
pg_createsubscriber does not get confused when started. If removing
this new logic, the test fails with the standby not able to start due
to an incorrect recovery target setup, where the startup process fails
quickly with a FATAL.
I have provided the design idea for the patch, that Alyona has written
(with some code adjustments from me). This could be considered as a
bug, but after discussion this is put into the bucket for improvements.
Redesigning pg_createsubscriber would not be acceptable in the stable
branches anyway.
Author: Alyona Vinter <dlaaren8@gmail.com>
Reviewed-by: Ilyasov Ian <ianilyasov@outlook.com>
Reviewed-by: Alexander Korotkov <aekorotkov@gmail.com>
Reviewed-by: Hayato Kuroda <kuroda.hayato@fujitsu.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Reviewed-by: Andrey Rudometov <unlimitedhikari@gmail.com>
Discussion: https://postgr.es/m/CAGWv16K6L6Pzm99i1KiXLjFWx2bUS3DVsR6yV87-YR9QO7xb3A@mail.gmail.com M doc/src/sgml/ref/pg_createsubscriber.sgml
M src/bin/pg_basebackup/pg_createsubscriber.c
M src/bin/pg_basebackup/t/040_pg_createsubscriber.pl
psql: Add tab completion for pstdin and pstdout in \copy.
commit : 28c4b8a05ba5431168e4bc8683f07e03ac911a2c
author : Masahiko Sawada <msawada@postgresql.org>
date : Wed, 7 Jan 2026 16:22:42 -0800
committer: Masahiko Sawada <msawada@postgresql.org>
date : Wed, 7 Jan 2026 16:22:42 -0800 This commit adds tab completion support for the keywords "pstdin" and
"pstdout" in the \copy command. "pstdin" is now suggested after FROM,
and "pstdout" is suggested after TO, alongside filenames and other
keywords.
Author: Yugo Nagata <nagata@sraoss.co.jp>
Reviewed-by: Srinath Reddy Sadipiralla <srinath2133@gmail.com>
Reviewed-by: Kirill Reshke <reshkekirill@gmail.com>
Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com>
Discussion: https://postgr.es/m/20251231183953.95132e171e43abd5e9b78084@sraoss.co.jp M src/bin/psql/tab-complete.in.c
Replace flaky CIC/RI isolation tests with a TAP test
commit : e1c971945d62d3150ecfe353ce7bb4263916b489
author : Álvaro Herrera <alvherre@kurilemu.de>
date : Wed, 7 Jan 2026 19:44:57 -0300
committer: Álvaro Herrera <alvherre@kurilemu.de>
date : Wed, 7 Jan 2026 19:44:57 -0300 The isolation tests for INSERT ON CONFLICT behavior during CREATE INDEX
CONCURRENTLY and REINDEX CONCURRENTLY (added by bc32a12e0db2,
2bc7e886fc1b, and 90eae926abbb) were disabled in 77038d6d0b49 due to
persistent CI flakiness, after several attempts at stabilization.
This commit removes them and introduces a TAP test in test_misc module
(010_index_concurrently_upsert.pl) that covers the same scenarios. This
new test should hopefully be more stable while providing assurance that
the fixes in all those commits (plus 81f72115cf18) continue to work.
Author: Mihail Nikalayeu <mihailnikalayeu@gmail.com>
Reported-by: Andres Freund <andres@anarazel.de>
Reviewed-by: Álvaro Herrera <alvherre@kurilemu.de>
Discussion: https://postgr.es/m/ccssrhafzbp3a3beju3ptyc56a7gbfimj4vwkbokoldofckrc7@bso37rxskjtf
Discussion: https://postgr.es/m/CANtu0ogv+6wqRzPK241jik4U95s1pW3MCZ3rX5ZqbFdUysz7Qw@mail.gmail.com
Discussion: https://postgr.es/m/202512112014.icpomgc37zx4@alvherre.pgsql M src/test/modules/injection_points/Makefile
D src/test/modules/injection_points/expected/index-concurrently-upsert-predicate.out
D src/test/modules/injection_points/expected/index-concurrently-upsert-predicate_1.out
D src/test/modules/injection_points/expected/index-concurrently-upsert.out
D src/test/modules/injection_points/expected/index-concurrently-upsert_1.out
D src/test/modules/injection_points/expected/reindex-concurrently-upsert-on-constraint.out
D src/test/modules/injection_points/expected/reindex-concurrently-upsert-partitioned.out
D src/test/modules/injection_points/expected/reindex-concurrently-upsert.out
M src/test/modules/injection_points/meson.build
D src/test/modules/injection_points/specs/index-concurrently-upsert-predicate.spec
D src/test/modules/injection_points/specs/index-concurrently-upsert.spec
D src/test/modules/injection_points/specs/reindex-concurrently-upsert-on-constraint.spec
D src/test/modules/injection_points/specs/reindex-concurrently-upsert-partitioned.spec
D src/test/modules/injection_points/specs/reindex-concurrently-upsert.spec
M src/test/modules/test_misc/Makefile
M src/test/modules/test_misc/meson.build
A src/test/modules/test_misc/t/010_index_concurrently_upsert.pl
MSVC: Support building for AArch64.
commit : a516b3f00d7469cbd1885a2c5903fbd62430a2ac
author : Nathan Bossart <nathan@postgresql.org>
date : Wed, 7 Jan 2026 13:42:57 -0600
committer: Nathan Bossart <nathan@postgresql.org>
date : Wed, 7 Jan 2026 13:42:57 -0600 This commit does the following to get tests passing for
MSVC/AArch64:
* Implements spin_delay() with an ISB instruction (like we do for
gcc/clang on AArch64).
* Sets USE_ARMV8_CRC32C unconditionally. Vendor-supported versions
of Windows for AArch64 require at least ARMv8.1, which is where CRC
extension support became mandatory.
* Implements S_UNLOCK() with _InterlockedExchange(). The existing
implementation for MSVC uses _ReadWriteBarrier() (a compiler
barrier), which is insufficient for this purpose on non-TSO
architectures.
There are likely other changes required to take full advantage of
the hardware (e.g., atomics/arch-arm.h, simd.h,
pg_popcount_aarch64.c), but those can be dealt with later.
Author: Niyas Sait <niyas.sait@linaro.org>
Co-authored-by: Greg Burd <greg@burd.me>
Co-authored-by: Dave Cramer <davecramer@gmail.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Reviewed-by: John Naylor <johncnaylorls@gmail.com>
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Reviewed-by: Andres Freund <andres@anarazel.de>
Reviewed-by: Thomas Munro <thomas.munro@gmail.com>
Tested-by: Andrew Dunstan <andrew@dunslane.net>
Discussion: https://postgr.es/m/A6152C7C-F5E3-4958-8F8E-7692D259FF2F%40greg.burd.me
Discussion: https://postgr.es/m/CAFPTBD-74%2BAEuN9n7caJ0YUnW5A0r-KBX8rYoEJWqFPgLKpzdg%40mail.gmail.com M doc/src/sgml/installation.sgml
M meson.build
M src/include/storage/s_lock.h
M src/port/pg_crc32c_armv8.c
M src/tools/msvc_gendef.pl
Fix nbtree skip array transformation comments.
commit : 8aed8e168fd2d2075a8f2622a980ed8991a69895
author : Peter Geoghegan <pg@bowt.ie>
date : Wed, 7 Jan 2026 12:53:07 -0500
committer: Peter Geoghegan <pg@bowt.ie>
date : Wed, 7 Jan 2026 12:53:07 -0500 Fix comments that incorrectly described transformations performed by the
"Avoid extra index searches through preprocessing" mechanism introduced
by commit b3f1a13f.
Author: Yugo Nagata <nagata@sraoss.co.jp>
Reviewed-By: Chao Li <li.evan.chao@gmail.com>
Reviewed-By: Peter Geoghegan <pg@bowt.ie>
Discussion: https://postgr.es/m/20251230190145.c3c88c5eb0f88b136adda92f@sraoss.co.jp
Backpatch-through: 18 M src/backend/access/nbtree/nbtpreprocesskeys.c
doc: Remove deprecated clauses from CREATE USER/GROUP syntax synopsis.
commit : 1b795ef0329d64427f3e779e38c7c492c0a15e5d
author : Fujii Masao <fujii@postgresql.org>
date : Thu, 8 Jan 2026 01:10:36 +0900
committer: Fujii Masao <fujii@postgresql.org>
date : Thu, 8 Jan 2026 01:10:36 +0900 The USER and IN GROUP clauses of CREATE ROLE are deprecated, and
commit 8e78f0a1 removed them from the CREATE ROLE syntax syntax
synopsis in the docs. However, previously CREATE USER and
CREATE GROUP docs still listed these clauses.
Since CREATE USER is equivalent to CREATE ROLE ... WITH LOGIN and
CREATE GROUP is equivalent to CREATE ROLE, their documented syntax
synopsis should match CREATE ROLE to avoid confusion.
Therefore this commit removes the deprecated USER and IN GROUP
clauses from the CREATE USER and CREATE GROUP syntax synopsis
in the docs.
Author: Japin Li <japinli@hotmail.com>
Reviewed-by: wenhui qiu <qiuwenhuifx@gmail.com>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>
Discussion: https://postgr.es/m/MEAPR01MB3031C30E72EF16CFC08C8565B687A@MEAPR01MB3031.ausprd01.prod.outlook.com M doc/src/sgml/ref/create_group.sgml
M doc/src/sgml/ref/create_user.sgml
Revert "Use WAIT FOR LSN in PostgreSQL::Test::Cluster::wait_for_catchup()"
commit : e54ce0b2da62ac71e3b2a5212f32e82b07bf39a5
author : Alexander Korotkov <akorotkov@postgresql.org>
date : Wed, 7 Jan 2026 16:29:58 +0200
committer: Alexander Korotkov <akorotkov@postgresql.org>
date : Wed, 7 Jan 2026 16:29:58 +0200 This reverts commit f30848cb05d4d63e1a5a2d6a9d72604f3b63370d. Due to
buildfarm failures related to recovery conflicts while executing the
WAIT FOR command. It appears that WAIT FOR still holds xmin for a while.
Reported-by: Thomas Munro <thomas.munro@gmail.com>
Discussion: https://postgr.es/m/CA%2BhUKG%2BL0OQR8dQtsNBSaA3FNNyQeFabdeRVzurm0b7Xtp592g%40mail.gmail.com M src/test/perl/PostgreSQL/Test/Cluster.pm
Fix typo
commit : 6675f41c18a7730d90d29a3c4c2ed9e1021f64e0
author : Peter Eisentraut <peter@eisentraut.org>
date : Wed, 7 Jan 2026 15:47:02 +0100
committer: Peter Eisentraut <peter@eisentraut.org>
date : Wed, 7 Jan 2026 15:47:02 +0100 Reported-by: Xueyu Gao <gaoxueyu_hope@163.com>
Discussion: https://www.postgresql.org/message-id/42b5c99a.856d.19b73d858e2.Coremail.gaoxueyu_hope%40163.com M .cirrus.tasks.yml
createuser: Update docs to reflect defaults
commit : ece25c2611d2a58fdeed07b6a42b607e5e99910b
author : John Naylor <john.naylor@postgresql.org>
date : Wed, 7 Jan 2026 16:02:19 +0700
committer: John Naylor <john.naylor@postgresql.org>
date : Wed, 7 Jan 2026 16:02:19 +0700 Commit c7eab0e97 changed the default password_encryption setting to
'scram-sha-256', so update the example for creating a user with an
assigned password.
In addition, commit 08951a7c9 added new options that in turn pass
default tokens NOBYPASSRLS and NOREPLICATION to the CREATE ROLE
command, so fix this omission as well for v16 and later.
Reported-by: Heikki Linnakangas <hlinnaka@iki.fi>
Discussion: https://postgr.es/m/cff1ea60-c67d-4320-9e33-094637c2c4fb%40iki.fi
Backpatch-through: 14 M doc/src/sgml/ref/createuser.sgml
Fix unexpected reversal of lists during catcache rehash
commit : 68119480a763d761a9cf2413f4320d9a5d4b34d5
author : Michael Paquier <michael@paquier.xyz>
date : Wed, 7 Jan 2026 17:52:54 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Wed, 7 Jan 2026 17:52:54 +0900 During catcache searches, the most-recently searched entries are kept at
the head of the list to speed up subsequent searches, keeping the
"freshest" entries at its beginning. A rehash of the catcache was doing
the opposite: fresh entries were moved to the tail of the newly-created
buckets, causing a rehash to slow down a bit.
When a rehash is done, this commit switches the code to use
dlist_push_tail() instead of dlist_push_head(), so as fresh entries are
kept at the head of the lists, not their tail.
Author: ChangAo Chen <cca5507@qq.com>
Reviewed-by: John Naylor <johncnaylorls@gmail.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://postgr.es/m/tencent_9EA10D8512B5FE29E7323F780A0749768708@qq.com M src/backend/utils/cache/catcache.c
Fix grammar in datatype.sgml
commit : ba887a8cdb5b4ebaebd7d5c9ce790563659e710e
author : Michael Paquier <michael@paquier.xyz>
date : Wed, 7 Jan 2026 14:13:18 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Wed, 7 Jan 2026 14:13:18 +0900 Introduced in b139bd3b6ef0.
Reported-by: Man Zeng <zengman@halodbtech.com>
Discussion: https://postgr.es/m/tencent_121C1BB152CAF3195C99D56C@qq.com M doc/src/sgml/datatype.sgml
Further doc updates to reflect MD5 deprecation
commit : e171405afe951f67d289b1d846c0895d589ef800
author : John Naylor <john.naylor@postgresql.org>
date : Wed, 7 Jan 2026 11:55:01 +0700
committer: John Naylor <john.naylor@postgresql.org>
date : Wed, 7 Jan 2026 11:55:01 +0700 Followup to 44f49511b.
Author: Fujii Masao <masao.fujii@gmail.com>
Reviewed-by: Heikki Linnakangas <hlinnaka@iki.fi>
Discussion: https://postgr.es/m/CAHGQGwH_UfN96vcvLGA%3DYro%2Bo6qCn0nEgEGoviwzEiLTHtt2Pw%40mail.gmail.com
Backpatch-through: 18 M doc/src/sgml/high-availability.sgml
M doc/src/sgml/logical-replication.sgml
doc: Add glossary and index entries for GUC.
commit : 0a7c37b847e239c2709db5ada78ac62e078c94d2
author : Fujii Masao <fujii@postgresql.org>
date : Wed, 7 Jan 2026 13:58:07 +0900
committer: Fujii Masao <fujii@postgresql.org>
date : Wed, 7 Jan 2026 13:58:07 +0900 GUC is a commonly used term but previously appeared only
in the acronym documentation. This commit adds glossary and
documentation index entries for GUC to make it easier to find
and understand.
Author: Robert Treat <rob@xzilla.net>
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>
Discussion: https://postgr.es/m/CABV9wwPQnkeo_G6-orMGnHPK9SXGVWm7ajJPzsbE6944tDx=hQ@mail.gmail.com M doc/src/sgml/config.sgml
M doc/src/sgml/glossary.sgml
doc: Add index entry for Git.
commit : 466347ad28d858ff49b36b9a5b1e98ea9ce5d58c
author : Fujii Masao <fujii@postgresql.org>
date : Wed, 7 Jan 2026 13:57:36 +0900
committer: Fujii Masao <fujii@postgresql.org>
date : Wed, 7 Jan 2026 13:57:36 +0900 This commit adds Git to the documentation index, pointing to
the source code repository documentation.
Author: Robert Treat <rob@xzilla.net>
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>
Discussion: https://postgr.es/m/CABV9wwPQnkeo_G6-orMGnHPK9SXGVWm7ajJPzsbE6944tDx=hQ@mail.gmail.com M doc/src/sgml/sourcerepo.sgml
Improve portability of test with oid8 comparison function
commit : a2e632ece1691be18771644182f769b525991f97
author : Michael Paquier <michael@paquier.xyz>
date : Wed, 7 Jan 2026 12:55:16 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Wed, 7 Jan 2026 12:55:16 +0900 Oversight in b139bd3b6ef0, per reports from buildfarm members longfin
and prion, that use -DSTRESS_SORT_INT_MIN. Thanks to Tom Lane for the
poke.
Discussion: https://postgr.es/m/1656709.1767754981@sss.pgh.pa.us M src/test/regress/expected/oid8.out
M src/test/regress/sql/oid8.sql
Add data type oid8, 64-bit unsigned identifier
commit : b139bd3b6ef000ab5d00dd47128e366a726da5f9
author : Michael Paquier <michael@paquier.xyz>
date : Wed, 7 Jan 2026 11:37:00 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Wed, 7 Jan 2026 11:37:00 +0900 This new identifier type provides support for 64-bit unsigned values,
to be used in catalogs, like OIDs. An advantage of a new data type is
that it becomes easier to grep for it in the code when assigning this
type to a catalog attribute, linking it to dedicated APIs and internal
structures.
The following operators are added in this commit, with dedicated tests:
- Casts with integer types and OID.
- btree and hash operators
- min/max functions.
- C type with related macros and defines, named around "Oid8".
This has been mentioned as useful on its own on the thread to add
support for 64-bit TOAST values, so as it becomes possible to attach
this data type to the TOAST code and catalog definitions. However, as
this concept can apply to many more areas, it is implemented as its own
independent change. This is based on a discussion with Andres Freund
and Tom Lane.
Bump catalog version.
Author: Michael Paquier <michael@paquier.xyz>
Reviewed-by: Greg Burd <greg@burd.me>
Reviewed-by: Nikhil Kumar Veldanda <veldanda.nikhilkumar17@gmail.com>
Discussion: https://postgr.es/m/1891064.1754681536@sss.pgh.pa.us M doc/src/sgml/datatype.sgml
M doc/src/sgml/func/func-aggregate.sgml
M src/backend/access/nbtree/nbtcompare.c
M src/backend/bootstrap/bootstrap.c
M src/backend/utils/adt/Makefile
M src/backend/utils/adt/int8.c
M src/backend/utils/adt/meson.build
A src/backend/utils/adt/oid8.c
M src/fe_utils/print.c
M src/include/c.h
M src/include/catalog/catversion.h
M src/include/catalog/pg_aggregate.dat
M src/include/catalog/pg_amop.dat
M src/include/catalog/pg_amproc.dat
M src/include/catalog/pg_cast.dat
M src/include/catalog/pg_opclass.dat
M src/include/catalog/pg_operator.dat
M src/include/catalog/pg_opfamily.dat
M src/include/catalog/pg_proc.dat
M src/include/catalog/pg_type.dat
M src/include/fmgr.h
M src/include/postgres.h
M src/test/regress/expected/hash_func.out
A src/test/regress/expected/oid8.out
M src/test/regress/expected/opr_sanity.out
M src/test/regress/expected/type_sanity.out
M src/test/regress/parallel_schedule
M src/test/regress/sql/hash_func.sql
A src/test/regress/sql/oid8.sql
M src/test/regress/sql/type_sanity.sql
Clean up ICU includes.
commit : af2d4ca191a4552217eceace21fde6ebc2b85770
author : Jeff Davis <jdavis@postgresql.org>
date : Tue, 6 Jan 2026 17:19:51 -0800
committer: Jeff Davis <jdavis@postgresql.org>
date : Tue, 6 Jan 2026 17:19:51 -0800 Remove ICU includes from pg_locale.h, and instead include them in the
few C files that need ICU. Clean up a few other includes in passing.
Reviewed-by: Andres Freund <andres@anarazel.de>
Discussion: https://postgr.es/m/48911db71d953edec66df0d2ce303563d631fbe0.camel@j-davis.com M src/backend/commands/collationcmds.c
M src/backend/utils/adt/formatting.c
M src/backend/utils/adt/pg_locale.c
M src/backend/utils/adt/pg_locale_icu.c
M src/backend/utils/adt/varlena.c
M src/include/utils/pg_locale.h
Fix buggy interaction between array subscripts and subplan params
commit : 75609fded35e4d95a0e8b9875a46a496a03437cf
author : Andres Freund <andres@anarazel.de>
date : Tue, 6 Jan 2026 19:51:10 -0500
committer: Andres Freund <andres@anarazel.de>
date : Tue, 6 Jan 2026 19:51:10 -0500 In a7f107df2 I changed subplan param evaluation to happen within the
containing expression. As part of that, ExecInitSubPlanExpr() was changed to
evaluate parameters via a new EEOP_PARAM_SET expression step. These parameters
were temporarily stored into ExprState->resvalue/resnull, with some reasoning
why that would be fine. Unfortunately, that analysis was wrong -
ExecInitSubscriptionRef() evaluates the input array into "resv"/"resnull",
which will often point to ExprState->resvalue/resnull. This means that the
EEOP_PARAM_SET, if inside an array subscript, would overwrite the input array
to array subscript.
The fix is fairly simple - instead of evaluating into
ExprState->resvalue/resnull, store the temporary result of the subplan in the
subplan's return value.
Bug: #19370
Reported-by: Zepeng Zhang <redraiment@gmail.com>
Diagnosed-by: Tom Lane <tgl@sss.pgh.pa.us>
Diagnosed-by: Andres Freund <andres@anarazel.de>
Discussion: https://postgr.es/m/19370-7fb7a5854b7618f1@postgresql.org
Backpatch-through: 18 M src/backend/executor/execExpr.c
M src/backend/executor/execExprInterp.c
M src/test/regress/expected/subselect.out
M src/test/regress/sql/subselect.sql
ICU: use UTF8-optimized case conversion API
commit : c4ff35f10441de7dbed4e87737bca205dcca698e
author : Jeff Davis <jdavis@postgresql.org>
date : Tue, 6 Jan 2026 14:09:07 -0800
committer: Jeff Davis <jdavis@postgresql.org>
date : Tue, 6 Jan 2026 14:09:07 -0800 Initializes a UCaseMap object once for use across calls, and uses
UTF8-optimized APIs.
Author: Andreas Karlsson <andreas@proxel.se>
Reviewed-by: zengman <zengman@halodbtech.com>
Discussion: https://postgr.es/m/5a010b27-8ed9-4739-86fe-1562b07ba564@proxel.se M src/backend/utils/adt/pg_locale_icu.c
M src/common/unicode/case_test.c
M src/include/utils/pg_locale.h
M src/tools/pgindent/typedefs.list
Improve portability of new worker_spi test
commit : 0547aeae0fd6f6d03dd7499c84145ad9e3aa51b9
author : Michael Paquier <michael@paquier.xyz>
date : Tue, 6 Jan 2026 20:24:17 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Tue, 6 Jan 2026 20:24:17 +0900 The new test 002_worker_terminate relies on the generation of a LOG
entry to check that a worker has been started, but missed the fact that
a node set with log_error_verbosity = verbose would add an error code.
The regexp used for the matching check did not take this case into
account, making the test fail on a timeout. The regexp is now fixed to
handle the verbose case correctly.
Per buildfarm member prion, that uses log_error_verbosity = verbose.
The error was reproducible by setting this GUC the same way in the test.
Oversight in f1e251be80a0. M src/test/modules/worker_spi/t/002_worker_terminate.pl
Add test coverage for indirection transformation
commit : 64492917280a1f6227ed9cf43d39095e2cec5cab
author : Peter Eisentraut <peter@eisentraut.org>
date : Tue, 6 Jan 2026 09:37:19 +0100
committer: Peter Eisentraut <peter@eisentraut.org>
date : Tue, 6 Jan 2026 09:37:19 +0100 These tests cover nested arrays of composite data types,
single-argument functions, and casting using dot-notation, providing a
baseline for future enhancements to jsonb dot-notation support.
Author: Alexandra Wang <alexandra.wang.oss@gmail.com>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/CAK98qZ1JNNAx4QneJG+eX7iLesOhd6A68FNQVvvHP6Up_THf3A@mail.gmail.com M src/test/regress/expected/arrays.out
M src/test/regress/expected/jsonb.out
M src/test/regress/sql/arrays.sql
M src/test/regress/sql/jsonb.sql
Fix variable usage in wakeupWaiters()
commit : bf308639bfcfa38541e24733e074184153a8ab7f
author : Alexander Korotkov <akorotkov@postgresql.org>
date : Tue, 6 Jan 2026 10:03:26 +0200
committer: Alexander Korotkov <akorotkov@postgresql.org>
date : Tue, 6 Jan 2026 10:03:26 +0200 Mistakenly, `i` was used both as an integer representation of lsnType and
an index in wakeUpProcs array.
Discussion: https://postgr.es/m/CA%2BhUKG%2BL0OQR8dQtsNBSaA3FNNyQeFabdeRVzurm0b7Xtp592g%40mail.gmail.com
Reviewed-by: Thomas Munro <thomas.munro@gmail.com>
Reviewed-by: Ruikai Peng <ruikai@pwno.io> M src/backend/access/transam/xlogwait.c
Use relation_close() more consistently in contrib/
commit : 8b9b93e39b10ce32577eca3c84face880fc8aff0
author : Michael Paquier <michael@paquier.xyz>
date : Tue, 6 Jan 2026 16:17:59 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Tue, 6 Jan 2026 16:17:59 +0900 All the code paths updated here have been using index_close() to
close a relation that was opened with relation_open(), in pgstattuple
and pageinspect. index_close() does the same thing as relation_close(),
so there is no harm, but being inconsistent could lead to issues if the
internals of these close() functions begin to introduce some specific
logic in the future.
In passing, this commit adds some comments explaining why we are using
relation_open() instead of index_open() in a few places, which is due to
the fact that partitioned indexes are not allowed in these functions.
Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>
Discussion: https://postgr.es/m/aUKamYGiDKO6byp5@ip-10-97-1-34.eu-west-3.compute.internal M contrib/pageinspect/hashfuncs.c
M contrib/pgstattuple/pgstatindex.c
Allow bgworkers to be terminated for database-related commands
commit : f1e251be80a05cb66191d5ea48f2cdc3acff72b5
author : Michael Paquier <michael@paquier.xyz>
date : Tue, 6 Jan 2026 14:24:29 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Tue, 6 Jan 2026 14:24:29 +0900 Background workers gain a new flag, called BGWORKER_INTERRUPTIBLE, that
offers the possibility to terminate the workers when these are connected
to a database that is involved in one of the following commands:
ALTER DATABASE RENAME TO
ALTER DATABASE SET TABLESPACE
CREATE DATABASE
DROP DATABASE
This is useful to give background workers the same behavior as backends
and autovacuum workers, which are stopped when these commands are
executed. The default behavior, that exists since 9.3, is still to
never terminate bgworkers connected to the database involved in any of
these commands. The new flag has to be set to terminate the workers.
A couple of tests are added to worker_spi to track the commands that
impact the termination of the workers. There is a test case for a
non-interruptible worker, additionally, that relies on an injection
point to make the wait time in CountOtherDBBackends() reduced from 5s to
0.3s for faster test runs. The tests rely on the contents of the server
logs to check if a worker has been started or terminated:
- LOG generated by worker_spi_main() at startup, once connection to
database is done.
- FATAL in bgworker_die() when terminated.
A couple of tests run in the CI have showed that this method is stable
enough. The safe_psql() calls that scan pg_stat_activity could be
replaced with some poll_query_until() for more stability, if the current
method proves to be an issue in the buildfarm.
Author: Aya Iwata <iwata.aya@fujitsu.com>
Reviewed-by: Hayato Kuroda <kuroda.hayato@fujitsu.com>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Ryo Matsumura <matsumura.ryo@fujitsu.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Reviewed-by: Peter Smith <smithpb2250@gmail.com>
Discussion: https://postgr.es/m/OS7PR01MB11964335F36BE41021B62EAE8EAE4A@OS7PR01MB11964.jpnprd01.prod.outlook.com M doc/src/sgml/bgworker.sgml
M src/backend/postmaster/bgworker.c
M src/backend/storage/ipc/procarray.c
M src/include/postmaster/bgworker.h
M src/test/modules/worker_spi/Makefile
M src/test/modules/worker_spi/meson.build
A src/test/modules/worker_spi/t/002_worker_terminate.pl
M src/test/modules/worker_spi/worker_spi–1.0.sql
M src/test/modules/worker_spi/worker_spi.c
Update comments atop ReplicationSlotCreate.
commit : c970bdc037f4f35f1ff852b4c032f5fb3f6f6622
author : Amit Kapila <akapila@postgresql.org>
date : Tue, 6 Jan 2026 05:02:25 +0000
committer: Amit Kapila <akapila@postgresql.org>
date : Tue, 6 Jan 2026 05:02:25 +0000 Since commit 1462aad2e4, which introduced the ability to modify the
two_phase property of a slot, the comments above ReplicationSlotCreate
have become outdated. We have now added a cautionary note in the comments
above ReplicationSlotAlter explaining when it is safe to modify the
two_phase property of a slot.
Author: Daniil Davydov <3danissimo@gmail.com>
Author: Amit Kapila <amit.kapila16@gmail.com>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Hayato Kuroda <kuroda.hayato@fujitsu.com>
Backpatch-through: 18
Discussion: https://postgr.es/m/CAJDiXggZXQZ7bD0QcTizDt6us9aX6ZKK4dWxzgb5x3+TsVHjqQ@mail.gmail.com M src/backend/replication/slot.c
Fix issue with EVENT TRIGGERS and ALTER PUBLICATION
commit : 6ca8506ea59e396b0efa43edf439d4d3c77d8311
author : David Rowley <drowley@postgresql.org>
date : Tue, 6 Jan 2026 17:29:12 +1300
committer: David Rowley <drowley@postgresql.org>
date : Tue, 6 Jan 2026 17:29:12 +1300 When processing the "publish" options of an ALTER PUBLICATION command,
we call SplitIdentifierString() to split the options into a List of
strings. Since SplitIdentifierString() modifies the delimiter
character and puts NULs in their place, this would overwrite the memory
of the AlterPublicationStmt. Later in AlterPublicationOptions(), the
modified AlterPublicationStmt is copied for event triggers, which would
result in the event trigger only seeing the first "publish" option
rather than all options that were specified in the command.
To fix this, make a copy of the string before passing to
SplitIdentifierString().
Here we also adjust a similar case in the pgoutput plugin. There's no
known issues caused by SplitIdentifierString() here, so this is being
done out of paranoia.
Thanks to Henson Choi for putting together an example case showing the
ALTER PUBLICATION issue.
Author: sunil s <sunilfeb26@gmail.com>
Reviewed-by: Henson Choi <assam258@gmail.com>
Reviewed-by: zengman <zengman@halodbtech.com>
Backpatch-through: 14 M src/backend/commands/publicationcmds.c
M src/backend/replication/pgoutput/pgoutput.c
Fix typo in slot.c.
commit : 63ed3bc7f9a66035e0b741aaa542de35a90fe1cc
author : Amit Kapila <akapila@postgresql.org>
date : Tue, 6 Jan 2026 04:13:40 +0000
committer: Amit Kapila <akapila@postgresql.org>
date : Tue, 6 Jan 2026 04:13:40 +0000 Author: Chao Li <li.evan.chao@gmail.com>
Discussion: https://postgr.es/m/AC9B87F1-ED04-4547-B85C-9443B4253A08@gmail.com
Discussion: https://postgr.es/m/CAJDiXggZXQZ7bD0QcTizDt6us9aX6ZKK4dWxzgb5x3+TsVHjqQ@mail.gmail.com M src/backend/replication/slot.c
Fix typo in planner.c
commit : ae283736025c2d0b41a4106788b4e45ffba6c82d
author : Michael Paquier <michael@paquier.xyz>
date : Tue, 6 Jan 2026 12:30:01 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Tue, 6 Jan 2026 12:30:01 +0900 b8cfcb9e00da did not get this change right.
Author: Alexander Law <exclusion@gmail.com>
Discussion: https://postgr.es/m/CAJ0YPFFWhJXs-e-=7iJz-FLp=b1dXfJA_qtrVAgto=bZmzD9zQ@mail.gmail.com M src/backend/optimizer/plan/planner.c
Add TAP test for GUC settings passed via CONNECTION in logical replication.
commit : 5f13999aa11d95018dd9ff5c41aad4bcb15d4222
author : Fujii Masao <fujii@postgresql.org>
date : Tue, 6 Jan 2026 11:57:12 +0900
committer: Fujii Masao <fujii@postgresql.org>
date : Tue, 6 Jan 2026 11:57:12 +0900 Commit d926462d819 restored the behavior of passing GUC settings from
the CONNECTION string to the publisher's walsender, allowing per-connection
configuration.
This commit adds a TAP test to verify that behavior works correctly.
Since commit d926462d819 was recently applied and backpatched to v15,
this follow-up commit is also backpatched accordingly.
Author: Fujii Masao <masao.fujii@gmail.com>
Reviewed-by: Chao Li <lic@highgo.com>
Reviewed-by: Kirill Reshke <reshkekirill@gmail.com>
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>
Discussion: https://postgr.es/m/CAHGQGwGYV+-abbKwdrM2UHUe-JYOFWmsrs6=QicyJO-j+-Widw@mail.gmail.com
Backpatch-through: 15 M src/test/subscription/t/001_rep_changes.pl
Honor GUC settings specified in CREATE SUBSCRIPTION CONNECTION.
commit : d926462d8190a81cc1f39c7fce65055f329e9419
author : Fujii Masao <fujii@postgresql.org>
date : Tue, 6 Jan 2026 11:52:22 +0900
committer: Fujii Masao <fujii@postgresql.org>
date : Tue, 6 Jan 2026 11:52:22 +0900 Prior to v15, GUC settings supplied in the CONNECTION clause of
CREATE SUBSCRIPTION were correctly passed through to
the publisher's walsender. For example:
CREATE SUBSCRIPTION mysub
CONNECTION 'options=''-c wal_sender_timeout=1000'''
PUBLICATION ...
would cause wal_sender_timeout to take effect on the publisher's walsender.
However, commit f3d4019da5d changed the way logical replication
connections are established, forcing the publisher's relevant
GUC settings (datestyle, intervalstyle, extra_float_digits) to
override those provided in the CONNECTION string. As a result,
from v15 through v18, GUC settings in the CONNECTION string were
always ignored.
This regression prevented per-connection tuning of logical replication.
For example, using a shorter timeout for walsender connecting
to a nearby subscriber and a longer one for walsender connecting
to a remote subscriber.
This commit restores the intended behavior by ensuring that
GUC settings in the CONNECTION string are again passed through
and applied by the walsender, allowing per-connection configuration.
Backpatch to v15, where the regression was introduced.
Author: Fujii Masao <masao.fujii@gmail.com>
Reviewed-by: Chao Li <lic@highgo.com>
Reviewed-by: Kirill Reshke <reshkekirill@gmail.com>
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>
Discussion: https://postgr.es/m/CAHGQGwGYV+-abbKwdrM2UHUe-JYOFWmsrs6=QicyJO-j+-Widw@mail.gmail.com
Backpatch-through: 15 M src/backend/replication/libpqwalreceiver/libpqwalreceiver.c
Simplify GetOperatorFromCompareType() code
commit : 7f9acc9bccfe2dc4d7d8ba75057c91ef09a7ebf2
author : David Rowley <drowley@postgresql.org>
date : Tue, 6 Jan 2026 15:25:13 +1300
committer: David Rowley <drowley@postgresql.org>
date : Tue, 6 Jan 2026 15:25:13 +1300 The old code would set *opid = InvalidOid to determine if the
get_opclass_opfamily_and_input_type() worked or not. This means more
moving parts that what's really needed here. Let's just fail
immediately if the get_opclass_opfamily_and_input_type() lookup fails.
Author: Paul A Jungwirth <pj@illuminatedcomputing.com>
Reviewed-by: Neil Chen <carpenter.nail.cz@gmail.com>
Discussion: https://postgr.es/m/CA+renyXOrjLacP_nhqEQUf2W+ZCoY2q5kpQCfG05vQVYzr8b9w@mail.gmail.com M src/backend/commands/indexcmds.c
Fix misleading comment for GetOperatorFromCompareType
commit : e8d4e94a47ea0f02e180208ec7daf03bdd2f751e
author : David Rowley <drowley@postgresql.org>
date : Tue, 6 Jan 2026 15:16:14 +1300
committer: David Rowley <drowley@postgresql.org>
date : Tue, 6 Jan 2026 15:16:14 +1300 The comment claimed *strat got set to InvalidStrategy when the function
lookup fails. This isn't true; an ERROR is raised when that happens.
Author: Paul A Jungwirth <pj@illuminatedcomputing.com>
Reviewed-by: Neil Chen <carpenter.nail.cz@gmail.com>
Discussion: https://postgr.es/m/CA+renyXOrjLacP_nhqEQUf2W+ZCoY2q5kpQCfG05vQVYzr8b9w@mail.gmail.com
Backpatch-through: 18 M src/backend/commands/indexcmds.c
doc: Fix outdated doc in pg_rewind.
commit : b9ee5f2dcba2ae2e6bfca6c873fb2708970f2c81
author : Fujii Masao <fujii@postgresql.org>
date : Tue, 6 Jan 2026 11:00:54 +0900
committer: Fujii Masao <fujii@postgresql.org>
date : Tue, 6 Jan 2026 11:00:54 +0900 Update pg_rewind documentation to reflect the change that data checksums are
now enabled by default during initdb.
Backpatch to v18, where data checksums were changed to be enabled by default.
Author: Zhijie Hou <houzj.fnst@fujitsu.com>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>
Discussion: https://postgr.es/m/TY4PR01MB16907D62F3A0A377B30FDBEA794B2A@TY4PR01MB16907.jpnprd01.prod.outlook.com
Backpatch-through: 18 M doc/src/sgml/ref/pg_rewind.sgml
Clarify where various catcache.h dlist_nodes are used
commit : c5af141cd4344d52ad8afbd6ecffe509227559a9
author : David Rowley <drowley@postgresql.org>
date : Tue, 6 Jan 2026 14:39:36 +1300
committer: David Rowley <drowley@postgresql.org>
date : Tue, 6 Jan 2026 14:39:36 +1300 Also remove a comment which mentions we don't currently divide the
per-cache lists into hash buckets. Since 473182c95, we do.
Author: ChangAo Chen <cca5507@qq.com>
Discussion: https://postgr.es/m/tencent_7732789707C8768EA13785A7B5EA29103208@qq.com M src/include/utils/catcache.h
pg_visibility: Fix incorrect buffer lock description in comment.
commit : e212a0f8e6ba95b403aa0ceacc05793449f5e742
author : Masahiko Sawada <msawada@postgresql.org>
date : Mon, 5 Jan 2026 15:49:43 -0800
committer: Masahiko Sawada <msawada@postgresql.org>
date : Mon, 5 Jan 2026 15:49:43 -0800 Although the comment in collect_corrupt_items() stated that the buffer
is locked in exclusive mode, it is actually locked in shared mode.
Author: Chao Li <lic@highgo.com>
Discussion: https://postgr.es/m/CAEoWx2kkhxgfp=kinPMetnwHaa0JjR6YBkO_0gg0oiy6mu7Zjw@mail.gmail.com M contrib/pg_visibility/pg_visibility.c
Fix meson build of snowball code.
commit : b85d5dc0e7e9d0857aaf4ba712fc2186e7684e5f
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Mon, 5 Jan 2026 16:51:36 -0500
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Mon, 5 Jan 2026 16:51:36 -0500 include/snowball/libstemmer has to be in the -I search path,
as it is in the autoconf build. It's not apparent to me how
this ever worked before, nor why my recent commit made it
stop working.
Discussion: https://postgr.es/m/ld2iurl7kzexwydxmdfhdgarpa7xxsfrgvggqhbblt4rvt3h6t@bxsk6oz5x7cc M src/backend/snowball/meson.build
Update to latest Snowball sources.
commit : 7dc95cc3b94f2f558606e5ec307466a4e3dbc832
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Mon, 5 Jan 2026 15:22:12 -0500
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Mon, 5 Jan 2026 15:22:12 -0500 It's been almost a year since we last did this, and upstream has
been busy. They've added stemmers for Polish and Esperanto,
and also deprecated their old Dutch stemmer in favor of the
Kraaij-Pohlmann algorithm. (The "dutch" stemmer is now the
latter, and "dutch_porter" is the old algorithm.)
Upstream also decided to rename their internal header "header.h"
to something less generic: "snowball_runtime.h". Seems like a good
thing, but it complicates this patch a bit because we were relying on
interposing our own version of "header.h" to control system header
inclusion order. (We're partially failing at that now, because now the
generated stemmer files include <stddef.h> before snowball_runtime.h.
I think that'll be okay, but if the buildfarm complains then we'll
have to do more-extensive editing of the generated files.)
I realized that we weren't documenting the available stemmers in
any user-visible place, except indirectly through sample \dFd output.
That's incomplete because we only provide built-in dictionaries for
the recommended stemmers for each language, not alternative stemmers
such as dutch_porter. So I added a list to the documentation.
I did not do anything with the stopword lists. If those are still
available from snowballstem.org, they are mighty well hidden.
Discussion: https://postgr.es/m/1185975.1767569534@sss.pgh.pa.us M doc/src/sgml/textsearch.sgml
M src/backend/snowball/Makefile
M src/backend/snowball/README
M src/backend/snowball/dict_snowball.c
M src/backend/snowball/libstemmer/api.c
M src/backend/snowball/libstemmer/stem_ISO_8859_1_basque.c
M src/backend/snowball/libstemmer/stem_ISO_8859_1_catalan.c
M src/backend/snowball/libstemmer/stem_ISO_8859_1_danish.c
M src/backend/snowball/libstemmer/stem_ISO_8859_1_dutch.c
A src/backend/snowball/libstemmer/stem_ISO_8859_1_dutch_porter.c
M src/backend/snowball/libstemmer/stem_ISO_8859_1_english.c
M src/backend/snowball/libstemmer/stem_ISO_8859_1_finnish.c
M src/backend/snowball/libstemmer/stem_ISO_8859_1_french.c
M src/backend/snowball/libstemmer/stem_ISO_8859_1_german.c
M src/backend/snowball/libstemmer/stem_ISO_8859_1_indonesian.c
M src/backend/snowball/libstemmer/stem_ISO_8859_1_irish.c
M src/backend/snowball/libstemmer/stem_ISO_8859_1_italian.c
M src/backend/snowball/libstemmer/stem_ISO_8859_1_norwegian.c
M src/backend/snowball/libstemmer/stem_ISO_8859_1_porter.c
M src/backend/snowball/libstemmer/stem_ISO_8859_1_portuguese.c
M src/backend/snowball/libstemmer/stem_ISO_8859_1_spanish.c
M src/backend/snowball/libstemmer/stem_ISO_8859_1_swedish.c
M src/backend/snowball/libstemmer/stem_ISO_8859_2_hungarian.c
A src/backend/snowball/libstemmer/stem_ISO_8859_2_polish.c
M src/backend/snowball/libstemmer/stem_KOI8_R_russian.c
M src/backend/snowball/libstemmer/stem_UTF_8_arabic.c
M src/backend/snowball/libstemmer/stem_UTF_8_armenian.c
M src/backend/snowball/libstemmer/stem_UTF_8_basque.c
M src/backend/snowball/libstemmer/stem_UTF_8_catalan.c
M src/backend/snowball/libstemmer/stem_UTF_8_danish.c
M src/backend/snowball/libstemmer/stem_UTF_8_dutch.c
A src/backend/snowball/libstemmer/stem_UTF_8_dutch_porter.c
M src/backend/snowball/libstemmer/stem_UTF_8_english.c
A src/backend/snowball/libstemmer/stem_UTF_8_esperanto.c
M src/backend/snowball/libstemmer/stem_UTF_8_estonian.c
M src/backend/snowball/libstemmer/stem_UTF_8_finnish.c
M src/backend/snowball/libstemmer/stem_UTF_8_french.c
M src/backend/snowball/libstemmer/stem_UTF_8_german.c
M src/backend/snowball/libstemmer/stem_UTF_8_greek.c
M src/backend/snowball/libstemmer/stem_UTF_8_hindi.c
M src/backend/snowball/libstemmer/stem_UTF_8_hungarian.c
M src/backend/snowball/libstemmer/stem_UTF_8_indonesian.c
M src/backend/snowball/libstemmer/stem_UTF_8_irish.c
M src/backend/snowball/libstemmer/stem_UTF_8_italian.c
M src/backend/snowball/libstemmer/stem_UTF_8_lithuanian.c
M src/backend/snowball/libstemmer/stem_UTF_8_nepali.c
M src/backend/snowball/libstemmer/stem_UTF_8_norwegian.c
A src/backend/snowball/libstemmer/stem_UTF_8_polish.c
M src/backend/snowball/libstemmer/stem_UTF_8_porter.c
M src/backend/snowball/libstemmer/stem_UTF_8_portuguese.c
M src/backend/snowball/libstemmer/stem_UTF_8_romanian.c
M src/backend/snowball/libstemmer/stem_UTF_8_russian.c
M src/backend/snowball/libstemmer/stem_UTF_8_serbian.c
M src/backend/snowball/libstemmer/stem_UTF_8_spanish.c
M src/backend/snowball/libstemmer/stem_UTF_8_swedish.c
M src/backend/snowball/libstemmer/stem_UTF_8_tamil.c
M src/backend/snowball/libstemmer/stem_UTF_8_turkish.c
M src/backend/snowball/libstemmer/stem_UTF_8_yiddish.c
M src/backend/snowball/libstemmer/utilities.c
M src/backend/snowball/meson.build
M src/backend/snowball/snowball_create.pl
M src/bin/initdb/initdb.c
M src/include/snowball/libstemmer/api.h
D src/include/snowball/libstemmer/header.h
A src/include/snowball/libstemmer/snowball_runtime.h
M src/include/snowball/libstemmer/stem_ISO_8859_1_basque.h
M src/include/snowball/libstemmer/stem_ISO_8859_1_catalan.h
M src/include/snowball/libstemmer/stem_ISO_8859_1_danish.h
M src/include/snowball/libstemmer/stem_ISO_8859_1_dutch.h
A src/include/snowball/libstemmer/stem_ISO_8859_1_dutch_porter.h
M src/include/snowball/libstemmer/stem_ISO_8859_1_english.h
M src/include/snowball/libstemmer/stem_ISO_8859_1_finnish.h
M src/include/snowball/libstemmer/stem_ISO_8859_1_french.h
M src/include/snowball/libstemmer/stem_ISO_8859_1_german.h
M src/include/snowball/libstemmer/stem_ISO_8859_1_indonesian.h
M src/include/snowball/libstemmer/stem_ISO_8859_1_irish.h
M src/include/snowball/libstemmer/stem_ISO_8859_1_italian.h
M src/include/snowball/libstemmer/stem_ISO_8859_1_norwegian.h
M src/include/snowball/libstemmer/stem_ISO_8859_1_porter.h
M src/include/snowball/libstemmer/stem_ISO_8859_1_portuguese.h
M src/include/snowball/libstemmer/stem_ISO_8859_1_spanish.h
M src/include/snowball/libstemmer/stem_ISO_8859_1_swedish.h
M src/include/snowball/libstemmer/stem_ISO_8859_2_hungarian.h
A src/include/snowball/libstemmer/stem_ISO_8859_2_polish.h
M src/include/snowball/libstemmer/stem_KOI8_R_russian.h
M src/include/snowball/libstemmer/stem_UTF_8_arabic.h
M src/include/snowball/libstemmer/stem_UTF_8_armenian.h
M src/include/snowball/libstemmer/stem_UTF_8_basque.h
M src/include/snowball/libstemmer/stem_UTF_8_catalan.h
M src/include/snowball/libstemmer/stem_UTF_8_danish.h
M src/include/snowball/libstemmer/stem_UTF_8_dutch.h
A src/include/snowball/libstemmer/stem_UTF_8_dutch_porter.h
M src/include/snowball/libstemmer/stem_UTF_8_english.h
A src/include/snowball/libstemmer/stem_UTF_8_esperanto.h
M src/include/snowball/libstemmer/stem_UTF_8_estonian.h
M src/include/snowball/libstemmer/stem_UTF_8_finnish.h
M src/include/snowball/libstemmer/stem_UTF_8_french.h
M src/include/snowball/libstemmer/stem_UTF_8_german.h
M src/include/snowball/libstemmer/stem_UTF_8_greek.h
M src/include/snowball/libstemmer/stem_UTF_8_hindi.h
M src/include/snowball/libstemmer/stem_UTF_8_hungarian.h
M src/include/snowball/libstemmer/stem_UTF_8_indonesian.h
M src/include/snowball/libstemmer/stem_UTF_8_irish.h
M src/include/snowball/libstemmer/stem_UTF_8_italian.h
M src/include/snowball/libstemmer/stem_UTF_8_lithuanian.h
M src/include/snowball/libstemmer/stem_UTF_8_nepali.h
M src/include/snowball/libstemmer/stem_UTF_8_norwegian.h
A src/include/snowball/libstemmer/stem_UTF_8_polish.h
M src/include/snowball/libstemmer/stem_UTF_8_porter.h
M src/include/snowball/libstemmer/stem_UTF_8_portuguese.h
M src/include/snowball/libstemmer/stem_UTF_8_romanian.h
M src/include/snowball/libstemmer/stem_UTF_8_russian.h
M src/include/snowball/libstemmer/stem_UTF_8_serbian.h
M src/include/snowball/libstemmer/stem_UTF_8_spanish.h
M src/include/snowball/libstemmer/stem_UTF_8_swedish.h
M src/include/snowball/libstemmer/stem_UTF_8_tamil.h
M src/include/snowball/libstemmer/stem_UTF_8_turkish.h
M src/include/snowball/libstemmer/stem_UTF_8_yiddish.h
R070 src/include/snowball/header.h src/include/snowball/snowball_runtime.h
ci: Remove ulimit -p for netbsd/openbsd
commit : bb048e31dc17202faaab37132420a0740f9ca85c
author : Andres Freund <andres@anarazel.de>
date : Mon, 5 Jan 2026 13:09:03 -0500
committer: Andres Freund <andres@anarazel.de>
date : Mon, 5 Jan 2026 13:09:03 -0500 Previously the ulimit -p 256 was needed to increase the limit on
openbsd. However, sometimes the limit actually was too low, causing
"could not fork new process for connection: Resource temporarily unavailable"
errors. Most commonly on netbsd, but also on openbsd.
The ulimit on openbsd couldn't trivially be increased with ulimit, because of
hitting the hard limit.
Instead of increasing the limit in the CI script, the CI image generation now
increases the limits: https://github.com/anarazel/pg-vm-images/pull/129
Backpatch-through: 18 M .cirrus.tasks.yml
Fix typo in parallel.c.
commit : d351063e49ac79399338b3aa5b9da39cde746030
author : Masahiko Sawada <msawada@postgresql.org>
date : Mon, 5 Jan 2026 10:16:28 -0800
committer: Masahiko Sawada <msawada@postgresql.org>
date : Mon, 5 Jan 2026 10:16:28 -0800 Author: kelan <ke_lan1@qq.com>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com>
Discussion: https://postgr.es/m/tencent_38B5875E2D440C8DA8C0C022ABD999F9C207@qq.com M src/backend/access/transam/parallel.c
Use WAIT FOR LSN in PostgreSQL::Test::Cluster::wait_for_catchup()
commit : f30848cb05d4d63e1a5a2d6a9d72604f3b63370d
author : Alexander Korotkov <akorotkov@postgresql.org>
date : Mon, 5 Jan 2026 19:41:31 +0200
committer: Alexander Korotkov <akorotkov@postgresql.org>
date : Mon, 5 Jan 2026 19:41:31 +0200 When the standby is passed as a PostgreSQL::Test::Cluster instance,
use the WAIT FOR LSN command on the standby server to implement
wait_for_catchup() for replay, write, and flush modes. This is more
efficient than polling pg_stat_replication on the upstream, as the
WAIT FOR LSN command uses a latch-based wakeup mechanism.
The optimization applies when:
- The standby is passed as a Cluster object (not just a name string)
- The mode is 'replay', 'write', or 'flush' (not 'sent')
- The standby is in recovery
For 'sent' mode, when the standby is passed as a string (e.g., a
subscription name for logical replication), or when the standby has
been promoted, the function falls back to the original polling-based
approach using pg_stat_replication on the upstream.
Discussion: https://postgr.es/m/CABPTF7UiArgW-sXj9CNwRzUhYOQrevLzkYcgBydmX5oDes1sjg%40mail.gmail.com
Author: Xuneng Zhou <xunengzhou@gmail.com>
Reviewed-by: Alexander Korotkov <aekorotkov@gmail.com>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Alvaro Herrera <alvherre@kurilemu.de> M src/test/perl/PostgreSQL/Test/Cluster.pm
Add tab completion for the WAIT FOR LSN MODE option
commit : 76948337f724fe92c937d3ccefe2cd08a45f4734
author : Alexander Korotkov <akorotkov@postgresql.org>
date : Mon, 5 Jan 2026 19:41:09 +0200
committer: Alexander Korotkov <akorotkov@postgresql.org>
date : Mon, 5 Jan 2026 19:41:09 +0200 Update psql tab completion to support the optional MODE option in the
WAIT FOR LSN command. After specifying an LSN value, completion now offers
both MODE and WITH keywords. The MODE option specifies which LSN type to wait
for. In particular, it controls whether the wait is evaluated from the
standby or primary perspective.
When MODE is specified, the completion suggests the valid mode values:
standby_replay, standby_write, standby_flush, and primary_flush.
Discussion: https://postgr.es/m/CABPTF7UiArgW-sXj9CNwRzUhYOQrevLzkYcgBydmX5oDes1sjg%40mail.gmail.com
Author: Xuneng Zhou <xunengzhou@gmail.com>
Reviewed-by: Alexander Korotkov <aekorotkov@gmail.com>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Alvaro Herrera <alvherre@kurilemu.de> M src/bin/psql/tab-complete.in.c
Add the MODE option to the WAIT FOR LSN command
commit : 49a181b5d634340fcfb7c762c387c03f6405367e
author : Alexander Korotkov <akorotkov@postgresql.org>
date : Mon, 5 Jan 2026 19:40:44 +0200
committer: Alexander Korotkov <akorotkov@postgresql.org>
date : Mon, 5 Jan 2026 19:40:44 +0200 This commit extends the WAIT FOR LSN command with an optional MODE option in
the WITH clause that specifies which LSN type to wait for:
WAIT FOR LSN '<lsn>' [WITH (MODE '<mode>', ...)]
where mode can be:
- 'standby_replay' (default): Wait for WAL to be replayed to the specified
LSN,
- 'standby_write': Wait for WAL to be written (received) to the specified
LSN,
- 'standby_flush': Wait for WAL to be flushed to disk at the specified LSN,
- 'primary_flush': Wait for WAL to be flushed to disk on the primary server.
The default mode is 'standby_replay', matching the original behavior when MODE
is not specified. This follows the pattern used by COPY and EXPLAIN
commands, where options are specified as string values in the WITH clause.
Modes are explicitly named to distinguish between primary and standby
operations:
- Standby modes ('standby_replay', 'standby_write', 'standby_flush') can only
be used during recovery (on a standby server),
- Primary mode ('primary_flush') can only be used on a primary server.
The 'standby_write' and 'standby_flush' modes are useful for scenarios where
applications need to ensure WAL has been received or persisted on the standby
without necessarily waiting for replay to complete. The 'primary_flush' mode
allows waiting for WAL to be flushed on the primary server.
This commit also includes includes:
- Documentation updates for the new syntax and mode descriptions,
- Test coverage for all four modes, including error cases and concurrent
waiters,
- Wakeup logic in walreceiver for standby write/flush waiters,
- Wakeup logic in WAL writer for primary flush waiters.
Discussion: https://postgr.es/m/CABPTF7UiArgW-sXj9CNwRzUhYOQrevLzkYcgBydmX5oDes1sjg%40mail.gmail.com
Author: Xuneng Zhou <xunengzhou@gmail.com>
Reviewed-by: Alexander Korotkov <aekorotkov@gmail.com>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Alvaro Herrera <alvherre@kurilemu.de> M doc/src/sgml/ref/wait_for.sgml
M src/backend/access/transam/xlog.c
M src/backend/commands/wait.c
M src/backend/replication/walreceiver.c
M src/test/recovery/t/049_wait_for_lsn.pl
Extend xlogwait infrastructure with write and flush wait types
commit : 7a39f43d885b44a78f366aa50535944c4e38bdbb
author : Alexander Korotkov <akorotkov@postgresql.org>
date : Mon, 5 Jan 2026 19:40:31 +0200
committer: Alexander Korotkov <akorotkov@postgresql.org>
date : Mon, 5 Jan 2026 19:40:31 +0200 Add support for waiting on WAL write and flush LSNs in addition to the
existing replay LSN wait type. This provides the foundation for
extending the WAIT FOR command with MODE parameter.
Key changes are following.
- Add WAIT_LSN_TYPE_STANDBY_WRITE and WAIT_LSN_TYPE_STANDBY_FLUSH to
WaitLSNType.
- Add GetCurrentLSNForWaitType() to retrieve the current LSN for each wait
type.
- Add new wait events WAIT_EVENT_WAIT_FOR_WAL_WRITE and
WAIT_EVENT_WAIT_FOR_WAL_FLUSH for pg_stat_activity visibility.
- Update WaitForLSN() to use GetCurrentLSNForWaitType() internally.
Discussion: https://postgr.es/m/CABPTF7UiArgW-sXj9CNwRzUhYOQrevLzkYcgBydmX5oDes1sjg%40mail.gmail.com
Author: Xuneng Zhou <xunengzhou@gmail.com>
Reviewed-by: Alexander Korotkov <aekorotkov@gmail.com>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Alvaro Herrera <alvherre@kurilemu.de> M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogrecovery.c
M src/backend/access/transam/xlogwait.c
M src/backend/commands/wait.c
M src/backend/utils/activity/wait_event_names.txt
M src/include/access/xlogwait.h
Adjust errcode in checkPartition()
commit : d51a5d8e56922a4343af8e31abef4a3faf95352f
author : Alexander Korotkov <akorotkov@postgresql.org>
date : Mon, 5 Jan 2026 19:38:03 +0200
committer: Alexander Korotkov <akorotkov@postgresql.org>
date : Mon, 5 Jan 2026 19:38:03 +0200 Replace ERRCODE_UNDEFINED_TABLE with ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE
for the case where we don't find a parent-child relationship between the
partitioned table and its partition. In this case, tables are present, but
they are not in a prerequisite state (no relationship).
Discussion: https://postgr.es/m/CAHewXNmBM%2B5qbrJMu60NxPn%2B0y-%3D2wXM-QVVs3xRp8NxFvDb9A%40mail.gmail.com
Author: Tender Wang <tndrwang@gmail.com>
Reviewed-by: Kirill Reshke <reshkekirill@gmail.com> M src/backend/parser/parse_utilcmd.c
Remove redundant SET enable_partitionwise_join = on.
commit : 3f33b63de278615130367d182c38e29661d588e2
author : Robert Haas <rhaas@postgresql.org>
date : Mon, 5 Jan 2026 11:57:24 -0500
committer: Robert Haas <rhaas@postgresql.org>
date : Mon, 5 Jan 2026 11:57:24 -0500 partition_join.sql keeps partitionwise join enabled for the entire file,
so we don't need to enable it for this test case individually.
Author: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>
Discussion: http://postgr.es/m/CAExHW5uRW=Z==bmLR=NXm6Vv3JGH4rUvb+Rfft8TfjrfzUUm3g@mail.gmail.com M src/test/regress/expected/partition_join.out
M src/test/regress/sql/partition_join.sql
Fix comment in tableam.c
commit : 877ae5db8968555d7a5634e69018dfe6c55976eb
author : Michael Paquier <michael@paquier.xyz>
date : Mon, 5 Jan 2026 19:15:55 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Mon, 5 Jan 2026 19:15:55 +0900 Author: shiyu qin <qinshy510@gmail.com>
Discussion: https://postgr.es/m/CAJUCM3uJjoLR1zfKoZD4J71T-hdeFdFw1kTQoMkywKZP0hZsvw@mail.gmail.com M src/backend/access/table/tableam.c
Separate read and write pointers in pg_saslprep
commit : de746e0d2a5856f162deed042420ca15e6683cdd
author : Peter Eisentraut <peter@eisentraut.org>
date : Mon, 5 Jan 2026 10:50:27 +0100
committer: Peter Eisentraut <peter@eisentraut.org>
date : Mon, 5 Jan 2026 10:50:27 +0100 Use separate pointers for reading const input ('p') and writing to
mutable output ('outp'), avoiding the need to cast away const on the
input parameter.
Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Discussion: https://postgr.es/m/aUQHy/MmWq7c97wK%40ip-10-97-1-34.eu-west-3.compute.internal M src/common/saslprep.c
Tighten up assertion on a local variable
commit : 461b8cc95252ff0177a44be20b06c21ff07af4fa
author : Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Mon, 5 Jan 2026 11:33:35 +0200
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Mon, 5 Jan 2026 11:33:35 +0200 'lineindex' is 0-based, as mentioned in the comments.
Backpatch to v18 where the assertion was added.
Author: ChangAo Chen <cca5507@qq.com>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://www.postgresql.org/message-id/tencent_A84F3C810365BB9BD08442955AE494141907@qq.com
Backpatch-through: 18 M src/backend/access/heap/heapam.c
Use the GetPGProcByNumber() macro when possible
commit : 4c144e0452daa2508a008bb4cde520613bbd386d
author : David Rowley <drowley@postgresql.org>
date : Mon, 5 Jan 2026 21:19:03 +1300
committer: David Rowley <drowley@postgresql.org>
date : Mon, 5 Jan 2026 21:19:03 +1300 A few places were accessing &ProcGlobal->allProcs directly, so adjust
them to use the accessor macro instead.
Author: Maksim Melnikov <m.melnikov@postgrespro.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: David Rowley <dgrowleyml@gmail.com>
Discussion: https://postgr.es/m/80621c00-aba6-483c-88b1-a845461d1165@postgrespro.ru M src/backend/access/transam/clog.c
M src/backend/postmaster/pgarch.c
M src/backend/postmaster/walsummarizer.c
M src/backend/storage/buffer/freelist.c
M src/backend/storage/lmgr/lock.c
M src/backend/storage/lmgr/proc.c
Improve the comments atop build_replindex_scan_key().
commit : 3f906d3af99d4d926c942ebdca7b2f92a209d346
author : Amit Kapila <akapila@postgresql.org>
date : Mon, 5 Jan 2026 03:06:55 +0000
committer: Amit Kapila <akapila@postgresql.org>
date : Mon, 5 Jan 2026 03:06:55 +0000 Author: zourenli <398740848@qq.com>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://postgr.es/m/tencent_C2DC8157CC05C8F5C36E12678A7864554809@qq.com M src/backend/executor/execReplication.c
Remove unneeded probes from configure and meson
commit : 8ab4b864c13f76512bd14591cc358df8c3d7c3a0
author : Michael Paquier <michael@paquier.xyz>
date : Mon, 5 Jan 2026 11:03:43 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Mon, 5 Jan 2026 11:03:43 +0900 7d854bdc5b72 has removed two symbols from pg_config.h.in. This file is
automatically generated. The correct cleanup needs to be done in the
build scripts, instead. autoheader produces now a consistent
pg_config.h.in, without the symbols that were removed in the previous
commit.
Reported-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/1193764.1767573683@sss.pgh.pa.us M configure
M configure.ac
M meson.build
Remove unneeded defines from pg_config.h.in
commit : 7d854bdc5b72b30ae58041d88c2be509950b99d4
author : Michael Paquier <michael@paquier.xyz>
date : Mon, 5 Jan 2026 09:27:19 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Mon, 5 Jan 2026 09:27:19 +0900 This commit removes HAVE_ATOMIC_H and HAVE_MBARRIER_H from
pg_config.h.in, cleanup that could have been done in 25f36066dd2a.
Author: Alexander Lakhin <exclusion@gmail.com>
Discussion: https://postgr.es/m/b2c0d0b7-3944-487d-a03d-d155851958ff@gmail.com M src/include/pg_config.h.in
Fix typos and inconsistencies in code and comments
commit : b8cfcb9e00da6f2149f5977e99bdcf3121fea0aa
author : Michael Paquier <michael@paquier.xyz>
date : Mon, 5 Jan 2026 09:19:15 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Mon, 5 Jan 2026 09:19:15 +0900 This change is a cocktail of harmonization of function argument names,
grammar typos, renames for better consistency and unused code (see
ltree). All of these have been spotted by the author.
Author: Alexander Lakhin <exclusion@gmail.com>
Discussion: https://postgr.es/m/b2c0d0b7-3944-487d-a03d-d155851958ff@gmail.com M contrib/ltree/ltxtquery_io.c
M doc/src/sgml/ref/create_subscription.sgml
M src/backend/access/heap/heapam.c
M src/backend/access/heap/heapam_xlog.c
M src/backend/access/rmgrdesc/gindesc.c
M src/backend/commands/subscriptioncmds.c
M src/backend/nodes/queryjumblefuncs.c
M src/backend/optimizer/plan/analyzejoins.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/util/plancat.c
M src/backend/partitioning/partbounds.c
M src/backend/replication/logical/slotsync.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/lmgr/predicate.c
M src/backend/utils/init/postinit.c
M src/backend/utils/misc/guc_parameters.dat
M src/bin/pg_upgrade/t/007_multixact_conversion.pl
M src/include/access/heapam.h
M src/include/c.h
M src/include/commands/sequence.h
M src/include/common/int128.h
M src/include/jit/llvmjit.h
M src/include/nodes/pathnodes.h
M src/include/optimizer/geqo_recombination.h
M src/include/port.h
M src/include/port/win32/sys/socket.h
M src/include/port/win32_port.h
M src/include/replication/logicalctl.h
M src/include/replication/worker_internal.h
M src/include/statistics/stat_utils.h
M src/include/storage/predicate.h
M src/include/utils/guc.h
M src/test/modules/brin/t/01_workitems.pl
M src/test/recovery/t/048_vacuum_horizon_floor.pl
M src/tools/valgrind.supp
Allow role created by new test to log in on Windows.
commit : e3fbc9a8de75206805a4252969a5896e6f6e5929
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Sun, 4 Jan 2026 18:14:02 -0500
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Sun, 4 Jan 2026 18:14:02 -0500 We must tell init about each role name we plan to connect as,
else SSPI auth fails. Similar to previous patches such as
da44d71e7.
Oversight in f3c9e341c, per buildfarm member drongo. M src/test/modules/test_extensions/t/001_extension_control_path.pl
Include error location in errors from ComputeIndexAttrs().
commit : ba75f717526cbaa9000b546aac456e43d03aaf53
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Sun, 4 Jan 2026 14:16:15 -0500
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Sun, 4 Jan 2026 14:16:15 -0500 Make use of IndexElem's new location field to localize these
errors better.
Author: jian he <jian.universality@gmail.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/CACJufxH3OgXF1hrzGAaWyNtye2jHEmk9JbtrtGv-KJK6tsGo5w@mail.gmail.com M src/backend/bootstrap/bootparse.y
M src/backend/commands/indexcmds.c
M src/backend/commands/tablecmds.c
M src/backend/tcop/utility.c
M src/include/commands/defrem.h
M src/test/regress/expected/alter_table.out
M src/test/regress/expected/collate.icu.utf8.out
M src/test/regress/expected/collate.linux.utf8.out
M src/test/regress/expected/collate.out
M src/test/regress/expected/collate.windows.win1252.out
M src/test/regress/expected/sqljson_queryfuncs.out
Add parse location to IndexElem.
commit : 62299bbd90d69e2273d3e2ba35af5953d20ca037
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Sun, 4 Jan 2026 13:23:26 -0500
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Sun, 4 Jan 2026 13:23:26 -0500 This patch mostly just fills in the field, although a few error
reports in resolve_unique_index_expr() are adjusted to use it.
The next commit will add more uses.
catversion bump out of an abundance of caution: I'm not sure
IndexElem can appear in stored rules, but I'm not sure it can't
either.
Author: Álvaro Herrera <alvherre@kurilemu.de>
Co-authored-by: jian he <jian.universality@gmail.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/CACJufxH3OgXF1hrzGAaWyNtye2jHEmk9JbtrtGv-KJK6tsGo5w@mail.gmail.com
Discussion: https://postgr.es/m/202512121327.f2zimsr6guso@alvherre.pgsql M src/backend/bootstrap/bootparse.y
M src/backend/nodes/nodeFuncs.c
M src/backend/parser/gram.y
M src/backend/parser/parse_clause.c
M src/backend/parser/parse_utilcmd.c
M src/include/catalog/catversion.h
M src/include/nodes/parsenodes.h
M src/test/regress/expected/insert_conflict.out
Fix partial read handling in pg_upgrade's multixact conversion
commit : ac94ce8194e501c1ace7115e5e4720e0da4b5168
author : Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Sun, 4 Jan 2026 20:04:36 +0200
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Sun, 4 Jan 2026 20:04:36 +0200 Author: Man Zeng <zengman@halodbtech.com>
Discussion: https://www.postgresql.org/message-id/tencent_566562B52163DB1502F4F7A4@qq.com M src/bin/pg_upgrade/slru_io.c
Remove bogus const qualifier on PageGetItem() argument
commit : 0eadf1767ab8dec03135feaff8cd9e38881c1960
author : Peter Eisentraut <peter@eisentraut.org>
date : Sun, 4 Jan 2026 16:00:15 +0100
committer: Peter Eisentraut <peter@eisentraut.org>
date : Sun, 4 Jan 2026 16:00:15 +0100 The function ends up casting away the const qualifier, so it was a
lie. No callers appear to rely on the const qualifier on the
argument, so the simplest solution is to just remove it.
Reviewed-by: Andres Freund <andres@anarazel.de>
Discussion: https://www.postgresql.org/message-id/beusplf77varvhip6ryuhd2fchsx26qmmhduqz432bnglq634b%402dx4k6yxj4cm M src/include/storage/bufpage.h
Doc: add missing punctuation
commit : 07e0e9ac270562b13743952c3e9c50ced00a2406
author : David Rowley <drowley@postgresql.org>
date : Sun, 4 Jan 2026 21:12:23 +1300
committer: David Rowley <drowley@postgresql.org>
date : Sun, 4 Jan 2026 21:12:23 +1300 Author: Daisuke Higuchi <higuchi.daisuke11@gmail.com>
Reviewed-by: Robert Treat <rob@xzilla.net>
Discussion: https://postgr.es/m/CAEVT6c-yWYstu76YZ7VOxmij2XA8vrOEvens08QLmKHTDjEPBw@mail.gmail.com
Backpatch-through: 14 M doc/src/sgml/config.sgml
M doc/src/sgml/history.sgml
Fix selectivity estimation integer overflow in contrib/intarray
commit : 4f49e4b55e709e9aa758312da5b84bbbb674f30a
author : David Rowley <drowley@postgresql.org>
date : Sun, 4 Jan 2026 20:32:40 +1300
committer: David Rowley <drowley@postgresql.org>
date : Sun, 4 Jan 2026 20:32:40 +1300 This fixes a poorly written integer comparison function which was
performing subtraction in an attempt to return a negative value when
a < b and a positive value when a > b, and 0 when the values were equal.
Unfortunately that didn't always work correctly due to two's complement
having the INT_MIN 1 further from zero than INT_MAX. This could result
in an overflow and cause the comparison function to return an incorrect
result, which would result in the binary search failing to find the
value being searched for.
This could cause poor selectivity estimates when the statistics stored
the value of INT_MAX (2147483647) and the value being searched for was
large enough to result in the binary search doing a comparison with that
INT_MAX value.
Author: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: David Rowley <dgrowleyml@gmail.com>
Discussion: https://postgr.es/m/CAEoWx2ng1Ot5LoKbVU-Dh---dFTUZWJRH8wv2chBu29fnNDMaQ@mail.gmail.com
Backpatch-through: 14 M contrib/intarray/_int_selfuncs.c
Improve a couple of error messages.
commit : 54315fde73915a2468eaa22a2fa38927a23ac4ec
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Sat, 3 Jan 2026 17:18:39 -0500
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Sat, 3 Jan 2026 17:18:39 -0500 Change "function" to "function or procedure" in
PreventInTransactionBlock, and improve grammar of ExecWaitStmt's
complaint about having an active snapshot.
Author: Pavel Stehule <pavel.stehule@gmail.com>
Reviewed-by: Andreas Karlsson <andreas@proxel.se>
Reviewed-by: Marcos Pegoraro <marcos@f10.com.br>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/CAFj8pRCveWPR06bbad9GnMb0Kcr6jnXPttv9XOaOB+oFCD1Tsg@mail.gmail.com M src/backend/access/transam/xact.c
M src/backend/commands/wait.c
M src/test/recovery/t/049_wait_for_lsn.pl
M src/test/regress/expected/subscription.out
Fix spelling mistake in fk-snapshot-3.spec
commit : 094b61ce3ebbb1258675cb9b4eca9198628e2177
author : David Rowley <drowley@postgresql.org>
date : Fri, 2 Jan 2026 17:53:07 +1300
committer: David Rowley <drowley@postgresql.org>
date : Fri, 2 Jan 2026 17:53:07 +1300 Author: Aditya Gollamudi <adigollamudi@gmail.com>
Discussion: https://postgr.es/m/CAD-KL_EdOOWp_cmPk9%3D5vNxo%2BabTTRpNx4vex-gVUm8u3GnkTg%40mail.gmail.com M src/test/isolation/specs/fk-snapshot-3.spec
Update copyright for 2026
commit : 451c43974f8e199097d97624a4952ad0973cea61
author : Bruce Momjian <bruce@momjian.us>
date : Thu, 1 Jan 2026 13:24:10 -0500
committer: Bruce Momjian <bruce@momjian.us>
date : Thu, 1 Jan 2026 13:24:10 -0500 Backpatch-through: 14 M COPYRIGHT
M config/check_modules.pl
M configure
M configure.ac
M contrib/amcheck/meson.build
M contrib/amcheck/t/001_verify_heapam.pl
M contrib/amcheck/t/002_cic.pl
M contrib/amcheck/t/003_cic_2pc.pl
M contrib/amcheck/t/004_verify_nbtree_unique.pl
M contrib/amcheck/t/005_pitr.pl
M contrib/amcheck/t/006_verify_gin.pl
M contrib/amcheck/verify_common.c
M contrib/amcheck/verify_common.h
M contrib/amcheck/verify_gin.c
M contrib/amcheck/verify_heapam.c
M contrib/amcheck/verify_nbtree.c
M contrib/auth_delay/auth_delay.c
M contrib/auth_delay/meson.build
M contrib/auto_explain/auto_explain.c
M contrib/auto_explain/meson.build
M contrib/auto_explain/t/001_auto_explain.pl
M contrib/basebackup_to_shell/basebackup_to_shell.c
M contrib/basebackup_to_shell/meson.build
M contrib/basebackup_to_shell/t/001_basic.pl
M contrib/basic_archive/basic_archive.c
M contrib/basic_archive/meson.build
M contrib/bloom/blcost.c
M contrib/bloom/blinsert.c
M contrib/bloom/bloom.h
M contrib/bloom/blscan.c
M contrib/bloom/blutils.c
M contrib/bloom/blvacuum.c
M contrib/bloom/blvalidate.c
M contrib/bloom/meson.build
M contrib/bloom/t/001_wal.pl
M contrib/bool_plperl/meson.build
M contrib/btree_gin/meson.build
M contrib/btree_gist/meson.build
M contrib/citext/meson.build
M contrib/cube/meson.build
M contrib/dblink/dblink.c
M contrib/dblink/meson.build
M contrib/dblink/t/001_auth_scram.pl
M contrib/dict_int/dict_int.c
M contrib/dict_int/meson.build
M contrib/dict_xsyn/dict_xsyn.c
M contrib/dict_xsyn/meson.build
M contrib/earthdistance/meson.build
M contrib/file_fdw/file_fdw.c
M contrib/file_fdw/meson.build
M contrib/fuzzystrmatch/daitch_mokotoff.c
M contrib/fuzzystrmatch/daitch_mokotoff_header.pl
M contrib/fuzzystrmatch/fuzzystrmatch.c
M contrib/fuzzystrmatch/meson.build
M contrib/hstore/hstore_subs.c
M contrib/hstore/meson.build
M contrib/hstore_plperl/meson.build
M contrib/hstore_plpython/meson.build
M contrib/intagg/meson.build
M contrib/intarray/_int_selfuncs.c
M contrib/intarray/bench/bench.pl
M contrib/intarray/bench/create_test.pl
M contrib/intarray/meson.build
M contrib/isn/isn.c
M contrib/isn/isn.h
M contrib/isn/meson.build
M contrib/jsonb_plperl/meson.build
M contrib/jsonb_plpython/meson.build
M contrib/lo/meson.build
M contrib/ltree/meson.build
M contrib/ltree_plpython/meson.build
M contrib/meson.build
M contrib/oid2name/meson.build
M contrib/oid2name/t/001_basic.pl
M contrib/pageinspect/brinfuncs.c
M contrib/pageinspect/fsmfuncs.c
M contrib/pageinspect/ginfuncs.c
M contrib/pageinspect/gistfuncs.c
M contrib/pageinspect/hashfuncs.c
M contrib/pageinspect/heapfuncs.c
M contrib/pageinspect/meson.build
M contrib/pageinspect/pageinspect.h
M contrib/pageinspect/rawpage.c
M contrib/passwordcheck/meson.build
M contrib/passwordcheck/passwordcheck.c
M contrib/pg_buffercache/meson.build
M contrib/pg_freespacemap/meson.build
M contrib/pg_logicalinspect/meson.build
M contrib/pg_logicalinspect/pg_logicalinspect.c
M contrib/pg_overexplain/meson.build
M contrib/pg_overexplain/pg_overexplain.c
M contrib/pg_prewarm/autoprewarm.c
M contrib/pg_prewarm/meson.build
M contrib/pg_prewarm/pg_prewarm.c
M contrib/pg_prewarm/t/001_basic.pl
M contrib/pg_stat_statements/meson.build
M contrib/pg_stat_statements/pg_stat_statements.c
M contrib/pg_stat_statements/t/010_restart.pl
M contrib/pg_surgery/heap_surgery.c
M contrib/pg_surgery/meson.build
M contrib/pg_trgm/meson.build
M contrib/pg_trgm/trgm_regexp.c
M contrib/pg_visibility/meson.build
M contrib/pg_visibility/pg_visibility.c
M contrib/pg_visibility/t/001_concurrent_transaction.pl
M contrib/pg_visibility/t/002_corrupt_vm.pl
M contrib/pg_walinspect/meson.build
M contrib/pg_walinspect/pg_walinspect.c
M contrib/pgcrypto/meson.build
M contrib/pgrowlocks/meson.build
M contrib/pgstattuple/meson.build
M contrib/pgstattuple/pgstatapprox.c
M contrib/postgres_fdw/connection.c
M contrib/postgres_fdw/deparse.c
M contrib/postgres_fdw/meson.build
M contrib/postgres_fdw/option.c
M contrib/postgres_fdw/postgres_fdw.c
M contrib/postgres_fdw/postgres_fdw.h
M contrib/postgres_fdw/shippable.c
M contrib/postgres_fdw/t/001_auth_scram.pl
M contrib/seg/meson.build
M contrib/seg/seg-validate.pl
M contrib/seg/sort-segments.pl
M contrib/sepgsql/database.c
M contrib/sepgsql/dml.c
M contrib/sepgsql/hooks.c
M contrib/sepgsql/label.c
M contrib/sepgsql/launcher
M contrib/sepgsql/meson.build
M contrib/sepgsql/proc.c
M contrib/sepgsql/relation.c
M contrib/sepgsql/schema.c
M contrib/sepgsql/selinux.c
M contrib/sepgsql/sepgsql.h
M contrib/sepgsql/t/001_sepgsql.pl
M contrib/sepgsql/uavc.c
M contrib/spi/meson.build
M contrib/sslinfo/meson.build
M contrib/tablefunc/meson.build
M contrib/tablefunc/tablefunc.c
M contrib/tcn/meson.build
M contrib/tcn/tcn.c
M contrib/test_decoding/meson.build
M contrib/test_decoding/t/001_repl_stats.pl
M contrib/test_decoding/test_decoding.c
M contrib/tsm_system_rows/meson.build
M contrib/tsm_system_rows/tsm_system_rows.c
M contrib/tsm_system_time/meson.build
M contrib/tsm_system_time/tsm_system_time.c
M contrib/unaccent/meson.build
M contrib/unaccent/unaccent.c
M contrib/uuid-ossp/meson.build
M contrib/uuid-ossp/uuid-ossp.c
M contrib/vacuumlo/meson.build
M contrib/vacuumlo/t/001_basic.pl
M contrib/vacuumlo/vacuumlo.c
M contrib/xml2/meson.build
M doc/src/sgml/generate-errcodes-table.pl
M doc/src/sgml/generate-keywords-table.pl
M doc/src/sgml/generate-targets-meson.pl
M doc/src/sgml/legal.sgml
M doc/src/sgml/lobj.sgml
M doc/src/sgml/meson.build
M doc/src/sgml/targets-meson.txt
M meson.build
M meson_options.txt
M src/backend/Makefile
M src/backend/access/brin/brin.c
M src/backend/access/brin/brin_bloom.c
M src/backend/access/brin/brin_inclusion.c
M src/backend/access/brin/brin_minmax.c
M src/backend/access/brin/brin_minmax_multi.c
M src/backend/access/brin/brin_pageops.c
M src/backend/access/brin/brin_revmap.c
M src/backend/access/brin/brin_tuple.c
M src/backend/access/brin/brin_validate.c
M src/backend/access/brin/brin_xlog.c
M src/backend/access/brin/meson.build
M src/backend/access/common/attmap.c
M src/backend/access/common/bufmask.c
M src/backend/access/common/detoast.c
M src/backend/access/common/heaptuple.c
M src/backend/access/common/indextuple.c
M src/backend/access/common/meson.build
M src/backend/access/common/printsimple.c
M src/backend/access/common/printtup.c
M src/backend/access/common/relation.c
M src/backend/access/common/reloptions.c
M src/backend/access/common/scankey.c
M src/backend/access/common/session.c
M src/backend/access/common/syncscan.c
M src/backend/access/common/tidstore.c
M src/backend/access/common/toast_compression.c
M src/backend/access/common/toast_internals.c
M src/backend/access/common/tupconvert.c
M src/backend/access/common/tupdesc.c
M src/backend/access/gin/ginarrayproc.c
M src/backend/access/gin/ginbtree.c
M src/backend/access/gin/ginbulk.c
M src/backend/access/gin/gindatapage.c
M src/backend/access/gin/ginentrypage.c
M src/backend/access/gin/ginfast.c
M src/backend/access/gin/ginget.c
M src/backend/access/gin/gininsert.c
M src/backend/access/gin/ginlogic.c
M src/backend/access/gin/ginpostinglist.c
M src/backend/access/gin/ginscan.c
M src/backend/access/gin/ginutil.c
M src/backend/access/gin/ginvacuum.c
M src/backend/access/gin/ginvalidate.c
M src/backend/access/gin/ginxlog.c
M src/backend/access/gin/meson.build
M src/backend/access/gist/gist.c
M src/backend/access/gist/gistbuild.c
M src/backend/access/gist/gistbuildbuffers.c
M src/backend/access/gist/gistget.c
M src/backend/access/gist/gistproc.c
M src/backend/access/gist/gistscan.c
M src/backend/access/gist/gistsplit.c
M src/backend/access/gist/gistutil.c
M src/backend/access/gist/gistvacuum.c
M src/backend/access/gist/gistvalidate.c
M src/backend/access/gist/gistxlog.c
M src/backend/access/gist/meson.build
M src/backend/access/hash/hash.c
M src/backend/access/hash/hash_xlog.c
M src/backend/access/hash/hashfunc.c
M src/backend/access/hash/hashinsert.c
M src/backend/access/hash/hashovfl.c
M src/backend/access/hash/hashpage.c
M src/backend/access/hash/hashsearch.c
M src/backend/access/hash/hashsort.c
M src/backend/access/hash/hashutil.c
M src/backend/access/hash/hashvalidate.c
M src/backend/access/hash/meson.build
M src/backend/access/heap/heapam.c
M src/backend/access/heap/heapam_handler.c
M src/backend/access/heap/heapam_visibility.c
M src/backend/access/heap/heapam_xlog.c
M src/backend/access/heap/heaptoast.c
M src/backend/access/heap/hio.c
M src/backend/access/heap/meson.build
M src/backend/access/heap/pruneheap.c
M src/backend/access/heap/rewriteheap.c
M src/backend/access/heap/vacuumlazy.c
M src/backend/access/heap/visibilitymap.c
M src/backend/access/index/amapi.c
M src/backend/access/index/amvalidate.c
M src/backend/access/index/genam.c
M src/backend/access/index/indexam.c
M src/backend/access/index/meson.build
M src/backend/access/meson.build
M src/backend/access/nbtree/meson.build
M src/backend/access/nbtree/nbtcompare.c
M src/backend/access/nbtree/nbtdedup.c
M src/backend/access/nbtree/nbtinsert.c
M src/backend/access/nbtree/nbtpage.c
M src/backend/access/nbtree/nbtpreprocesskeys.c
M src/backend/access/nbtree/nbtreadpage.c
M src/backend/access/nbtree/nbtree.c
M src/backend/access/nbtree/nbtsearch.c
M src/backend/access/nbtree/nbtsort.c
M src/backend/access/nbtree/nbtsplitloc.c
M src/backend/access/nbtree/nbtutils.c
M src/backend/access/nbtree/nbtvalidate.c
M src/backend/access/nbtree/nbtxlog.c
M src/backend/access/rmgrdesc/brindesc.c
M src/backend/access/rmgrdesc/clogdesc.c
M src/backend/access/rmgrdesc/committsdesc.c
M src/backend/access/rmgrdesc/dbasedesc.c
M src/backend/access/rmgrdesc/genericdesc.c
M src/backend/access/rmgrdesc/gindesc.c
M src/backend/access/rmgrdesc/gistdesc.c
M src/backend/access/rmgrdesc/hashdesc.c
M src/backend/access/rmgrdesc/heapdesc.c
M src/backend/access/rmgrdesc/logicalmsgdesc.c
M src/backend/access/rmgrdesc/meson.build
M src/backend/access/rmgrdesc/mxactdesc.c
M src/backend/access/rmgrdesc/nbtdesc.c
M src/backend/access/rmgrdesc/relmapdesc.c
M src/backend/access/rmgrdesc/replorigindesc.c
M src/backend/access/rmgrdesc/rmgrdesc_utils.c
M src/backend/access/rmgrdesc/seqdesc.c
M src/backend/access/rmgrdesc/smgrdesc.c
M src/backend/access/rmgrdesc/spgdesc.c
M src/backend/access/rmgrdesc/standbydesc.c
M src/backend/access/rmgrdesc/tblspcdesc.c
M src/backend/access/rmgrdesc/xactdesc.c
M src/backend/access/rmgrdesc/xlogdesc.c
M src/backend/access/sequence/meson.build
M src/backend/access/sequence/sequence.c
M src/backend/access/spgist/meson.build
M src/backend/access/spgist/spgdoinsert.c
M src/backend/access/spgist/spginsert.c
M src/backend/access/spgist/spgkdtreeproc.c
M src/backend/access/spgist/spgproc.c
M src/backend/access/spgist/spgquadtreeproc.c
M src/backend/access/spgist/spgscan.c
M src/backend/access/spgist/spgtextproc.c
M src/backend/access/spgist/spgutils.c
M src/backend/access/spgist/spgvacuum.c
M src/backend/access/spgist/spgvalidate.c
M src/backend/access/spgist/spgxlog.c
M src/backend/access/table/meson.build
M src/backend/access/table/table.c
M src/backend/access/table/tableam.c
M src/backend/access/table/tableamapi.c
M src/backend/access/table/toast_helper.c
M src/backend/access/tablesample/bernoulli.c
M src/backend/access/tablesample/meson.build
M src/backend/access/tablesample/system.c
M src/backend/access/tablesample/tablesample.c
M src/backend/access/transam/clog.c
M src/backend/access/transam/commit_ts.c
M src/backend/access/transam/generic_xlog.c
M src/backend/access/transam/meson.build
M src/backend/access/transam/multixact.c
M src/backend/access/transam/parallel.c
M src/backend/access/transam/slru.c
M src/backend/access/transam/subtrans.c
M src/backend/access/transam/timeline.c
M src/backend/access/transam/transam.c
M src/backend/access/transam/twophase.c
M src/backend/access/transam/twophase_rmgr.c
M src/backend/access/transam/varsup.c
M src/backend/access/transam/xact.c
M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogarchive.c
M src/backend/access/transam/xlogbackup.c
M src/backend/access/transam/xlogfuncs.c
M src/backend/access/transam/xloginsert.c
M src/backend/access/transam/xlogprefetcher.c
M src/backend/access/transam/xlogreader.c
M src/backend/access/transam/xlogrecovery.c
M src/backend/access/transam/xlogstats.c
M src/backend/access/transam/xlogutils.c
M src/backend/access/transam/xlogwait.c
M src/backend/archive/meson.build
M src/backend/archive/shell_archive.c
M src/backend/backup/backup_manifest.c
M src/backend/backup/basebackup.c
M src/backend/backup/basebackup_copy.c
M src/backend/backup/basebackup_gzip.c
M src/backend/backup/basebackup_incremental.c
M src/backend/backup/basebackup_lz4.c
M src/backend/backup/basebackup_progress.c
M src/backend/backup/basebackup_sink.c
M src/backend/backup/basebackup_target.c
M src/backend/backup/basebackup_throttle.c
M src/backend/backup/basebackup_zstd.c
M src/backend/backup/meson.build
M src/backend/backup/walsummary.c
M src/backend/backup/walsummaryfuncs.c
M src/backend/bootstrap/bootparse.y
M src/backend/bootstrap/bootscanner.l
M src/backend/bootstrap/bootstrap.c
M src/backend/bootstrap/meson.build
M src/backend/catalog/Catalog.pm
M src/backend/catalog/Makefile
M src/backend/catalog/aclchk.c
M src/backend/catalog/catalog.c
M src/backend/catalog/dependency.c
M src/backend/catalog/genbki.pl
M src/backend/catalog/heap.c
M src/backend/catalog/index.c
M src/backend/catalog/indexing.c
M src/backend/catalog/information_schema.sql
M src/backend/catalog/meson.build
M src/backend/catalog/namespace.c
M src/backend/catalog/objectaccess.c
M src/backend/catalog/objectaddress.c
M src/backend/catalog/partition.c
M src/backend/catalog/pg_aggregate.c
M src/backend/catalog/pg_attrdef.c
M src/backend/catalog/pg_cast.c
M src/backend/catalog/pg_class.c
M src/backend/catalog/pg_collation.c
M src/backend/catalog/pg_constraint.c
M src/backend/catalog/pg_conversion.c
M src/backend/catalog/pg_db_role_setting.c
M src/backend/catalog/pg_depend.c
M src/backend/catalog/pg_enum.c
M src/backend/catalog/pg_inherits.c
M src/backend/catalog/pg_largeobject.c
M src/backend/catalog/pg_namespace.c
M src/backend/catalog/pg_operator.c
M src/backend/catalog/pg_parameter_acl.c
M src/backend/catalog/pg_proc.c
M src/backend/catalog/pg_publication.c
M src/backend/catalog/pg_range.c
M src/backend/catalog/pg_shdepend.c
M src/backend/catalog/pg_subscription.c
M src/backend/catalog/pg_tablespace.c
M src/backend/catalog/pg_type.c
M src/backend/catalog/storage.c
M src/backend/catalog/system_functions.sql
M src/backend/catalog/system_views.sql
M src/backend/catalog/toasting.c
M src/backend/commands/aggregatecmds.c
M src/backend/commands/alter.c
M src/backend/commands/amcmds.c
M src/backend/commands/analyze.c
M src/backend/commands/async.c
M src/backend/commands/cluster.c
M src/backend/commands/collationcmds.c
M src/backend/commands/comment.c
M src/backend/commands/constraint.c
M src/backend/commands/conversioncmds.c
M src/backend/commands/copy.c
M src/backend/commands/copyfrom.c
M src/backend/commands/copyfromparse.c
M src/backend/commands/copyto.c
M src/backend/commands/createas.c
M src/backend/commands/dbcommands.c
M src/backend/commands/define.c
M src/backend/commands/discard.c
M src/backend/commands/dropcmds.c
M src/backend/commands/event_trigger.c
M src/backend/commands/explain.c
M src/backend/commands/explain_dr.c
M src/backend/commands/explain_format.c
M src/backend/commands/explain_state.c
M src/backend/commands/extension.c
M src/backend/commands/foreigncmds.c
M src/backend/commands/functioncmds.c
M src/backend/commands/indexcmds.c
M src/backend/commands/lockcmds.c
M src/backend/commands/matview.c
M src/backend/commands/meson.build
M src/backend/commands/opclasscmds.c
M src/backend/commands/operatorcmds.c
M src/backend/commands/policy.c
M src/backend/commands/portalcmds.c
M src/backend/commands/prepare.c
M src/backend/commands/proclang.c
M src/backend/commands/publicationcmds.c
M src/backend/commands/schemacmds.c
M src/backend/commands/seclabel.c
M src/backend/commands/sequence.c
M src/backend/commands/sequence_xlog.c
M src/backend/commands/statscmds.c
M src/backend/commands/subscriptioncmds.c
M src/backend/commands/tablecmds.c
M src/backend/commands/tablespace.c
M src/backend/commands/trigger.c
M src/backend/commands/tsearchcmds.c
M src/backend/commands/typecmds.c
M src/backend/commands/user.c
M src/backend/commands/vacuum.c
M src/backend/commands/vacuumparallel.c
M src/backend/commands/variable.c
M src/backend/commands/view.c
M src/backend/commands/wait.c
M src/backend/executor/execAmi.c
M src/backend/executor/execAsync.c
M src/backend/executor/execCurrent.c
M src/backend/executor/execExpr.c
M src/backend/executor/execExprInterp.c
M src/backend/executor/execGrouping.c
M src/backend/executor/execIndexing.c
M src/backend/executor/execJunk.c
M src/backend/executor/execMain.c
M src/backend/executor/execParallel.c
M src/backend/executor/execPartition.c
M src/backend/executor/execProcnode.c
M src/backend/executor/execReplication.c
M src/backend/executor/execSRF.c
M src/backend/executor/execScan.c
M src/backend/executor/execTuples.c
M src/backend/executor/execUtils.c
M src/backend/executor/functions.c
M src/backend/executor/instrument.c
M src/backend/executor/meson.build
M src/backend/executor/nodeAgg.c
M src/backend/executor/nodeAppend.c
M src/backend/executor/nodeBitmapAnd.c
M src/backend/executor/nodeBitmapHeapscan.c
M src/backend/executor/nodeBitmapIndexscan.c
M src/backend/executor/nodeBitmapOr.c
M src/backend/executor/nodeCtescan.c
M src/backend/executor/nodeCustom.c
M src/backend/executor/nodeForeignscan.c
M src/backend/executor/nodeFunctionscan.c
M src/backend/executor/nodeGather.c
M src/backend/executor/nodeGatherMerge.c
M src/backend/executor/nodeGroup.c
M src/backend/executor/nodeHash.c
M src/backend/executor/nodeHashjoin.c
M src/backend/executor/nodeIncrementalSort.c
M src/backend/executor/nodeIndexonlyscan.c
M src/backend/executor/nodeIndexscan.c
M src/backend/executor/nodeLimit.c
M src/backend/executor/nodeLockRows.c
M src/backend/executor/nodeMaterial.c
M src/backend/executor/nodeMemoize.c
M src/backend/executor/nodeMergeAppend.c
M src/backend/executor/nodeMergejoin.c
M src/backend/executor/nodeModifyTable.c
M src/backend/executor/nodeNamedtuplestorescan.c
M src/backend/executor/nodeNestloop.c
M src/backend/executor/nodeProjectSet.c
M src/backend/executor/nodeRecursiveunion.c
M src/backend/executor/nodeResult.c
M src/backend/executor/nodeSamplescan.c
M src/backend/executor/nodeSeqscan.c
M src/backend/executor/nodeSetOp.c
M src/backend/executor/nodeSort.c
M src/backend/executor/nodeSubplan.c
M src/backend/executor/nodeSubqueryscan.c
M src/backend/executor/nodeTableFuncscan.c
M src/backend/executor/nodeTidrangescan.c
M src/backend/executor/nodeTidscan.c
M src/backend/executor/nodeUnique.c
M src/backend/executor/nodeValuesscan.c
M src/backend/executor/nodeWindowAgg.c
M src/backend/executor/nodeWorktablescan.c
M src/backend/executor/spi.c
M src/backend/executor/tqueue.c
M src/backend/executor/tstoreReceiver.c
M src/backend/foreign/foreign.c
M src/backend/foreign/meson.build
M src/backend/jit/jit.c
M src/backend/jit/llvm/llvmjit.c
M src/backend/jit/llvm/llvmjit_deform.c
M src/backend/jit/llvm/llvmjit_error.cpp
M src/backend/jit/llvm/llvmjit_expr.c
M src/backend/jit/llvm/llvmjit_inline.cpp
M src/backend/jit/llvm/llvmjit_types.c
M src/backend/jit/llvm/llvmjit_wrap.cpp
M src/backend/jit/llvm/meson.build
M src/backend/jit/meson.build
M src/backend/lib/bipartite_match.c
M src/backend/lib/bloomfilter.c
M src/backend/lib/dshash.c
M src/backend/lib/hyperloglog.c
M src/backend/lib/ilist.c
M src/backend/lib/integerset.c
M src/backend/lib/knapsack.c
M src/backend/lib/meson.build
M src/backend/lib/pairingheap.c
M src/backend/lib/rbtree.c
M src/backend/libpq/auth-oauth.c
M src/backend/libpq/auth-sasl.c
M src/backend/libpq/auth-scram.c
M src/backend/libpq/auth.c
M src/backend/libpq/be-fsstubs.c
M src/backend/libpq/be-gssapi-common.c
M src/backend/libpq/be-secure-common.c
M src/backend/libpq/be-secure-gssapi.c
M src/backend/libpq/be-secure-openssl.c
M src/backend/libpq/be-secure.c
M src/backend/libpq/crypt.c
M src/backend/libpq/hba.c
M src/backend/libpq/ifaddr.c
M src/backend/libpq/meson.build
M src/backend/libpq/pqcomm.c
M src/backend/libpq/pqformat.c
M src/backend/libpq/pqmq.c
M src/backend/libpq/pqsignal.c
M src/backend/main/main.c
M src/backend/main/meson.build
M src/backend/meson.build
M src/backend/nodes/bitmapset.c
M src/backend/nodes/copyfuncs.c
M src/backend/nodes/equalfuncs.c
M src/backend/nodes/extensible.c
M src/backend/nodes/gen_node_support.pl
M src/backend/nodes/list.c
M src/backend/nodes/makefuncs.c
M src/backend/nodes/meson.build
M src/backend/nodes/multibitmapset.c
M src/backend/nodes/nodeFuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/params.c
M src/backend/nodes/print.c
M src/backend/nodes/queryjumblefuncs.c
M src/backend/nodes/read.c
M src/backend/nodes/readfuncs.c
M src/backend/nodes/tidbitmap.c
M src/backend/nodes/value.c
M src/backend/optimizer/geqo/geqo_copy.c
M src/backend/optimizer/geqo/geqo_eval.c
M src/backend/optimizer/geqo/geqo_main.c
M src/backend/optimizer/geqo/geqo_misc.c
M src/backend/optimizer/geqo/geqo_pool.c
M src/backend/optimizer/geqo/geqo_random.c
M src/backend/optimizer/geqo/geqo_selection.c
M src/backend/optimizer/geqo/meson.build
M src/backend/optimizer/meson.build
M src/backend/optimizer/path/allpaths.c
M src/backend/optimizer/path/clausesel.c
M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/path/equivclass.c
M src/backend/optimizer/path/indxpath.c
M src/backend/optimizer/path/joinpath.c
M src/backend/optimizer/path/joinrels.c
M src/backend/optimizer/path/meson.build
M src/backend/optimizer/path/pathkeys.c
M src/backend/optimizer/path/tidpath.c
M src/backend/optimizer/plan/analyzejoins.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/plan/initsplan.c
M src/backend/optimizer/plan/meson.build
M src/backend/optimizer/plan/planagg.c
M src/backend/optimizer/plan/planmain.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/plan/setrefs.c
M src/backend/optimizer/plan/subselect.c
M src/backend/optimizer/prep/meson.build
M src/backend/optimizer/prep/prepagg.c
M src/backend/optimizer/prep/prepjointree.c
M src/backend/optimizer/prep/prepqual.c
M src/backend/optimizer/prep/preptlist.c
M src/backend/optimizer/prep/prepunion.c
M src/backend/optimizer/util/appendinfo.c
M src/backend/optimizer/util/clauses.c
M src/backend/optimizer/util/extendplan.c
M src/backend/optimizer/util/inherit.c
M src/backend/optimizer/util/joininfo.c
M src/backend/optimizer/util/meson.build
M src/backend/optimizer/util/orclauses.c
M src/backend/optimizer/util/paramassign.c
M src/backend/optimizer/util/pathnode.c
M src/backend/optimizer/util/placeholder.c
M src/backend/optimizer/util/plancat.c
M src/backend/optimizer/util/predtest.c
M src/backend/optimizer/util/relnode.c
M src/backend/optimizer/util/restrictinfo.c
M src/backend/optimizer/util/tlist.c
M src/backend/optimizer/util/var.c
M src/backend/parser/analyze.c
M src/backend/parser/check_keywords.pl
M src/backend/parser/gram.y
M src/backend/parser/gramparse.h
M src/backend/parser/meson.build
M src/backend/parser/parse_agg.c
M src/backend/parser/parse_clause.c
M src/backend/parser/parse_coerce.c
M src/backend/parser/parse_collate.c
M src/backend/parser/parse_cte.c
M src/backend/parser/parse_enr.c
M src/backend/parser/parse_expr.c
M src/backend/parser/parse_func.c
M src/backend/parser/parse_jsontable.c
M src/backend/parser/parse_merge.c
M src/backend/parser/parse_node.c
M src/backend/parser/parse_oper.c
M src/backend/parser/parse_param.c
M src/backend/parser/parse_relation.c
M src/backend/parser/parse_target.c
M src/backend/parser/parse_type.c
M src/backend/parser/parse_utilcmd.c
M src/backend/parser/parser.c
M src/backend/parser/scan.l
M src/backend/parser/scansup.c
M src/backend/partitioning/meson.build
M src/backend/partitioning/partbounds.c
M src/backend/partitioning/partdesc.c
M src/backend/partitioning/partprune.c
M src/backend/po/meson.build
M src/backend/port/atomics.c
M src/backend/port/meson.build
M src/backend/port/posix_sema.c
M src/backend/port/sysv_sema.c
M src/backend/port/sysv_shmem.c
M src/backend/port/win32/crashdump.c
M src/backend/port/win32/meson.build
M src/backend/port/win32/signal.c
M src/backend/port/win32/socket.c
M src/backend/port/win32/timer.c
M src/backend/port/win32_sema.c
M src/backend/port/win32_shmem.c
M src/backend/postmaster/autovacuum.c
M src/backend/postmaster/auxprocess.c
M src/backend/postmaster/bgworker.c
M src/backend/postmaster/bgwriter.c
M src/backend/postmaster/checkpointer.c
M src/backend/postmaster/fork_process.c
M src/backend/postmaster/interrupt.c
M src/backend/postmaster/launch_backend.c
M src/backend/postmaster/meson.build
M src/backend/postmaster/pgarch.c
M src/backend/postmaster/pmchild.c
M src/backend/postmaster/postmaster.c
M src/backend/postmaster/startup.c
M src/backend/postmaster/syslogger.c
M src/backend/postmaster/walsummarizer.c
M src/backend/postmaster/walwriter.c
M src/backend/regex/meson.build
M src/backend/regex/regc_pg_locale.c
M src/backend/regex/regexport.c
M src/backend/regex/regprefix.c
M src/backend/replication/libpqwalreceiver/libpqwalreceiver.c
M src/backend/replication/libpqwalreceiver/meson.build
M src/backend/replication/logical/applyparallelworker.c
M src/backend/replication/logical/conflict.c
M src/backend/replication/logical/decode.c
M src/backend/replication/logical/launcher.c
M src/backend/replication/logical/logical.c
M src/backend/replication/logical/logicalctl.c
M src/backend/replication/logical/logicalfuncs.c
M src/backend/replication/logical/meson.build
M src/backend/replication/logical/message.c
M src/backend/replication/logical/origin.c
M src/backend/replication/logical/proto.c
M src/backend/replication/logical/relation.c
M src/backend/replication/logical/reorderbuffer.c
M src/backend/replication/logical/sequencesync.c
M src/backend/replication/logical/slotsync.c
M src/backend/replication/logical/snapbuild.c
M src/backend/replication/logical/syncutils.c
M src/backend/replication/logical/tablesync.c
M src/backend/replication/logical/worker.c
M src/backend/replication/meson.build
M src/backend/replication/pgoutput/meson.build
M src/backend/replication/pgoutput/pgoutput.c
M src/backend/replication/repl_gram.y
M src/backend/replication/repl_scanner.l
M src/backend/replication/slot.c
M src/backend/replication/slotfuncs.c
M src/backend/replication/syncrep.c
M src/backend/replication/syncrep_gram.y
M src/backend/replication/syncrep_scanner.l
M src/backend/replication/walreceiver.c
M src/backend/replication/walreceiverfuncs.c
M src/backend/replication/walsender.c
M src/backend/rewrite/meson.build
M src/backend/rewrite/rewriteDefine.c
M src/backend/rewrite/rewriteHandler.c
M src/backend/rewrite/rewriteManip.c
M src/backend/rewrite/rewriteRemove.c
M src/backend/rewrite/rewriteSearchCycle.c
M src/backend/rewrite/rewriteSupport.c
M src/backend/rewrite/rowsecurity.c
M src/backend/snowball/dict_snowball.c
M src/backend/snowball/meson.build
M src/backend/snowball/snowball.sql.in
M src/backend/snowball/snowball_create.pl
M src/backend/snowball/snowball_func.sql.in
M src/backend/statistics/attribute_stats.c
M src/backend/statistics/dependencies.c
M src/backend/statistics/extended_stats.c
M src/backend/statistics/mcv.c
M src/backend/statistics/meson.build
M src/backend/statistics/mvdistinct.c
M src/backend/statistics/relation_stats.c
M src/backend/statistics/stat_utils.c
M src/backend/storage/aio/aio.c
M src/backend/storage/aio/aio_callback.c
M src/backend/storage/aio/aio_funcs.c
M src/backend/storage/aio/aio_init.c
M src/backend/storage/aio/aio_io.c
M src/backend/storage/aio/aio_target.c
M src/backend/storage/aio/meson.build
M src/backend/storage/aio/method_io_uring.c
M src/backend/storage/aio/method_sync.c
M src/backend/storage/aio/method_worker.c
M src/backend/storage/aio/read_stream.c
M src/backend/storage/buffer/buf_init.c
M src/backend/storage/buffer/buf_table.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/buffer/freelist.c
M src/backend/storage/buffer/localbuf.c
M src/backend/storage/buffer/meson.build
M src/backend/storage/file/buffile.c
M src/backend/storage/file/copydir.c
M src/backend/storage/file/fd.c
M src/backend/storage/file/fileset.c
M src/backend/storage/file/meson.build
M src/backend/storage/file/reinit.c
M src/backend/storage/file/sharedfileset.c
M src/backend/storage/freespace/freespace.c
M src/backend/storage/freespace/fsmpage.c
M src/backend/storage/freespace/indexfsm.c
M src/backend/storage/freespace/meson.build
M src/backend/storage/ipc/barrier.c
M src/backend/storage/ipc/dsm.c
M src/backend/storage/ipc/dsm_impl.c
M src/backend/storage/ipc/dsm_registry.c
M src/backend/storage/ipc/ipc.c
M src/backend/storage/ipc/ipci.c
M src/backend/storage/ipc/latch.c
M src/backend/storage/ipc/meson.build
M src/backend/storage/ipc/pmsignal.c
M src/backend/storage/ipc/procarray.c
M src/backend/storage/ipc/procsignal.c
M src/backend/storage/ipc/shm_mq.c
M src/backend/storage/ipc/shm_toc.c
M src/backend/storage/ipc/shmem.c
M src/backend/storage/ipc/signalfuncs.c
M src/backend/storage/ipc/sinval.c
M src/backend/storage/ipc/sinvaladt.c
M src/backend/storage/ipc/standby.c
M src/backend/storage/ipc/waiteventset.c
M src/backend/storage/large_object/inv_api.c
M src/backend/storage/large_object/meson.build
M src/backend/storage/lmgr/condition_variable.c
M src/backend/storage/lmgr/deadlock.c
M src/backend/storage/lmgr/generate-lwlocknames.pl
M src/backend/storage/lmgr/lmgr.c
M src/backend/storage/lmgr/lock.c
M src/backend/storage/lmgr/lwlock.c
M src/backend/storage/lmgr/meson.build
M src/backend/storage/lmgr/predicate.c
M src/backend/storage/lmgr/proc.c
M src/backend/storage/lmgr/s_lock.c
M src/backend/storage/meson.build
M src/backend/storage/page/bufpage.c
M src/backend/storage/page/checksum.c
M src/backend/storage/page/itemptr.c
M src/backend/storage/page/meson.build
M src/backend/storage/smgr/bulk_write.c
M src/backend/storage/smgr/md.c
M src/backend/storage/smgr/meson.build
M src/backend/storage/smgr/smgr.c
M src/backend/storage/sync/meson.build
M src/backend/storage/sync/sync.c
M src/backend/tcop/backend_startup.c
M src/backend/tcop/cmdtag.c
M src/backend/tcop/dest.c
M src/backend/tcop/fastpath.c
M src/backend/tcop/meson.build
M src/backend/tcop/postgres.c
M src/backend/tcop/pquery.c
M src/backend/tcop/utility.c
M src/backend/tsearch/Makefile
M src/backend/tsearch/dict.c
M src/backend/tsearch/dict_ispell.c
M src/backend/tsearch/dict_simple.c
M src/backend/tsearch/dict_synonym.c
M src/backend/tsearch/dict_thesaurus.c
M src/backend/tsearch/meson.build
M src/backend/tsearch/regis.c
M src/backend/tsearch/spell.c
M src/backend/tsearch/to_tsany.c
M src/backend/tsearch/ts_locale.c
M src/backend/tsearch/ts_parse.c
M src/backend/tsearch/ts_selfuncs.c
M src/backend/tsearch/ts_typanalyze.c
M src/backend/tsearch/ts_utils.c
M src/backend/tsearch/wparser.c
M src/backend/tsearch/wparser_def.c
M src/backend/utils/Gen_dummy_probes.pl
M src/backend/utils/Gen_fmgrtab.pl
M src/backend/utils/Makefile
M src/backend/utils/activity/Makefile
M src/backend/utils/activity/backend_progress.c
M src/backend/utils/activity/backend_status.c
M src/backend/utils/activity/generate-wait_event_types.pl
M src/backend/utils/activity/meson.build
M src/backend/utils/activity/pgstat.c
M src/backend/utils/activity/pgstat_archiver.c
M src/backend/utils/activity/pgstat_backend.c
M src/backend/utils/activity/pgstat_bgwriter.c
M src/backend/utils/activity/pgstat_checkpointer.c
M src/backend/utils/activity/pgstat_database.c
M src/backend/utils/activity/pgstat_function.c
M src/backend/utils/activity/pgstat_io.c
M src/backend/utils/activity/pgstat_relation.c
M src/backend/utils/activity/pgstat_replslot.c
M src/backend/utils/activity/pgstat_shmem.c
M src/backend/utils/activity/pgstat_slru.c
M src/backend/utils/activity/pgstat_subscription.c
M src/backend/utils/activity/pgstat_wal.c
M src/backend/utils/activity/pgstat_xact.c
M src/backend/utils/activity/wait_event.c
M src/backend/utils/activity/wait_event_funcs.c
M src/backend/utils/activity/wait_event_names.txt
M src/backend/utils/adt/acl.c
M src/backend/utils/adt/amutils.c
M src/backend/utils/adt/array_expanded.c
M src/backend/utils/adt/array_selfuncs.c
M src/backend/utils/adt/array_typanalyze.c
M src/backend/utils/adt/array_userfuncs.c
M src/backend/utils/adt/arrayfuncs.c
M src/backend/utils/adt/arraysubs.c
M src/backend/utils/adt/arrayutils.c
M src/backend/utils/adt/ascii.c
M src/backend/utils/adt/bool.c
M src/backend/utils/adt/bytea.c
M src/backend/utils/adt/char.c
M src/backend/utils/adt/cryptohashfuncs.c
M src/backend/utils/adt/date.c
M src/backend/utils/adt/datetime.c
M src/backend/utils/adt/datum.c
M src/backend/utils/adt/dbsize.c
M src/backend/utils/adt/domains.c
M src/backend/utils/adt/encode.c
M src/backend/utils/adt/enum.c
M src/backend/utils/adt/expandeddatum.c
M src/backend/utils/adt/expandedrecord.c
M src/backend/utils/adt/float.c
M src/backend/utils/adt/format_type.c
M src/backend/utils/adt/formatting.c
M src/backend/utils/adt/genfile.c
M src/backend/utils/adt/geo_ops.c
M src/backend/utils/adt/geo_selfuncs.c
M src/backend/utils/adt/geo_spgist.c
M src/backend/utils/adt/hbafuncs.c
M src/backend/utils/adt/int.c
M src/backend/utils/adt/int8.c
M src/backend/utils/adt/json.c
M src/backend/utils/adt/jsonb.c
M src/backend/utils/adt/jsonb_gin.c
M src/backend/utils/adt/jsonb_op.c
M src/backend/utils/adt/jsonb_util.c
M src/backend/utils/adt/jsonbsubs.c
M src/backend/utils/adt/jsonfuncs.c
M src/backend/utils/adt/jsonpath.c
M src/backend/utils/adt/jsonpath_exec.c
M src/backend/utils/adt/jsonpath_gram.y
M src/backend/utils/adt/jsonpath_internal.h
M src/backend/utils/adt/jsonpath_scan.l
M src/backend/utils/adt/levenshtein.c
M src/backend/utils/adt/like.c
M src/backend/utils/adt/like_match.c
M src/backend/utils/adt/like_support.c
M src/backend/utils/adt/lockfuncs.c
M src/backend/utils/adt/mac.c
M src/backend/utils/adt/mac8.c
M src/backend/utils/adt/mcxtfuncs.c
M src/backend/utils/adt/meson.build
M src/backend/utils/adt/misc.c
M src/backend/utils/adt/multirangetypes.c
M src/backend/utils/adt/multirangetypes_selfuncs.c
M src/backend/utils/adt/multixactfuncs.c
M src/backend/utils/adt/name.c
M src/backend/utils/adt/network_gist.c
M src/backend/utils/adt/network_selfuncs.c
M src/backend/utils/adt/network_spgist.c
M src/backend/utils/adt/numeric.c
M src/backend/utils/adt/numutils.c
M src/backend/utils/adt/oid.c
M src/backend/utils/adt/oracle_compat.c
M src/backend/utils/adt/orderedsetaggs.c
M src/backend/utils/adt/partitionfuncs.c
M src/backend/utils/adt/pg_dependencies.c
M src/backend/utils/adt/pg_locale.c
M src/backend/utils/adt/pg_locale_builtin.c
M src/backend/utils/adt/pg_locale_icu.c
M src/backend/utils/adt/pg_locale_libc.c
M src/backend/utils/adt/pg_lsn.c
M src/backend/utils/adt/pg_ndistinct.c
M src/backend/utils/adt/pg_upgrade_support.c
M src/backend/utils/adt/pgstatfuncs.c
M src/backend/utils/adt/pseudorandomfuncs.c
M src/backend/utils/adt/pseudotypes.c
M src/backend/utils/adt/quote.c
M src/backend/utils/adt/rangetypes.c
M src/backend/utils/adt/rangetypes_gist.c
M src/backend/utils/adt/rangetypes_selfuncs.c
M src/backend/utils/adt/rangetypes_spgist.c
M src/backend/utils/adt/rangetypes_typanalyze.c
M src/backend/utils/adt/regexp.c
M src/backend/utils/adt/regproc.c
M src/backend/utils/adt/ri_triggers.c
M src/backend/utils/adt/rowtypes.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/adt/selfuncs.c
M src/backend/utils/adt/skipsupport.c
M src/backend/utils/adt/tid.c
M src/backend/utils/adt/timestamp.c
M src/backend/utils/adt/trigfuncs.c
M src/backend/utils/adt/tsginidx.c
M src/backend/utils/adt/tsgistidx.c
M src/backend/utils/adt/tsquery.c
M src/backend/utils/adt/tsquery_cleanup.c
M src/backend/utils/adt/tsquery_gist.c
M src/backend/utils/adt/tsquery_op.c
M src/backend/utils/adt/tsquery_rewrite.c
M src/backend/utils/adt/tsquery_util.c
M src/backend/utils/adt/tsrank.c
M src/backend/utils/adt/tsvector.c
M src/backend/utils/adt/tsvector_op.c
M src/backend/utils/adt/tsvector_parser.c
M src/backend/utils/adt/uuid.c
M src/backend/utils/adt/varbit.c
M src/backend/utils/adt/varchar.c
M src/backend/utils/adt/varlena.c
M src/backend/utils/adt/version.c
M src/backend/utils/adt/waitfuncs.c
M src/backend/utils/adt/windowfuncs.c
M src/backend/utils/adt/xid.c
M src/backend/utils/adt/xid8funcs.c
M src/backend/utils/adt/xml.c
M src/backend/utils/cache/attoptcache.c
M src/backend/utils/cache/catcache.c
M src/backend/utils/cache/evtcache.c
M src/backend/utils/cache/funccache.c
M src/backend/utils/cache/inval.c
M src/backend/utils/cache/lsyscache.c
M src/backend/utils/cache/meson.build
M src/backend/utils/cache/partcache.c
M src/backend/utils/cache/plancache.c
M src/backend/utils/cache/relcache.c
M src/backend/utils/cache/relfilenumbermap.c
M src/backend/utils/cache/relmapper.c
M src/backend/utils/cache/spccache.c
M src/backend/utils/cache/syscache.c
M src/backend/utils/cache/ts_cache.c
M src/backend/utils/cache/typcache.c
M src/backend/utils/errcodes.txt
M src/backend/utils/error/assert.c
M src/backend/utils/error/csvlog.c
M src/backend/utils/error/elog.c
M src/backend/utils/error/jsonlog.c
M src/backend/utils/error/meson.build
M src/backend/utils/fmgr/dfmgr.c
M src/backend/utils/fmgr/fmgr.c
M src/backend/utils/fmgr/funcapi.c
M src/backend/utils/fmgr/meson.build
M src/backend/utils/generate-errcodes.pl
M src/backend/utils/hash/dynahash.c
M src/backend/utils/hash/meson.build
M src/backend/utils/hash/pg_crc.c
M src/backend/utils/init/globals.c
M src/backend/utils/init/meson.build
M src/backend/utils/init/miscinit.c
M src/backend/utils/init/postinit.c
M src/backend/utils/init/usercontext.c
M src/backend/utils/mb/Unicode/Makefile
M src/backend/utils/mb/Unicode/UCS_to_BIG5.pl
M src/backend/utils/mb/Unicode/UCS_to_EUC_CN.pl
M src/backend/utils/mb/Unicode/UCS_to_EUC_JIS_2004.pl
M src/backend/utils/mb/Unicode/UCS_to_EUC_JP.pl
M src/backend/utils/mb/Unicode/UCS_to_EUC_KR.pl
M src/backend/utils/mb/Unicode/UCS_to_EUC_TW.pl
M src/backend/utils/mb/Unicode/UCS_to_GB18030.pl
M src/backend/utils/mb/Unicode/UCS_to_JOHAB.pl
M src/backend/utils/mb/Unicode/UCS_to_SHIFT_JIS_2004.pl
M src/backend/utils/mb/Unicode/UCS_to_SJIS.pl
M src/backend/utils/mb/Unicode/UCS_to_UHC.pl
M src/backend/utils/mb/Unicode/UCS_to_most.pl
M src/backend/utils/mb/Unicode/convutils.pm
M src/backend/utils/mb/conv.c
M src/backend/utils/mb/conversion_procs/Makefile
M src/backend/utils/mb/conversion_procs/cyrillic_and_mic/cyrillic_and_mic.c
M src/backend/utils/mb/conversion_procs/euc2004_sjis2004/euc2004_sjis2004.c
M src/backend/utils/mb/conversion_procs/euc_cn_and_mic/euc_cn_and_mic.c
M src/backend/utils/mb/conversion_procs/euc_jp_and_sjis/euc_jp_and_sjis.c
M src/backend/utils/mb/conversion_procs/euc_kr_and_mic/euc_kr_and_mic.c
M src/backend/utils/mb/conversion_procs/euc_tw_and_big5/euc_tw_and_big5.c
M src/backend/utils/mb/conversion_procs/latin2_and_win1250/latin2_and_win1250.c
M src/backend/utils/mb/conversion_procs/latin_and_mic/latin_and_mic.c
M src/backend/utils/mb/conversion_procs/meson.build
M src/backend/utils/mb/conversion_procs/utf8_and_big5/utf8_and_big5.c
M src/backend/utils/mb/conversion_procs/utf8_and_cyrillic/utf8_and_cyrillic.c
M src/backend/utils/mb/conversion_procs/utf8_and_euc2004/utf8_and_euc2004.c
M src/backend/utils/mb/conversion_procs/utf8_and_euc_cn/utf8_and_euc_cn.c
M src/backend/utils/mb/conversion_procs/utf8_and_euc_jp/utf8_and_euc_jp.c
M src/backend/utils/mb/conversion_procs/utf8_and_euc_kr/utf8_and_euc_kr.c
M src/backend/utils/mb/conversion_procs/utf8_and_euc_tw/utf8_and_euc_tw.c
M src/backend/utils/mb/conversion_procs/utf8_and_gb18030/utf8_and_gb18030.c
M src/backend/utils/mb/conversion_procs/utf8_and_gbk/utf8_and_gbk.c
M src/backend/utils/mb/conversion_procs/utf8_and_iso8859/utf8_and_iso8859.c
M src/backend/utils/mb/conversion_procs/utf8_and_iso8859_1/utf8_and_iso8859_1.c
M src/backend/utils/mb/conversion_procs/utf8_and_johab/utf8_and_johab.c
M src/backend/utils/mb/conversion_procs/utf8_and_sjis/utf8_and_sjis.c
M src/backend/utils/mb/conversion_procs/utf8_and_sjis2004/utf8_and_sjis2004.c
M src/backend/utils/mb/conversion_procs/utf8_and_uhc/utf8_and_uhc.c
M src/backend/utils/mb/conversion_procs/utf8_and_win/utf8_and_win.c
M src/backend/utils/mb/mbutils.c
M src/backend/utils/mb/meson.build
M src/backend/utils/mb/stringinfo_mb.c
M src/backend/utils/meson.build
M src/backend/utils/misc/conffiles.c
M src/backend/utils/misc/gen_guc_tables.pl
M src/backend/utils/misc/guc-file.l
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/guc_funcs.c
M src/backend/utils/misc/guc_internal.h
M src/backend/utils/misc/guc_parameters.dat
M src/backend/utils/misc/guc_tables.c
M src/backend/utils/misc/help_config.c
M src/backend/utils/misc/injection_point.c
M src/backend/utils/misc/meson.build
M src/backend/utils/misc/pg_config.c
M src/backend/utils/misc/pg_controldata.c
M src/backend/utils/misc/pg_rusage.c
M src/backend/utils/misc/ps_status.c
M src/backend/utils/misc/queryenvironment.c
M src/backend/utils/misc/rls.c
M src/backend/utils/misc/sampling.c
M src/backend/utils/misc/stack_depth.c
M src/backend/utils/misc/superuser.c
M src/backend/utils/misc/timeout.c
M src/backend/utils/misc/tzparser.c
M src/backend/utils/mmgr/alignedalloc.c
M src/backend/utils/mmgr/aset.c
M src/backend/utils/mmgr/bump.c
M src/backend/utils/mmgr/dsa.c
M src/backend/utils/mmgr/freepage.c
M src/backend/utils/mmgr/generation.c
M src/backend/utils/mmgr/mcxt.c
M src/backend/utils/mmgr/memdebug.c
M src/backend/utils/mmgr/meson.build
M src/backend/utils/mmgr/portalmem.c
M src/backend/utils/mmgr/slab.c
M src/backend/utils/postprocess_dtrace.sed
M src/backend/utils/probes.d
M src/backend/utils/resowner/meson.build
M src/backend/utils/resowner/resowner.c
M src/backend/utils/sort/logtape.c
M src/backend/utils/sort/meson.build
M src/backend/utils/sort/sharedtuplestore.c
M src/backend/utils/sort/sortsupport.c
M src/backend/utils/sort/tuplesort.c
M src/backend/utils/sort/tuplesortvariants.c
M src/backend/utils/sort/tuplestore.c
M src/backend/utils/time/combocid.c
M src/backend/utils/time/meson.build
M src/backend/utils/time/snapmgr.c
M src/bin/Makefile
M src/bin/initdb/Makefile
M src/bin/initdb/findtimezone.c
M src/bin/initdb/initdb.c
M src/bin/initdb/meson.build
M src/bin/initdb/po/meson.build
M src/bin/initdb/t/001_initdb.pl
M src/bin/meson.build
M src/bin/pg_amcheck/Makefile
M src/bin/pg_amcheck/meson.build
M src/bin/pg_amcheck/pg_amcheck.c
M src/bin/pg_amcheck/po/meson.build
M src/bin/pg_amcheck/t/001_basic.pl
M src/bin/pg_amcheck/t/002_nonesuch.pl
M src/bin/pg_amcheck/t/003_check.pl
M src/bin/pg_amcheck/t/004_verify_heapam.pl
M src/bin/pg_amcheck/t/005_opclass_damage.pl
M src/bin/pg_archivecleanup/meson.build
M src/bin/pg_archivecleanup/po/meson.build
M src/bin/pg_archivecleanup/t/010_pg_archivecleanup.pl
M src/bin/pg_basebackup/Makefile
M src/bin/pg_basebackup/astreamer_inject.c
M src/bin/pg_basebackup/astreamer_inject.h
M src/bin/pg_basebackup/meson.build
M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pg_basebackup/pg_createsubscriber.c
M src/bin/pg_basebackup/pg_receivewal.c
M src/bin/pg_basebackup/pg_recvlogical.c
M src/bin/pg_basebackup/po/meson.build
M src/bin/pg_basebackup/receivelog.c
M src/bin/pg_basebackup/receivelog.h
M src/bin/pg_basebackup/streamutil.c
M src/bin/pg_basebackup/streamutil.h
M src/bin/pg_basebackup/t/010_pg_basebackup.pl
M src/bin/pg_basebackup/t/011_in_place_tablespace.pl
M src/bin/pg_basebackup/t/020_pg_receivewal.pl
M src/bin/pg_basebackup/t/030_pg_recvlogical.pl
M src/bin/pg_basebackup/t/040_pg_createsubscriber.pl
M src/bin/pg_basebackup/walmethods.c
M src/bin/pg_basebackup/walmethods.h
M src/bin/pg_checksums/Makefile
M src/bin/pg_checksums/meson.build
M src/bin/pg_checksums/pg_checksums.c
M src/bin/pg_checksums/po/meson.build
M src/bin/pg_checksums/t/001_basic.pl
M src/bin/pg_checksums/t/002_actions.pl
M src/bin/pg_combinebackup/Makefile
M src/bin/pg_combinebackup/backup_label.c
M src/bin/pg_combinebackup/backup_label.h
M src/bin/pg_combinebackup/copy_file.c
M src/bin/pg_combinebackup/copy_file.h
M src/bin/pg_combinebackup/load_manifest.c
M src/bin/pg_combinebackup/load_manifest.h
M src/bin/pg_combinebackup/meson.build
M src/bin/pg_combinebackup/pg_combinebackup.c
M src/bin/pg_combinebackup/po/meson.build
M src/bin/pg_combinebackup/reconstruct.c
M src/bin/pg_combinebackup/reconstruct.h
M src/bin/pg_combinebackup/t/001_basic.pl
M src/bin/pg_combinebackup/t/002_compare_backups.pl
M src/bin/pg_combinebackup/t/003_timeline.pl
M src/bin/pg_combinebackup/t/004_manifest.pl
M src/bin/pg_combinebackup/t/005_integrity.pl
M src/bin/pg_combinebackup/t/006_db_file_copy.pl
M src/bin/pg_combinebackup/t/007_wal_level_minimal.pl
M src/bin/pg_combinebackup/t/008_promote.pl
M src/bin/pg_combinebackup/t/009_no_full_file.pl
M src/bin/pg_combinebackup/t/010_hardlink.pl
M src/bin/pg_combinebackup/write_manifest.c
M src/bin/pg_combinebackup/write_manifest.h
M src/bin/pg_config/Makefile
M src/bin/pg_config/meson.build
M src/bin/pg_config/pg_config.c
M src/bin/pg_config/po/meson.build
M src/bin/pg_config/t/001_pg_config.pl
M src/bin/pg_controldata/Makefile
M src/bin/pg_controldata/meson.build
M src/bin/pg_controldata/po/meson.build
M src/bin/pg_controldata/t/001_pg_controldata.pl
M src/bin/pg_ctl/Makefile
M src/bin/pg_ctl/meson.build
M src/bin/pg_ctl/pg_ctl.c
M src/bin/pg_ctl/po/meson.build
M src/bin/pg_ctl/t/001_start_stop.pl
M src/bin/pg_ctl/t/002_status.pl
M src/bin/pg_ctl/t/003_promote.pl
M src/bin/pg_ctl/t/004_logrotate.pl
M src/bin/pg_dump/Makefile
M src/bin/pg_dump/common.c
M src/bin/pg_dump/compress_gzip.c
M src/bin/pg_dump/compress_gzip.h
M src/bin/pg_dump/compress_io.c
M src/bin/pg_dump/compress_io.h
M src/bin/pg_dump/compress_lz4.c
M src/bin/pg_dump/compress_lz4.h
M src/bin/pg_dump/compress_none.c
M src/bin/pg_dump/compress_none.h
M src/bin/pg_dump/compress_zstd.c
M src/bin/pg_dump/compress_zstd.h
M src/bin/pg_dump/connectdb.c
M src/bin/pg_dump/connectdb.h
M src/bin/pg_dump/dumputils.c
M src/bin/pg_dump/dumputils.h
M src/bin/pg_dump/filter.c
M src/bin/pg_dump/filter.h
M src/bin/pg_dump/meson.build
M src/bin/pg_dump/parallel.c
M src/bin/pg_dump/parallel.h
M src/bin/pg_dump/pg_backup_directory.c
M src/bin/pg_dump/pg_backup_utils.c
M src/bin/pg_dump/pg_backup_utils.h
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dump.h
M src/bin/pg_dump/pg_dump_sort.c
M src/bin/pg_dump/pg_dumpall.c
M src/bin/pg_dump/po/meson.build
M src/bin/pg_dump/t/001_basic.pl
M src/bin/pg_dump/t/002_pg_dump.pl
M src/bin/pg_dump/t/003_pg_dump_with_server.pl
M src/bin/pg_dump/t/004_pg_dump_parallel.pl
M src/bin/pg_dump/t/005_pg_dump_filterfile.pl
M src/bin/pg_dump/t/006_pg_dump_compress.pl
M src/bin/pg_dump/t/010_dump_connstr.pl
M src/bin/pg_resetwal/Makefile
M src/bin/pg_resetwal/meson.build
M src/bin/pg_resetwal/pg_resetwal.c
M src/bin/pg_resetwal/po/meson.build
M src/bin/pg_resetwal/t/001_basic.pl
M src/bin/pg_resetwal/t/002_corrupted.pl
M src/bin/pg_rewind/Makefile
M src/bin/pg_rewind/datapagemap.c
M src/bin/pg_rewind/datapagemap.h
M src/bin/pg_rewind/file_ops.c
M src/bin/pg_rewind/file_ops.h
M src/bin/pg_rewind/filemap.c
M src/bin/pg_rewind/filemap.h
M src/bin/pg_rewind/libpq_source.c
M src/bin/pg_rewind/local_source.c
M src/bin/pg_rewind/meson.build
M src/bin/pg_rewind/parsexlog.c
M src/bin/pg_rewind/pg_rewind.c
M src/bin/pg_rewind/pg_rewind.h
M src/bin/pg_rewind/po/meson.build
M src/bin/pg_rewind/rewind_source.h
M src/bin/pg_rewind/t/001_basic.pl
M src/bin/pg_rewind/t/002_databases.pl
M src/bin/pg_rewind/t/003_extrafiles.pl
M src/bin/pg_rewind/t/004_pg_xlog_symlink.pl
M src/bin/pg_rewind/t/005_same_timeline.pl
M src/bin/pg_rewind/t/006_options.pl
M src/bin/pg_rewind/t/007_standby_source.pl
M src/bin/pg_rewind/t/008_min_recovery_point.pl
M src/bin/pg_rewind/t/009_growing_files.pl
M src/bin/pg_rewind/t/010_keep_recycled_wals.pl
M src/bin/pg_rewind/t/011_wal_copy.pl
M src/bin/pg_rewind/t/RewindTest.pm
M src/bin/pg_rewind/timeline.c
M src/bin/pg_test_fsync/meson.build
M src/bin/pg_test_fsync/pg_test_fsync.c
M src/bin/pg_test_fsync/po/meson.build
M src/bin/pg_test_fsync/t/001_basic.pl
M src/bin/pg_test_timing/meson.build
M src/bin/pg_test_timing/po/meson.build
M src/bin/pg_test_timing/t/001_basic.pl
M src/bin/pg_upgrade/check.c
M src/bin/pg_upgrade/controldata.c
M src/bin/pg_upgrade/dump.c
M src/bin/pg_upgrade/exec.c
M src/bin/pg_upgrade/file.c
M src/bin/pg_upgrade/function.c
M src/bin/pg_upgrade/info.c
M src/bin/pg_upgrade/meson.build
M src/bin/pg_upgrade/multixact_read_v18.c
M src/bin/pg_upgrade/multixact_read_v18.h
M src/bin/pg_upgrade/multixact_rewrite.c
M src/bin/pg_upgrade/option.c
M src/bin/pg_upgrade/parallel.c
M src/bin/pg_upgrade/pg_upgrade.c
M src/bin/pg_upgrade/pg_upgrade.h
M src/bin/pg_upgrade/po/meson.build
M src/bin/pg_upgrade/relfilenumber.c
M src/bin/pg_upgrade/server.c
M src/bin/pg_upgrade/slru_io.c
M src/bin/pg_upgrade/slru_io.h
M src/bin/pg_upgrade/t/001_basic.pl
M src/bin/pg_upgrade/t/002_pg_upgrade.pl
M src/bin/pg_upgrade/t/003_logical_slots.pl
M src/bin/pg_upgrade/t/004_subscription.pl
M src/bin/pg_upgrade/t/005_char_signedness.pl
M src/bin/pg_upgrade/t/006_transfer_modes.pl
M src/bin/pg_upgrade/t/007_multixact_conversion.pl
M src/bin/pg_upgrade/tablespace.c
M src/bin/pg_upgrade/task.c
M src/bin/pg_upgrade/util.c
M src/bin/pg_upgrade/version.c
M src/bin/pg_verifybackup/astreamer_verify.c
M src/bin/pg_verifybackup/meson.build
M src/bin/pg_verifybackup/pg_verifybackup.c
M src/bin/pg_verifybackup/pg_verifybackup.h
M src/bin/pg_verifybackup/po/meson.build
M src/bin/pg_verifybackup/t/001_basic.pl
M src/bin/pg_verifybackup/t/002_algorithm.pl
M src/bin/pg_verifybackup/t/003_corruption.pl
M src/bin/pg_verifybackup/t/004_options.pl
M src/bin/pg_verifybackup/t/005_bad_manifest.pl
M src/bin/pg_verifybackup/t/006_encoding.pl
M src/bin/pg_verifybackup/t/007_wal.pl
M src/bin/pg_verifybackup/t/008_untar.pl
M src/bin/pg_verifybackup/t/009_extract.pl
M src/bin/pg_verifybackup/t/010_client_untar.pl
M src/bin/pg_waldump/compat.c
M src/bin/pg_waldump/meson.build
M src/bin/pg_waldump/pg_waldump.c
M src/bin/pg_waldump/po/meson.build
M src/bin/pg_waldump/t/001_basic.pl
M src/bin/pg_waldump/t/002_save_fullpage.pl
M src/bin/pg_walsummary/Makefile
M src/bin/pg_walsummary/meson.build
M src/bin/pg_walsummary/pg_walsummary.c
M src/bin/pg_walsummary/po/meson.build
M src/bin/pg_walsummary/t/001_basic.pl
M src/bin/pg_walsummary/t/002_blocks.pl
M src/bin/pgbench/exprparse.y
M src/bin/pgbench/exprscan.l
M src/bin/pgbench/meson.build
M src/bin/pgbench/pgbench.c
M src/bin/pgbench/pgbench.h
M src/bin/pgbench/t/001_pgbench_with_server.pl
M src/bin/pgbench/t/002_pgbench_no_server.pl
M src/bin/pgevent/Makefile
M src/bin/pgevent/meson.build
M src/bin/psql/Makefile
M src/bin/psql/command.c
M src/bin/psql/command.h
M src/bin/psql/common.c
M src/bin/psql/common.h
M src/bin/psql/copy.c
M src/bin/psql/copy.h
M src/bin/psql/create_help.pl
M src/bin/psql/crosstabview.c
M src/bin/psql/crosstabview.h
M src/bin/psql/describe.c
M src/bin/psql/describe.h
M src/bin/psql/gen_tabcomplete.pl
M src/bin/psql/help.c
M src/bin/psql/help.h
M src/bin/psql/input.c
M src/bin/psql/input.h
M src/bin/psql/large_obj.c
M src/bin/psql/large_obj.h
M src/bin/psql/mainloop.c
M src/bin/psql/mainloop.h
M src/bin/psql/meson.build
M src/bin/psql/po/meson.build
M src/bin/psql/prompt.c
M src/bin/psql/prompt.h
M src/bin/psql/psqlscanslash.h
M src/bin/psql/psqlscanslash.l
M src/bin/psql/settings.h
M src/bin/psql/startup.c
M src/bin/psql/stringutils.c
M src/bin/psql/stringutils.h
M src/bin/psql/t/001_basic.pl
M src/bin/psql/t/010_tab_completion.pl
M src/bin/psql/t/020_cancel.pl
M src/bin/psql/t/030_pager.pl
M src/bin/psql/tab-complete.h
M src/bin/psql/tab-complete.in.c
M src/bin/psql/variables.c
M src/bin/psql/variables.h
M src/bin/scripts/Makefile
M src/bin/scripts/clusterdb.c
M src/bin/scripts/common.c
M src/bin/scripts/common.h
M src/bin/scripts/createdb.c
M src/bin/scripts/createuser.c
M src/bin/scripts/dropdb.c
M src/bin/scripts/dropuser.c
M src/bin/scripts/meson.build
M src/bin/scripts/pg_isready.c
M src/bin/scripts/po/meson.build
M src/bin/scripts/reindexdb.c
M src/bin/scripts/t/010_clusterdb.pl
M src/bin/scripts/t/011_clusterdb_all.pl
M src/bin/scripts/t/020_createdb.pl
M src/bin/scripts/t/040_createuser.pl
M src/bin/scripts/t/050_dropdb.pl
M src/bin/scripts/t/070_dropuser.pl
M src/bin/scripts/t/080_pg_isready.pl
M src/bin/scripts/t/090_reindexdb.pl
M src/bin/scripts/t/091_reindexdb_all.pl
M src/bin/scripts/t/100_vacuumdb.pl
M src/bin/scripts/t/101_vacuumdb_all.pl
M src/bin/scripts/t/102_vacuumdb_stages.pl
M src/bin/scripts/t/200_connstr.pl
M src/bin/scripts/vacuumdb.c
M src/bin/scripts/vacuuming.c
M src/bin/scripts/vacuuming.h
M src/common/archive.c
M src/common/base64.c
M src/common/binaryheap.c
M src/common/blkreftable.c
M src/common/checksum_helper.c
M src/common/compression.c
M src/common/config_info.c
M src/common/controldata_utils.c
M src/common/cryptohash.c
M src/common/cryptohash_openssl.c
M src/common/d2s.c
M src/common/d2s_full_table.h
M src/common/d2s_intrinsics.h
M src/common/encnames.c
M src/common/exec.c
M src/common/f2s.c
M src/common/fe_memutils.c
M src/common/file_perm.c
M src/common/file_utils.c
M src/common/hashfn.c
M src/common/hmac.c
M src/common/hmac_openssl.c
M src/common/ip.c
M src/common/jsonapi.c
M src/common/keywords.c
M src/common/kwlookup.c
M src/common/link-canary.c
M src/common/logging.c
M src/common/md5.c
M src/common/md5_common.c
M src/common/md5_int.h
M src/common/meson.build
M src/common/parse_manifest.c
M src/common/percentrepl.c
M src/common/pg_get_line.c
M src/common/pg_lzcompress.c
M src/common/pg_prng.c
M src/common/pgfnames.c
M src/common/psprintf.c
M src/common/relpath.c
M src/common/restricted_token.c
M src/common/rmtree.c
M src/common/ryu_common.h
M src/common/saslprep.c
M src/common/scram-common.c
M src/common/sha1.c
M src/common/sha1_int.h
M src/common/sha2.c
M src/common/sha2_int.h
M src/common/sprompt.c
M src/common/string.c
M src/common/stringinfo.c
M src/common/unicode/case_test.c
M src/common/unicode/category_test.c
M src/common/unicode/generate-norm_test_table.pl
M src/common/unicode/generate-unicode_case_table.pl
M src/common/unicode/generate-unicode_category_table.pl
M src/common/unicode/generate-unicode_east_asian_fw_table.pl
M src/common/unicode/generate-unicode_nonspacing_table.pl
M src/common/unicode/generate-unicode_norm_table.pl
M src/common/unicode/generate-unicode_normprops_table.pl
M src/common/unicode/generate-unicode_version.pl
M src/common/unicode/meson.build
M src/common/unicode/norm_test.c
M src/common/unicode_case.c
M src/common/unicode_category.c
M src/common/unicode_norm.c
M src/common/username.c
M src/common/wait_error.c
M src/common/wchar.c
M src/fe_utils/Makefile
M src/fe_utils/archive.c
M src/fe_utils/astreamer_file.c
M src/fe_utils/astreamer_gzip.c
M src/fe_utils/astreamer_lz4.c
M src/fe_utils/astreamer_tar.c
M src/fe_utils/astreamer_zstd.c
M src/fe_utils/cancel.c
M src/fe_utils/conditional.c
M src/fe_utils/connect_utils.c
M src/fe_utils/mbprint.c
M src/fe_utils/meson.build
M src/fe_utils/option_utils.c
M src/fe_utils/parallel_slot.c
M src/fe_utils/print.c
M src/fe_utils/psqlscan.l
M src/fe_utils/query_utils.c
M src/fe_utils/recovery_gen.c
M src/fe_utils/simple_list.c
M src/fe_utils/string_utils.c
M src/fe_utils/version.c
M src/include/access/amapi.h
M src/include/access/amvalidate.h
M src/include/access/attmap.h
M src/include/access/attnum.h
M src/include/access/brin.h
M src/include/access/brin_internal.h
M src/include/access/brin_page.h
M src/include/access/brin_pageops.h
M src/include/access/brin_revmap.h
M src/include/access/brin_tuple.h
M src/include/access/brin_xlog.h
M src/include/access/bufmask.h
M src/include/access/clog.h
M src/include/access/cmptype.h
M src/include/access/commit_ts.h
M src/include/access/detoast.h
M src/include/access/genam.h
M src/include/access/generic_xlog.h
M src/include/access/gin.h
M src/include/access/gin_private.h
M src/include/access/gin_tuple.h
M src/include/access/ginblock.h
M src/include/access/ginxlog.h
M src/include/access/gist.h
M src/include/access/gist_private.h
M src/include/access/gistscan.h
M src/include/access/gistxlog.h
M src/include/access/hash.h
M src/include/access/hash_xlog.h
M src/include/access/heapam.h
M src/include/access/heapam_xlog.h
M src/include/access/heaptoast.h
M src/include/access/hio.h
M src/include/access/htup.h
M src/include/access/htup_details.h
M src/include/access/itup.h
M src/include/access/multixact.h
M src/include/access/multixact_internal.h
M src/include/access/nbtree.h
M src/include/access/nbtxlog.h
M src/include/access/parallel.h
M src/include/access/printsimple.h
M src/include/access/printtup.h
M src/include/access/relation.h
M src/include/access/reloptions.h
M src/include/access/relscan.h
M src/include/access/rewriteheap.h
M src/include/access/rmgrdesc_utils.h
M src/include/access/rmgrlist.h
M src/include/access/sdir.h
M src/include/access/sequence.h
M src/include/access/session.h
M src/include/access/skey.h
M src/include/access/slru.h
M src/include/access/spgist.h
M src/include/access/spgist_private.h
M src/include/access/spgxlog.h
M src/include/access/stratnum.h
M src/include/access/subtrans.h
M src/include/access/syncscan.h
M src/include/access/sysattr.h
M src/include/access/table.h
M src/include/access/tableam.h
M src/include/access/tidstore.h
M src/include/access/timeline.h
M src/include/access/toast_compression.h
M src/include/access/toast_helper.h
M src/include/access/toast_internals.h
M src/include/access/transam.h
M src/include/access/tsmapi.h
M src/include/access/tupconvert.h
M src/include/access/tupdesc.h
M src/include/access/tupdesc_details.h
M src/include/access/tupmacs.h
M src/include/access/twophase.h
M src/include/access/twophase_rmgr.h
M src/include/access/valid.h
M src/include/access/visibilitymap.h
M src/include/access/visibilitymapdefs.h
M src/include/access/xact.h
M src/include/access/xlog.h
M src/include/access/xlog_internal.h
M src/include/access/xlogarchive.h
M src/include/access/xlogbackup.h
M src/include/access/xlogdefs.h
M src/include/access/xloginsert.h
M src/include/access/xlogprefetcher.h
M src/include/access/xlogreader.h
M src/include/access/xlogrecord.h
M src/include/access/xlogrecovery.h
M src/include/access/xlogstats.h
M src/include/access/xlogutils.h
M src/include/access/xlogwait.h
M src/include/archive/archive_module.h
M src/include/archive/shell_archive.h
M src/include/backup/backup_manifest.h
M src/include/backup/basebackup.h
M src/include/backup/basebackup_incremental.h
M src/include/backup/basebackup_sink.h
M src/include/backup/basebackup_target.h
M src/include/backup/walsummary.h
M src/include/bootstrap/bootstrap.h
M src/include/c.h
M src/include/catalog/Makefile
M src/include/catalog/binary_upgrade.h
M src/include/catalog/catalog.h
M src/include/catalog/catversion.h
M src/include/catalog/dependency.h
M src/include/catalog/duplicate_oids
M src/include/catalog/genbki.h
M src/include/catalog/heap.h
M src/include/catalog/index.h
M src/include/catalog/indexing.h
M src/include/catalog/meson.build
M src/include/catalog/namespace.h
M src/include/catalog/objectaccess.h
M src/include/catalog/objectaddress.h
M src/include/catalog/partition.h
M src/include/catalog/pg_aggregate.dat
M src/include/catalog/pg_aggregate.h
M src/include/catalog/pg_am.dat
M src/include/catalog/pg_am.h
M src/include/catalog/pg_amop.dat
M src/include/catalog/pg_amop.h
M src/include/catalog/pg_amproc.dat
M src/include/catalog/pg_amproc.h
M src/include/catalog/pg_attrdef.h
M src/include/catalog/pg_attribute.h
M src/include/catalog/pg_auth_members.h
M src/include/catalog/pg_authid.dat
M src/include/catalog/pg_authid.h
M src/include/catalog/pg_cast.dat
M src/include/catalog/pg_cast.h
M src/include/catalog/pg_class.dat
M src/include/catalog/pg_class.h
M src/include/catalog/pg_collation.dat
M src/include/catalog/pg_collation.h
M src/include/catalog/pg_constraint.h
M src/include/catalog/pg_control.h
M src/include/catalog/pg_conversion.dat
M src/include/catalog/pg_conversion.h
M src/include/catalog/pg_database.dat
M src/include/catalog/pg_database.h
M src/include/catalog/pg_db_role_setting.h
M src/include/catalog/pg_default_acl.h
M src/include/catalog/pg_depend.h
M src/include/catalog/pg_description.h
M src/include/catalog/pg_enum.h
M src/include/catalog/pg_event_trigger.h
M src/include/catalog/pg_extension.h
M src/include/catalog/pg_foreign_data_wrapper.h
M src/include/catalog/pg_foreign_server.h
M src/include/catalog/pg_foreign_table.h
M src/include/catalog/pg_index.h
M src/include/catalog/pg_inherits.h
M src/include/catalog/pg_init_privs.h
M src/include/catalog/pg_language.dat
M src/include/catalog/pg_language.h
M src/include/catalog/pg_largeobject.h
M src/include/catalog/pg_largeobject_metadata.h
M src/include/catalog/pg_namespace.dat
M src/include/catalog/pg_namespace.h
M src/include/catalog/pg_opclass.dat
M src/include/catalog/pg_opclass.h
M src/include/catalog/pg_operator.dat
M src/include/catalog/pg_operator.h
M src/include/catalog/pg_opfamily.dat
M src/include/catalog/pg_opfamily.h
M src/include/catalog/pg_parameter_acl.h
M src/include/catalog/pg_partitioned_table.h
M src/include/catalog/pg_policy.h
M src/include/catalog/pg_proc.dat
M src/include/catalog/pg_proc.h
M src/include/catalog/pg_publication.h
M src/include/catalog/pg_publication_namespace.h
M src/include/catalog/pg_publication_rel.h
M src/include/catalog/pg_range.dat
M src/include/catalog/pg_range.h
M src/include/catalog/pg_replication_origin.h
M src/include/catalog/pg_rewrite.h
M src/include/catalog/pg_seclabel.h
M src/include/catalog/pg_sequence.h
M src/include/catalog/pg_shdepend.h
M src/include/catalog/pg_shdescription.h
M src/include/catalog/pg_shseclabel.h
M src/include/catalog/pg_statistic.h
M src/include/catalog/pg_statistic_ext.h
M src/include/catalog/pg_statistic_ext_data.h
M src/include/catalog/pg_subscription.h
M src/include/catalog/pg_subscription_rel.h
M src/include/catalog/pg_tablespace.dat
M src/include/catalog/pg_tablespace.h
M src/include/catalog/pg_transform.h
M src/include/catalog/pg_trigger.h
M src/include/catalog/pg_ts_config.dat
M src/include/catalog/pg_ts_config.h
M src/include/catalog/pg_ts_config_map.dat
M src/include/catalog/pg_ts_config_map.h
M src/include/catalog/pg_ts_dict.dat
M src/include/catalog/pg_ts_dict.h
M src/include/catalog/pg_ts_parser.dat
M src/include/catalog/pg_ts_parser.h
M src/include/catalog/pg_ts_template.dat
M src/include/catalog/pg_ts_template.h
M src/include/catalog/pg_type.dat
M src/include/catalog/pg_type.h
M src/include/catalog/pg_user_mapping.h
M src/include/catalog/reformat_dat_file.pl
M src/include/catalog/renumber_oids.pl
M src/include/catalog/storage.h
M src/include/catalog/storage_xlog.h
M src/include/catalog/toasting.h
M src/include/catalog/unused_oids
M src/include/commands/alter.h
M src/include/commands/async.h
M src/include/commands/cluster.h
M src/include/commands/collationcmds.h
M src/include/commands/comment.h
M src/include/commands/conversioncmds.h
M src/include/commands/copy.h
M src/include/commands/copyapi.h
M src/include/commands/copyfrom_internal.h
M src/include/commands/createas.h
M src/include/commands/dbcommands.h
M src/include/commands/dbcommands_xlog.h
M src/include/commands/defrem.h
M src/include/commands/discard.h
M src/include/commands/event_trigger.h
M src/include/commands/explain.h
M src/include/commands/explain_dr.h
M src/include/commands/explain_format.h
M src/include/commands/explain_state.h
M src/include/commands/extension.h
M src/include/commands/lockcmds.h
M src/include/commands/matview.h
M src/include/commands/policy.h
M src/include/commands/portalcmds.h
M src/include/commands/prepare.h
M src/include/commands/proclang.h
M src/include/commands/progress.h
M src/include/commands/publicationcmds.h
M src/include/commands/schemacmds.h
M src/include/commands/seclabel.h
M src/include/commands/sequence.h
M src/include/commands/sequence_xlog.h
M src/include/commands/subscriptioncmds.h
M src/include/commands/tablecmds.h
M src/include/commands/tablespace.h
M src/include/commands/trigger.h
M src/include/commands/typecmds.h
M src/include/commands/vacuum.h
M src/include/commands/view.h
M src/include/commands/wait.h
M src/include/common/archive.h
M src/include/common/base64.h
M src/include/common/blkreftable.h
M src/include/common/checksum_helper.h
M src/include/common/compression.h
M src/include/common/config_info.h
M src/include/common/connect.h
M src/include/common/controldata_utils.h
M src/include/common/cryptohash.h
M src/include/common/fe_memutils.h
M src/include/common/file_perm.h
M src/include/common/file_utils.h
M src/include/common/hashfn.h
M src/include/common/hashfn_unstable.h
M src/include/common/hmac.h
M src/include/common/int.h
M src/include/common/int128.h
M src/include/common/ip.h
M src/include/common/jsonapi.h
M src/include/common/keywords.h
M src/include/common/kwlookup.h
M src/include/common/link-canary.h
M src/include/common/logging.h
M src/include/common/md5.h
M src/include/common/oauth-common.h
M src/include/common/openssl.h
M src/include/common/parse_manifest.h
M src/include/common/percentrepl.h
M src/include/common/pg_prng.h
M src/include/common/relpath.h
M src/include/common/restricted_token.h
M src/include/common/saslprep.h
M src/include/common/scram-common.h
M src/include/common/sha1.h
M src/include/common/sha2.h
M src/include/common/shortest_dec.h
M src/include/common/string.h
M src/include/common/unicode_case.h
M src/include/common/unicode_case_table.h
M src/include/common/unicode_category.h
M src/include/common/unicode_category_table.h
M src/include/common/unicode_norm.h
M src/include/common/unicode_norm_hashfunc.h
M src/include/common/unicode_norm_table.h
M src/include/common/unicode_version.h
M src/include/common/username.h
M src/include/datatype/timestamp.h
M src/include/executor/execAsync.h
M src/include/executor/execExpr.h
M src/include/executor/execParallel.h
M src/include/executor/execPartition.h
M src/include/executor/execScan.h
M src/include/executor/execdebug.h
M src/include/executor/execdesc.h
M src/include/executor/executor.h
M src/include/executor/functions.h
M src/include/executor/hashjoin.h
M src/include/executor/instrument.h
M src/include/executor/nodeAgg.h
M src/include/executor/nodeAppend.h
M src/include/executor/nodeBitmapAnd.h
M src/include/executor/nodeBitmapHeapscan.h
M src/include/executor/nodeBitmapIndexscan.h
M src/include/executor/nodeBitmapOr.h
M src/include/executor/nodeCtescan.h
M src/include/executor/nodeCustom.h
M src/include/executor/nodeForeignscan.h
M src/include/executor/nodeFunctionscan.h
M src/include/executor/nodeGather.h
M src/include/executor/nodeGatherMerge.h
M src/include/executor/nodeGroup.h
M src/include/executor/nodeHash.h
M src/include/executor/nodeHashjoin.h
M src/include/executor/nodeIncrementalSort.h
M src/include/executor/nodeIndexonlyscan.h
M src/include/executor/nodeIndexscan.h
M src/include/executor/nodeLimit.h
M src/include/executor/nodeLockRows.h
M src/include/executor/nodeMaterial.h
M src/include/executor/nodeMemoize.h
M src/include/executor/nodeMergeAppend.h
M src/include/executor/nodeMergejoin.h
M src/include/executor/nodeModifyTable.h
M src/include/executor/nodeNamedtuplestorescan.h
M src/include/executor/nodeNestloop.h
M src/include/executor/nodeProjectSet.h
M src/include/executor/nodeRecursiveunion.h
M src/include/executor/nodeResult.h
M src/include/executor/nodeSamplescan.h
M src/include/executor/nodeSeqscan.h
M src/include/executor/nodeSetOp.h
M src/include/executor/nodeSort.h
M src/include/executor/nodeSubplan.h
M src/include/executor/nodeSubqueryscan.h
M src/include/executor/nodeTableFuncscan.h
M src/include/executor/nodeTidrangescan.h
M src/include/executor/nodeTidscan.h
M src/include/executor/nodeUnique.h
M src/include/executor/nodeValuesscan.h
M src/include/executor/nodeWindowAgg.h
M src/include/executor/nodeWorktablescan.h
M src/include/executor/spi.h
M src/include/executor/spi_priv.h
M src/include/executor/tablefunc.h
M src/include/executor/tqueue.h
M src/include/executor/tstoreReceiver.h
M src/include/executor/tuptable.h
M src/include/fe_utils/archive.h
M src/include/fe_utils/astreamer.h
M src/include/fe_utils/cancel.h
M src/include/fe_utils/conditional.h
M src/include/fe_utils/connect_utils.h
M src/include/fe_utils/mbprint.h
M src/include/fe_utils/option_utils.h
M src/include/fe_utils/parallel_slot.h
M src/include/fe_utils/print.h
M src/include/fe_utils/psqlscan.h
M src/include/fe_utils/psqlscan_int.h
M src/include/fe_utils/query_utils.h
M src/include/fe_utils/recovery_gen.h
M src/include/fe_utils/simple_list.h
M src/include/fe_utils/string_utils.h
M src/include/fe_utils/version.h
M src/include/fmgr.h
M src/include/foreign/fdwapi.h
M src/include/foreign/foreign.h
M src/include/funcapi.h
M src/include/getopt_long.h
M src/include/jit/jit.h
M src/include/jit/llvmjit.h
M src/include/jit/llvmjit_emit.h
M src/include/lib/binaryheap.h
M src/include/lib/bipartite_match.h
M src/include/lib/bloomfilter.h
M src/include/lib/dshash.h
M src/include/lib/hyperloglog.h
M src/include/lib/ilist.h
M src/include/lib/integerset.h
M src/include/lib/knapsack.h
M src/include/lib/pairingheap.h
M src/include/lib/qunique.h
M src/include/lib/radixtree.h
M src/include/lib/rbtree.h
M src/include/lib/simplehash.h
M src/include/lib/sort_template.h
M src/include/lib/stringinfo.h
M src/include/libpq/auth.h
M src/include/libpq/be-fsstubs.h
M src/include/libpq/be-gssapi-common.h
M src/include/libpq/crypt.h
M src/include/libpq/ifaddr.h
M src/include/libpq/libpq-be-fe-helpers.h
M src/include/libpq/libpq-be-fe.h
M src/include/libpq/libpq-be.h
M src/include/libpq/libpq-fs.h
M src/include/libpq/libpq.h
M src/include/libpq/oauth.h
M src/include/libpq/pg-gssapi.h
M src/include/libpq/pqcomm.h
M src/include/libpq/pqformat.h
M src/include/libpq/pqmq.h
M src/include/libpq/pqsignal.h
M src/include/libpq/protocol.h
M src/include/libpq/sasl.h
M src/include/libpq/scram.h
M src/include/mb/pg_wchar.h
M src/include/mb/stringinfo_mb.h
M src/include/meson.build
M src/include/miscadmin.h
M src/include/nodes/bitmapset.h
M src/include/nodes/execnodes.h
M src/include/nodes/extensible.h
M src/include/nodes/lockoptions.h
M src/include/nodes/makefuncs.h
M src/include/nodes/memnodes.h
M src/include/nodes/meson.build
M src/include/nodes/miscnodes.h
M src/include/nodes/multibitmapset.h
M src/include/nodes/nodeFuncs.h
M src/include/nodes/nodes.h
M src/include/nodes/params.h
M src/include/nodes/parsenodes.h
M src/include/nodes/pathnodes.h
M src/include/nodes/pg_list.h
M src/include/nodes/plannodes.h
M src/include/nodes/primnodes.h
M src/include/nodes/print.h
M src/include/nodes/queryjumble.h
M src/include/nodes/readfuncs.h
M src/include/nodes/replnodes.h
M src/include/nodes/subscripting.h
M src/include/nodes/supportnodes.h
M src/include/nodes/tidbitmap.h
M src/include/nodes/value.h
M src/include/optimizer/appendinfo.h
M src/include/optimizer/clauses.h
M src/include/optimizer/cost.h
M src/include/optimizer/extendplan.h
M src/include/optimizer/geqo.h
M src/include/optimizer/geqo_copy.h
M src/include/optimizer/geqo_gene.h
M src/include/optimizer/geqo_misc.h
M src/include/optimizer/geqo_mutation.h
M src/include/optimizer/geqo_pool.h
M src/include/optimizer/geqo_random.h
M src/include/optimizer/geqo_recombination.h
M src/include/optimizer/geqo_selection.h
M src/include/optimizer/inherit.h
M src/include/optimizer/joininfo.h
M src/include/optimizer/optimizer.h
M src/include/optimizer/orclauses.h
M src/include/optimizer/paramassign.h
M src/include/optimizer/pathnode.h
M src/include/optimizer/paths.h
M src/include/optimizer/placeholder.h
M src/include/optimizer/plancat.h
M src/include/optimizer/planmain.h
M src/include/optimizer/planner.h
M src/include/optimizer/prep.h
M src/include/optimizer/restrictinfo.h
M src/include/optimizer/subselect.h
M src/include/optimizer/tlist.h
M src/include/parser/analyze.h
M src/include/parser/kwlist.h
M src/include/parser/parse_agg.h
M src/include/parser/parse_clause.h
M src/include/parser/parse_coerce.h
M src/include/parser/parse_collate.h
M src/include/parser/parse_cte.h
M src/include/parser/parse_enr.h
M src/include/parser/parse_expr.h
M src/include/parser/parse_func.h
M src/include/parser/parse_merge.h
M src/include/parser/parse_node.h
M src/include/parser/parse_oper.h
M src/include/parser/parse_param.h
M src/include/parser/parse_relation.h
M src/include/parser/parse_target.h
M src/include/parser/parse_type.h
M src/include/parser/parse_utilcmd.h
M src/include/parser/parser.h
M src/include/parser/parsetree.h
M src/include/parser/scanner.h
M src/include/parser/scansup.h
M src/include/partitioning/partbounds.h
M src/include/partitioning/partdefs.h
M src/include/partitioning/partdesc.h
M src/include/partitioning/partprune.h
M src/include/pch/meson.build
M src/include/pg_config_manual.h
M src/include/pg_getopt.h
M src/include/pg_trace.h
M src/include/pgstat.h
M src/include/pgtar.h
M src/include/pgtime.h
M src/include/port.h
M src/include/port/atomics.h
M src/include/port/atomics/arch-arm.h
M src/include/port/atomics/arch-ppc.h
M src/include/port/atomics/arch-x86.h
M src/include/port/atomics/fallback.h
M src/include/port/atomics/generic-gcc.h
M src/include/port/atomics/generic-msvc.h
M src/include/port/atomics/generic.h
M src/include/port/pg_bitutils.h
M src/include/port/pg_bswap.h
M src/include/port/pg_crc32c.h
M src/include/port/pg_iovec.h
M src/include/port/pg_lfind.h
M src/include/port/pg_numa.h
M src/include/port/simd.h
M src/include/port/win32_port.h
M src/include/port/win32ntdll.h
M src/include/portability/instr_time.h
M src/include/portability/mem.h
M src/include/postgres.h
M src/include/postgres_fe.h
M src/include/postmaster/autovacuum.h
M src/include/postmaster/auxprocess.h
M src/include/postmaster/bgworker.h
M src/include/postmaster/bgworker_internals.h
M src/include/postmaster/bgwriter.h
M src/include/postmaster/fork_process.h
M src/include/postmaster/interrupt.h
M src/include/postmaster/pgarch.h
M src/include/postmaster/postmaster.h
M src/include/postmaster/proctypelist.h
M src/include/postmaster/startup.h
M src/include/postmaster/syslogger.h
M src/include/postmaster/walsummarizer.h
M src/include/postmaster/walwriter.h
M src/include/regex/regexport.h
M src/include/replication/conflict.h
M src/include/replication/decode.h
M src/include/replication/logical.h
M src/include/replication/logicalctl.h
M src/include/replication/logicallauncher.h
M src/include/replication/logicalproto.h
M src/include/replication/logicalrelation.h
M src/include/replication/logicalworker.h
M src/include/replication/message.h
M src/include/replication/origin.h
M src/include/replication/output_plugin.h
M src/include/replication/pgoutput.h
M src/include/replication/reorderbuffer.h
M src/include/replication/slot.h
M src/include/replication/slotsync.h
M src/include/replication/snapbuild.h
M src/include/replication/snapbuild_internal.h
M src/include/replication/syncrep.h
M src/include/replication/walreceiver.h
M src/include/replication/walsender.h
M src/include/replication/walsender_private.h
M src/include/replication/worker_internal.h
M src/include/rewrite/prs2lock.h
M src/include/rewrite/rewriteDefine.h
M src/include/rewrite/rewriteHandler.h
M src/include/rewrite/rewriteManip.h
M src/include/rewrite/rewriteRemove.h
M src/include/rewrite/rewriteSearchCycle.h
M src/include/rewrite/rewriteSupport.h
M src/include/rewrite/rowsecurity.h
M src/include/snowball/header.h
M src/include/statistics/extended_stats_internal.h
M src/include/statistics/stat_utils.h
M src/include/statistics/statistics.h
M src/include/statistics/statistics_format.h
M src/include/storage/aio.h
M src/include/storage/aio_internal.h
M src/include/storage/aio_subsys.h
M src/include/storage/aio_types.h
M src/include/storage/barrier.h
M src/include/storage/block.h
M src/include/storage/buf.h
M src/include/storage/buf_internals.h
M src/include/storage/buffile.h
M src/include/storage/bufmgr.h
M src/include/storage/bufpage.h
M src/include/storage/bulk_write.h
M src/include/storage/checksum.h
M src/include/storage/checksum_impl.h
M src/include/storage/condition_variable.h
M src/include/storage/copydir.h
M src/include/storage/dsm.h
M src/include/storage/dsm_impl.h
M src/include/storage/dsm_registry.h
M src/include/storage/fd.h
M src/include/storage/fileset.h
M src/include/storage/freespace.h
M src/include/storage/fsm_internals.h
M src/include/storage/indexfsm.h
M src/include/storage/io_worker.h
M src/include/storage/ipc.h
M src/include/storage/itemid.h
M src/include/storage/itemptr.h
M src/include/storage/large_object.h
M src/include/storage/latch.h
M src/include/storage/lmgr.h
M src/include/storage/lock.h
M src/include/storage/lockdefs.h
M src/include/storage/lwlock.h
M src/include/storage/lwlocklist.h
M src/include/storage/md.h
M src/include/storage/meson.build
M src/include/storage/off.h
M src/include/storage/pg_sema.h
M src/include/storage/pg_shmem.h
M src/include/storage/pmsignal.h
M src/include/storage/predicate.h
M src/include/storage/predicate_internals.h
M src/include/storage/proc.h
M src/include/storage/procarray.h
M src/include/storage/proclist.h
M src/include/storage/proclist_types.h
M src/include/storage/procnumber.h
M src/include/storage/procsignal.h
M src/include/storage/read_stream.h
M src/include/storage/reinit.h
M src/include/storage/relfilelocator.h
M src/include/storage/s_lock.h
M src/include/storage/sharedfileset.h
M src/include/storage/shm_mq.h
M src/include/storage/shm_toc.h
M src/include/storage/shmem.h
M src/include/storage/sinval.h
M src/include/storage/sinvaladt.h
M src/include/storage/smgr.h
M src/include/storage/spin.h
M src/include/storage/standby.h
M src/include/storage/standbydefs.h
M src/include/storage/sync.h
M src/include/storage/waiteventset.h
M src/include/tcop/backend_startup.h
M src/include/tcop/cmdtag.h
M src/include/tcop/cmdtaglist.h
M src/include/tcop/deparse_utility.h
M src/include/tcop/dest.h
M src/include/tcop/fastpath.h
M src/include/tcop/pquery.h
M src/include/tcop/tcopprot.h
M src/include/tcop/utility.h
M src/include/tsearch/dicts/regis.h
M src/include/tsearch/dicts/spell.h
M src/include/tsearch/ts_cache.h
M src/include/tsearch/ts_locale.h
M src/include/tsearch/ts_public.h
M src/include/tsearch/ts_type.h
M src/include/tsearch/ts_utils.h
M src/include/utils/acl.h
M src/include/utils/aclchk_internal.h
M src/include/utils/array.h
M src/include/utils/arrayaccess.h
M src/include/utils/ascii.h
M src/include/utils/attoptcache.h
M src/include/utils/backend_progress.h
M src/include/utils/backend_status.h
M src/include/utils/builtins.h
M src/include/utils/bytea.h
M src/include/utils/catcache.h
M src/include/utils/combocid.h
M src/include/utils/conffiles.h
M src/include/utils/date.h
M src/include/utils/datetime.h
M src/include/utils/datum.h
M src/include/utils/dsa.h
M src/include/utils/elog.h
M src/include/utils/evtcache.h
M src/include/utils/expandeddatum.h
M src/include/utils/expandedrecord.h
M src/include/utils/float.h
M src/include/utils/fmgrtab.h
M src/include/utils/formatting.h
M src/include/utils/freepage.h
M src/include/utils/funccache.h
M src/include/utils/geo_decls.h
M src/include/utils/guc.h
M src/include/utils/guc_hooks.h
M src/include/utils/guc_tables.h
M src/include/utils/help_config.h
M src/include/utils/hsearch.h
M src/include/utils/index_selfuncs.h
M src/include/utils/inet.h
M src/include/utils/injection_point.h
M src/include/utils/inval.h
M src/include/utils/json.h
M src/include/utils/jsonb.h
M src/include/utils/jsonfuncs.h
M src/include/utils/jsonpath.h
M src/include/utils/logtape.h
M src/include/utils/lsyscache.h
M src/include/utils/memdebug.h
M src/include/utils/memutils.h
M src/include/utils/memutils_internal.h
M src/include/utils/memutils_memorychunk.h
M src/include/utils/meson.build
M src/include/utils/multirangetypes.h
M src/include/utils/numeric.h
M src/include/utils/palloc.h
M src/include/utils/partcache.h
M src/include/utils/pg_crc.h
M src/include/utils/pg_locale.h
M src/include/utils/pg_locale_c.h
M src/include/utils/pg_lsn.h
M src/include/utils/pg_rusage.h
M src/include/utils/pgstat_internal.h
M src/include/utils/pgstat_kind.h
M src/include/utils/pidfile.h
M src/include/utils/plancache.h
M src/include/utils/portal.h
M src/include/utils/queryenvironment.h
M src/include/utils/rangetypes.h
M src/include/utils/regproc.h
M src/include/utils/rel.h
M src/include/utils/relcache.h
M src/include/utils/relfilenumbermap.h
M src/include/utils/relmapper.h
M src/include/utils/relptr.h
M src/include/utils/reltrigger.h
M src/include/utils/resowner.h
M src/include/utils/rls.h
M src/include/utils/ruleutils.h
M src/include/utils/sampling.h
M src/include/utils/selfuncs.h
M src/include/utils/sharedtuplestore.h
M src/include/utils/skipsupport.h
M src/include/utils/snapmgr.h
M src/include/utils/snapshot.h
M src/include/utils/sortsupport.h
M src/include/utils/spccache.h
M src/include/utils/syscache.h
M src/include/utils/timeout.h
M src/include/utils/timestamp.h
M src/include/utils/tuplesort.h
M src/include/utils/tuplestore.h
M src/include/utils/typcache.h
M src/include/utils/tzparser.h
M src/include/utils/uuid.h
M src/include/utils/varbit.h
M src/include/utils/varlena.h
M src/include/utils/wait_classes.h
M src/include/utils/wait_event.h
M src/include/utils/xid8.h
M src/include/utils/xml.h
M src/include/varatt.h
M src/include/windowapi.h
M src/interfaces/ecpg/compatlib/Makefile
M src/interfaces/ecpg/compatlib/meson.build
M src/interfaces/ecpg/ecpglib/Makefile
M src/interfaces/ecpg/ecpglib/meson.build
M src/interfaces/ecpg/ecpglib/po/meson.build
M src/interfaces/ecpg/include/meson.build
M src/interfaces/ecpg/meson.build
M src/interfaces/ecpg/pgtypeslib/Makefile
M src/interfaces/ecpg/pgtypeslib/meson.build
M src/interfaces/ecpg/preproc/Makefile
M src/interfaces/ecpg/preproc/c_kwlist.h
M src/interfaces/ecpg/preproc/ecpg.c
M src/interfaces/ecpg/preproc/ecpg_kwlist.h
M src/interfaces/ecpg/preproc/keywords.c
M src/interfaces/ecpg/preproc/meson.build
M src/interfaces/ecpg/preproc/parse.pl
M src/interfaces/ecpg/preproc/parser.c
M src/interfaces/ecpg/preproc/pgc.l
M src/interfaces/ecpg/preproc/po/meson.build
M src/interfaces/ecpg/preproc/t/001_ecpg_err_warn_msg.pl
M src/interfaces/ecpg/preproc/t/002_ecpg_err_warn_msg_informix.pl
M src/interfaces/ecpg/test/compat_informix/meson.build
M src/interfaces/ecpg/test/compat_oracle/meson.build
M src/interfaces/ecpg/test/connect/meson.build
M src/interfaces/ecpg/test/meson.build
M src/interfaces/ecpg/test/pg_regress_ecpg.c
M src/interfaces/ecpg/test/pgtypeslib/meson.build
M src/interfaces/ecpg/test/preproc/meson.build
M src/interfaces/ecpg/test/sql/meson.build
M src/interfaces/ecpg/test/thread/meson.build
M src/interfaces/libpq-oauth/Makefile
M src/interfaces/libpq-oauth/meson.build
M src/interfaces/libpq-oauth/oauth-curl.c
M src/interfaces/libpq-oauth/oauth-curl.h
M src/interfaces/libpq-oauth/oauth-utils.c
M src/interfaces/libpq-oauth/oauth-utils.h
M src/interfaces/libpq-oauth/t/001_oauth.pl
M src/interfaces/libpq-oauth/test-oauth-curl.c
M src/interfaces/libpq/Makefile
M src/interfaces/libpq/fe-auth-oauth.c
M src/interfaces/libpq/fe-auth-oauth.h
M src/interfaces/libpq/fe-auth-sasl.h
M src/interfaces/libpq/fe-auth-scram.c
M src/interfaces/libpq/fe-auth.c
M src/interfaces/libpq/fe-auth.h
M src/interfaces/libpq/fe-cancel.c
M src/interfaces/libpq/fe-connect.c
M src/interfaces/libpq/fe-exec.c
M src/interfaces/libpq/fe-gssapi-common.c
M src/interfaces/libpq/fe-gssapi-common.h
M src/interfaces/libpq/fe-lobj.c
M src/interfaces/libpq/fe-misc.c
M src/interfaces/libpq/fe-print.c
M src/interfaces/libpq/fe-protocol3.c
M src/interfaces/libpq/fe-secure-common.c
M src/interfaces/libpq/fe-secure-common.h
M src/interfaces/libpq/fe-secure-gssapi.c
M src/interfaces/libpq/fe-secure-openssl.c
M src/interfaces/libpq/fe-secure.c
M src/interfaces/libpq/fe-trace.c
M src/interfaces/libpq/legacy-pqsignal.c
M src/interfaces/libpq/libpq-events.c
M src/interfaces/libpq/libpq-events.h
M src/interfaces/libpq/libpq-fe.h
M src/interfaces/libpq/libpq-int.h
M src/interfaces/libpq/libpq_check.pl
M src/interfaces/libpq/meson.build
M src/interfaces/libpq/po/meson.build
M src/interfaces/libpq/pqexpbuffer.c
M src/interfaces/libpq/pqexpbuffer.h
M src/interfaces/libpq/pthread-win32.c
M src/interfaces/libpq/t/001_uri.pl
M src/interfaces/libpq/t/002_api.pl
M src/interfaces/libpq/t/003_load_balance_host_list.pl
M src/interfaces/libpq/t/004_load_balance_dns.pl
M src/interfaces/libpq/t/005_negotiate_encryption.pl
M src/interfaces/libpq/t/006_service.pl
M src/interfaces/libpq/test/libpq_testclient.c
M src/interfaces/libpq/test/libpq_uri_regress.c
M src/interfaces/libpq/test/meson.build
M src/interfaces/libpq/win32.c
M src/interfaces/meson.build
M src/makefiles/meson.build
M src/meson.build
M src/pl/meson.build
M src/pl/plperl/meson.build
M src/pl/plperl/plc_perlboot.pl
M src/pl/plperl/plc_trusted.pl
M src/pl/plperl/plperl.h
M src/pl/plperl/plperl_opmask.pl
M src/pl/plperl/plperl_system.h
M src/pl/plperl/po/meson.build
M src/pl/plperl/text2macro.pl
M src/pl/plpgsql/meson.build
M src/pl/plpgsql/src/generate-plerrcodes.pl
M src/pl/plpgsql/src/meson.build
M src/pl/plpgsql/src/pl_comp.c
M src/pl/plpgsql/src/pl_exec.c
M src/pl/plpgsql/src/pl_funcs.c
M src/pl/plpgsql/src/pl_gram.y
M src/pl/plpgsql/src/pl_handler.c
M src/pl/plpgsql/src/pl_reserved_kwlist.h
M src/pl/plpgsql/src/pl_scanner.c
M src/pl/plpgsql/src/pl_unreserved_kwlist.h
M src/pl/plpgsql/src/plpgsql.h
M src/pl/plpgsql/src/po/meson.build
M src/pl/plpython/generate-spiexceptions.pl
M src/pl/plpython/meson.build
M src/pl/plpython/plpython.h
M src/pl/plpython/plpython_system.h
M src/pl/plpython/po/meson.build
M src/pl/tcl/generate-pltclerrcodes.pl
M src/pl/tcl/meson.build
M src/pl/tcl/po/meson.build
M src/port/bsearch_arg.c
M src/port/chklocale.c
M src/port/dirent.c
M src/port/dirmod.c
M src/port/explicit_bzero.c
M src/port/getpeereid.c
M src/port/kill.c
M src/port/meson.build
M src/port/mkdtemp.c
M src/port/noblock.c
M src/port/open.c
M src/port/path.c
M src/port/pg_bitutils.c
M src/port/pg_crc32c_armv8.c
M src/port/pg_crc32c_armv8_choose.c
M src/port/pg_crc32c_loongarch.c
M src/port/pg_crc32c_sb8.c
M src/port/pg_crc32c_sse42.c
M src/port/pg_crc32c_sse42_choose.c
M src/port/pg_localeconv_r.c
M src/port/pg_numa.c
M src/port/pg_popcount_aarch64.c
M src/port/pg_popcount_avx512.c
M src/port/pg_strong_random.c
M src/port/pgcheckdir.c
M src/port/pgsleep.c
M src/port/pgstrcasecmp.c
M src/port/pgstrsignal.c
M src/port/pqsignal.c
M src/port/pthread_barrier_wait.c
M src/port/quotes.c
M src/port/snprintf.c
M src/port/strerror.c
M src/port/strlcpy.c
M src/port/strnlen.c
M src/port/strtof.c
M src/port/system.c
M src/port/win32common.c
M src/port/win32dlopen.c
M src/port/win32env.c
M src/port/win32error.c
M src/port/win32fdatasync.c
M src/port/win32fseek.c
M src/port/win32gai_strerror.c
M src/port/win32getrusage.c
M src/port/win32link.c
M src/port/win32ntdll.c
M src/port/win32pread.c
M src/port/win32pwrite.c
M src/port/win32security.c
M src/port/win32setlocale.c
M src/port/win32stat.c
M src/port/win32ver.rc
M src/test/authentication/Makefile
M src/test/authentication/meson.build
M src/test/authentication/t/001_password.pl
M src/test/authentication/t/002_saslprep.pl
M src/test/authentication/t/003_peer.pl
M src/test/authentication/t/004_file_inclusion.pl
M src/test/authentication/t/005_sspi.pl
M src/test/authentication/t/006_login_trigger.pl
M src/test/authentication/t/007_pre_auth.pl
M src/test/examples/testlo.c
M src/test/examples/testlo64.c
M src/test/icu/Makefile
M src/test/icu/meson.build
M src/test/icu/t/010_database.pl
M src/test/isolation/isolation_main.c
M src/test/isolation/isolationtester.h
M src/test/isolation/meson.build
M src/test/isolation/specparse.y
M src/test/isolation/specscanner.l
M src/test/kerberos/Makefile
M src/test/kerberos/meson.build
M src/test/kerberos/t/001_auth.pl
M src/test/ldap/LdapServer.pm
M src/test/ldap/Makefile
M src/test/ldap/meson.build
M src/test/ldap/t/001_auth.pl
M src/test/ldap/t/002_bindpasswd.pl
M src/test/ldap/t/003_ldap_connection_param_lookup.pl
M src/test/locale/sort-test.pl
M src/test/meson.build
M src/test/modules/brin/meson.build
M src/test/modules/brin/t/01_workitems.pl
M src/test/modules/brin/t/02_wal_consistency.pl
M src/test/modules/commit_ts/meson.build
M src/test/modules/commit_ts/t/001_base.pl
M src/test/modules/commit_ts/t/002_standby.pl
M src/test/modules/commit_ts/t/003_standby_2.pl
M src/test/modules/commit_ts/t/004_restart.pl
M src/test/modules/delay_execution/delay_execution.c
M src/test/modules/delay_execution/meson.build
M src/test/modules/dummy_index_am/dummy_index_am.c
M src/test/modules/dummy_index_am/meson.build
M src/test/modules/dummy_seclabel/dummy_seclabel.c
M src/test/modules/dummy_seclabel/meson.build
M src/test/modules/gin/meson.build
M src/test/modules/index/meson.build
M src/test/modules/injection_points/injection_points.c
M src/test/modules/injection_points/meson.build
M src/test/modules/injection_points/regress_injection.c
M src/test/modules/ldap_password_func/Makefile
M src/test/modules/ldap_password_func/ldap_password_func.c
M src/test/modules/ldap_password_func/t/001_mutated_bindpasswd.pl
M src/test/modules/libpq_pipeline/libpq_pipeline.c
M src/test/modules/libpq_pipeline/meson.build
M src/test/modules/libpq_pipeline/t/001_libpq_pipeline.pl
M src/test/modules/meson.build
M src/test/modules/nbtree/meson.build
M src/test/modules/oauth_validator/Makefile
M src/test/modules/oauth_validator/fail_validator.c
M src/test/modules/oauth_validator/magic_validator.c
M src/test/modules/oauth_validator/meson.build
M src/test/modules/oauth_validator/oauth_hook_client.c
M src/test/modules/oauth_validator/t/001_server.pl
M src/test/modules/oauth_validator/t/002_client.pl
M src/test/modules/oauth_validator/t/OAuth/Server.pm
M src/test/modules/oauth_validator/validator.c
M src/test/modules/plsample/meson.build
M src/test/modules/plsample/plsample.c
M src/test/modules/spgist_name_ops/meson.build
M src/test/modules/spgist_name_ops/spgist_name_ops.c
M src/test/modules/ssl_passphrase_callback/meson.build
M src/test/modules/ssl_passphrase_callback/t/001_testfunc.pl
M src/test/modules/test_aio/meson.build
M src/test/modules/test_aio/t/001_aio.pl
M src/test/modules/test_aio/t/002_io_workers.pl
M src/test/modules/test_aio/test_aio.c
M src/test/modules/test_binaryheap/meson.build
M src/test/modules/test_binaryheap/test_binaryheap.c
M src/test/modules/test_bitmapset/meson.build
M src/test/modules/test_bitmapset/test_bitmapset.c
M src/test/modules/test_bloomfilter/meson.build
M src/test/modules/test_bloomfilter/test_bloomfilter.c
M src/test/modules/test_cloexec/t/001_cloexec.pl
M src/test/modules/test_cloexec/test_cloexec.c
M src/test/modules/test_copy_callbacks/meson.build
M src/test/modules/test_copy_callbacks/test_copy_callbacks.c
M src/test/modules/test_custom_rmgrs/meson.build
M src/test/modules/test_custom_rmgrs/t/001_basic.pl
M src/test/modules/test_custom_rmgrs/test_custom_rmgrs.c
M src/test/modules/test_custom_stats/meson.build
M src/test/modules/test_custom_stats/t/001_custom_stats.pl
M src/test/modules/test_custom_stats/test_custom_fixed_stats.c
M src/test/modules/test_custom_stats/test_custom_var_stats.c
M src/test/modules/test_ddl_deparse/meson.build
M src/test/modules/test_ddl_deparse/test_ddl_deparse.c
M src/test/modules/test_dsa/meson.build
M src/test/modules/test_dsa/test_dsa.c
M src/test/modules/test_dsm_registry/meson.build
M src/test/modules/test_dsm_registry/test_dsm_registry.c
M src/test/modules/test_escape/t/001_test_escape.pl
M src/test/modules/test_escape/test_escape.c
M src/test/modules/test_extensions/meson.build
M src/test/modules/test_extensions/t/001_extension_control_path.pl
M src/test/modules/test_ginpostinglist/meson.build
M src/test/modules/test_ginpostinglist/test_ginpostinglist.c
M src/test/modules/test_int128/meson.build
M src/test/modules/test_int128/t/001_test_int128.pl
M src/test/modules/test_int128/test_int128.c
M src/test/modules/test_integerset/meson.build
M src/test/modules/test_integerset/test_integerset.c
M src/test/modules/test_json_parser/meson.build
M src/test/modules/test_json_parser/t/001_test_json_parser_incremental.pl
M src/test/modules/test_json_parser/t/002_inline.pl
M src/test/modules/test_json_parser/t/003_test_semantic.pl
M src/test/modules/test_json_parser/t/004_test_parser_perf.pl
M src/test/modules/test_json_parser/test_json_parser_incremental.c
M src/test/modules/test_json_parser/test_json_parser_perf.c
M src/test/modules/test_lfind/meson.build
M src/test/modules/test_lfind/test_lfind.c
M src/test/modules/test_lwlock_tranches/meson.build
M src/test/modules/test_lwlock_tranches/test_lwlock_tranches.c
M src/test/modules/test_misc/meson.build
M src/test/modules/test_misc/t/001_constraint_validation.pl
M src/test/modules/test_misc/t/002_tablespace.pl
M src/test/modules/test_misc/t/003_check_guc.pl
M src/test/modules/test_misc/t/004_io_direct.pl
M src/test/modules/test_misc/t/005_timeouts.pl
M src/test/modules/test_misc/t/006_signal_autovacuum.pl
M src/test/modules/test_misc/t/007_catcache_inval.pl
M src/test/modules/test_misc/t/008_replslot_single_user.pl
M src/test/modules/test_misc/t/009_log_temp_files.pl
M src/test/modules/test_oat_hooks/meson.build
M src/test/modules/test_oat_hooks/test_oat_hooks.c
M src/test/modules/test_parser/meson.build
M src/test/modules/test_parser/test_parser.c
M src/test/modules/test_pg_dump/meson.build
M src/test/modules/test_pg_dump/t/001_base.pl
M src/test/modules/test_predtest/meson.build
M src/test/modules/test_predtest/test_predtest.c
M src/test/modules/test_radixtree/meson.build
M src/test/modules/test_radixtree/test_radixtree.c
M src/test/modules/test_rbtree/meson.build
M src/test/modules/test_rbtree/test_rbtree.c
M src/test/modules/test_regex/meson.build
M src/test/modules/test_regex/test_regex.c
M src/test/modules/test_resowner/meson.build
M src/test/modules/test_resowner/test_resowner_basic.c
M src/test/modules/test_resowner/test_resowner_many.c
M src/test/modules/test_rls_hooks/meson.build
M src/test/modules/test_rls_hooks/test_rls_hooks.c
M src/test/modules/test_rls_hooks/test_rls_hooks.h
M src/test/modules/test_shm_mq/meson.build
M src/test/modules/test_shm_mq/setup.c
M src/test/modules/test_shm_mq/test.c
M src/test/modules/test_shm_mq/test_shm_mq.h
M src/test/modules/test_shm_mq/worker.c
M src/test/modules/test_slru/meson.build
M src/test/modules/test_slru/t/001_multixact.pl
M src/test/modules/test_slru/t/002_multixact_wraparound.pl
M src/test/modules/test_slru/test_multixact.c
M src/test/modules/test_slru/test_slru.c
M src/test/modules/test_tidstore/meson.build
M src/test/modules/test_tidstore/test_tidstore.c
M src/test/modules/typcache/meson.build
M src/test/modules/unsafe_tests/meson.build
M src/test/modules/worker_spi/meson.build
M src/test/modules/worker_spi/t/001_worker_spi.pl
M src/test/modules/worker_spi/worker_spi.c
M src/test/modules/xid_wraparound/meson.build
M src/test/modules/xid_wraparound/t/001_emergency_vacuum.pl
M src/test/modules/xid_wraparound/t/002_limits.pl
M src/test/modules/xid_wraparound/t/003_wraparounds.pl
M src/test/modules/xid_wraparound/t/004_notify_freeze.pl
M src/test/modules/xid_wraparound/xid_wraparound.c
M src/test/perl/Makefile
M src/test/perl/PostgreSQL/Test/AdjustDump.pm
M src/test/perl/PostgreSQL/Test/AdjustUpgrade.pm
M src/test/perl/PostgreSQL/Test/BackgroundPsql.pm
M src/test/perl/PostgreSQL/Test/Cluster.pm
M src/test/perl/PostgreSQL/Test/Kerberos.pm
M src/test/perl/PostgreSQL/Test/RecursiveCopy.pm
M src/test/perl/PostgreSQL/Test/SimpleTee.pm
M src/test/perl/PostgreSQL/Test/Utils.pm
M src/test/perl/PostgreSQL/Version.pm
M src/test/perl/meson.build
M src/test/postmaster/Makefile
M src/test/postmaster/meson.build
M src/test/postmaster/t/001_basic.pl
M src/test/postmaster/t/002_connection_limits.pl
M src/test/postmaster/t/003_start_stop.pl
M src/test/recovery/Makefile
M src/test/recovery/meson.build
M src/test/recovery/t/001_stream_rep.pl
M src/test/recovery/t/002_archiving.pl
M src/test/recovery/t/003_recovery_targets.pl
M src/test/recovery/t/004_timeline_switch.pl
M src/test/recovery/t/005_replay_delay.pl
M src/test/recovery/t/006_logical_decoding.pl
M src/test/recovery/t/007_sync_rep.pl
M src/test/recovery/t/008_fsm_truncation.pl
M src/test/recovery/t/009_twophase.pl
M src/test/recovery/t/010_logical_decoding_timelines.pl
M src/test/recovery/t/012_subtransactions.pl
M src/test/recovery/t/013_crash_restart.pl
M src/test/recovery/t/014_unlogged_reinit.pl
M src/test/recovery/t/015_promotion_pages.pl
M src/test/recovery/t/016_min_consistency.pl
M src/test/recovery/t/017_shm.pl
M src/test/recovery/t/018_wal_optimize.pl
M src/test/recovery/t/019_replslot_limit.pl
M src/test/recovery/t/020_archive_status.pl
M src/test/recovery/t/021_row_visibility.pl
M src/test/recovery/t/022_crash_temp_files.pl
M src/test/recovery/t/023_pitr_prepared_xact.pl
M src/test/recovery/t/024_archive_recovery.pl
M src/test/recovery/t/025_stuck_on_old_timeline.pl
M src/test/recovery/t/026_overwrite_contrecord.pl
M src/test/recovery/t/027_stream_regress.pl
M src/test/recovery/t/028_pitr_timelines.pl
M src/test/recovery/t/029_stats_restart.pl
M src/test/recovery/t/030_stats_cleanup_replica.pl
M src/test/recovery/t/031_recovery_conflict.pl
M src/test/recovery/t/032_relfilenode_reuse.pl
M src/test/recovery/t/033_replay_tsp_drops.pl
M src/test/recovery/t/034_create_database.pl
M src/test/recovery/t/035_standby_logical_decoding.pl
M src/test/recovery/t/036_truncated_dropped.pl
M src/test/recovery/t/037_invalid_database.pl
M src/test/recovery/t/038_save_logical_slots_shutdown.pl
M src/test/recovery/t/039_end_of_wal.pl
M src/test/recovery/t/040_standby_failover_slots_sync.pl
M src/test/recovery/t/041_checkpoint_at_promote.pl
M src/test/recovery/t/042_low_level_backup.pl
M src/test/recovery/t/043_no_contrecord_switch.pl
M src/test/recovery/t/044_invalidate_inactive_slots.pl
M src/test/recovery/t/045_archive_restartpoint.pl
M src/test/recovery/t/046_checkpoint_logical_slot.pl
M src/test/recovery/t/047_checkpoint_physical_slot.pl
M src/test/recovery/t/048_vacuum_horizon_floor.pl
M src/test/recovery/t/050_redo_segment_missing.pl
M src/test/recovery/t/051_effective_wal_level.pl
M src/test/regress/GNUmakefile
M src/test/regress/meson.build
M src/test/regress/pg_regress.c
M src/test/regress/pg_regress.h
M src/test/regress/pg_regress_main.c
M src/test/regress/po/meson.build
M src/test/regress/regress.c
M src/test/ssl/Makefile
M src/test/ssl/meson.build
M src/test/ssl/sslfiles.mk
M src/test/ssl/t/001_ssltests.pl
M src/test/ssl/t/002_scram.pl
M src/test/ssl/t/003_sslinfo.pl
M src/test/ssl/t/SSL/Backend/OpenSSL.pm
M src/test/ssl/t/SSL/Server.pm
M src/test/subscription/Makefile
M src/test/subscription/meson.build
M src/test/subscription/t/001_rep_changes.pl
M src/test/subscription/t/002_types.pl
M src/test/subscription/t/003_constraints.pl
M src/test/subscription/t/004_sync.pl
M src/test/subscription/t/005_encoding.pl
M src/test/subscription/t/006_rewrite.pl
M src/test/subscription/t/007_ddl.pl
M src/test/subscription/t/008_diff_schema.pl
M src/test/subscription/t/009_matviews.pl
M src/test/subscription/t/010_truncate.pl
M src/test/subscription/t/011_generated.pl
M src/test/subscription/t/012_collation.pl
M src/test/subscription/t/013_partition.pl
M src/test/subscription/t/014_binary.pl
M src/test/subscription/t/015_stream.pl
M src/test/subscription/t/016_stream_subxact.pl
M src/test/subscription/t/017_stream_ddl.pl
M src/test/subscription/t/018_stream_subxact_abort.pl
M src/test/subscription/t/019_stream_subxact_ddl_abort.pl
M src/test/subscription/t/020_messages.pl
M src/test/subscription/t/021_twophase.pl
M src/test/subscription/t/022_twophase_cascade.pl
M src/test/subscription/t/023_twophase_stream.pl
M src/test/subscription/t/024_add_drop_pub.pl
M src/test/subscription/t/025_rep_changes_for_schema.pl
M src/test/subscription/t/026_stats.pl
M src/test/subscription/t/027_nosuperuser.pl
M src/test/subscription/t/028_row_filter.pl
M src/test/subscription/t/029_on_error.pl
M src/test/subscription/t/030_origin.pl
M src/test/subscription/t/031_column_list.pl
M src/test/subscription/t/032_subscribe_use_index.pl
M src/test/subscription/t/033_run_as_table_owner.pl
M src/test/subscription/t/034_temporal.pl
M src/test/subscription/t/035_conflicts.pl
M src/test/subscription/t/036_sequences.pl
M src/test/subscription/t/100_bugs.pl
M src/timezone/meson.build
M src/timezone/pgtz.c
M src/timezone/pgtz.h
M src/timezone/tznames/meson.build
M src/tools/PerfectHash.pm
M src/tools/add_commit_links.pl
M src/tools/check_bison_recursion.pl
M src/tools/copyright.pl
M src/tools/gen_export.pl
M src/tools/gen_keywordlist.pl
M src/tools/git_changelog
M src/tools/ifaddrs/Makefile
M src/tools/mark_pgdllimport.pl
M src/tools/msvc_gendef.pl
M src/tools/pg_bsd_indent/Makefile
M src/tools/pg_bsd_indent/meson.build
M src/tools/pg_bsd_indent/t/001_pg_bsd_indent.pl
M src/tools/pginclude/headerscheck
M src/tools/pgindent/pgindent
M src/tools/version_stamp.pl
M src/tools/win32tzlist.pl
M src/tutorial/complex.source
M src/tutorial/syscat.source
Add paths of extensions to pg_available_extensions
commit : f3c9e341cdf167ae3378e74e770558e81f9aa48e
author : Andrew Dunstan <andrew@dunslane.net>
date : Thu, 1 Jan 2026 12:11:37 -0500
committer: Andrew Dunstan <andrew@dunslane.net>
date : Thu, 1 Jan 2026 12:11:37 -0500 Add a new "location" column to the pg_available_extensions and
pg_available_extension_versions views, exposing the directory where
the extension is located.
The default system location is shown as '$system', the same value
that can be used to configure the extension_control_path GUC.
User-defined locations are only visible for super users, otherwise
'<insufficient privilege>' is returned as a column value, the same
behaviour that we already use in pg_stat_activity.
I failed to resist the temptation to do a little extra editorializing of
the TAP test script.
Catalog version bumped.
Author: Matheus Alcantara <mths.dev@pm.me>
Reviewed-By: Chao Li <li.evan.chao@gmail.com>
Reviewed-By: Rohit Prasad <rohit.prasad@arm.com>
Reviewed-By: Michael Banck <mbanck@gmx.net>
Reviewed-By: Manni Wood <manni.wood@enterprisedb.com>
Reviewed-By: Euler Taveira <euler@eulerto.com>
Reviewed-By: Quan Zongliang <quanzongliang@yeah.net> M doc/src/sgml/system-views.sgml
M src/backend/catalog/system_views.sql
M src/backend/commands/extension.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/test/modules/test_extensions/t/001_extension_control_path.pl
M src/test/regress/expected/rules.out
M src/tools/pgindent/typedefs.list
Fix macro name for io_uring_queue_init_mem check.
commit : 85d5bd308bf5dc3068a4c28aa0f12cc22272f789
author : Masahiko Sawada <msawada@postgresql.org>
date : Wed, 31 Dec 2025 11:18:14 -0800
committer: Masahiko Sawada <msawada@postgresql.org>
date : Wed, 31 Dec 2025 11:18:14 -0800 Commit f54af9f2679d added a check for
io_uring_queue_init_mem(). However, it used the macro name
HAVE_LIBURING_QUEUE_INIT_MEM in both meson.build and the C code, while
the Autotools build script defined HAVE_IO_URING_QUEUE_INIT_MEM. As a
result, the optimization was never enabled in builds configured with
Autotools, as the C code checked for the wrong macro name.
This commit changes the macro name to HAVE_IO_URING_QUEUE_INIT_MEM in
meson.build and the C code. This matches the actual function
name (io_uring_queue_init_mem), following the standard HAVE_<FUNCTION>
convention.
Backpatch to 18, where the macro was introduced.
Bug: #19368
Reported-by: Evan Si <evsi@amazon.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/19368-016d79a7f3a1c599@postgresql.org
Backpatch-through: 18 M meson.build
M src/backend/storage/aio/method_io_uring.c
Doc: remove obsolete, confused <note> about rowtype I/O syntax.
commit : d6542f8dfc6c7db9b491a4f0b1ea082cfa4537eb
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Wed, 31 Dec 2025 13:19:27 -0500
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Wed, 31 Dec 2025 13:19:27 -0500 This <note> was originally written to describe the double levels
of de-backslashing encountered when a backslash-aware string
literal is used to hold the text representation of a composite
value. It still made sense when we switched to mostly using E'...'
syntax for that type of literal. However, commit f77de4b0c mangled
it completely by changing the example literal to be SQL-standard.
The extra pass of de-backslashing described in the text doesn't
actually occur with the example as written, unless you happen to
be using standard_conforming_strings = off.
We could restore this <note> to self-consistency by reverting the
change from f77de4b0c, but on the whole I judge that its time has
passed. standard_conforming_strings = off is nearly obsolete,
and may soon be fully so. But without that, the behavior isn't
so complicated as to justify a discursive note. I observe that
the nearby section about array I/O syntax has no equivalent text,
although that syntax is equally subject to this issue.
Author: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/2998401.1767038920@sss.pgh.pa.us
Discussion: https://postgr.es/m/3279216.1767072538@sss.pgh.pa.us M doc/src/sgml/rowtypes.sgml
jit: Fix jit_profiling_support when unavailable.
commit : 915711c8a4e60f606a8417ad033cea5385364c07
author : Thomas Munro <tmunro@postgresql.org>
date : Wed, 31 Dec 2025 13:24:17 +1300
committer: Thomas Munro <tmunro@postgresql.org>
date : Wed, 31 Dec 2025 13:24:17 +1300 jit_profiling_support=true captures profile data for Linux perf. On
other platforms, LLVMCreatePerfJITEventListener() returns NULL and the
attempt to register the listener would crash.
Fix by ignoring the setting in that case. The documentation already
says that it only has an effect if perf support is present, and we
already did the same for older LLVM versions that lacked support.
No field reports, unsurprisingly for an obscure developer-oriented
setting. Noticed in passing while working on commit 1a28b4b4.
Backpatch-through: 14
Reviewed-by: Matheus Alcantara <matheusssilv97@gmail.com>
Reviewed-by: Andres Freund <andres@anarazel.de>
Discussion: https://postgr.es/m/CA%2BhUKGJgB6gvrdDohgwLfCwzVQm%3DVMtb9m0vzQn%3DCwWn-kwG9w%40mail.gmail.com M src/backend/jit/llvm/llvmjit.c
Change IndexAmRoutines to be statically-allocated structs.
commit : bc6374cd76abb2e6a48c4b57c0b5a7baa5babd67
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Tue, 30 Dec 2025 18:26:23 -0500
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Tue, 30 Dec 2025 18:26:23 -0500 Up to now, index amhandlers were expected to produce a new, palloc'd
struct on each call. That requires palloc/pfree overhead, and creates
a risk of memory leaks if the caller fails to pfree, and the time
taken to fill such a large structure isn't nil. Moreover, we were
storing these things in the relcache, eating several hundred bytes for
each cached index. There is not anything in these structs that needs
to vary at runtime, so let's change the definition so that an
amhandler can return a pointer to a "static const" struct of which
there's only one copy per index AM. Mark all the core code's
IndexAmRoutine pointers const so that we catch anyplace that might
still try to change or pfree one.
(This is similar to the way we were already handling TableAmRoutine
structs. This commit does fix one comment that was infelicitously
copied-and-pasted into tableamapi.c.)
This commit needs to be called out in the v19 release notes as an API
change for extension index AMs. An un-updated AM will still work
(as of now, anyway) but it risks memory leaks and will be slower than
necessary.
Author: Matthias van de Meent <boekewurm+postgres@gmail.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/CAEoWx2=vApYk2LRu8R0DdahsPNEhWUxGBZ=rbZo1EXE=uA+opQ@mail.gmail.com M contrib/bloom/blutils.c
M doc/src/sgml/indexam.sgml
M src/backend/access/brin/brin.c
M src/backend/access/gin/ginutil.c
M src/backend/access/gist/gist.c
M src/backend/access/hash/hash.c
M src/backend/access/index/amapi.c
M src/backend/access/nbtree/nbtree.c
M src/backend/access/spgist/spgutils.c
M src/backend/access/table/tableamapi.c
M src/backend/catalog/index.c
M src/backend/commands/indexcmds.c
M src/backend/commands/opclasscmds.c
M src/backend/executor/execAmi.c
M src/backend/optimizer/util/plancat.c
M src/backend/utils/adt/amutils.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/cache/lsyscache.c
M src/backend/utils/cache/relcache.c
M src/include/access/amapi.h
M src/include/utils/rel.h
M src/test/modules/dummy_index_am/dummy_index_am.c
Add dead items memory usage to VACUUM (VERBOSE) and autovacuum logs.
commit : 736f754eed01ca81198b6cd7421321088cbe5ded
author : Masahiko Sawada <msawada@postgresql.org>
date : Tue, 30 Dec 2025 13:12:10 -0800
committer: Masahiko Sawada <msawada@postgresql.org>
date : Tue, 30 Dec 2025 13:12:10 -0800 This commit adds the total memory allocated during vacuum, the number
of times the dead items storage was reset, and the configured memory
limit. This helps users understand how much memory VACUUM required,
and such information can be used to avoid multiple index scans.
Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/CAHza6qcPitBCkyiKJosDTt3bmxMvzZOTONoebwCkBZrr3rk65Q%40mail.gmail.com M src/backend/access/heap/vacuumlazy.c
Fix a race condition in updating procArray->replication_slot_xmin.
commit : 2a5225b99d7659b4e641f5397ca9e7ad625e6726
author : Masahiko Sawada <msawada@postgresql.org>
date : Tue, 30 Dec 2025 10:56:30 -0800
committer: Masahiko Sawada <msawada@postgresql.org>
date : Tue, 30 Dec 2025 10:56:30 -0800 Previously, ReplicationSlotsComputeRequiredXmin() computed the oldest
xmin across all slots without holding ProcArrayLock (when
already_locked is false), acquiring the lock just before updating the
replication slot xmin.
This could lead to a race condition: if a backend created a new slot
and updates the global replication slot xmin, another backend
concurrently running ReplicationSlotsComputeRequiredXmin() could
overwrite that update with an invalid or stale value. This happens
because the concurrent backend might have computed the aggregate xmin
before the new slot was accounted for, but applied the update after
the new slot had already updated the global value.
In the reported failure, a walsender for an apply worker computed
InvalidTransactionId as the oldest xmin and overwrote a valid
replication slot xmin value computed by a walsender for a tablesync
worker. Consequently, the tablesync worker computed a transaction ID
via GetOldestSafeDecodingTransactionId() effectively without
considering the replication slot xmin. This led to the error "cannot
build an initial slot snapshot as oldest safe xid %u follows
snapshot's xmin %u", which was an assertion failure prior to commit
240e0dbacd3.
To fix this, we acquire ReplicationSlotControlLock in exclusive mode
during slot creation to perform the initial update of the slot
xmin. In ReplicationSlotsComputeRequiredXmin(), we hold
ReplicationSlotControlLock in shared mode until the global slot xmin
is updated in ProcArraySetReplicationSlotXmin(). This prevents
concurrent computations and updates of the global xmin by other
backends during the initial slot xmin update process, while still
permitting concurrent calls to ReplicationSlotsComputeRequiredXmin().
Backpatch to all supported versions.
Author: Zhijie Hou <houzj.fnst@fujitsu.com>
Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com>
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>
Reviewed-by: Pradeep Kumar <spradeepkumar29@gmail.com>
Reviewed-by: Hayato Kuroda (Fujitsu) <kuroda.hayato@fujitsu.com>
Reviewed-by: Robert Haas <robertmhaas@gmail.com>
Reviewed-by: Andres Freund <andres@anarazel.de>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://postgr.es/m/CAA4eK1L8wYcyTPxNzPGkhuO52WBGoOZbT0A73Le=ZUWYAYmdfw@mail.gmail.com
Backpatch-through: 14 M src/backend/replication/logical/launcher.c
M src/backend/replication/logical/logical.c
M src/backend/replication/logical/slotsync.c
M src/backend/replication/slot.c
Fix comment in lsyscache.c
commit : ffdcc9c638eeb71d2e6990e27f91623736603b58
author : Michael Paquier <michael@paquier.xyz>
date : Tue, 30 Dec 2025 16:42:21 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Tue, 30 Dec 2025 16:42:21 +0900 Author: Chao Li <li.evan.chao@gmail.com>
Discussion: https://postgr.es/m/CAEoWx2miv0KGcM9j29ANRN45-Vz-2qAqrM0cv9OtaLx8e_WCMQ@mail.gmail.com M src/backend/utils/cache/lsyscache.c
jit: Drop redundant LLVM configure probes.
commit : 1a28b4b455df41725ea2115ae2a2fd9b33a20ae5
author : Thomas Munro <tmunro@postgresql.org>
date : Tue, 30 Dec 2025 16:39:19 +1300
committer: Thomas Munro <tmunro@postgresql.org>
date : Tue, 30 Dec 2025 16:39:19 +1300 We currently require LLVM 14, so these probes for LLVM 9 functions
always succeeded. Even when the features aren't enabled in an LLVM
build, dummy functions are defined (a problem for a later commit).
The whole PGAC_CHECK_LLVM_FUNCTIONS macro and Meson equivalent are
removed, because we switched to testing LLVM_VERSION_MAJOR at compile
time in subsequent work and these were the last holdouts. That suits
the nature of LLVM API evolution better, and also allows for strictly
mechanical pruning in future commits like 820b5af7 and 972c2cd2. They
advanced the minimum LLVM version but failed to spot these.
Reviewed-by: Matheus Alcantara <matheusssilv97@gmail.com>
Reviewed-by: Andres Freund <andres@anarazel.de>
Discussion: https://postgr.es/m/CA%2BhUKGJgB6gvrdDohgwLfCwzVQm%3DVMtb9m0vzQn%3DCwWn-kwG9w%40mail.gmail.com M config/llvm.m4
M configure
M configure.ac
M meson.build
M src/backend/jit/llvm/llvmjit.c
M src/include/pg_config.h.in
Add pg_get_multixact_stats()
commit : 97b101776ce23dd6c4abbdae213806bc24ed6133
author : Michael Paquier <michael@paquier.xyz>
date : Tue, 30 Dec 2025 15:38:50 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Tue, 30 Dec 2025 15:38:50 +0900 This new function exposes at SQL level some information related to
multixacts, not available until now. This data is useful for monitoring
purposes, especially for workloads that make a heavy use of multixacts:
- num_mxids, number of MultiXact IDs in use.
- num_members, number of member entries in use.
- members_size, bytes used by num_members in pg_multixact/members/.
- oldest_multixact: oldest MultiXact still needed.
This patch has been originally proposed when MultiXactOffset was still
32 bits, to monitor wraparound. This part is not relevant anymore since
bd8d9c9bdfa0 that has widen MultiXactOffset to 64 bits. The monitoring
of disk space usage for the members is still relevant.
Some tests are added to check this function, in the shape of one
isolation test with concurrent transactions that take a ROW SHARE lock,
and some SQL tests for pg_read_all_stats. Some documentation is added
to explain some patterns that can come from the information provided by
the function.
Bump catalog version.
Author: Naga Appani <nagnrik@gmail.com>
Reviewed-by: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Reviewed-by: Atsushi Torikoshi <torikoshia@oss.nttdata.com>
Discussion: https://postgr.es/m/CA+QeY+AAsYK6WvBW4qYzHz4bahHycDAY_q5ECmHkEV_eB9ckzg@mail.gmail.com M doc/src/sgml/func/func-info.sgml
M doc/src/sgml/maintenance.sgml
M src/backend/utils/adt/multixactfuncs.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
A src/test/isolation/expected/multixact-stats.out
M src/test/isolation/isolation_schedule
A src/test/isolation/specs/multixact-stats.spec
M src/test/regress/expected/misc_functions.out
M src/test/regress/sql/misc_functions.sql
Add MultiXactOffsetStorageSize() to multixact_internal.h
commit : 0e3ad4b96aedee57fc2694e28486fe0ceca8110a
author : Michael Paquier <michael@paquier.xyz>
date : Tue, 30 Dec 2025 14:13:40 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Tue, 30 Dec 2025 14:13:40 +0900 This function calculates in bytes the storage taken between two
multixact offsets. This will be used in an upcoming patch, introduced
separately here as this piece can be useful on its own.
Author: Naga Appani <nagnrik@gmail.com>
Co-authored-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://postgr.es/m/aUyTvZMq2CLgNEB4@paquier.xyz M src/include/access/multixact_internal.h
Change GetMultiXactInfo() to return the next multixact offset
commit : 9cf746a453c15ffdf652a6d50683bfd82e654950
author : Michael Paquier <michael@paquier.xyz>
date : Tue, 30 Dec 2025 14:03:49 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Tue, 30 Dec 2025 14:03:49 +0900 This routine returned a number of members as a MultiXactOffset,
calculated based on the difference between the next-to-be-assigned
offset and the oldest offset. However, this number is not actually an
offset but a number.
This type confusion comes from the original implementation of
MultiXactMemberFreezeThreshold(), in 53bb309d2d5a. The number of
members is now defined as a uint64, large enough for MultiXactOffset.
This change will be used in a follow-up patch.
Reviewed-by: Naga Appani <nagnrik@gmail.com>
Discussion: https://postgr.es/m/aUyTvZMq2CLgNEB4@paquier.xyz M src/backend/access/transam/multixact.c
M src/include/access/multixact.h
jit: Remove -Wno-deprecated-declarations in 18+.
commit : 7da9d8f2db655eefba8757a66097bfabd3660a82
author : Thomas Munro <tmunro@postgresql.org>
date : Tue, 30 Dec 2025 14:11:37 +1300
committer: Thomas Munro <tmunro@postgresql.org>
date : Tue, 30 Dec 2025 14:11:37 +1300 REL_18_STABLE and master have commit ee485912, so they always use the
newer LLVM opaque pointer functions. Drop -Wno-deprecated-declarations
(commit a56e7b660) for code under jit/llvm in those branches, to catch
any new deprecation warnings that arrive in future version of LLVM.
Older branches continued to use functions marked deprecated in LLVM 14
and 15 (ie switched to the newer functions only for LLVM 16+), as a
precaution against unforeseen compatibility problems with bitcode
already shipped. In those branches, the comment about warning
suppression is updated to explain that situation better. In theory we
could suppress warnings only for LLVM 14 and 15 specifically, but that
isn't done here.
Backpatch-through: 14
Reported-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/1407185.1766682319%40sss.pgh.pa.us M src/backend/jit/llvm/Makefile
Ensure sanity of hash-join costing when there are no MCV statistics.
commit : bd3e3e9e56830e1b1448b559743b0f0a90a6e38d
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Mon, 29 Dec 2025 13:01:27 -0500
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Mon, 29 Dec 2025 13:01:27 -0500 estimate_hash_bucket_stats is defined to return zero to *mcv_freq if
it cannot obtain a value for the frequency of the most common value.
Its sole caller final_cost_hashjoin ignored this provision and would
blindly believe the zero value, resulting in computing zero for the
largest bucket size. In consequence, the safety check that intended
to prevent the largest bucket from exceeding get_hash_memory_limit()
was ineffective, allowing very silly plans to be chosen if statistics
were missing.
After fixing final_cost_hashjoin to disregard zero results for
mcv_freq, a second problem appeared: some cases that should use hash
joins failed to. This is because estimate_hash_bucket_stats was
unaware of the fact that ANALYZE won't store MCV statistics if it
doesn't find any multiply-occurring values. Thus the lack of an MCV
stats entry doesn't necessarily mean that we know nothing; we may
well know that the column is unique. The former coding returned zero
for *mcv_freq in this case, which was pretty close to correct, but now
final_cost_hashjoin doesn't believe it and disables the hash join.
So check to see if there is a HISTOGRAM stats entry; if so, ANALYZE
has in fact run for this column and must have found it to be unique.
In that case report the MCV frequency as 1 / rows, instead of claiming
ignorance.
Reporting a more accurate *mcv_freq in this case can also affect the
bucket-size skew adjustment further down in estimate_hash_bucket_stats,
causing hash-join cost estimates to change slightly. This affects
some plan choices in the core regression tests. The first diff in
join.out corresponds to a case where we have no stats and should not
risk a hash join, but the remaining changes are caused by producing
a better bucket-size estimate for unique join columns. Those are all
harmless changes so far as I can tell.
The existing behavior was introduced in commit 4867d7f62 in v11.
It appears from the commit log that disabling the bucket-size safety
check in the absence of statistics was intentional; but we've now seen
a case where the ensuing behavior is bad enough to make that seem like
a poor decision. In any case the lack of other problems with that
safety check after several years helps to justify enforcing it more
strictly. However, we won't risk back-patching this, in case any
applications are depending on the existing behavior.
Bug: #19363
Reported-by: Jinhui Lai <jinhui.lai@qq.com>
Author: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://postgr.es/m/2380165.1766871097@sss.pgh.pa.us
Discussion: https://postgr.es/m/19363-8dd32fc7600a1153@postgresql.org M src/backend/optimizer/path/costsize.c
M src/backend/utils/adt/selfuncs.c
M src/test/regress/expected/join.out
M src/test/regress/expected/join_hash.out
M src/test/regress/expected/partition_join.out
M src/test/regress/sql/join_hash.sql
Further stabilize a postgres_fdw test case.
commit : cb77bc04422fbbd1be48dde9794bfc0d0e5d7ad5
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Mon, 29 Dec 2025 12:53:49 -0500
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Mon, 29 Dec 2025 12:53:49 -0500 This patch causes one postgres_fdw test case to revert to the plan
it used before aa86129e1, i.e., using a remote sort in preference to
local sort. That decision is actually a coin-flip because cost_sort()
will give the same answer on both sides, so that the plan choice comes
down to little more than roundoff error. In consequence, the test
output can change as a result of even minor changes in nearby costs,
as we saw in aa86129e1 (compare also b690e5fac and 4b14e1871).
b690e5fac's solution to stabilizing the adjacent test case was to
disable sorting locally, and here we extend that to the currently-
problematic case. Without this, the following patch would cause this
plan choice to change back in this same way, for even less apparent
reason.
Author: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://postgr.es/m/2551253.1766952956@sss.pgh.pa.us M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/sql/postgres_fdw.sql
Fix Mkvcbuild.pm builds of test_cloexec.c.
commit : 45d92b76dc4ac31d44e46ca38bee12d5d8fac1f5
author : Thomas Munro <tmunro@postgresql.org>
date : Mon, 29 Dec 2025 15:22:16 +1300
committer: Thomas Munro <tmunro@postgresql.org>
date : Mon, 29 Dec 2025 15:22:16 +1300 Mkvcbuild.pm scrapes Makefile contents, but couldn't understand the
change made by commit bec2a0aa. Revealed by BF animal hamerkop in
branch REL_16_STABLE.
1. It used += instead of =, which didn't match the pattern that
Mkvcbuild.pm looks for. Drop the +.
2. Mkvcbuild.pm doesn't link PROGRAM executables with libpgport. Apply
a local workaround to REL_16_STABLE only (later branches dropped
Mkvcbuild.pm).
Backpatch-through: 16
Reported-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/175163.1766357334%40sss.pgh.pa.us M src/test/modules/test_cloexec/Makefile
Ignore PlaceHolderVars when looking up statistics
commit : 559f9e90dbbd5d72b1da802703317913280c5080
author : Richard Guo <rguo@postgresql.org>
date : Mon, 29 Dec 2025 11:40:45 +0900
committer: Richard Guo <rguo@postgresql.org>
date : Mon, 29 Dec 2025 11:40:45 +0900 When looking up statistical data about an expression, we failed to
look through PlaceHolderVar nodes, treating them as opaque. This
could prevent us from matching an expression to base columns, index
expressions, or extended statistics, as examine_variable() relies on
strict structural matching.
As a result, queries involving PlaceHolderVar nodes often fell back to
default selectivity estimates, potentially leading to poor plan
choices.
This patch updates examine_variable() to strip PlaceHolderVars before
analysis. This is safe during estimation because PlaceHolderVars are
transparent for the purpose of statistics lookup: they do not alter
the value distribution of the underlying expression.
To minimize performance overhead on this hot path, a lightweight
walker first checks for the presence of PlaceHolderVars. The more
expensive mutator is invoked only when necessary.
There is one ensuing plan change in the regression tests, which is
expected and demonstrates the fix: the rowcount estimate becomes much
more accurate with this patch.
Back-patch to v18. Although this issue exists before that, changes in
this version made it common enough to notice. Given the lack of field
reports for older versions, I am not back-patching further.
Reported-by: Haowu Ge <gehaowu@bitmoe.com>
Author: Richard Guo <guofenglinux@gmail.com>
Discussion: https://postgr.es/m/62af586c-c270-44f3-9c5e-02c81d537e3d.gehaowu@bitmoe.com
Backpatch-through: 18 M src/backend/utils/adt/selfuncs.c
M src/test/regress/expected/join.out
M src/test/regress/sql/join.sql
Strip PlaceHolderVars from index operands
commit : ad66f705fa6796b40311a8210e9f37144df02ef5
author : Richard Guo <rguo@postgresql.org>
date : Mon, 29 Dec 2025 11:38:49 +0900
committer: Richard Guo <rguo@postgresql.org>
date : Mon, 29 Dec 2025 11:38:49 +0900 When pulling up a subquery, we may need to wrap its targetlist items
in PlaceHolderVars to enforce separate identity or as a result of
outer joins. However, this causes any upper-level WHERE clauses
referencing these outputs to contain PlaceHolderVars, which prevents
indxpath.c from recognizing that they could be matched to index
columns or index expressions, potentially affecting the planner's
ability to use indexes.
To fix, explicitly strip PlaceHolderVars from index operands. A
PlaceHolderVar appearing in a relation-scan-level expression is
effectively a no-op. Nevertheless, to play it safe, we strip only
PlaceHolderVars that are not marked nullable.
The stripping is performed recursively to handle cases where
PlaceHolderVars are nested or interleaved with other node types. To
minimize performance impact, we first use a lightweight walker to
check for the presence of strippable PlaceHolderVars. The expensive
mutator is invoked only if a candidate is found, avoiding unnecessary
memory allocation and tree copying in the common case where no
PlaceHolderVars are present.
Back-patch to v18. Although this issue exists before that, changes in
this version made it common enough to notice. Given the lack of field
reports for older versions, I am not back-patching further.
Reported-by: Haowu Ge <gehaowu@bitmoe.com>
Author: Richard Guo <guofenglinux@gmail.com>
Discussion: https://postgr.es/m/62af586c-c270-44f3-9c5e-02c81d537e3d.gehaowu@bitmoe.com
Backpatch-through: 18 M src/backend/optimizer/path/indxpath.c
M src/backend/optimizer/plan/createplan.c
M src/include/optimizer/paths.h
M src/test/regress/expected/groupingsets.out
M src/test/regress/sql/groupingsets.sql
Change some Datum to void * for opaque pass-through pointer
commit : b7057e43467ff2d7c04c3abcf5ec35fcc7db9611
author : Peter Eisentraut <peter@eisentraut.org>
date : Sun, 28 Dec 2025 14:34:12 +0100
committer: Peter Eisentraut <peter@eisentraut.org>
date : Sun, 28 Dec 2025 14:34:12 +0100 Here, Datum was used to pass around an opaque pointer between a group
of functions. But one might as well use void * for that; the use of
Datum doesn't achieve anything here and is just distracting.
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://www.postgresql.org/message-id/flat/1c5d23cb-288b-4154-b1cd-191fe2301707%40eisentraut.org M src/backend/tsearch/to_tsany.c
M src/backend/utils/adt/tsquery.c
M src/include/tsearch/ts_utils.h
Split some long Makefile lists
commit : 9adf32da6b48e423e632ac24d6c634021e1ab154
author : Michael Paquier <michael@paquier.xyz>
date : Sun, 28 Dec 2025 09:17:42 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Sun, 28 Dec 2025 09:17:42 +0900 This change makes more readable code diffs when adding new items or
removing old items, while ensuring that lines do not get excessively
long. Some SUBDIRS, PROGRAMS and REGRESS lists are split.
Note that there are a few more REGRESS lists that could be split,
particularly in contrib/.
Author: Jelte Fennema-Nio <postgres@jeltef.nl>
Co-Authored-By: Jacob Champion <jacob.champion@enterprisedb.com>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>
Reviewed-by: Man Zeng <zengman@halodbtech.com>
Discussion: https://postgr.es/m/DF6HDGB559U5.3MPRFCWPONEAE@jeltef.nl M contrib/pageinspect/Makefile
M src/backend/Makefile
M src/backend/access/Makefile
M src/backend/optimizer/Makefile
M src/backend/storage/Makefile
M src/bin/scripts/Makefile
M src/include/Makefile
M src/interfaces/ecpg/Makefile
M src/pl/tcl/Makefile
M src/test/Makefile
M src/test/examples/Makefile
Fix incorrectly spelled city name
commit : a9123db14a12e2e2dfb93dbbef4f2cdc2986023b
author : Daniel Gustafsson <dgustafsson@postgresql.org>
date : Sat, 27 Dec 2025 23:47:40 +0100
committer: Daniel Gustafsson <dgustafsson@postgresql.org>
date : Sat, 27 Dec 2025 23:47:40 +0100 The correct spelling is Beijing, fix in regression test
and docs.
Author: JiaoShuntian <jiaoshuntian@gmail.com>
Reviewed-by: Kirill Reshke <reshkekirill@gmail.com>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>
Discussion: https://postgr.es/m/ebfa3ec2-dc3c-4adb-be2a-4a882c2e85a7@gmail.com M doc/src/sgml/ref/alter_table.sgml
M src/test/regress/expected/partition_merge.out
M src/test/regress/expected/partition_split.out
M src/test/regress/sql/partition_merge.sql
M src/test/regress/sql/partition_split.sql
Remove MsgType type
commit : b63443718a4a3a50304610e6ccda93bbfa06a1e6
author : Peter Eisentraut <peter@eisentraut.org>
date : Sat, 27 Dec 2025 22:50:46 +0100
committer: Peter Eisentraut <peter@eisentraut.org>
date : Sat, 27 Dec 2025 22:50:46 +0100 Presumably, the C type MsgType was meant to hold the protocol message
type in the pre-version-3 era, but this was never fully developed even
then, and the name is pretty confusing nowadays. It has only one
vestigial use for cancel requests that we can get rid of. Since a
cancel request is indicated by a special protocol version number, we
can use the ProtocolVersion type, which MsgType was based on.
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/505e76cb-0ca2-4e22-ba0f-772b5dc3f230%40eisentraut.org M src/include/libpq/pqcomm.h
M src/interfaces/libpq/fe-cancel.c
M src/tools/pgindent/typedefs.list
Add oauth_validator_libraries to variable_is_guc_list_quote
commit : ec0da9b89377960553a3d9054ec79c0512742275
author : Daniel Gustafsson <dgustafsson@postgresql.org>
date : Sat, 27 Dec 2025 23:05:48 +0100
committer: Daniel Gustafsson <dgustafsson@postgresql.org>
date : Sat, 27 Dec 2025 23:05:48 +0100 The variable_is_guc_list_quote function need to know about all
GUC_QUOTE variables, this adds oauth_validator_libraries which
was missing. Backpatch to v18 where OAuth was introduced.
Author: ChangAo Chen <cca5507@qq.com>
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>
Discussion: https://postgr.es/m/tencent_03D4D2A5C0C8DCE0CD1DB4D945858E15420A@qq.com
Backpatch-through: 18 M src/bin/pg_dump/dumputils.c
Fix pg_stat_get_backend_activity() to use multi-byte truncated result
commit : 36b8f4974a884a7206df97f37ea62d2adc0b77f0
author : Michael Paquier <michael@paquier.xyz>
date : Sat, 27 Dec 2025 17:23:30 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Sat, 27 Dec 2025 17:23:30 +0900 pg_stat_get_backend_activity() calls pgstat_clip_activity() to ensure
that the reported query string is correctly truncated when it finishes
with an incomplete multi-byte sequence. However, the result returned by
the function was not what pgstat_clip_activity() generated, but the
non-truncated, original, contents from PgBackendStatus.st_activity_raw.
Oversight in 54b6cd589ac2, so backpatch all the way down.
Author: Chao Li <li.evan.chao@gmail.com>
Discussion: https://postgr.es/m/CAEoWx2mDzwc48q2EK9tSXS6iJMJ35wvxNQnHX+rXjy5VgLvJQw@mail.gmail.com
Backpatch-through: 14 M src/backend/utils/adt/pgstatfuncs.c
doc: warn about the use of "ctid" queries beyond the examples
commit : e82e9aaa6a2942505c2c328426778787e4976ea6
author : Bruce Momjian <bruce@momjian.us>
date : Fri, 26 Dec 2025 17:34:17 -0500
committer: Bruce Momjian <bruce@momjian.us>
date : Fri, 26 Dec 2025 17:34:17 -0500 Also be more assertive that "ctid" should not be used for long-term
storage.
Reported-by: Bernice Southey
Discussion: https://postgr.es/m/CAEDh4nyn5swFYuSfcnGAbpQrKOc47Hh_ZyKVSPYJcu2P=51Luw@mail.gmail.com
Backpatch-through: 17 M doc/src/sgml/ddl.sgml
M doc/src/sgml/ref/delete.sgml
M doc/src/sgml/ref/update.sgml
doc: Remove duplicate word in ECPG description
commit : f8a4cad8f42ea5232b56199f677a4752940d76ea
author : Michael Paquier <michael@paquier.xyz>
date : Fri, 26 Dec 2025 15:25:46 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Fri, 26 Dec 2025 15:25:46 +0900 Author: Laurenz Albe <laurenz.albe@cybertec.at>
Reviewed-by: vignesh C <vignesh21@gmail.com>
Discussion: https://postgr.es/m/d6d6a800f8b503cd78d5f4fa721198e40eec1677.camel@cybertec.at
Backpatch-through: 14 M doc/src/sgml/ecpg.sgml
Upgrade BufFile to use int64 for byte positions
commit : bde3a4616072534fd03c75f9019d5165665ed211
author : Michael Paquier <michael@paquier.xyz>
date : Fri, 26 Dec 2025 08:41:56 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Fri, 26 Dec 2025 08:41:56 +0900 This change has the advantage of removing some weird type casts, caused
by offset calculations based on pgoff_t but saved as int (on older
branches we use off_t, which could be 4 or 8 bytes depending on the
environment). These are safe currently because capped by
MAX_PHYSICAL_FILESIZE, but we would run into problems when to make
MAX_PHYSICAL_FILESIZE larger or allow callers of these routines to use a
larger physical max size on demand.
While on it, this improves BufFileDumpBuffer() so as we do not use an
offset for "availbytes". It is not a file offset per-set, but a number
of available bytes.
This change should lead to no functional changes.
Author: Chao Li <li.evan.chao@gmail.com>
Discussion: https://postgr.es/m/aUStrqoOCDRFAq1M@paquier.xyz M src/backend/storage/file/buffile.c
Fix typo in stat_utils.c
commit : eee19a30d60dacf571f44c252f3f8d455fee2b4f
author : Michael Paquier <michael@paquier.xyz>
date : Fri, 26 Dec 2025 07:53:46 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Fri, 26 Dec 2025 07:53:46 +0900 Introduced by 213a1b895270.
Reported-by: Tender Wang <tndrwang@gmail.com>
Discussion: https://postgr.es/m/CAHewXNku-jz-FPKeJVk25fZ1pV2buYh5vpeqGDOB=bFQhKxXhw@mail.gmail.com M src/backend/statistics/stat_utils.c
Move attribute statistics functions to stat_utils.c
commit : 213a1b89527049cb27bbcd6871fdb0c0916b43e1
author : Michael Paquier <michael@paquier.xyz>
date : Thu, 25 Dec 2025 15:13:39 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Thu, 25 Dec 2025 15:13:39 +0900 Many of the operations done for attribute stats in attribute_stats.c
share the same logic as extended stats, as done by a patch under
discussion to add support for extended stats import and export. All the
pieces necessary for extended statistics are moved to stats_utils.c,
which is the file where common facilities are shared for stats files.
The following renames are done:
* get_attr_stat_type() -> statatt_get_type()
* init_empty_stats_tuple() -> statatt_init_empty_tuple()
* set_stats_slot() -> statatt_set_slot()
* get_elem_stat_type() -> statatt_get_elem_type()
While on it, this commit adds more documentation for all these
functions, describing more their internals and the dependencies that
have been implied for attribute statistics. The same concepts apply to
extended statistics, at some degree.
Author: Corey Huinker <corey.huinker@gmail.com>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Yu Wang <wangyu_runtime@163.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://postgr.es/m/CADkLM=dpz3KFnqP-dgJ-zvRvtjsa8UZv8wDAQdqho=qN3kX0Zg@mail.gmail.com M src/backend/statistics/attribute_stats.c
M src/backend/statistics/stat_utils.c
M src/include/statistics/stat_utils.h
Fix planner error with SRFs and grouping sets
commit : 325808cac9b379869099f47fe4f8198ddd7805c0
author : Richard Guo <rguo@postgresql.org>
date : Thu, 25 Dec 2025 12:12:52 +0900
committer: Richard Guo <rguo@postgresql.org>
date : Thu, 25 Dec 2025 12:12:52 +0900 If there are any SRFs in a PathTarget, we must separate it into
SRF-computing and SRF-free targets. This is because the executor can
only handle SRFs that appear at the top level of the targetlist of a
ProjectSet plan node.
If we find a subexpression that matches an expression already computed
in the previous plan level, we should treat it like a Var and should
not split it again. setrefs.c will later replace the expression with
a Var referencing the subplan output.
However, when processing the grouping target for grouping sets, the
planner can fail to recognize that an expression is already computed
in the scan/join phase. The root cause is a mismatch in the
nullingrels bits. Expressions in the grouping target carry the
grouping nulling bit in their nullingrels to indicate that they can be
nulled by the grouping step. However, the corresponding expressions
in the scan/join target do not have these bits.
As a result, the exact match check in list_member() fails, leading the
planner to incorrectly believe that the expression needs to be
re-evaluated from its arguments, which are often not available in the
subplan. This can lead to planner errors such as "variable not found
in subplan target list".
To fix, ignore the grouping nulling bit when checking whether an
expression from the grouping target is available in the pre-grouping
input target. This aligns with the matching logic in setrefs.c.
Backpatch to v18, where this issue was introduced.
Bug: #19353
Reported-by: Marian MULLER REBEYROL <marian.muller@serli.com>
Author: Richard Guo <guofenglinux@gmail.com>
Reviewed-by: Tender Wang <tndrwang@gmail.com>
Discussion: https://postgr.es/m/19353-aaa179bba986a19b@postgresql.org
Backpatch-through: 18 M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/util/tlist.c
M src/include/optimizer/tlist.h
M src/test/regress/expected/groupingsets.out
M src/test/regress/sql/groupingsets.sql
psql: Fix tab completion for VACUUM option values.
commit : c5c808f9b30b098421ad9f255954c4b16d121ab4
author : Masahiko Sawada <msawada@postgresql.org>
date : Wed, 24 Dec 2025 13:55:29 -0800
committer: Masahiko Sawada <msawada@postgresql.org>
date : Wed, 24 Dec 2025 13:55:29 -0800 Commit 8a3e4011 introduced tab completion for the ONLY option of
VACUUM and ANALYZE, along with some code simplification using
MatchAnyN. However, it caused a regression in tab completion for
VACUUM option values. For example, neither ON nor OFF was suggested
after "VACUUM (VERBOSE". In addition, the ONLY keyword was not
suggested immediately after a completed option list.
Backpatch to v18.
Author: Yugo Nagata <nagata@sraoss.co.jp>
Discussion: https://postgr.es/m/20251223021509.19bba68ecbbc70c9f983c2b4@sraoss.co.jp
Backpatch-through: 18 M src/bin/psql/tab-complete.in.c
doc: change "can not" to "cannot"
commit : 41808377fec7e6d5bb80f550f3640a503470da23
author : Bruce Momjian <bruce@momjian.us>
date : Wed, 24 Dec 2025 15:12:01 -0500
committer: Bruce Momjian <bruce@momjian.us>
date : Wed, 24 Dec 2025 15:12:01 -0500 Reported-by: Chao Li
Author: Chao Li
Discussion: https://postgr.es/m/CAEoWx2kyiD+7-vUoOYhH=y2Hrmvqyyhm4EhzgKyrxGBXOMWCxw@mail.gmail.com M doc/src/sgml/ecpg.sgml
M doc/src/sgml/func/func-aggregate.sgml
Fix regression test failure when wal_level is set to minimal.
commit : 0de5f0d869d1e06f172f10adf441e504174cf2fe
author : Masahiko Sawada <msawada@postgresql.org>
date : Wed, 24 Dec 2025 10:48:27 -0800
committer: Masahiko Sawada <msawada@postgresql.org>
date : Wed, 24 Dec 2025 10:48:27 -0800 Commit 67c209 removed the WARNING for insufficient wal_level from the
expected output, but the WARNING may still appear on buildfarm members
that run with wal_level=minimal.
To avoid unstable test output depending on wal_level, this commit the
test to use ALTER PUBLICATION for verifying the same behavior,
ensuring the output remains consistent regardless of the wal_level
setting.
Per buildfarm member thorntail.
Author: Zhijie Hou <houzj.fnst@fujitsu.com>
Discussion: https://postgr.es/m/TY4PR01MB16907680E27BAB146C8EB1A4294B2A@TY4PR01MB16907.jpnprd01.prod.outlook.com M src/test/regress/expected/publication.out
M src/test/regress/sql/publication.sql
doc: Use proper tags in pg_overexplain documentation.
commit : 008beba005c9990e2ba2a729c08585f051a24950
author : Fujii Masao <fujii@postgresql.org>
date : Thu, 25 Dec 2025 00:27:19 +0900
committer: Fujii Masao <fujii@postgresql.org>
date : Thu, 25 Dec 2025 00:27:19 +0900 The pg_overexplain documentation previously used the <literal> tag for
some file names, struct names, and commands. Update the markup to
use the more appropriate tags: <filename>, <structname>, and <command>.
Backpatch to v18, where pg_overexplain was introduced.
Author: Fujii Masao <masao.fujii@gmail.com>
Reviewed-by: Shixin Wang <wang-shi-xin@outlook.com>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://postgr.es/m/CAHGQGwEyYUzz0LjBV_fMcdwU3wgmu0NCoT+JJiozPa8DG6eeog@mail.gmail.com
Backpatch-through: 18 M doc/src/sgml/pgoverexplain.sgml
Fix CREATE SUBSCRIPTION failure when the publisher runs on pre-PG19.
commit : d1b35952da0fa94329b66f8a7768c61a416c6271
author : Fujii Masao <fujii@postgresql.org>
date : Wed, 24 Dec 2025 23:43:30 +0900
committer: Fujii Masao <fujii@postgresql.org>
date : Wed, 24 Dec 2025 23:43:30 +0900 CREATE SUBSCRIPTION with copy_data=true and origin='none' previously
failed when the publisher was running a version earlier than PostgreSQL 19,
even though this combination should be supported.
The failure occurred because the command issued a query calling
pg_get_publication_sequences function on the publisher. That function
does not exist before PG19 and the query is only needed for logical
replication sequence synchronization, which is supported starting in PG19.
This commit fixes this issue by skipping that query when the
publisher runs a version earlier than PG19.
Author: Fujii Masao <masao.fujii@gmail.com>
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>
Reviewed-by: Hayato Kuroda <kuroda.hayato@fujitsu.com>
Reviewed-by: Shlok Kyal <shlok.kyal.oss@gmail.com>
Discussion: https://postgr.es/m/CAHGQGwEx4twHtJdiPWTyAXJhcBPLaH467SH2ajGSe-41m65giA@mail.gmail.com M src/backend/commands/subscriptioncmds.c
Fix version check for retain_dead_tuples subscription option.
commit : 5e813edb55ed16f3b5540f099319bcca7ca1b816
author : Fujii Masao <fujii@postgresql.org>
date : Wed, 24 Dec 2025 23:25:00 +0900
committer: Fujii Masao <fujii@postgresql.org>
date : Wed, 24 Dec 2025 23:25:00 +0900 The retain_dead_tuples subscription option is supported only when
the publisher runs PostgreSQL 19 or later. However, it could previously
be enabled even when the publisher was running an earlier version.
This was caused by check_pub_dead_tuple_retention() comparing
the publisher server version against 19000 instead of 190000.
Fix this typo so that the version check correctly enforces the PG19+
requirement.
Author: Fujii Masao <masao.fujii@gmail.com>
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>
Reviewed-by: Hayato Kuroda <kuroda.hayato@fujitsu.com>
Reviewed-by: Shlok Kyal <shlok.kyal.oss@gmail.com>
Discussion: https://postgr.es/m/CAHGQGwEx4twHtJdiPWTyAXJhcBPLaH467SH2ajGSe-41m65giA@mail.gmail.com M src/backend/commands/subscriptioncmds.c
Update comments to reflect changes in 8e0d32a4a1.
commit : 98e8fe57c24f69f9248a1fea09f618f10cc168d7
author : Amit Kapila <akapila@postgresql.org>
date : Wed, 24 Dec 2025 10:29:53 +0000
committer: Amit Kapila <akapila@postgresql.org>
date : Wed, 24 Dec 2025 10:29:53 +0000 Commit 8e0d32a4a1 fixed an issue by allowing the replication origin to be
created while marking the table sync state as SUBREL_STATE_DATASYNC.
Update the comment in check_old_cluster_subscription_state() to accurately
describe this corrected behavior.
Author: Amit Kapila <amit.kapila16@gmail.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Backpatch-through: 17, where the code was introduced
Discussion: https://postgr.es/m/CAA4eK1+KaSf5nV_tWy+SDGV6MnFnKMhdt41jJjSDWm6yCyOcTw@mail.gmail.com
Discussion: https://postgr.es/m/aUTekQTg4OYnw-Co@paquier.xyz M src/bin/pg_upgrade/check.c
Doc: Clarify publication privilege requirements.
commit : dc6c879455e2db9adb7cf656ac29fdddeac39d77
author : Amit Kapila <akapila@postgresql.org>
date : Wed, 24 Dec 2025 09:22:00 +0000
committer: Amit Kapila <akapila@postgresql.org>
date : Wed, 24 Dec 2025 09:22:00 +0000 Update the logical replication documentation to explicitly outline the
privilege requirements for each publication syntax. This will ensure users
understand the necessary permissions when creating or managing
publications.
Author: Shlok Kyal <shlok.kyal.oss@gmail.com>
Reviewed-by: Peter Smith <smithpb2250@gmail.com>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: David G. Johnston <david.g.johnston@gmail.com>
Discussion: https://postgr.es/m/CANhcyEXODen4U0XLk0aAwFTwGxjAfE9eRaynREenLp-JBSaFHw@mail.gmail.com M doc/src/sgml/logical-replication.sgml
Teach expr_is_nonnullable() to handle more expression types
commit : c8d2f68cc800e02f858f8f59e3e9ba46ce43e880
author : Richard Guo <rguo@postgresql.org>
date : Wed, 24 Dec 2025 18:00:44 +0900
committer: Richard Guo <rguo@postgresql.org>
date : Wed, 24 Dec 2025 18:00:44 +0900 Currently, the function expr_is_nonnullable() checks only Const and
Var expressions to determine if an expression is non-nullable. This
patch extends the detection logic to handle more expression types.
This can enable several downstream optimizations, such as reducing
NullTest quals to constant truth values (e.g., "COALESCE(var, 1) IS
NULL" becomes FALSE) and converting "COUNT(expr)" to the more
efficient "COUNT(*)" when the expression is proven non-nullable.
This breaks a test case in test_predtest.sql, since we now simplify
"ARRAY[] IS NULL" to constant FALSE, preventing it from weakly
refuting a strict ScalarArrayOpExpr ("x = any(ARRAY[])"). To ensure
the refutation logic is still exercised as intended, wrap the array
argument in opaque_array().
Author: Richard Guo <guofenglinux@gmail.com>
Reviewed-by: Tender Wang <tndrwang@gmail.com>
Reviewed-by: Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>
Reviewed-by: David Rowley <dgrowleyml@gmail.com>
Reviewed-by: Matheus Alcantara <matheusssilv97@gmail.com>
Discussion: https://postgr.es/m/CAMbWs49UhPBjm+NRpxerjaeuFKyUZJ_AjM3NBcSYK2JgZ6VTEQ@mail.gmail.com M src/backend/optimizer/util/clauses.c
M src/test/modules/test_predtest/expected/test_predtest.out
M src/test/modules/test_predtest/sql/test_predtest.sql
M src/test/regress/expected/predicate.out
M src/test/regress/sql/predicate.sql
Optimize ROW(...) IS [NOT] NULL using non-nullable fields
commit : cb7b7ec7a1c6d8933b7e731be2dd101080822cf8
author : Richard Guo <rguo@postgresql.org>
date : Wed, 24 Dec 2025 18:00:02 +0900
committer: Richard Guo <rguo@postgresql.org>
date : Wed, 24 Dec 2025 18:00:02 +0900 We break ROW(...) IS [NOT] NULL into separate tests on its component
fields. During this breakdown, we can improve efficiency by utilizing
expr_is_nonnullable() to detect fields that are provably non-nullable.
If a component field is proven non-nullable, it affects the outcome
based on the test type. For an IS NULL test, a single non-nullable
field refutes the whole NullTest, reducing it to constant FALSE. For
an IS NOT NULL test, the check for that specific field is guaranteed
to succeed, so we can discard it from the list of component tests.
This extends the existing optimization logic, which previously only
handled Const fields, to support any expression that can be proven
non-nullable.
In passing, update the existing constant folding of NullTests to use
expr_is_nonnullable() instead of var_is_nonnullable(), enabling it to
benefit from future improvements to that function.
Author: Richard Guo <guofenglinux@gmail.com>
Reviewed-by: Tender Wang <tndrwang@gmail.com>
Reviewed-by: Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>
Reviewed-by: David Rowley <dgrowleyml@gmail.com>
Reviewed-by: Matheus Alcantara <matheusssilv97@gmail.com>
Discussion: https://postgr.es/m/CAMbWs49UhPBjm+NRpxerjaeuFKyUZJ_AjM3NBcSYK2JgZ6VTEQ@mail.gmail.com M src/backend/optimizer/util/clauses.c
Simplify COALESCE expressions using non-nullable arguments
commit : 10c4fe074a92eccf9fa6f7a39fe4d3f97b9b87e2
author : Richard Guo <rguo@postgresql.org>
date : Wed, 24 Dec 2025 17:58:49 +0900
committer: Richard Guo <rguo@postgresql.org>
date : Wed, 24 Dec 2025 17:58:49 +0900 The COALESCE function returns the first of its arguments that is not
null. When an argument is proven non-null, if it is the first
non-null-constant argument, the entire COALESCE expression can be
replaced by that argument. If it is a subsequent argument, all
following arguments can be dropped, since they will never be reached.
Currently, we perform this simplification only for Const arguments.
This patch extends the simplification to support any expression that
can be proven non-nullable.
This can help avoid the overhead of evaluating unreachable arguments.
It can also lead to better plans when the first argument is proven
non-nullable and replaces the expression, as the planner no longer has
to treat the expression as non-strict, and can also leverage index
scans on the resulting expression.
There is an ensuing plan change in generated_virtual.out, and we have
to modify the test to ensure that it continues to test what it is
intended to.
Author: Richard Guo <guofenglinux@gmail.com>
Reviewed-by: Tender Wang <tndrwang@gmail.com>
Reviewed-by: Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>
Reviewed-by: David Rowley <dgrowleyml@gmail.com>
Reviewed-by: Matheus Alcantara <matheusssilv97@gmail.com>
Discussion: https://postgr.es/m/CAMbWs49UhPBjm+NRpxerjaeuFKyUZJ_AjM3NBcSYK2JgZ6VTEQ@mail.gmail.com M src/backend/optimizer/util/clauses.c
M src/test/regress/expected/generated_virtual.out
M src/test/regress/expected/predicate.out
M src/test/regress/sql/generated_virtual.sql
M src/test/regress/sql/predicate.sql
Improve comment in pgstatfuncs.c
commit : b947dd5c75b1f9681d07bf58969233e7c9a73eff
author : Michael Paquier <michael@paquier.xyz>
date : Wed, 24 Dec 2025 17:09:13 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Wed, 24 Dec 2025 17:09:13 +0900 Author: Zizhen Qiao <zizhen_qiao@163.com>
Discussion: https://postgr.es/m/5ee635f9.49f7.19b4ed9e803.Coremail.zizhen_qiao@163.com M src/backend/utils/adt/pgstatfuncs.c
Don't advance origin during apply failure.
commit : 1528b0d899d65e0b01120f7d06c23256d390e4fe
author : Amit Kapila <akapila@postgresql.org>
date : Wed, 24 Dec 2025 04:36:39 +0000
committer: Amit Kapila <akapila@postgresql.org>
date : Wed, 24 Dec 2025 04:36:39 +0000 The logical replication parallel apply worker could incorrectly advance
the origin progress during an error or failed apply. This behavior risks
transaction loss because such transactions will not be resent by the
server.
Commit 3f28b2fcac addressed a similar issue for both the apply worker and
the table sync worker by registering a before_shmem_exit callback to reset
origin information. This prevents the worker from advancing the origin
during transaction abortion on shutdown. This patch applies the same fix
to the parallel apply worker, ensuring consistent behavior across all
worker types.
As with 3f28b2fcac, we are backpatching through version 16, since parallel
apply mode was introduced there and the issue only occurs when changes are
applied before the transaction end record (COMMIT or ABORT) is received.
Author: Hou Zhijie <houzj.fnst@fujitsu.com>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>
Backpatch-through: 16
Discussion: https://postgr.es/m/TY4PR01MB169078771FB31B395AB496A6B94B4A@TY4PR01MB16907.jpnprd01.prod.outlook.com
Discussion: https://postgr.es/m/TYAPR01MB5692FAC23BE40C69DA8ED4AFF5B92@TYAPR01MB5692.jpnprd01.prod.outlook.com M src/backend/replication/logical/worker.c
M src/test/subscription/t/023_twophase_stream.pl
Fix another case of indirectly casting away const.
commit : 9f7565c6c2d45df9705556c60f41394a8356cdf9
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Tue, 23 Dec 2025 21:38:43 -0500
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Tue, 23 Dec 2025 21:38:43 -0500 This one was missed in 8f1791c61, because the machines that
detected those issues don't compile this function.
Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/1324889.1764886170@sss.pgh.pa.us M src/port/getopt.c
C comment: fix psql "pstdout" duplicate to "pstdin"
commit : 2214a207ee8170afce79478df3b37114a94d976e
author : Bruce Momjian <bruce@momjian.us>
date : Tue, 23 Dec 2025 20:35:51 -0500
committer: Bruce Momjian <bruce@momjian.us>
date : Tue, 23 Dec 2025 20:35:51 -0500 Reported-by: Ignat Remizov
Author: Ignat Remizov
Discussion: https://postgr.es/m/CAKiC8XbbR2_YqmbxmYWuEA+MmWP3c=obV5xS1Hye3ZHS-Ss_DA@mail.gmail.com M src/bin/psql/copy.c
pg_visibility: Use visibilitymap_count instead of loop.
commit : 55c46bbf3a09a20d09d423c5dd4fded64d179d3e
author : Masahiko Sawada <msawada@postgresql.org>
date : Tue, 23 Dec 2025 10:33:06 -0800
committer: Masahiko Sawada <msawada@postgresql.org>
date : Tue, 23 Dec 2025 10:33:06 -0800 This commit updates pg_visibility_map_summary() to use the
visibilitymap_count() API, replacing its own counting mechanism. This
simplifies the function and improves performance by leveraging the
vectorized implementation introduced in commit 41c51f0c68.
Author: Matthias van de Meent <boekewurm+postgres@gmail.com>
Reviewed-by: wenhui qiu <qiuwenhuifx@gmail.com>
Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com>
Discussion: https://postgr.es/m/CAEze2WgPu-EYYuYQimy=AHQHGa7w8EvLVve5DM5eGMR6zh-7sw@mail.gmail.com M contrib/pg_visibility/pg_visibility.c
Toggle logical decoding dynamically based on logical slot presence.
commit : 67c20979ce72b8c236622e5603f9775968ff501c
author : Masahiko Sawada <msawada@postgresql.org>
date : Tue, 23 Dec 2025 10:13:16 -0800
committer: Masahiko Sawada <msawada@postgresql.org>
date : Tue, 23 Dec 2025 10:13:16 -0800 Previously logical decoding required wal_level to be set to 'logical'
at server start. This meant that users had to incur the overhead of
logical-level WAL logging even when no logical replication slots were
in use.
This commit adds functionality to automatically control logical
decoding availability based on logical replication slot presence. The
newly introduced module logicalctl.c allows logical decoding to be
dynamically activated when needed when wal_level is set to
'replica'.
When the first logical replication slot is created, the system
automatically increases the effective WAL level to maintain
logical-level WAL records. Conversely, after the last logical slot is
dropped or invalidated, it decreases back to 'replica' WAL level.
While activation occurs synchronously right after creating the first
logical slot, deactivation happens asynchronously through the
checkpointer process. This design avoids a race condition at the end
of recovery; a concurrent deactivation could happen while the startup
process enables logical decoding at the end of recovery, but WAL
writes are still not permitted until recovery fully completes. The
checkpointer will handle it after recovery is done. Asynchronous
deactivation also avoids excessive toggling of the logical decoding
status in workloads that repeatedly create and drop a single logical
slot. On the other hand, this lazy approach can delay changes to
effective_wal_level and the disabling logical decoding, especially
when the checkpointer is busy with other tasks. We chose this lazy
approach in all deactivation paths to keep the implementation simple,
even though laziness is strictly required only for end-of-recovery
cases. Future work might address this limitation either by using a
dedicated worker instead of the checkpointer, or by implementing
synchronous waiting during slot drops if workloads are significantly
affected by the lazy deactivation of logical decoding.
The effective WAL level, determined internally by XLogLogicalInfo, is
allowed to change within a transaction until an XID is assigned. Once
an XID is assigned, the value becomes fixed for the remainder of the
transaction. This behavior ensures that the logging mode remains
consistent within a writing transaction, similar to the behavior of
GUC parameters.
A new read-only GUC parameter effective_wal_level is introduced to
monitor the actual WAL level in effect. This parameter reflects the
current operational WAL level, which may differ from the configured
wal_level setting.
Bump PG_CONTROL_VERSION as it adds a new field to CheckPoint struct.
Reviewed-by: Shveta Malik <shveta.malik@gmail.com>
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>
Reviewed-by: Hayato Kuroda <kuroda.hayato@fujitsu.com>
Reviewed-by: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Reviewed-by: Peter Smith <smithpb2250@gmail.com>
Reviewed-by: Shlok Kyal <shlok.kyal.oss@gmail.com>
Reviewed-by: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>
Discussion: https://postgr.es/m/CAD21AoCVLeLYq09pQPaWs+Jwdni5FuJ8v2jgq-u9_uFbcp6UbA@mail.gmail.com M doc/src/sgml/config.sgml
M doc/src/sgml/logical-replication.sgml
M doc/src/sgml/logicaldecoding.sgml
M doc/src/sgml/ref/pg_createsubscriber.sgml
M doc/src/sgml/system-views.sgml
M src/backend/access/heap/heapam.c
M src/backend/access/rmgrdesc/xlogdesc.c
M src/backend/access/transam/xact.c
M src/backend/access/transam/xlog.c
M src/backend/commands/publicationcmds.c
M src/backend/commands/tablecmds.c
M src/backend/postmaster/checkpointer.c
M src/backend/postmaster/postmaster.c
M src/backend/replication/logical/Makefile
M src/backend/replication/logical/decode.c
M src/backend/replication/logical/logical.c
A src/backend/replication/logical/logicalctl.c
M src/backend/replication/logical/meson.build
M src/backend/replication/logical/slotsync.c
M src/backend/replication/slot.c
M src/backend/replication/slotfuncs.c
M src/backend/replication/walsender.c
M src/backend/storage/ipc/ipci.c
M src/backend/storage/ipc/procsignal.c
M src/backend/storage/ipc/standby.c
M src/backend/utils/activity/wait_event_names.txt
M src/backend/utils/cache/inval.c
M src/backend/utils/init/postinit.c
M src/backend/utils/misc/guc_parameters.dat
M src/backend/utils/misc/guc_tables.c
M src/bin/pg_basebackup/pg_createsubscriber.c
M src/bin/pg_basebackup/t/040_pg_createsubscriber.pl
M src/bin/pg_upgrade/check.c
M src/bin/pg_upgrade/t/002_pg_upgrade.pl
M src/include/access/xlog.h
M src/include/catalog/pg_control.h
A src/include/replication/logicalctl.h
M src/include/replication/slot.h
M src/include/storage/lwlocklist.h
M src/include/storage/procsignal.h
M src/include/utils/guc_hooks.h
M src/test/recovery/meson.build
M src/test/recovery/t/035_standby_logical_decoding.pl
A src/test/recovery/t/051_effective_wal_level.pl
M src/test/regress/expected/publication.out
M src/test/subscription/t/001_rep_changes.pl
M src/tools/pgindent/typedefs.list
Fix bug in following update chain when locking a heap tuple
commit : 955f5506863dce0a3416e3fae7c3297dbbaa946d
author : Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Tue, 23 Dec 2025 13:37:16 +0200
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Tue, 23 Dec 2025 13:37:16 +0200 After waiting for a concurrent updater to finish, heap_lock_tuple()
followed the update chain to lock all tuple versions. However, when
stepping from the initial tuple to the next one, it failed to check
that the next tuple's XMIN matches the initial tuple's XMAX. That's an
important check whenever following an update chain, and the recursive
part that follows the chain did it, but the initial step missed it.
Without the check, if the updating transaction aborts, the updated
tuple is vacuumed away and replaced by an unrelated tuple, the
unrelated tuple might get incorrectly locked.
Author: Jasper Smit <jasper.smit@servicenow.com>
Discussion: https://www.postgresql.org/message-id/CAOG+RQ74x0q=kgBBQ=mezuvOeZBfSxM1qu_o0V28bwDz3dHxLw@mail.gmail.com
Backpatch-through: 14 M src/backend/access/heap/heapam.c
M src/test/modules/injection_points/Makefile
A src/test/modules/injection_points/expected/heap_lock_update.out
M src/test/modules/injection_points/meson.build
A src/test/modules/injection_points/specs/heap_lock_update.spec
Fix orphaned origin in shared memory after DROP SUBSCRIPTION
commit : 8e0d32a4a1bfbae7f8340679c3586626b5fe3a08
author : Michael Paquier <michael@paquier.xyz>
date : Tue, 23 Dec 2025 14:32:14 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Tue, 23 Dec 2025 14:32:14 +0900 Since ce0fdbfe9722, a replication slot and an origin are created by each
tablesync worker, whose information is stored in both a catalog and
shared memory (once the origin is set up in the latter case). The
transaction where the origin is created is the same as the one that runs
the initial COPY, with the catalog state of the origin becoming visible
for other sessions only once the COPY transaction has committed. The
catalog state is coupled with a state in shared memory, initialized at
the same time as the origin created in the catalogs. Note that the
transaction doing the initial data sync can take a long time, time that
depends on the amount of data to transfer from a publication node to its
subscriber node.
Now, when a DROP SUBSCRIPTION is executed, all its workers are stopped
with the origins removed. The removal of each origin relies on a
catalog lookup. A worker still running the initial COPY would fail its
transaction, with the catalog state of the origin rolled back while the
shared memory state remains around. The session running the DROP
SUBSCRIPTION should be in charge of cleaning up the catalog and the
shared memory state, but as there is no data in the catalogs the shared
memory state is not removed. This issue would leave orphaned origin
data in shared memory, leading to a confusing state as it would still
show up in pg_replication_origin_status. Note that this shared memory
data is sticky, being flushed on disk in replorigin_checkpoint at
checkpoint. This prevents other origins from reusing a slot position
in the shared memory data.
To address this problem, the commit moves the creation of the origin at
the end of the transaction that precedes the one executing the initial
COPY, making the origin immediately visible in the catalogs for other
sessions, giving DROP SUBSCRIPTION a way to know about it. A different
solution would have been to clean up the shared memory state using an
abort callback within the tablesync worker. The solution of this commit
is more consistent with the apply worker that creates an origin in a
short transaction.
A test is added in the subscription test 004_sync.pl, which was able to
display the problem. The test fails when this commit is reverted.
Reported-by: Tenglong Gu <brucegu@amazon.com>
Reported-by: Daisuke Higuchi <higudai@amazon.com>
Analyzed-by: Michael Paquier <michael@paquier.xyz>
Author: Hou Zhijie <houzj.fnst@fujitsu.com>
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>
Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com>
Discussion: https://postgr.es/m/aUTekQTg4OYnw-Co@paquier.xyz
Backpatch-through: 14 M src/backend/commands/subscriptioncmds.c
M src/backend/replication/logical/tablesync.c
M src/test/subscription/t/004_sync.pl
doc: add "DO" to "ON CONFLICT" in CREATE VIEW text
commit : ea97154fc2f5ff830b1b9a6fc6cf540042c28cbc
author : Bruce Momjian <bruce@momjian.us>
date : Mon, 22 Dec 2025 19:41:52 -0500
committer: Bruce Momjian <bruce@momjian.us>
date : Mon, 22 Dec 2025 19:41:52 -0500 This is done for consistency.
Reported-by: jian he
Author: Laurenz Albe
Discussion: https://postgr.es/m/CACJufxEW1RRDD9ZWGcW_Np_Z9VGPE-YC7u0C6RcsEY8EKiTdBg@mail.gmail.com M doc/src/sgml/ref/create_view.sgml
Switch buffile.c/h to use pgoff_t instead of off_t
commit : e5f3839af685c303d8ebcc1ea0d407c124372931
author : Michael Paquier <michael@paquier.xyz>
date : Tue, 23 Dec 2025 07:41:34 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Tue, 23 Dec 2025 07:41:34 +0900 off_t was previously used for offsets, which is 4 bytes on Windows,
hence limiting the backend code to a hard limit for files longer than
2GB. This leads to some simplification in these files, removing some
casts based on long, also 4 bytes on Windows.
This commit removes one comment introduced in db3c4c3a2d98, not relevant
anymore as pgoff_t is a safe 8-byte alternative on Windows.
This change is surprisingly not invasive, as the callers of
BufFileTell(), BufFileSeek() and BufFileTruncateFileSet() (worker.c,
tuplestore.c, etc.) track offsets in local structures that just to
switch from off_t to pgoff_t for the most part.
The file is still relying on a maximum file size of
MAX_PHYSICAL_FILESIZE (1GB). This change allows the code to make this
maximum potentially larger in the future, or larger on a per-demand
basis.
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://postgr.es/m/aUStrqoOCDRFAq1M@paquier.xyz M src/backend/replication/logical/worker.c
M src/backend/storage/file/buffile.c
M src/backend/utils/sort/tuplestore.c
M src/include/storage/buffile.h
psql: Improve tab completion for COPY option lists.
commit : c6a7d3bab493e8d589f24d239db00ce5c2934178
author : Masahiko Sawada <msawada@postgresql.org>
date : Mon, 22 Dec 2025 14:28:12 -0800
committer: Masahiko Sawada <msawada@postgresql.org>
date : Mon, 22 Dec 2025 14:28:12 -0800 Previously, only the first option in a parenthesized option list was
suggested by tab completion. This commit enhances tab completion for
both COPY TO and COPY FROM commands to suggest options after each
comma.
Also add completion for HEADER and FREEZE option value candidates.
Author: Yugo Nagata <nagata@sraoss.co.jp>
Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com>
Discussion: https://postgr.es/m/20250605100835.b396f9d656df1018f65a4556@sraoss.co.jp M src/bin/psql/tab-complete.in.c
Add missing .gitignore for src/test/modules/test_cloexec.
commit : 37a1688a1bae6e6ce6e09d2ac1a5f2420f1b5775
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Mon, 22 Dec 2025 14:06:54 -0500
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Mon, 22 Dec 2025 14:06:54 -0500 A src/test/modules/test_cloexec/.gitignore
doc: Fix incorrect reference in pg_overexplain documentation.
commit : c5d162435ab7a6d8f992009810dfe869cfdb9dd6
author : Fujii Masao <fujii@postgresql.org>
date : Mon, 22 Dec 2025 17:56:28 +0900
committer: Fujii Masao <fujii@postgresql.org>
date : Mon, 22 Dec 2025 17:56:28 +0900 Correct the referenced location of the RangeTblEntry definition
in the pg_overexplain documentation.
Backpatched to v18, where pg_overexplain was introduced.
Author: Julien Tachoires <julien@tachoires.me>
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>
Discussion: https://postgr.es/m/20251218092319.tht64ffmcvzqdz7u@poseidon.home.virt
Backpatch-through: 18 M doc/src/sgml/pgoverexplain.sgml
Fix another typo in gininsert.c
commit : d31276f0e290a58c3df999116bc59d2332ca3148
author : Michael Paquier <michael@paquier.xyz>
date : Mon, 22 Dec 2025 12:38:40 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Mon, 22 Dec 2025 12:38:40 +0900 Reported-by: Tender Wang <tndrwang@gmail.com>
Discussion: https://postgr.es/m/CAHewXNkRJ9DMFZMQKWQ32U+OTBR78KeGh2=9Wy5jEeWDxMVFcQ@mail.gmail.com M src/backend/access/gin/gininsert.c
Remove obsolete name_ops index-only scan comments.
commit : fab5cd3dd1323f9e66efeb676c4bb212ff340204
author : Peter Geoghegan <pg@bowt.ie>
date : Sun, 21 Dec 2025 12:27:38 -0500
committer: Peter Geoghegan <pg@bowt.ie>
date : Sun, 21 Dec 2025 12:27:38 -0500 nbtree index-only scans of an index that uses btree/name_ops as one of
its index column's input opclasses are no longer at any risk of reading
past the end of currTuples. We're no longer reliant on such scans being
able to at least read from the start of markTuples storage (which uses
space from the same allocation as currTuples) to avoid a segfault:
StoreIndexTuple (from nodeIndexonlyscan.c) won't actually read past the
end of a cstring datum from a name_ops index. In other words, we
already have the "special-case treatment for name_ops" that the removed
comment supposed we could avoid by relying on markTuples in this way.
Oversight in commit a63224be49, which added special case handling of
name_ops cstrings to StoreIndexTuple, but missed these comments. M src/backend/access/nbtree/nbtree.c
Clean up test_cloexec.c and Makefile.
commit : bec2a0aa306599c59f2b7d35b26eba9864f29c10
author : Thomas Munro <tmunro@postgresql.org>
date : Sun, 21 Dec 2025 15:40:07 +1300
committer: Thomas Munro <tmunro@postgresql.org>
date : Sun, 21 Dec 2025 15:40:07 +1300 An unused variable caused a compiler warning on BF animal fairywren, an
snprintf() call was redundant, and some buffer sizes were inconsistent.
Per code review from Tom Lane.
The Makefile's test ifeq ($(PORTNAME), win32) never succeeded due to a
circularity, so only Meson builds were actually compiling the new test
code, partially explaining why CI didn't tell us about the warning
sooner (the other problem being that CompilerWarnings only makes
world-bin, a problem for another commit). Simplify.
Backpatch-through: 16, like commit c507ba55
Author: Bryan Green <dbryan.green@gmail.com>
Co-authored-by: Thomas Munro <tmunro@gmail.com>
Reported-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/1086088.1765593851%40sss.pgh.pa.us M src/test/modules/test_cloexec/Makefile
M src/test/modules/test_cloexec/test_cloexec.c
heapam: Move logic to handle HEAP_MOVED into a helper function
commit : 548de59d93d5593d5ef5354241510d57b68959db
author : Andres Freund <andres@anarazel.de>
date : Fri, 19 Dec 2025 13:28:34 -0500
committer: Andres Freund <andres@anarazel.de>
date : Fri, 19 Dec 2025 13:28:34 -0500 Before we dealt with this in 6 near identical and one very similar copy.
The helper function errors out when encountering a
HEAP_MOVED_IN/HEAP_MOVED_OUT tuple with xvac considered current or
in-progress. It'd be preferrable to do that change separately, but otherwise
it'd not be possible to deduplicate the handling in
HeapTupleSatisfiesVacuum().
Reviewed-by: Heikki Linnakangas <hlinnaka@iki.fi>
Discussion: https://postgr.es/m/lxzj26ga6ippdeunz6kuncectr5gfuugmm2ry22qu6hcx6oid6@lzx3sjsqhmt6
Discussion: https://postgr.es/m/6rgb2nvhyvnszz4ul3wfzlf5rheb2kkwrglthnna7qhe24onwr@vw27225tkyar M src/backend/access/heap/heapam_visibility.c
bufmgr: Optimize & harmonize LockBufHdr(), LWLockWaitListLock()
commit : 09ae2c8bac8db409a8cd0b8ee438ea7526deb4c3
author : Andres Freund <andres@anarazel.de>
date : Fri, 19 Dec 2025 13:23:13 -0500
committer: Andres Freund <andres@anarazel.de>
date : Fri, 19 Dec 2025 13:23:13 -0500 The main optimization is for LockBufHdr() to delay initializing
SpinDelayStatus, similar to what LWLockWaitListLock already did. The
initialization is sufficiently expensive & buffer header lock acquisitions are
sufficiently frequent, to make it worthwhile to instead have a fastpath (via a
likely() branch) that does not initialize the SpinDelayStatus.
While LWLockWaitListLock() already the aforementioned optimization, it did not
use likely(), and inspection of the assembly shows that this indeed leads to
worse code generation (also observed in a microbenchmark). Fix that by adding
the likely().
While the LockBufHdr() improvement is a small gain on its own, it mainly is
aimed at preventing a regression after a future commit, which requires
additional locking to set hint bits.
While touching both, also make the comments more similar to each other.
Reviewed-by: Heikki Linnakangas <heikki.linnakangas@iki.fi>
Discussion: https://postgr.es/m/fvfmkr5kk4nyex56ejgxj3uzi63isfxovp2biecb4bspbjrze7@az2pljabhnff M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/lmgr/lwlock.c
doc: clarify when physical/logical replication is used
commit : 80f08a6e6a6c11ac3530c473cfb963f646d0891a
author : Bruce Momjian <bruce@momjian.us>
date : Fri, 19 Dec 2025 12:01:23 -0500
committer: Bruce Momjian <bruce@momjian.us>
date : Fri, 19 Dec 2025 12:01:23 -0500 The imprecision caused some text to be only partially accurate.
Reported-by: Paul A Jungwirth
Author: Robert Treat
Discussion: https://postgr.es/m/CA%2BrenyULt3VBS1cRFKUfT2%3D5dr61xBOZdAZ-CqX3XLGXqY-aTQ%40mail.gmail.com M doc/src/sgml/config.sgml
M doc/src/sgml/high-availability.sgml
M doc/src/sgml/logical-replication.sgml
M doc/src/sgml/logicaldecoding.sgml
Use proper type for RestoreTransactionSnapshot's PGPROC arg
commit : 47a9f61fcafcf26bd3d68740ca05ba69ac729d93
author : Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Fri, 19 Dec 2025 13:40:02 +0200
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Fri, 19 Dec 2025 13:40:02 +0200 Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://www.postgresql.org/message-id/08cbaeb5-aaaf-47b6-9ed8-4f7455b0bc4b@iki.fi M src/backend/utils/time/snapmgr.c
M src/include/utils/snapmgr.h
Update pg_hba.conf example to reflect MD5 deprecation
commit : 44f49511b7940adf3be4337d4feb2de38fe92297
author : John Naylor <john.naylor@postgresql.org>
date : Fri, 19 Dec 2025 15:48:18 +0700
committer: John Naylor <john.naylor@postgresql.org>
date : Fri, 19 Dec 2025 15:48:18 +0700 In the wake of commit db6a4a985, remove most use of 'md5' from the
example configuration file. The only remainder is an example exception
for a client that doesn't support SCRAM.
Author: Mikael Gustavsson <mikael.gustavsson@smhi.se>
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>
Reviewed-by: Andreas Karlsson <andreas@proxel.se>
Reviewed-by: Laurenz Albe <laurenz.albe@cybertec.at>
Discussion: https://postgr.es/m/176595607507.978865.11597773194269211255@wrigleys.postgresql.org
Discussion: https://postgr.es/m/4ed268473fdb4cf9b0eced6c8019d353@smhi.se
Backpatch-through: 18 M doc/src/sgml/client-auth.sgml
Fix typos in gininsert.c
commit : 5cdbec5aa9dcf5b30ad68485abdb1ec88324999f
author : Michael Paquier <michael@paquier.xyz>
date : Fri, 19 Dec 2025 14:33:38 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Fri, 19 Dec 2025 14:33:38 +0900 Introduced by 8492feb98f6d.
Author: Xingbin She <xingbin.she@qq.com>
Discussion: https://postgr.es/m/tencent_C254AE962588605F132DB4A6F87205D6A30A@qq.com M src/backend/access/gin/gininsert.c
Add guard to prevent recursive memory context logging.
commit : b3ccb0a2cb2ef53571021d6c8f9b70809a6bf20c
author : Fujii Masao <fujii@postgresql.org>
date : Fri, 19 Dec 2025 12:05:37 +0900
committer: Fujii Masao <fujii@postgresql.org>
date : Fri, 19 Dec 2025 12:05:37 +0900 Previously, if memory context logging was triggered repeatedly and
rapidly while a previous request was still being processed, it could
result in recursive calls to ProcessLogMemoryContextInterrupt().
This could lead to infinite recursion and potentially crash the process.
This commit adds a guard to prevent such recursion.
If ProcessLogMemoryContextInterrupt() is already in progress and
logging memory contexts, subsequent calls will exit immediately,
avoiding unintended recursive calls.
While this scenario is unlikely in practice, it's not impossible.
This change adds a safety check to prevent such failures.
Back-patch to v14, where memory context logging was introduced.
Reported-by: Robert Haas <robertmhaas@gmail.com>
Author: Fujii Masao <masao.fujii@gmail.com>
Reviewed-by: Atsushi Torikoshi <torikoshia@oss.nttdata.com>
Reviewed-by: Robert Haas <robertmhaas@gmail.com>
Reviewed-by: Artem Gavrilov <artem.gavrilov@percona.com>
Discussion: https://postgr.es/m/CA+TgmoZMrv32tbNRrFTvF9iWLnTGqbhYSLVcrHGuwZvCtph0NA@mail.gmail.com
Backpatch-through: 14 M src/backend/utils/mmgr/mcxt.c
Use table/index_close() more consistently
commit : 9d0f7996e58c2a92efe06c901c6dfe1f6ced0a1d
author : Michael Paquier <michael@paquier.xyz>
date : Fri, 19 Dec 2025 07:55:58 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Fri, 19 Dec 2025 07:55:58 +0900 All the code paths updated here have been using relation_close() to
close a relation that has already been opened with table_open() or
index_open(), where a relkind check is enforced.
table_close() and index_open() do the same thing as relation_close(), so
there was no harm, but being inconsistent could lead to issues if the
internals of these close() functions begin to introduce some logic
specific to each relkind in the future.
Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Discussion: https://postgr.es/m/aUKamYGiDKO6byp5@ip-10-97-1-34.eu-west-3.compute.internal M src/backend/access/brin/brin.c
M src/backend/parser/parse_utilcmd.c
Sort DO_SUBSCRIPTION_REL dump objects independent of OIDs.
commit : d49936f3028b0bb6ac8ff83e07e421ca2a4f5c3f
author : Noah Misch <noah@leadboat.com>
date : Thu, 18 Dec 2025 10:23:47 -0800
committer: Noah Misch <noah@leadboat.com>
date : Thu, 18 Dec 2025 10:23:47 -0800 Commit 0decd5e89db9f5edb9b27351082f0d74aae7a9b6 missed
DO_SUBSCRIPTION_REL, leading to assertion failures. In the unlikely use
case of diffing "pg_dump --binary-upgrade" output, spurious diffs were
possible. As part of fixing that, align the DumpableObject naming and
sort order with DO_PUBLICATION_REL. The overall effect of this commit
is to change sort order from (subname, srsubid) to (rel, subname).
Since DO_SUBSCRIPTION_REL is only for --binary-upgrade, accept that
larger-than-usual dump order change. Back-patch to v17, where commit
9a17be1e244a45a77de25ed2ada246fd34e4557d introduced DO_SUBSCRIPTION_REL.
Reported-by: vignesh C <vignesh21@gmail.com>
Author: vignesh C <vignesh21@gmail.com>
Discussion: https://postgr.es/m/CALDaNm2x3rd7C0_HjUpJFbxpAqXgm=QtoKfkEWDVA8h+JFpa_w@mail.gmail.com
Backpatch-through: 17 M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dump_sort.c
M src/bin/pg_upgrade/t/004_subscription.pl
Do not emit WAL for unlogged BRIN indexes
commit : 951b60f7abdcdeb37f2d73ad4822f278d2687c1c
author : Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Thu, 18 Dec 2025 15:08:48 +0200
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Thu, 18 Dec 2025 15:08:48 +0200 Operations on unlogged relations should not be WAL-logged. The
brin_initialize_empty_new_buffer() function didn't get the memo.
The function is only called when a concurrent update to a brin page
uses up space that we're just about to insert to, which makes it
pretty hard to hit. If you do manage to hit it, a full-page WAL record
is erroneously emitted for the unlogged index. If you then crash,
crash recovery will fail on that record with an error like this:
FATAL: could not create file "base/5/32819": File exists
Author: Kirill Reshke <reshkekirill@gmail.com>
Discussion: https://www.postgresql.org/message-id/CALdSSPhpZXVFnWjwEBNcySx_vXtXHwB2g99gE6rK0uRJm-3GgQ@mail.gmail.com
Backpatch-through: 14 M src/backend/access/brin/brin_pageops.c
Fix intermittent BF failure in 040_standby_failover_slots_sync.
commit : b47c50e5667b489bec3affb55ecdf4e9c306ca2d
author : Amit Kapila <akapila@postgresql.org>
date : Thu, 18 Dec 2025 05:06:55 +0000
committer: Amit Kapila <akapila@postgresql.org>
date : Thu, 18 Dec 2025 05:06:55 +0000 Commit 0d2d4a0ec3 introduced a test that verifies replication slot
synchronization to a standby server via SQL API. However, the test did not
configure synchronized_standby_slots. Without this setting, logical
failover slots can advance beyond the physical replication slot, causing
intermittent synchronization failures.
Author: Hou Zhijie <houzj.fnst@fujitsu.com>
Discussion: https://postgr.es/m/TY4PR01MB16907DF70205308BE918E0D4494ABA@TY4PR01MB16907.jpnprd01.prod.outlook.com M src/test/recovery/t/040_standby_failover_slots_sync.pl
btree_gist: Fix memory allocation formula
commit : 5cf03552fbb43b2d2d11369d779f9b168ea9b87a
author : Michael Paquier <michael@paquier.xyz>
date : Thu, 18 Dec 2025 11:01:43 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Thu, 18 Dec 2025 11:01:43 +0900 This change has been suggested by the two authors listed in this commit,
both of them providing an incomplete solution (David's formula relied on
a "bytea *", while Bertrand's did not use palloc_array()). The solution
provided in this commit uses GBT_VARKEY instead of the inconsistent
bytea for the allocation size, with a palloc_array().
The change related to Vsrt is one I am flipping to a more consistent
style, in passing.
Author: David Geier <geidav.pg@gmail.com>
Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Discussion: https://postgr.es/m/ad0748d4-3080-436e-b0bc-ac8f86a3466a@gmail.com
Discussion: https://postgr.es/m/aTrG3Fi4APtfiCvQ@ip-10-97-1-34.eu-west-3.compute.internal M contrib/btree_gist/btree_utils_var.c
Fix const correctness in pgstat data serialization callbacks
commit : 167cb26718e3eae4fef470900b4cd1d434f15649
author : Michael Paquier <michael@paquier.xyz>
date : Thu, 18 Dec 2025 07:33:40 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Thu, 18 Dec 2025 07:33:40 +0900 4ba012a8ed9c defined the "header" (pointer to the stats data) of
from_serialized_data() as a const, even though it is fine (and
expected!) for the callback to modify the shared memory entry when
loading the stats at startup.
While on it, this commit updates the callback to_serialized_data() in
the test module test_custom_stats to make the data extracted from the
"header" parameter a const since it should never be modified: the stats
are written to disk and no modifications are expected in the shared
memory entry.
This clarifies the API contract of these new callbacks.
Reported-By: Peter Eisentraut <peter@eisentraut.org>
Author: Michael Paquier <michael@paquier.xyz>
Co-authored-by: Sami Imseih <samimseih@gmail.com>
Discussion: https://postgr.es/m/d87a93b0-19c7-4db6-b9c0-d6827e7b2da1@eisentraut.org M src/include/utils/pgstat_internal.h
M src/test/modules/test_custom_stats/test_custom_var_stats.c
oauth_validator: Avoid races in log_check()
commit : ab8af1db43031544a5c01314bef9f0392bfde7f9
author : Jacob Champion <jchampion@postgresql.org>
date : Wed, 17 Dec 2025 11:46:05 -0800
committer: Jacob Champion <jchampion@postgresql.org>
date : Wed, 17 Dec 2025 11:46:05 -0800 Commit e0f373ee4 fixed up races in Cluster::connect_fails when using
log_like. t/002_client.pl didn't get the memo, though, because it
doesn't use Test::Cluster to perform its custom hook tests. (This is
probably not an issue at the moment, since the log check is only done
after authentication success and not failure, but there's no reason to
wait for someone to hit it.)
Introduce the fix, based on debug2 logging, to its use of log_check() as
well, and move the logic into the test() helper so that any additions
don't need to continually duplicate it.
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://postgr.es/m/CAOYmi%2BmrGg%2Bn_X2MOLgeWcj3v_M00gR8uz_D7mM8z%3DdX1JYVbg%40mail.gmail.com
Backpatch-through: 18 M src/test/modules/oauth_validator/t/002_client.pl
libpq-oauth: use correct c_args in meson.build
commit : 781ca72139d6f7d91629d09f55fb9c94822aa404
author : Jacob Champion <jchampion@postgresql.org>
date : Wed, 17 Dec 2025 11:46:01 -0800
committer: Jacob Champion <jchampion@postgresql.org>
date : Wed, 17 Dec 2025 11:46:01 -0800 Copy-paste bug from b0635bfda: libpq-oauth.so was being built with
libpq_so_c_args, rather than libpq_oauth_so_c_args. (At the moment, the
two lists are identical, but that won't be true forever.)
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://postgr.es/m/CAOYmi%2BmrGg%2Bn_X2MOLgeWcj3v_M00gR8uz_D7mM8z%3DdX1JYVbg%40mail.gmail.com
Backpatch-through: 18 M src/interfaces/libpq-oauth/meson.build
libpq-fe.h: Don't claim SOCKTYPE in the global namespace
commit : 8b217c96ea2d0cf5046092aef03612f46bb136e4
author : Jacob Champion <jchampion@postgresql.org>
date : Wed, 17 Dec 2025 11:45:52 -0800
committer: Jacob Champion <jchampion@postgresql.org>
date : Wed, 17 Dec 2025 11:45:52 -0800 The definition of PGoauthBearerRequest uses a temporary SOCKTYPE macro
to hide the difference between Windows and Berkeley socket handles,
since we don't surface pgsocket in our public API. This macro doesn't
need to escape the header, because implementers will choose the correct
socket type based on their platform, so I #undef'd it immediately after
use.
I didn't namespace that helper, though, so if anyone else needs a
SOCKTYPE macro, libpq-fe.h will now unhelpfully get rid of it. This
doesn't seem too far-fetched, given its proximity to existing POSIX
macro names.
Add a PQ_ prefix to avoid collisions, update and improve the surrounding
documentation, and backpatch.
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://postgr.es/m/CAOYmi%2BmrGg%2Bn_X2MOLgeWcj3v_M00gR8uz_D7mM8z%3DdX1JYVbg%40mail.gmail.com
Backpatch-through: 18 M doc/src/sgml/libpq.sgml
M src/interfaces/libpq/libpq-fe.h
Rename regress.so's .mo file to postgresql-regress-VERSION.mo.
commit : 5b4fb2b97d2d953629f2a83adb6b7292b4745476
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Wed, 17 Dec 2025 14:10:42 -0500
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Wed, 17 Dec 2025 14:10:42 -0500 I originally used just "regress-VERSION.mo", but that seems too
generic considering that some packagers will put this file into
a system-wide directory. Per suggestion from Christoph Berg.
Reported-by: Christoph Berg <myon@debian.org>
Author: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/aULSW7Xqx5MqDW_1@msg.df7cb.de M src/test/regress/nls.mk
M src/test/regress/po/meson.build
M src/test/regress/regress.c
Make postmaster 003_start_stop.pl test less flaky
commit : 5cbaa00592d4c1e8ef519bf0d89c415bfa3b3473
author : Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Wed, 17 Dec 2025 16:23:13 +0200
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Wed, 17 Dec 2025 16:23:13 +0200 The test is very sensitive to how backends start and exit, because it
tests dead-end backends which occur when all the connection slots are
in use. The test failed occasionally in the CI, when the backend that
was launched for the raw_connect_works() check lingered for a while,
and exited only later during the test. When it exited, it released a
connection slot, when the test expected all the slots to be in use at
that time.
The 002_connection_limits.pl test had a similar issue: if the backend
launched for safe_psql() in the test initialization lingers around, it
uses up a connection slot during the test, messing up the test's
connection counting. I haven't seen that in the CI, but when I added a
"sleep(1);" to proc_exit(), the test failed.
To make the tests more robust, restart the server to ensure that the
lingering backends doesn't interfere with the later test steps.
In the passing, fix a bogus test name.
Report and analysis by Jelte Fennema-Nio, Andres Freund, Thomas Munro.
Discussion: https://www.postgresql.org/message-id/CAGECzQSU2iGuocuP+fmu89hmBmR3tb-TNyYKjCcL2M_zTCkAFw@mail.gmail.com
Backpatch-through: 18 M src/test/postmaster/t/002_connection_limits.pl
M src/test/postmaster/t/003_start_stop.pl
Support existing publications in pg_createsubscriber.
commit : 85ddcc2f4cdef490276d151c80459e287bceb782
author : Amit Kapila <akapila@postgresql.org>
date : Wed, 17 Dec 2025 09:43:53 +0000
committer: Amit Kapila <akapila@postgresql.org>
date : Wed, 17 Dec 2025 09:43:53 +0000 Allow pg_createsubscriber to reuse existing publications instead of
failing when they already exist on the publisher.
Previously, pg_createsubscriber would fail if any specified publication
already existed. Now, existing publications are reused as-is with their
current configuration, and non-existing publications are created
automatically with FOR ALL TABLES.
This change provides flexibility when working with mixed scenarios of
existing and new publications. Users should verify that existing
publications have the desired configuration before reusing them, and can
use --dry-run with verbose mode to see which publications will be reused
and which will be created.
Only publications created by pg_createsubscriber are cleaned up during
error cleanup operations. Pre-existing publications are preserved unless
'--clean=publications' is explicitly specified, which drops all
publications.
This feature would be helpful for pub-sub configurations where users want
to subscribe to a subset of tables from the publisher.
Author: Shubham Khanna <khannashubham1197@gmail.com>
Reviewed-by: Euler Taveira <euler@eulerto.com>
Reviewed-by: Peter Smith <smithpb2250@gmail.com>
Reviewed-by: Zhijie Hou (Fujitsu) <houzj.fnst@fujitsu.com
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: vignesh C <vignesh21@gmail.com>
Reviewed-by: tianbing <tian_bing_0531@163.com>
Discussion: https://postgr.es/m/CAHv8Rj%2BsxWutv10WiDEAPZnygaCbuY2RqiLMj2aRMH-H3iZwyA%40mail.gmail.com M doc/src/sgml/ref/pg_createsubscriber.sgml
M src/bin/pg_basebackup/pg_createsubscriber.c
M src/bin/pg_basebackup/t/040_pg_createsubscriber.pl
Change pgstat_report_vacuum() to use Relation
commit : f4e797171eac645eeae2a5e95bf3361bb7f7f0cc
author : Michael Paquier <michael@paquier.xyz>
date : Wed, 17 Dec 2025 11:26:17 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Wed, 17 Dec 2025 11:26:17 +0900 This change makes pgstat_report_vacuum() more consistent with
pgstat_report_analyze(), that also uses a Relation. This enforces a
policy that callers of this routine should open and lock the relation
whose statistics are updated before calling this routine. We will
unlikely have a lot of callers of this routine in the tree, but it seems
like a good idea to imply this requirement in the long run.
Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Suggested-by: Andres Freund <andres@anarazel.de>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://postgr.es/m/aUEA6UZZkDCQFgSA@ip-10-97-1-34.eu-west-3.compute.internal M src/backend/access/heap/vacuumlazy.c
M src/backend/utils/activity/pgstat_relation.c
M src/include/pgstat.h
Remove useless code in InjectionPointAttach()
commit : 1d325ad99cb2dec0e8b45ba36909ee0a497d2a57
author : Michael Paquier <michael@paquier.xyz>
date : Wed, 17 Dec 2025 08:58:58 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Wed, 17 Dec 2025 08:58:58 +0900 strlcpy() ensures that a target string is zero-terminated, so there is
no need to enforce it a second time in this code. This simplification
could have been done in 0eb23285a257.
Author: Feilong Meng <feelingmeng@foxmail.com>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://postgr.es/m/tencent_771178777C5BC17FCB7F7A1771CD1FFD5708@qq.com M src/backend/utils/misc/injection_point.c
Avoid global LC_CTYPE dependency in pg_locale_icu.c.
commit : 0a90df58cf38cf68d59c6841513be98aeeff250e
author : Jeff Davis <jdavis@postgresql.org>
date : Tue, 16 Dec 2025 15:32:57 -0800
committer: Jeff Davis <jdavis@postgresql.org>
date : Tue, 16 Dec 2025 15:32:57 -0800 ICU still depends on libc for compatibility with certain historical
behavior for single-byte encodings. Make the dependency explicit by
holding a locale_t object when required.
We should consider a better solution in the future, such as decoding
the text to UTF-32 and using u_tolower(). That would be a behavior
change and require additional infrastructure though; so for now, just
avoid the global LC_CTYPE dependency.
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://postgr.es/m/450ceb6260cad30d7afdf155d991a9caafee7c0d.camel@j-davis.com M src/backend/utils/adt/pg_locale_icu.c
M src/include/utils/pg_locale.h
downcase_identifier(): use method table from locale provider.
commit : 87b2968df0f866aaccb6ba69adf284e3c4a79454
author : Jeff Davis <jdavis@postgresql.org>
date : Tue, 16 Dec 2025 15:32:41 -0800
committer: Jeff Davis <jdavis@postgresql.org>
date : Tue, 16 Dec 2025 15:32:41 -0800 Previously, libc's tolower() was always used for lowercasing
identifiers, regardless of the database locale (though only characters
beyond 127 in single-byte encodings were affected). Refactor to allow
each provider to supply its own implementation of identifier
downcasing.
For historical compatibility, when using a single-byte encoding, ICU
still relies on tolower().
One minor behavior change is that, before the database default locale
is initialized, it uses ASCII semantics to downcase the
identifiers. Previously, it would use the postmaster's LC_CTYPE
setting from the environment. While that could have some effect during
GUC processing, for example, it would have been fragile to rely on the
environment setting anyway. (Also, it only matters when the encoding
is single-byte.)
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Discussion: https://postgr.es/m/450ceb6260cad30d7afdf155d991a9caafee7c0d.camel@j-davis.com M src/backend/parser/scansup.c
M src/backend/utils/adt/pg_locale.c
M src/backend/utils/adt/pg_locale_builtin.c
M src/backend/utils/adt/pg_locale_icu.c
M src/backend/utils/adt/pg_locale_libc.c
M src/include/utils/pg_locale.h
ltree: fix case-insensitive matching.
commit : 7f007e4a044a713df5320fca09621d6ba8e632ba
author : Jeff Davis <jdavis@postgresql.org>
date : Tue, 16 Dec 2025 11:13:17 -0800
committer: Jeff Davis <jdavis@postgresql.org>
date : Tue, 16 Dec 2025 11:13:17 -0800 Previously, ltree_prefix_eq_ci() used lowercasing with the default
collation; while ltree_crc32_sz() used tolower() directly. These were
equivalent only if the default collation provider was libc and the
encoding was single-byte.
Change both to use casefolding with the default collation.
Backpatch through 18, where the casefolding APIs were introduced. The
bug exists in earlier versions, but would require some adaptation.
A REINDEX is required for ltree indexes where the database default
collation is not libc.
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Backpatch-through: 18
Discussion: https://postgr.es/m/450ceb6260cad30d7afdf155d991a9caafee7c0d.camel@j-davis.com
Discussion: https://postgr.es/m/01fc00fd66f641b9693d4f9f1af0ccf44cbdfbdf.camel@j-davis.com M contrib/ltree/crc32.c
M contrib/ltree/lquery_op.c
Clarify a #define introduced in 8d299052fe.
commit : 24bf379cb15162514b01fc9fd05420a0203b82e9
author : Jeff Davis <jdavis@postgresql.org>
date : Tue, 16 Dec 2025 12:48:53 -0800
committer: Jeff Davis <jdavis@postgresql.org>
date : Tue, 16 Dec 2025 12:48:53 -0800 The value is the same, but use the right symbol for clarity. M src/include/utils/pg_locale.h
Fix multibyte issue in ltree_strncasecmp().
commit : 84d5efa7e3ebcf04694d312b0f14ceb35dcdfb8e
author : Jeff Davis <jdavis@postgresql.org>
date : Tue, 16 Dec 2025 10:35:40 -0800
committer: Jeff Davis <jdavis@postgresql.org>
date : Tue, 16 Dec 2025 10:35:40 -0800 Previously, the API for ltree_strncasecmp() took two inputs but only
one length (that of the smaller input). It truncated the larger input
to that length, but that could break a multibyte sequence.
Change the API to be a check for prefix equality (possibly
case-insensitive) instead, which is all that's needed by the
callers. Also, provide the lengths of both inputs.
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Discussion: https://postgr.es/m/5f65b85740197ba6249ea507cddf609f84a6188b.camel%40j-davis.com
Backpatch-through: 14 M contrib/ltree/lquery_op.c
M contrib/ltree/ltree.h
M contrib/ltree/ltxtquery_op.c
Switch memory contexts in ReinitializeParallelDSM.
commit : f1a6e622bd94735c36d72c663813b55c442739b4
author : Robert Haas <rhaas@postgresql.org>
date : Tue, 16 Dec 2025 10:40:53 -0500
committer: Robert Haas <rhaas@postgresql.org>
date : Tue, 16 Dec 2025 10:40:53 -0500 We already do this in CreateParallelContext, InitializeParallelDSM, and
LaunchParallelWorkers. I suspect the reason why the matching logic was
omitted from ReinitializeParallelDSM is that I failed to realize that
any memory allocation was happening here -- but shm_mq_attach does
allocate, which could result in a shm_mq_handle being allocated in a
shorter-lived context than the ParallelContext which points to it.
That could result in a crash if the shorter-lived context is freed
before the parallel context is destroyed. As far as I am currently
aware, there is no way to reach a crash using only code that is
present in core PostgreSQL, but extensions could potentially trip
over this. Fixing this in the back-branches appears low-risk, so
back-patch to all supported versions.
Author: Jakub Wartak <jakub.wartak@enterprisedb.com>
Co-authored-by: Jeevan Chalke <jeevan.chalke@enterprisedb.com>
Backpatch-through: 14
Discussion: http://postgr.es/m/CAKZiRmwfVripa3FGo06=5D1EddpsLu9JY2iJOTgbsxUQ339ogQ@mail.gmail.com M src/backend/access/transam/parallel.c
Test PRI* macros even when we can't test NLS translation.
commit : 462e2476525e71aa028c4a079bd77d2cac8a36b7
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Tue, 16 Dec 2025 12:01:46 -0500
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Tue, 16 Dec 2025 12:01:46 -0500 Further research shows that the reason commit 7db6809ce failed
is that recent glibc versions short-circuit translation attempts
when LC_MESSAGES is 'C.<encoding>', not only when it's 'C'.
There seems no way around that, so we'll have to live with only
testing NLS when a suitable real locale is installed.
However, something can still be salvaged: it still seems like a
good idea to verify that the PRI* macros work as-expected even when
we can't check their translations (see f8715ec86 for motivation).
Hence, adjust the test to always run the ereport calls, and tweak
the parameter values in hopes of detecting any cases where there's
confusion about the actual widths of the parameters.
Discussion: https://postgr.es/m/1991599.1765818338@sss.pgh.pa.us M src/test/regress/expected/nls.out
M src/test/regress/expected/nls_1.out
M src/test/regress/expected/nls_2.out
M src/test/regress/regress.c
M src/test/regress/sql/nls.sql
Add explanatory comment to prune_freeze_setup()
commit : bfe5c4bec75091d5c91813ff9c6994a169ceb8ef
author : Melanie Plageman <melanieplageman@gmail.com>
date : Tue, 16 Dec 2025 10:30:14 -0500
committer: Melanie Plageman <melanieplageman@gmail.com>
date : Tue, 16 Dec 2025 10:30:14 -0500 heap_page_prune_and_freeze() fills in PruneState->deadoffsets, the array
of OffsetNumbers of dead tuples. It is returned to the caller in the
PruneFreezeResult. To avoid having two copies of the array, the
PruneState saves only a pointer to the array. This was a bit unusual and
confusing, so add a clarifying comment.
Author: Melanie Plageman <melanieplageman@gmail.com>
Suggested-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://postgr.es/m/CAEoWx2=jiD1nqch4JQN+odAxZSD7mRvdoHUGJYN2r6tQG_66yQ@mail.gmail.com M src/backend/access/heap/pruneheap.c
Fix const qualification in prune_freeze_setup()
commit : 4877391ce894e5b964a69e94e1750cde9df04a07
author : Melanie Plageman <melanieplageman@gmail.com>
date : Tue, 16 Dec 2025 10:29:16 -0500
committer: Melanie Plageman <melanieplageman@gmail.com>
date : Tue, 16 Dec 2025 10:29:16 -0500 The const qualification of the presult argument to prune_freeze_setup()
is later cast away, so it was not correct. Remove it and add a comment
explaining that presult should not be modified.
Author: Peter Eisentraut <peter@eisentraut.org>
Reviewed-by: Melanie Plageman <melanieplageman@gmail.com>
Discussion: https://postgr.es/m/fb97d0ae-a0bc-411d-8a87-f84e7e146488%40eisentraut.org M src/backend/access/heap/pruneheap.c
doc: Update header file mention for CompareType
commit : b39013b7b1b116b5d9be51f0919b472b58b3a28d
author : Daniel Gustafsson <dgustafsson@postgresql.org>
date : Tue, 16 Dec 2025 09:46:53 +0100
committer: Daniel Gustafsson <dgustafsson@postgresql.org>
date : Tue, 16 Dec 2025 09:46:53 +0100 Commit 119fc30 moved CompareType to cmptype.h but the mention in
the docs still refered to primnodes.h
Author: Daisuke Higuchi <higuchi.daisuke11@gmail.com>
Reviewed-by: Paul A Jungwirth <pj@illuminatedcomputing.com>
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>
Discussion: https://postgr.es/m/CAEVT6c8guXe5P=L_Un5NUUzCgEgbHnNcP+Y3TV2WbQh-xjiwqA@mail.gmail.com
Backpatch-through: 18 M doc/src/sgml/gist.sgml
Separate out bytea sort support from varlena.c
commit : 9303d62c6db0207b8c2649205f7bc9350c1f62db
author : John Naylor <john.naylor@postgresql.org>
date : Tue, 16 Dec 2025 15:19:16 +0700
committer: John Naylor <john.naylor@postgresql.org>
date : Tue, 16 Dec 2025 15:19:16 +0700 In the wake of commit b45242fd3, bytea_sortsupport() still called out
to varstr_sortsupport(). Treating bytea as a kind of text/varchar
required varstr_sortsupport() to allow for the possibility of
NUL bytes, but only for C collation. This was confusing. For
better separation of concerns, create an independent sortsupport
implementation in bytea.c.
The heuristics for bytea_abbrev_abort() remain the same as for
varstr_abbrev_abort(). It's possible that the bytea case warrants
different treatment, but that is left for future investigation.
In passing, adjust some strange looking comparisons in
varstr_abbrev_abort().
Author: Aleksander Alekseev <aleksander@tigerdata.com>
Reviewed-by: John Naylor <johncnaylorls@gmail.com>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://postgr.es/m/CAJ7c6TP1bAbEhUJa6+rgceN6QJWMSsxhg1=mqfSN=Nb-n6DAKg@mail.gmail.com M src/backend/utils/adt/bytea.c
M src/backend/utils/adt/varlena.c
M src/tools/pgindent/typedefs.list
Add TAP test to check recovery when redo LSN is missing
commit : 15f68cebdcecf5a5508aaa12780526232c13c3f0
author : Michael Paquier <michael@paquier.xyz>
date : Tue, 16 Dec 2025 14:28:05 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Tue, 16 Dec 2025 14:28:05 +0900 This commit provides test coverage for dc7c77f825d7, where the redo
record and the checkpoint record finish on different WAL segments with
the start of recovery able to detect that the redo record is missing.
This test uses a wait injection point done in the critical section of a
checkpoint, method that requires not one but actually two wait injection
points to avoid any memory allocations within the critical section of
the checkpoint:
- Checkpoint run with a background psql.
- One first wait point is run by the checkpointer before the critical
section, allocating the shared memory required by the DSM registry for
the wait machinery in the library injection_points.
- First point is woken up.
- Second wait point is loaded before the critical section, allocating
the memory to build the path to the library loaded, then run in the
critical section once the checkpoint redo record has been logged.
- WAL segment is switched while waiting on the second point.
- Checkpoint completes.
- Stop cluster with immediate mode.
- The segment that includes the redo record is removed.
- Start, recovery fails as the redo record cannot be found.
The error message introduced in dc7c77f825d7 is now reduced to a FATAL,
meaning that the information is still provided while being able to use a
test for it. Nitin has provided a basic version of the test, that I
have enhanced to make it portable with two points. Without
dc7c77f825d7, the cluster crashes in this test, not on a PANIC but due
to the pointer dereference at the beginning of recovery, failure
mentioned in the other commit.
Author: Nitin Jadhav <nitinjadhavpostgres@gmail.com>
Co-authored-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://postgr.es/m/CAMm1aWaaJi2w49c0RiaDBfhdCL6ztbr9m=daGqiOuVdizYWYaA@mail.gmail.com M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogrecovery.c
M src/test/recovery/meson.build
A src/test/recovery/t/050_redo_segment_missing.pl
Fail recovery when missing redo checkpoint record without backup_label
commit : dc7c77f825d778cd49d35544c21e7efe1cd240af
author : Michael Paquier <michael@paquier.xyz>
date : Tue, 16 Dec 2025 13:29:28 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Tue, 16 Dec 2025 13:29:28 +0900 This commit adds an extra check at the beginning of recovery to ensure
that the redo record of a checkpoint exists before attempting WAL
replay, logging a PANIC if the redo record referenced by the checkpoint
record could not be found. This is the same level of failure as when a
checkpoint record is missing. This check is added when a cluster is
started without a backup_label, after retrieving its checkpoint record.
The redo LSN used for the check is retrieved from the checkpoint record
successfully read.
In the case where a backup_label exists, the startup process already
fails if the redo record cannot be found after reading a checkpoint
record at the beginning of recovery.
Previously, the presence of the redo record was not checked. If the
redo and checkpoint records were located on different WAL segments, it
would be possible to miss a entire range of WAL records that should have
been replayed but were just ignored. The consequences of missing the
redo record depend on the version dealt with, these becoming worse the
older the version used:
- On HEAD, v18 and v17, recovery fails with a pointer dereference at the
beginning of the redo loop, as the redo record is expected but cannot be
found. These versions are good students, because we detect a failure
before doing anything, even if the failure is misleading in the shape of
a segmentation fault, giving no information that the redo record is
missing.
- In v16 and v15, problems show at the end of recovery within
FinishWalRecovery(), the startup process using a buggy LSN to decide
from where to start writing WAL. The cluster gets corrupted, still it
is noisy about it.
- v14 and older versions are worse: a cluster gets corrupted but it is
entirely silent about the matter. The redo record missing causes the
startup process to skip entirely recovery, because a missing record is
the same as not redo being required at all. This leads to data loss, as
everything is missed between the redo record and the checkpoint record.
Note that I have tested that down to 9.4, reproducing the issue with a
version of the author's reproducer slightly modified. The code is wrong
since at least 9.2, but I did not look at the exact point of origin.
This problem has been found by debugging a cluster where the WAL segment
including the redo segment was missing due to an operator error, leading
to a crash, based on an investigation in v15.
Requesting archive recovery with the creation of a recovery.signal or
a standby.signal even without a backup_label would mitigate the issue:
if the record cannot be found in pg_wal/, the missing segment can be
retrieved with a restore_command when checking that the redo record
exists. This was already the case without this commit, where recovery
would re-fetch the WAL segment that includes the redo record. The check
introduced by this commit makes the segment to be retrieved earlier to
make sure that the redo record can be found.
On HEAD, the code will be slightly changed in a follow-up commit to not
rely on a PANIC, to include a test able to emulate the original problem.
This is a minimal backpatchable fix, kept separated for clarity.
Reported-by: Andres Freund <andres@anarazel.de>
Analyzed-by: Andres Freund <andres@anarazel.de>
Author: Nitin Jadhav <nitinjadhavpostgres@gmail.com>
Discussion: https://postgr.es/m/20231023232145.cmqe73stvivsmlhs@awork3.anarazel.de
Discussion: https://postgr.es/m/CAMm1aWaaJi2w49c0RiaDBfhdCL6ztbr9m=daGqiOuVdizYWYaA@mail.gmail.com
Backpatch-through: 14 M src/backend/access/transam/xlogrecovery.c
Revert "Avoid requiring Spanish locale to test NLS infrastructure."
commit : 84a3778c79c2d28b4dc281d03ef2ab019b16483b
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Mon, 15 Dec 2025 18:36:29 -0500
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Mon, 15 Dec 2025 18:36:29 -0500 This reverts commit 7db6809ced4406257a80766e4109c8be8e1ea744.
That doesn't seem to work with recent (last couple of years)
glibc, and the reasons are obscure. I can't let the farm stay
this broken for long. M src/test/regress/expected/nls.out
M src/test/regress/expected/nls_1.out
A src/test/regress/expected/nls_2.out
D src/test/regress/po/C.po
M src/test/regress/po/LINGUAS
A src/test/regress/po/es.po
M src/test/regress/regress.c
M src/test/regress/sql/nls.sql
libpq: Align oauth_json_set_error() with other NLS patterns
commit : f7fbd02d32c46ee1cada6c3faf94414657b7a19a
author : Jacob Champion <jchampion@postgresql.org>
date : Mon, 15 Dec 2025 13:22:04 -0800
committer: Jacob Champion <jchampion@postgresql.org>
date : Mon, 15 Dec 2025 13:22:04 -0800 Now that the prior commits have fixed missing OAuth translations, pull
the bespoke usage of libpq_gettext() for OAUTHBEARER parsing into
oauth_json_set_error() itself, and make that a gettext trigger as well,
to better match what the other sites are doing. Add an _internal()
variant to handle the existing untranslated case.
Suggested-by: Daniel Gustafsson <daniel@yesql.se>
Reviewed-by: Álvaro Herrera <alvherre@kurilemu.de>
Discussion: https://postgr.es/m/0EEBCAA8-A5AC-4E3B-BABA-0BA7A08C361B%40yesql.se
Backpatch-through: 18 M src/interfaces/libpq/fe-auth-oauth.c
M src/interfaces/libpq/nls.mk
libpq-oauth: Don't translate internal errors
commit : 301a1dcf00c82350aad642b872d263730cd87f8f
author : Jacob Champion <jchampion@postgresql.org>
date : Mon, 15 Dec 2025 13:21:00 -0800
committer: Jacob Champion <jchampion@postgresql.org>
date : Mon, 15 Dec 2025 13:21:00 -0800 Some error messages are generated when OAuth multiplexer operations fail
unexpectedly in the client. Álvaro pointed out that these are both
difficult to translate idiomatically (as they use internal terminology
heavily) and of dubious translation value to end users (since they're
going to need to get developer help anyway). The response parsing engine
has a similar issue.
Remove these from the translation files by introducing internal variants
of actx_error() and oauth_parse_set_error().
Suggested-by: Álvaro Herrera <alvherre@kurilemu.de>
Reviewed-by: Álvaro Herrera <alvherre@kurilemu.de>
Discussion: https://postgr.es/m/CAOYmi%2BkQQ8vpRcoSrA5EQ98Wa3G6jFj1yRHs6mh1V7ohkTC7JA%40mail.gmail.com
Backpatch-through: 18 M src/interfaces/libpq-oauth/oauth-curl.c
libpq: Add missing OAuth translations
commit : ea3370b18ebea536a100ae6dce25add3f5eb6565
author : Jacob Champion <jchampion@postgresql.org>
date : Mon, 15 Dec 2025 13:17:10 -0800
committer: Jacob Champion <jchampion@postgresql.org>
date : Mon, 15 Dec 2025 13:17:10 -0800 Several strings that should have been translated as they passed through
libpq_gettext were not actually being pulled into the translation files,
because I hadn't directly wrapped them in one of the GETTEXT_TRIGGERS.
Move the responsibility for calling libpq_gettext() to the code that
sets actx->errctx. Doing the same in report_type_mismatch() would result
in double-translation, so mark those strings with gettext_noop()
instead. And wrap two ternary operands with gettext_noop(), even though
they're already in one of the triggers, since xgettext sees only the
first.
Finally, fe-auth-oauth.c was missing from nls.mk, so none of that file
was being translated at all. Add it now.
Original patch by Zhijie Hou, plus suggested tweaks by Álvaro Herrera
and small additions by me.
Reported-by: Zhijie Hou <houzj.fnst@fujitsu.com>
Author: Zhijie Hou <houzj.fnst@fujitsu.com>
Co-authored-by: Álvaro Herrera <alvherre@kurilemu.de>
Co-authored-by: Jacob Champion <jacob.champion@enterprisedb.com>
Reviewed-by: Álvaro Herrera <alvherre@kurilemu.de>
Discussion: https://postgr.es/m/TY4PR01MB1690746DB91991D1E9A47F57E94CDA%40TY4PR01MB16907.jpnprd01.prod.outlook.com
Backpatch-through: 18 M src/interfaces/libpq-oauth/oauth-curl.c
M src/interfaces/libpq/nls.mk
Allow passing a pointer to GetNamedDSMSegment()'s init callback.
commit : 48d4a1423d2e92d10077365532d92e059ba2eb2e
author : Nathan Bossart <nathan@postgresql.org>
date : Mon, 15 Dec 2025 14:27:16 -0600
committer: Nathan Bossart <nathan@postgresql.org>
date : Mon, 15 Dec 2025 14:27:16 -0600 This commit adds a new "void *arg" parameter to
GetNamedDSMSegment() that is passed to the initialization callback
function. This is useful for reusing an initialization callback
function for multiple DSM segments.
Author: Zsolt Parragi <zsolt.parragi@percona.com>
Reviewed-by: Sami Imseih <samimseih@gmail.com>
Discussion: https://postgr.es/m/CAN4CZFMjh8TrT9ZhWgjVTzBDkYZi2a84BnZ8bM%2BfLPuq7Cirzg%40mail.gmail.com M contrib/pg_prewarm/autoprewarm.c
M doc/src/sgml/xfunc.sgml
M src/backend/storage/ipc/dsm_registry.c
M src/include/storage/dsm_registry.h
M src/test/modules/injection_points/injection_points.c
M src/test/modules/test_dsa/test_dsa.c
M src/test/modules/test_dsm_registry/test_dsm_registry.c
Revisit cosmetics of "For inplace update, send nontransactional invalidations."
commit : 64bf53dd61ea3224020bb340725a4df6a27bc974
author : Noah Misch <noah@leadboat.com>
date : Mon, 15 Dec 2025 12:19:49 -0800
committer: Noah Misch <noah@leadboat.com>
date : Mon, 15 Dec 2025 12:19:49 -0800 This removes a never-used CacheInvalidateHeapTupleInplace() parameter.
It adds README content about inplace update visibility in logical
decoding. It rewrites other comments.
Back-patch to v18, where commit 243e9b40f1b2dd09d6e5bf91ebf6e822a2cd3704
first appeared. Since this removes a CacheInvalidateHeapTupleInplace()
parameter, expect a v18 ".abi-compliance-history" edit to follow. PGXN
contains no calls to that function.
Reported-by: Paul A Jungwirth <pj@illuminatedcomputing.com>
Reported-by: Ilyasov Ian <ianilyasov@outlook.com>
Reviewed-by: Paul A Jungwirth <pj@illuminatedcomputing.com>
Reviewed-by: Surya Poondla <s_poondla@apple.com>
Discussion: https://postgr.es/m/CA+renyU+LGLvCqS0=fHit-N1J-2=2_mPK97AQxvcfKm+F-DxJA@mail.gmail.com
Backpatch-through: 18 M src/backend/access/heap/README.tuplock
M src/backend/access/heap/heapam.c
M src/backend/replication/logical/decode.c
M src/backend/utils/cache/inval.c
M src/include/utils/inval.h
Correct comments of "Fix data loss at inplace update after heap_update()".
commit : 0839fbe400d7807196d1442f4c781f9234ac2a4c
author : Noah Misch <noah@leadboat.com>
date : Mon, 15 Dec 2025 12:19:49 -0800
committer: Noah Misch <noah@leadboat.com>
date : Mon, 15 Dec 2025 12:19:49 -0800 This corrects commit a07e03fd8fa7daf4d1356f7cb501ffe784ea6257.
Reported-by: Paul A Jungwirth <pj@illuminatedcomputing.com>
Reported-by: Surya Poondla <s_poondla@apple.com>
Reviewed-by: Paul A Jungwirth <pj@illuminatedcomputing.com>
Discussion: https://postgr.es/m/CA+renyWCW+_2QvXERBQ+mna6ANwAVXXmHKCA-WzL04bZRsjoBA@mail.gmail.com M src/backend/access/heap/heapam.c
M src/backend/access/index/genam.c
Avoid requiring Spanish locale to test NLS infrastructure.
commit : 7db6809ced4406257a80766e4109c8be8e1ea744
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Mon, 15 Dec 2025 15:16:26 -0500
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Mon, 15 Dec 2025 15:16:26 -0500 I had supposed that the majority of machines with gettext installed
would have most language locales installed, but at least in the
buildfarm it turns out less than half have es_ES installed. So
depending on that to run the test now seems like a bad idea. But it
turns out that gettext can be persuaded to "translate" even in the C
locale, as long as you fake out its short-circuit logic by spelling
the locale name like "C.UTF-8" or similar. (Many thanks to Bryan
Green for correcting my misconceptions about that.) Quick testing
suggests that that spelling is accepted by most platforms, though
again the buildfarm may show that "most" isn't "all".
Hence, remove the es_ES dependency and instead create a "C" message
catalog. I've made the test unconditionally set lc_messages to
'C.UTF-8'. That approach might need adjustment depending on what
the buildfarm shows, but let's keep it simple until proven wrong.
While at it, tweak the test so that we run the various ereport's
even when !ENABLE_NLS. This is useful to verify that the macros
provided by <inttypes.h> are compatible with snprintf.c, as we
now know is worth questioning.
Discussion: https://postgr.es/m/1991599.1765818338@sss.pgh.pa.us M src/test/regress/expected/nls.out
M src/test/regress/expected/nls_1.out
D src/test/regress/expected/nls_2.out
A src/test/regress/po/C.po
M src/test/regress/po/LINGUAS
D src/test/regress/po/es.po
M src/test/regress/regress.c
M src/test/regress/sql/nls.sql
Remove incorrect declarations in pg_wchar.h.
commit : 95a19fefdcbe8d7c511971fe3b9554d0bdd4e26a
author : Jeff Davis <jdavis@postgresql.org>
date : Mon, 15 Dec 2025 10:38:55 -0800
committer: Jeff Davis <jdavis@postgresql.org>
date : Mon, 15 Dec 2025 10:38:55 -0800 Oversight in commit 9acae56ce0.
Discussion: https://postgr.es/m/541F240E-94AD-4D65-9794-7D6C316BC3FF@gmail.com M src/include/mb/pg_wchar.h
Remove unused single-byte char_is_cased() API.
commit : 54c41a6deb9df0868da078490ef9c26d1290e490
author : Jeff Davis <jdavis@postgresql.org>
date : Mon, 15 Dec 2025 10:24:57 -0800
committer: Jeff Davis <jdavis@postgresql.org>
date : Mon, 15 Dec 2025 10:24:57 -0800 https://postgr.es/m/450ceb6260cad30d7afdf155d991a9caafee7c0d.camel@j-davis.com M src/backend/utils/adt/pg_locale.c
M src/backend/utils/adt/pg_locale_builtin.c
M src/backend/utils/adt/pg_locale_icu.c
M src/backend/utils/adt/pg_locale_libc.c
M src/include/utils/pg_locale.h
Use multibyte-aware extraction of pattern prefixes.
commit : 9c8de1596912b36a8b22d880766ac660b66d03c7
author : Jeff Davis <jdavis@postgresql.org>
date : Mon, 15 Dec 2025 10:24:47 -0800
committer: Jeff Davis <jdavis@postgresql.org>
date : Mon, 15 Dec 2025 10:24:47 -0800 Previously, like_fixed_prefix() used char-at-a-time logic, which
forced it to be too conservative for case-insensitive matching.
Introduce like_fixed_prefix_ci(), and use that for case-insensitive
pattern prefixes. It uses multibyte and locale-aware logic, along with
the new pg_iswcased() API introduced in 630706ced0.
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Discussion: https://postgr.es/m/450ceb6260cad30d7afdf155d991a9caafee7c0d.camel@j-davis.com M src/backend/utils/adt/like_support.c
Add offnum range checks to suppress compile warnings with UBSAN.
commit : 8191937082a2d4738afc7a232ac08789eea151a3
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Mon, 15 Dec 2025 12:40:09 -0500
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Mon, 15 Dec 2025 12:40:09 -0500 Late-model gcc with -fsanitize=undefined enabled issues warnings
about uses of PageGetItemId() when it can't prove that the
offsetNumber is > 0. The call sites where this happens are
checking that the offnum is <= PageGetMaxOffsetNumber(page), so
it seems reasonable to add an explicit check that offnum >= 1 too.
While at it, rearrange the code to be less contorted and avoid
duplicate checks on PageGetMaxOffsetNumber. Maybe the compiler
would optimize away the duplicate logic or maybe not, but the
existing coding has little to recommend it anyway.
There are multiple instances of this identical coding pattern in
heapam.c and heapam_xlog.c. Current gcc only complains about two
of them, but I fixed them all in the name of consistency.
Potentially this could be back-patched in the name of silencing
warnings; but I think enabling UBSAN is mainly something people
would do on HEAD, so for now it seems not worth the trouble.
Discussion: https://postgr.es/m/1699806.1765746897@sss.pgh.pa.us M src/backend/access/heap/heapam.c
M src/backend/access/heap/heapam_xlog.c
M src/backend/access/nbtree/nbtsearch.c
Increase timeout in multixid_conversion upgrade test
commit : bd43940b02b292c836e912a8f9423f771ec15fab
author : Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Mon, 15 Dec 2025 18:06:24 +0200
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Mon, 15 Dec 2025 18:06:24 +0200 The workload to generate multixids before upgrade is very slow on
buildfarm members running with JIT enabled. The workload runs a lot of
small queries, so it's unsurprising that JIT makes it slower. On my
laptop it nevertheless runs in under 10 s even with JIT enabled, while
some buildfarm members have been hitting the 180 s timeout. That seems
extreme, but I suppose it's still expected on very slow and busy
buildfarm animals. The timeout applies to the BackgroundPsql sessions
as whole rather than the individual queries.
Bump up the timeout to avoid the test failures. Add periodic progress
reports to the test output so that we get a better picture of just how
slow the test is.
In the passing, also fix comments about how many multixids and members
the workload generates. The comments were written based on 10 parallel
connections, but it actually uses 20.
Discussion: https://www.postgresql.org/message-id/b7faf07c-7d2c-4f35-8c43-392e057153ef@gmail.com M src/bin/pg_upgrade/t/007_multixact_conversion.pl
Improve sanity checks on multixid members length
commit : ecb553ae8211e3d135e0c9d42b90cc22be51d27c
author : Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Mon, 15 Dec 2025 13:30:17 +0200
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Mon, 15 Dec 2025 13:30:17 +0200 In the server, check explicitly for multixids with zero members. We
used to have an assertion for it, but commit d4b7bde418 replaced it
with more extensive runtime checks, but it missed the original case of
zero members.
In the upgrade code, a negative length never makes sense, so better
check for it explicitly. Commit d4b7bde418 added a similar sanity
check to the corresponding server code on master, and in backbranches,
the 'length' is passed to palloc which would fail with "invalid memory
alloc request size" error. Clarify the comments on what kind of
invalid entries are tolerated by the upgrade code and which ones are
reported as fatal errors.
Coverity complained about 'length' in the upgrade code being
tainted. That's bogus because we trust the data on disk at least to
some extent, but hopefully this will silence the complaint. If not,
I'll dismiss it manually.
Discussion: https://www.postgresql.org/message-id/7b505284-c6e9-4c80-a7ee-816493170abc@iki.fi M src/backend/access/transam/multixact.c
M src/bin/pg_upgrade/multixact_read_v18.c
Disable recently added CIC/RI isolation tests
commit : 77038d6d0b49622e719fc00ed46db0ab47d2b747
author : Álvaro Herrera <alvherre@kurilemu.de>
date : Mon, 15 Dec 2025 12:17:37 +0100
committer: Álvaro Herrera <alvherre@kurilemu.de>
date : Mon, 15 Dec 2025 12:17:37 +0100 We have tried to stabilize them several times already, but they are very
flaky -- apparently there's some intrinsic instability that's hard to
solve with the isolationtester framework. They are very noisy in CI
runs (whereas buildfarm has not registered any such failures). They may
need to be rewritten completely. In the meantime just comment them out
in Makefile/meson.build, leaving the spec files around.
Per complaint from Andres Freund.
Discussion: https://postgr.es/m/202512112014.icpomgc37zx4@alvherre.pgsql M src/test/modules/injection_points/Makefile
M src/test/modules/injection_points/meson.build
Refactor static_assert() support.
commit : 17f446784d54da827f74c2acc0fa772a41b92354
author : Peter Eisentraut <peter@eisentraut.org>
date : Mon, 15 Dec 2025 11:43:11 +0100
committer: Peter Eisentraut <peter@eisentraut.org>
date : Mon, 15 Dec 2025 11:43:11 +0100 HAVE__STATIC_ASSERT was really a test for GCC statement expressions,
as needed for StaticAssertExpr() now that _Static_assert could be
assumed to be available through our C11 requirement. This
artificially prevented Visual Studio from being able to use
static_assert() in other contexts.
Instead, make a new test for HAVE_STATEMENT_EXPRESSIONS, and use that
to control only whether StaticAssertExpr() uses fallback code, not the
other variants. This improves the quality of failure messages in the
(much more common) other variants under Visual Studio.
Also get rid of the two separate implementations for C++, since the C
implementation is also also valid as C++11. While it is a stretch to
apply HAVE_STATEMENT_EXPRESSIONS tested with $CC to a C++ compiler,
the previous C++ coding assumed that the C++ compiler had them
unconditionally, so it isn't a new stretch. In practice, the C and
C++ compilers are very likely to agree, and if a combination is ever
reported that falsifies this assumption we can always reconsider that.
Author: Thomas Munro <thomas.munro@gmail.com>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://postgr.es/m/CA%2BhUKGKvr0x_oGmQTUkx%3DODgSksT2EtgCA6LmGx_jQFG%3DsDUpg%40mail.gmail.com M config/c-compiler.m4
M configure
M configure.ac
M meson.build
M src/include/c.h
M src/include/pg_config.h.in
Clarify comment on multixid offset wraparound check
commit : 366dcdaf5779792f522d1d18a8e558244850afdf
author : Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Mon, 15 Dec 2025 11:47:04 +0200
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Mon, 15 Dec 2025 11:47:04 +0200 Coverity complained that offset cannot be 0 here because there's an
explicit check for "offset == 0" earlier in the function, but it
didn't see the possibility that offset could've wrapped around to 0.
The code is correct, but clarify the comment about it.
The same code exists in backbranches in the server
GetMultiXactIdMembers() function and in 'master' in the pg_upgrade
GetOldMultiXactIdSingleMember function. In backbranches Coverity
didn't complain about it because the check was merely an assertion,
but change the comment in all supported branches for consistency.
Per Tom Lane's suggestion.
Discussion: https://www.postgresql.org/message-id/1827755.1765752936@sss.pgh.pa.us M src/bin/pg_upgrade/multixact_read_v18.c
Fix typo in tablecmds.c
commit : cd83ed9a91bbd4d05fffd059161b060b7473f5ad
author : David Rowley <drowley@postgresql.org>
date : Mon, 15 Dec 2025 17:17:04 +1300
committer: David Rowley <drowley@postgresql.org>
date : Mon, 15 Dec 2025 17:17:04 +1300 Author: Chao Li <li.evan.chao@gmail.com>
Discussion: https://postgr.es/m/CAEoWx2%3DAib%2BcatZn6wHKmz0BWe8-q10NAhpxu8wUDT19SddKNA%40mail.gmail.com M src/backend/commands/tablecmds.c
Add retry logic to pg_sync_replication_slots().
commit : 0d2d4a0ec3eca64e7f5ce7f7630b56a561b2663c
author : Amit Kapila <akapila@postgresql.org>
date : Mon, 15 Dec 2025 02:50:21 +0000
committer: Amit Kapila <akapila@postgresql.org>
date : Mon, 15 Dec 2025 02:50:21 +0000 Previously, pg_sync_replication_slots() would finish without synchronizing
slots that didn't meet requirements, rather than failing outright. This
could leave some failover slots unsynchronized if required catalog rows or
WAL segments were missing or at risk of removal, while the standby
continued removing needed data.
To address this, the function now waits for the primary slot to advance to
a position where all required data is available on the standby before
completing synchronization. It retries cyclically until all failover slots
that existed on the primary at the start of the call are synchronized.
Slots created after the function begins are not included. If the standby
is promoted during this wait, the function exits gracefully and the
temporary slots will be removed.
Author: Ajin Cherian <itsajin@gmail.com>
Author: Hou Zhijie <houzj.fnst@fujitsu.com>
Reviewed-by: Shveta Malik <shveta.malik@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>
Reviewed-by: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>
Reviewed-by: Ashutosh Sharma <ashu.coek88@gmail.com>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Yilin Zhang <jiezhilove@126.com>
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>
Discussion: https://postgr.es/m/CAFPTHDZAA%2BgWDntpa5ucqKKba41%3DtXmoXqN3q4rpjO9cdxgQrw%40mail.gmail.com M doc/src/sgml/func/func-admin.sgml
M doc/src/sgml/logicaldecoding.sgml
M src/backend/replication/logical/slotsync.c
M src/backend/utils/activity/wait_event_names.txt
M src/test/recovery/t/040_standby_failover_slots_sync.pl
test_custom_stats: Fix compilation warning
commit : 33980eaa6df0b1358ba2e70edbe9efd56dbd7fa6
author : Michael Paquier <michael@paquier.xyz>
date : Mon, 15 Dec 2025 10:34:18 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Mon, 15 Dec 2025 10:34:18 +0900 I have fat-fingered an error message related to an offset while
switching the code to use pgoff_t. Let's switch to the same error
message used in the rest of the tree for similar failures with fseeko(),
instead.
Per buildfarm members running macos: longfin, sifaka and indri. M src/test/modules/test_custom_stats/test_custom_var_stats.c
pageinspect: use index_close() for GiST index relation
commit : 171198ff2a57fafe0772ec9d3dfbf061cffffacd
author : Michael Paquier <michael@paquier.xyz>
date : Mon, 15 Dec 2025 10:28:28 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Mon, 15 Dec 2025 10:28:28 +0900 gist_page_items() opens its target relation with index_open(), but
closed it using relation_close() instead of index_close(). This was
harmless because index_close() and relation_close() do the exact same
work, still inconsistent with the rest of the code tree as routines
opening and closing a relation based on a relkind are expected to match,
at least in name.
Author: Chao Li <li.evan.chao@gmail.com>
Discussion: https://postgr.es/m/CAEoWx2=bL41WWcD-4Fxx-buS2Y2G5=9PjkxZbHeFMR6Uy2WNvw@mail.gmail.com M contrib/pageinspect/gistfuncs.c
test_custom_stats: Add tests with read/write of auxiliary data
commit : 481783e69f144936f1ebbc3259809bee518c6c0c
author : Michael Paquier <michael@paquier.xyz>
date : Mon, 15 Dec 2025 09:47:30 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Mon, 15 Dec 2025 09:47:30 +0900 This commit builds upon 4ba012a8ed9c, giving an example of what can be
achieved with the new callbacks. This provides coverage for the new
pgstats APIs, while serving as a reference template.
Note that built-in stats kinds could use them, we just don't have a
use-case there yet.
Author: Sami Imseih <samimseih@gmail.com>
Co-authored-by: Michael Paquier <michael@paquier.xyz>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://postgr.es/m/CAA5RZ0s9SDOu+Z6veoJCHWk+kDeTktAtC-KY9fQ9Z6BJdDUirQ@mail.gmail.com M src/test/modules/test_custom_stats/t/001_custom_stats.pl
M src/test/modules/test_custom_stats/test_custom_var_stats–1.0.sql
M src/test/modules/test_custom_stats/test_custom_var_stats.c
Allow cumulative statistics to read/write auxiliary data from/to disk
commit : 4ba012a8ed9c4214bd35b221c087f02efb1ac424
author : Michael Paquier <michael@paquier.xyz>
date : Mon, 15 Dec 2025 09:40:56 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Mon, 15 Dec 2025 09:40:56 +0900 Cumulative stats kinds gain the capability to write additional per-entry
data when flushing the stats at shutdown, and read this data when
loading back the stats at startup. This can be fit for example in the
case of variable-length data (like normalized query strings), so as it
becomes possible to link the shared memory stats entries to data that is
stored in a different area, like a DSA segment.
Three new optional callbacks are added to PgStat_KindInfo, available to
variable-numbered stats kinds:
* to_serialized_data: writes auxiliary data for an entry.
* from_serialized_data: reads auxiliary data for an entry.
* finish: performs actions after read/write/discard operations. This is
invoked after processing all the entries of a kind, allowing extensions
to close file handles and clean up resources.
Stats kinds have the option to store this data in the existing pgstats
file, but can as well store it in one or more additional files whose
names can be built upon the entry keys. The new serialized callbacks
are called once an entry key is read or written from the main stats
file. A file descriptor to the main pgstats file is available in the
arguments of the callbacks.
Author: Sami Imseih <samimseih@gmail.com>
Co-authored-by: Michael Paquier <michael@paquier.xyz>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://postgr.es/m/CAA5RZ0s9SDOu+Z6veoJCHWk+kDeTktAtC-KY9fQ9Z6BJdDUirQ@mail.gmail.com M src/backend/utils/activity/pgstat.c
M src/include/utils/pgstat_internal.h
M src/tools/pgindent/typedefs.list
Update typedefs.list to match what the buildfarm currently reports.
commit : 58dad7f349b3fdbadda6bead21d596a448db1950
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Sun, 14 Dec 2025 17:03:53 -0500
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Sun, 14 Dec 2025 17:03:53 -0500 The current list from the buildfarm includes quite a few typedef
names that it used to miss. The reason is a bit obscure, but it
seems likely to have something to do with our recent increased
use of palloc_object and palloc_array. In any case, this makes
the relevant struct declarations be much more nicely formatted,
so I'll take it. Install the current list and re-run pgindent
to update affected code.
Syncing with the current list also removes some obsolete
typedef names and fixes some alphabetization errors.
Discussion: https://postgr.es/m/1681301.1765742268@sss.pgh.pa.us M src/backend/access/heap/rewriteheap.c
M src/backend/access/transam/twophase.c
M src/backend/executor/nodeWindowAgg.c
M src/backend/partitioning/partdesc.c
M src/backend/utils/adt/arrayfuncs.c
M src/include/access/gin_private.h
M src/include/access/heapam.h
M src/include/access/relscan.h
M src/include/executor/nodeAgg.h
M src/include/nodes/execnodes.h
M src/include/nodes/pathnodes.h
M src/include/utils/skipsupport.h
M src/include/utils/tuplesort.h
M src/test/modules/test_int128/test_int128.c
M src/tools/pgindent/typedefs.list
Make "pgoff_t" be a typedef not a #define.
commit : 66b2282b0c2237bccd933804da2e1dd0321ac151
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Sun, 14 Dec 2025 16:53:34 -0500
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Sun, 14 Dec 2025 16:53:34 -0500 There doesn't seem to be any great reason why this has been a macro
rather than a typedef. But doing it like that means our buildfarm
typedef tooling doesn't capture the name as a typedef. That would
result in pgindent glitches, except that we've seemingly kept it
in typedefs.list manually. That's obviously error-prone, so let's
convert it to a typedef now.
Discussion: https://postgr.es/m/1681301.1765742268@sss.pgh.pa.us M src/include/port.h
M src/include/port/win32_port.h
Looks like we can't test NLS on machines that lack any es_ES locale.
commit : fe7ede45f125af271fb3fef3cc5ee507d4c40d87
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Sun, 14 Dec 2025 14:30:34 -0500
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Sun, 14 Dec 2025 14:30:34 -0500 While commit 5b275a6e1 fixed a few unhappy buildfarm animals,
it looks like the remainder simply don't have any es_ES locale
at all. There's little point in running the test in that case,
so minimize the number of variant expected-files by bailing out.
Also emit a log entry so that it's possible to tell from buildfarm
postmaster logs which case occurred.
Possibly, the scope of this testing could be improved by providing
additional translations. But I think it's likely that the failing
animals have no non-C locales installed at all.
In passing, update typedefs.list so that koel doesn't think
regress.c is misformatted.
Discussion: https://postgr.es/m/E1vUpNU-000kcQ-1D@gemulon.postgresql.org M src/test/regress/expected/nls.out
M src/test/regress/expected/nls_1.out
A src/test/regress/expected/nls_2.out
M src/test/regress/sql/nls.sql
M src/tools/pgindent/typedefs.list
bufmgr: Add one-entry cache for private refcount
commit : 30df61990c67f0cf7450e36c1e038d513960f148
author : Andres Freund <andres@anarazel.de>
date : Sun, 14 Dec 2025 13:09:43 -0500
committer: Andres Freund <andres@anarazel.de>
date : Sun, 14 Dec 2025 13:09:43 -0500 The private refcount entry for a buffer is often looked up repeatedly for the
same buffer, e.g. to pin and then unpin a buffer. Benchmarking shows that it's
worthwhile to have a one-entry cache for that case. With that cache in place,
it's worth splitting GetPrivateRefCountEntry() into a small inline
portion (for the cache hit case) and an out-of-line helper for the rest.
This is helpful for some workloads today, but becomes more important in an
upcoming patch that will utilize the private refcount infrastructure to also
store whether the buffer is currently locked, as that increases the rate of
lookups substantially.
Reviewed-by: Melanie Plageman <melanieplageman@gmail.com>
Discussion: https://postgr.es/m/6rgb2nvhyvnszz4ul3wfzlf5rheb2kkwrglthnna7qhe24onwr@vw27225tkyar M src/backend/storage/buffer/bufmgr.c
bufmgr: Separate keys for private refcount infrastructure
commit : edbaaea0a95ef1c32ffe8aa62e1556588c7a714b
author : Andres Freund <andres@anarazel.de>
date : Sun, 14 Dec 2025 13:09:43 -0500
committer: Andres Freund <andres@anarazel.de>
date : Sun, 14 Dec 2025 13:09:43 -0500 This makes lookups faster, due to allowing auto-vectorized lookups. It is also
beneficial for an upcoming patch, independent of auto-vectorization, as the
upcoming patch wants to track more information for each pinned buffer, making
the existing loop, iterating over an array of PrivateRefCountEntry, more
expensive due to increasing its size.
Reviewed-by: Melanie Plageman <melanieplageman@gmail.com>
Discussion: https://postgr.es/m/fvfmkr5kk4nyex56ejgxj3uzi63isfxovp2biecb4bspbjrze7@az2pljabhnff M src/backend/storage/buffer/bufmgr.c
M src/tools/pgindent/typedefs.list
Try a few different locale name spellings in nls.sql.
commit : 5b275a6e154833803d3beb49da0879d2fe8b1d6c
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Sun, 14 Dec 2025 12:54:57 -0500
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Sun, 14 Dec 2025 12:54:57 -0500 While CI testing in advance of commit 8c498479d suggested that all
Unix-ish platforms would accept 'es_ES.UTF-8', the buildfarm has
a different opinion. Let's dynamically select something that works,
if possible.
Discussion: https://postgr.es/m/E1vUpNU-000kcQ-1D@gemulon.postgresql.org M src/test/regress/expected/nls.out
M src/test/regress/expected/nls_1.out
M src/test/regress/sql/nls.sql
Fix double assignment.
commit : b853e644d78d99ef1779c9bf7bc3944694460aa2
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Sun, 14 Dec 2025 12:09:56 -0500
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Sun, 14 Dec 2025 12:09:56 -0500 Coverity complained about this, not without reason:
OldMultiXactReader *state = state = pg_malloc(sizeof(*state));
(I'm surprised this is even legal C ... why is "state" in-scope
in its initialization expression?)
While at it, convert to use our newly-preferred "pg_malloc_object"
macro instead of an explicit sizeof(). M src/bin/pg_upgrade/multixact_read_v18.c
Add a regression test to verify that NLS translation works.
commit : 8c498479d70f963533d57d8bb1b3a58e00fe0d03
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Sun, 14 Dec 2025 11:55:18 -0500
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Sun, 14 Dec 2025 11:55:18 -0500 We've never actually had a formal test for this facility.
It seems worth adding one now, mainly because we are starting
to depend on gettext() being able to handle the PRI* macros
from <inttypes.h>, and it's not all that certain that that
works everywhere. So the test goes to a bit of effort to
check all the PRI* macros we are likely to use.
(This effort has indeed found one problem already, now fixed
in commit f8715ec86.)
Discussion: https://postgr.es/m/3098752.1765221796@sss.pgh.pa.us
Discussion: https://postgr.es/m/292844.1765315339@sss.pgh.pa.us A src/test/regress/expected/nls.out
A src/test/regress/expected/nls_1.out
M src/test/regress/meson.build
A src/test/regress/nls.mk
M src/test/regress/parallel_schedule
A src/test/regress/po/LINGUAS
A src/test/regress/po/es.po
A src/test/regress/po/meson.build
M src/test/regress/regress.c
A src/test/regress/sql/nls.sql
Refactor WaitLSNType enum to use a macro for type count
commit : b27e48213fbc1d0ff698be4ae5a0eb3e161d9172
author : Alexander Korotkov <akorotkov@postgresql.org>
date : Sun, 14 Dec 2025 17:18:32 +0200
committer: Alexander Korotkov <akorotkov@postgresql.org>
date : Sun, 14 Dec 2025 17:18:32 +0200 Change WAIT_LSN_TYPE_COUNT from an enum sentinel to a macro definition,
in a similar way to IOObject, IOContext, and BackendType enums. Remove
explicit enum value assignments well.
Author: Xuneng Zhou <xunengzhou@gmail.com> M src/backend/access/transam/xlogwait.c
M src/include/access/xlogwait.h
Fix usage of palloc() in MERGE/SPLIT PARTITION(s) code
commit : c5ae07a90a0f3594e5053a26f3c99b041df427d3
author : Alexander Korotkov <akorotkov@postgresql.org>
date : Sun, 14 Dec 2025 16:10:25 +0200
committer: Alexander Korotkov <akorotkov@postgresql.org>
date : Sun, 14 Dec 2025 16:10:25 +0200 f2e4cc427951 and 4b3d173629f4 implement ALTER TABLE ... MERGE/SPLIT
PARTITION(s) commands. In several places, these commits use palloc(),
where we should use palloc_object() and palloc_array(). This commit
provides appropriate usage of palloc_object() and palloc_array().
Reported-by: Man Zeng <zengman@halodbtech.com>
Discussion: https://postgr.es/m/tencent_3661BB522D5466B33EA33666%40qq.com M src/backend/commands/tablecmds.c
M src/backend/partitioning/partbounds.c
Implement ALTER TABLE ... SPLIT PARTITION ... command
commit : 4b3d173629f4cd7ab6cd700d1053af5d5c7c9e37
author : Alexander Korotkov <akorotkov@postgresql.org>
date : Sun, 14 Dec 2025 13:29:38 +0200
committer: Alexander Korotkov <akorotkov@postgresql.org>
date : Sun, 14 Dec 2025 13:29:38 +0200 This new DDL command splits a single partition into several partitions. Just
like the ALTER TABLE ... MERGE PARTITIONS ... command, new partitions are
created using the createPartitionTable() function with the parent partition
as the template.
This commit comprises a quite naive implementation which works in a single
process and holds the ACCESS EXCLUSIVE LOCK on the parent table during all
the operations, including the tuple routing. This is why the new DDL command
can't be recommended for large, partitioned tables under high load. However,
this implementation comes in handy in certain cases, even as it is. Also, it
could serve as a foundation for future implementations with less locking and
possibly parallelism.
Discussion: https://postgr.es/m/c73a1746-0cd0-6bdd-6b23-3ae0b7c0c582%40postgrespro.ru
Author: Dmitry Koval <d.koval@postgrespro.ru>
Co-authored-by: Alexander Korotkov <aekorotkov@gmail.com>
Co-authored-by: Tender Wang <tndrwang@gmail.com>
Co-authored-by: Richard Guo <guofenglinux@gmail.com>
Co-authored-by: Dagfinn Ilmari Mannsaker <ilmari@ilmari.org>
Co-authored-by: Fujii Masao <masao.fujii@gmail.com>
Co-authored-by: Jian He <jian.universality@gmail.com>
Reviewed-by: Matthias van de Meent <boekewurm+postgres@gmail.com>
Reviewed-by: Laurenz Albe <laurenz.albe@cybertec.at>
Reviewed-by: Zhihong Yu <zyu@yugabyte.com>
Reviewed-by: Justin Pryzby <pryzby@telsasoft.com>
Reviewed-by: Alvaro Herrera <alvherre@alvh.no-ip.org>
Reviewed-by: Robert Haas <rhaas@postgresql.org>
Reviewed-by: Stephane Tachoires <stephane.tachoires@gmail.com>
Reviewed-by: Jian He <jian.universality@gmail.com>
Reviewed-by: Alexander Korotkov <aekorotkov@gmail.com>
Reviewed-by: Pavel Borisov <pashkin.elfe@gmail.com>
Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com>
Reviewed-by: Alexander Lakhin <exclusion@gmail.com>
Reviewed-by: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Reviewed-by: Daniel Gustafsson <dgustafsson@postgresql.org>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Noah Misch <noah@leadboat.com> M doc/src/sgml/ddl.sgml
M doc/src/sgml/ref/alter_table.sgml
M src/backend/commands/tablecmds.c
M src/backend/parser/gram.y
M src/backend/parser/parse_utilcmd.c
M src/backend/partitioning/partbounds.c
M src/bin/psql/tab-complete.in.c
M src/include/nodes/parsenodes.h
M src/include/parser/kwlist.h
M src/include/partitioning/partbounds.h
A src/test/isolation/expected/partition-split.out
M src/test/isolation/isolation_schedule
A src/test/isolation/specs/partition-split.spec
M src/test/modules/test_ddl_deparse/expected/alter_table.out
M src/test/modules/test_ddl_deparse/sql/alter_table.sql
M src/test/modules/test_ddl_deparse/test_ddl_deparse.c
A src/test/regress/expected/partition_split.out
M src/test/regress/parallel_schedule
A src/test/regress/sql/partition_split.sql
M src/tools/pgindent/typedefs.list
Implement ALTER TABLE ... MERGE PARTITIONS ... command
commit : f2e4cc427951b7c46629fb7625a22f7898586f3a
author : Alexander Korotkov <akorotkov@postgresql.org>
date : Sun, 14 Dec 2025 13:29:17 +0200
committer: Alexander Korotkov <akorotkov@postgresql.org>
date : Sun, 14 Dec 2025 13:29:17 +0200 This new DDL command merges several partitions into a single partition of the
target table. The target partition is created using the new
createPartitionTable() function with the parent partition as the template.
This commit comprises a quite naive implementation which works in a single
process and holds the ACCESS EXCLUSIVE LOCK on the parent table during all
the operations, including the tuple routing. This is why this new DDL
command can't be recommended for large partitioned tables under a high load.
However, this implementation comes in handy in certain cases, even as it is.
Also, it could serve as a foundation for future implementations with less
locking and possibly parallelism.
Discussion: https://postgr.es/m/c73a1746-0cd0-6bdd-6b23-3ae0b7c0c582%40postgrespro.ru
Author: Dmitry Koval <d.koval@postgrespro.ru>
Co-authored-by: Alexander Korotkov <aekorotkov@gmail.com>
Co-authored-by: Tender Wang <tndrwang@gmail.com>
Co-authored-by: Richard Guo <guofenglinux@gmail.com>
Co-authored-by: Dagfinn Ilmari Mannsaker <ilmari@ilmari.org>
Co-authored-by: Fujii Masao <masao.fujii@gmail.com>
Co-authored-by: Jian He <jian.universality@gmail.com>
Reviewed-by: Matthias van de Meent <boekewurm+postgres@gmail.com>
Reviewed-by: Laurenz Albe <laurenz.albe@cybertec.at>
Reviewed-by: Zhihong Yu <zyu@yugabyte.com>
Reviewed-by: Justin Pryzby <pryzby@telsasoft.com>
Reviewed-by: Alvaro Herrera <alvherre@alvh.no-ip.org>
Reviewed-by: Robert Haas <rhaas@postgresql.org>
Reviewed-by: Stephane Tachoires <stephane.tachoires@gmail.com>
Reviewed-by: Jian He <jian.universality@gmail.com>
Reviewed-by: Alexander Korotkov <aekorotkov@gmail.com>
Reviewed-by: Pavel Borisov <pashkin.elfe@gmail.com>
Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com>
Reviewed-by: Alexander Lakhin <exclusion@gmail.com>
Reviewed-by: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Reviewed-by: Daniel Gustafsson <dgustafsson@postgresql.org>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Noah Misch <noah@leadboat.com> M doc/src/sgml/ddl.sgml
M doc/src/sgml/ref/alter_table.sgml
M src/backend/catalog/dependency.c
M src/backend/catalog/pg_constraint.c
M src/backend/commands/tablecmds.c
M src/backend/parser/gram.y
M src/backend/parser/parse_utilcmd.c
M src/backend/partitioning/partbounds.c
M src/bin/psql/tab-complete.in.c
M src/include/catalog/dependency.h
M src/include/nodes/parsenodes.h
M src/include/parser/kwlist.h
M src/include/partitioning/partbounds.h
A src/test/isolation/expected/partition-merge.out
M src/test/isolation/isolation_schedule
A src/test/isolation/specs/partition-merge.spec
M src/test/modules/test_ddl_deparse/expected/alter_table.out
M src/test/modules/test_ddl_deparse/sql/alter_table.sql
M src/test/modules/test_ddl_deparse/test_ddl_deparse.c
A src/test/regress/expected/partition_merge.out
M src/test/regress/parallel_schedule
A src/test/regress/sql/partition_merge.sql
doc: Fix incorrect documentation for test_custom_stats
commit : 5b3ef3055d8ec22610af399715128361a65c845f
author : Michael Paquier <michael@paquier.xyz>
date : Sun, 14 Dec 2025 11:21:01 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Sun, 14 Dec 2025 11:21:01 +0900 The reference to the test module test_custom_stats should have been
added under the section "Custom Cumulative Statistics", but the section
"Injection Points" has been updated instead, reversing the references
for both test modules.
d52c24b0f808 has removed a paragraph that was correct, and 31280d96a648
has added a paragraph that was incorrect.
Author: Sami Imseih <samimseih@gmail.com>
Discussion: https://postgr.es/m/CAA5RZ0s4heX926+ZNh63u12gLd9jgauU6yiirKc7xGo1G01PXQ@mail.gmail.com M doc/src/sgml/xfunc.sgml
Fix jsonb_object_agg crash after eliminating null-valued pairs.
commit : ef5f559b95e2883c32d20d309d316f0572fd84b5
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Sat, 13 Dec 2025 16:18:23 -0500
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Sat, 13 Dec 2025 16:18:23 -0500 In commit b61aa76e4 I added an assumption in jsonb_object_agg_finalfn
that it'd be okay to apply uniqueifyJsonbObject repeatedly to a
JsonbValue. I should have studied that code more closely first,
because in skip_nulls mode it removed leading nulls by changing the
"pairs" array start pointer. This broke the data structure's
invariants in two ways: pairs no longer references a repalloc-able
chunk, and the distance from pairs to the end of its array is less
than parseState->size. So any subsequent addition of more pairs is
at high risk of clobbering memory and/or causing repalloc to crash.
Unfortunately, adding more pairs is exactly what will happen when the
aggregate is being used as a window function.
Fix by rewriting uniqueifyJsonbObject to not do that. The prior
coding had little to recommend it anyway.
Reported-by: Alexander Lakhin <exclusion@gmail.com>
Author: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/ec5e96fb-ee49-4e5f-8a09-3f72b4780538@gmail.com M src/backend/utils/adt/jsonb.c
M src/backend/utils/adt/jsonb_util.c
M src/test/regress/expected/jsonb.out
M src/test/regress/sql/jsonb.sql
Use correct preprocessor conditional in relptr.h
commit : 315342ffedf6b81f629c42e87bfaedbcc7211646
author : Peter Eisentraut <peter@eisentraut.org>
date : Sat, 13 Dec 2025 19:56:09 +0100
committer: Peter Eisentraut <peter@eisentraut.org>
date : Sat, 13 Dec 2025 19:56:09 +0100 When relptr.h was added (commit fbc1c12a94a), there was no check for
HAVE_TYPEOF, so it used HAVE__BUILTIN_TYPES_COMPATIBLE_P, which
already existed (commit ea473fb2dee) and which was thought to cover
approximately the same compilers. But the guarded code can also work
without HAVE__BUILTIN_TYPES_COMPATIBLE_P, and we now have a check for
HAVE_TYPEOF (commit 4cb824699e1), so let's fix this up to use the
correct logic.
Co-authored-by: Thomas Munro <thomas.munro@gmail.com>
Discussion: https://www.postgresql.org/message-id/CA%2BhUKGL7trhWiJ4qxpksBztMMTWDyPnP1QN%2BLq341V7QL775DA%40mail.gmail.com M src/include/utils/relptr.h
Fix out-of-date comment on makeRangeConstructors
commit : abb331da0a3454aebdb416fd19baf289063c254b
author : Peter Eisentraut <peter@eisentraut.org>
date : Sat, 13 Dec 2025 16:56:07 +0100
committer: Peter Eisentraut <peter@eisentraut.org>
date : Sat, 13 Dec 2025 16:56:07 +0100 We did define 4 functions in 4429f6a9e3, but in df73584431e7 we got
rid of the 0- and 1-arg versions.
Author: Paul A. Jungwirth <pj@illuminatedcomputing.com>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://www.postgresql.org/message-id/CA%2BrenyVQti3iC7LE4UxtQb4ROLYMs6%2Bu-d4LrN5U4idH1Ghx6Q%40mail.gmail.com M src/backend/commands/typecmds.c
Clarify comment about temporal foreign keys
commit : ff30bad7f6f085598e61bb06a8433cb33b3400c7
author : Peter Eisentraut <peter@eisentraut.org>
date : Sat, 13 Dec 2025 16:44:33 +0100
committer: Peter Eisentraut <peter@eisentraut.org>
date : Sat, 13 Dec 2025 16:44:33 +0100 In RI_ConstraintInfo, period_contained_by_oper and
period_intersect_oper can take either anyrange or anymultirange.
Author: Paul A. Jungwirth <pj@illuminatedcomputing.com>
Discussion: https://www.postgresql.org/message-id/CA%2BrenyWzDth%2BjqLZA2L2Cezs3wE%2BWX-5P8W2EOVx_zfFD%3Daicg%40mail.gmail.com M src/backend/utils/adt/ri_triggers.c
Reject opclass options in ON CONFLICT clause
commit : 630a93799d538c35c94187e07ef64d566a573a4e
author : Álvaro Herrera <alvherre@kurilemu.de>
date : Fri, 12 Dec 2025 14:26:42 +0100
committer: Álvaro Herrera <alvherre@kurilemu.de>
date : Fri, 12 Dec 2025 14:26:42 +0100 It's as pointless as ASC/DESC and NULLS FIRST/LAST are, so reject all of
them in the same way. While at it, normalize the others' error messages
to have less translatable strings. Add tests for these errors.
Noticed while reviewing recent INSERT ON CONFLICT patches.
Author: Álvaro Herrera <alvherre@kurilemu.de>
Reviewed-by: Peter Geoghegan <pg@bowt.ie>
Discussion: https://postgr.es/m/202511271516.oiefpvn3z27m@alvherre.pgsql M src/backend/parser/parse_clause.c
M src/test/regress/expected/insert_conflict.out
M src/test/regress/sql/insert_conflict.sql
Replace most StaticAssertStmt() with StaticAssertDecl()
commit : 493eb0da31be4520252e1af723342dc7ead0c3e5
author : Peter Eisentraut <peter@eisentraut.org>
date : Fri, 12 Dec 2025 08:58:34 +0100
committer: Peter Eisentraut <peter@eisentraut.org>
date : Fri, 12 Dec 2025 08:58:34 +0100 Similar to commit 75f49221c22, it is preferable to use
StaticAssertDecl() instead of StaticAssertStmt() when possible.
Discussion: https://www.postgresql.org/message-id/flat/CA%2BhUKGKvr0x_oGmQTUkx%3DODgSksT2EtgCA6LmGx_jQFG%3DsDUpg%40mail.gmail.com M contrib/hstore/hstore_compat.c
M src/backend/access/heap/vacuumlazy.c
M src/backend/access/table/tableam.c
M src/backend/access/transam/parallel.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/file/fd.c
M src/backend/storage/ipc/waiteventset.c
M src/backend/utils/adt/mac.c
M src/backend/utils/cache/inval.c
M src/include/storage/fd.h
Never store 0 as the nextMXact
commit : 87a350e1f284bb99591f9185c0be0ae28899f38a
author : Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Fri, 12 Dec 2025 10:47:34 +0200
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Fri, 12 Dec 2025 10:47:34 +0200 Before this commit, when multixid wraparound happens,
MultiXactState->nextMXact goes to 0, which is invalid. All the readers
need to deal with that possibility and skip over the 0. That's
error-prone and we've missed it a few times in the past. This commit
changes the responsibility so that all the writers of
MultiXactState->nextMXact skip over the zero already, and readers can
trust that it's never 0.
We were already doing that for MultiXactState->oldestMultiXactId; none
of its writers would set it to 0. ReadMultiXactIdRange() was
nevertheless checking for that possibility. For clarity, remove that
check.
Reviewed-by: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>
Reviewed-by: Maxim Orlov <orlovmg@gmail.com>
Discussion: https://www.postgresql.org/message-id/3624730d-6dae-42bf-9458-76c4c965fb27@iki.fi M src/backend/access/transam/multixact.c
M src/bin/pg_resetwal/pg_resetwal.c
M src/bin/pg_resetwal/t/001_basic.pl
Fix some comments.
commit : b4cbc106a6ced69a0a13a980e1b4b212bb127458
author : Nathan Bossart <nathan@postgresql.org>
date : Thu, 11 Dec 2025 15:13:04 -0600
committer: Nathan Bossart <nathan@postgresql.org>
date : Thu, 11 Dec 2025 15:13:04 -0600 Like commit 123661427b, these were discovered while reviewing
Aleksander Alekseev's proposed changes to pgindent. M src/backend/libpq/pqformat.c
M src/backend/rewrite/rewriteHandler.c
M src/backend/storage/file/fileset.c
M src/backend/utils/adt/numutils.c
M src/backend/utils/cache/relcache.c
M src/backend/utils/mb/conv.c
M src/backend/utils/mb/mbutils.c
M src/backend/utils/misc/guc.c
M src/backend/utils/mmgr/alignedalloc.c
M src/backend/utils/mmgr/portalmem.c
M src/backend/utils/sort/tuplesortvariants.c
M src/include/executor/executor.h
M src/include/libpq/libpq-be-fe-helpers.h
Fix infer_arbiter_index for partitioned tables
commit : 81f72115cf189b0a428d3efca2e4beb02b825111
author : Álvaro Herrera <alvherre@kurilemu.de>
date : Thu, 11 Dec 2025 20:56:37 +0100
committer: Álvaro Herrera <alvherre@kurilemu.de>
date : Thu, 11 Dec 2025 20:56:37 +0100 The fix for concurrent index operations in bc32a12e0db2 started
considering indexes that are not yet marked indisvalid as arbiters for
INSERT ON CONFLICT. For partitioned tables, this leads to including
indexes that may not exist in partitions, causing a trivially
reproducible "invalid arbiter index list" error to be thrown because of
failure to match the index. To fix, it suffices to ignore !indisvalid
indexes on partitioned tables. There should be no risk that the set of
indexes will change for concurrent transactions, because in order for
such an index to be marked valid, an ALTER INDEX ATTACH PARTITION must
run which requires AccessExclusiveLock.
Author: Mihail Nikalayeu <mihailnikalayeu@gmail.com>
Reported-by: Alexander Lakhin <exclusion@gmail.com>
Reviewed-by: Álvaro Herrera <alvherre@kurilemu.de>
Discussion: https://postgr.es/m/17622f79-117a-4a44-aa8e-0374e53faaf0%40gmail.com M src/backend/optimizer/util/plancat.c
M src/test/regress/expected/partition_info.out
M src/test/regress/sql/partition_info.sql
Fix comment on how temp files and subtransactions are handled
commit : b65f1ad9b12767dbd45d9588ce8ed2e593dbddbf
author : Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Thu, 11 Dec 2025 15:57:11 +0200
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Thu, 11 Dec 2025 15:57:11 +0200 The comment was accurate a long time ago, but not any more. I failed
to update the comment in commit ab3148b712. M src/backend/storage/file/fd.c
Add runtime checks for bogus multixact offsets
commit : d4b7bde4183bc39c6d7a22d22188fc4aab2ba8d1
author : Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Thu, 11 Dec 2025 11:18:14 +0200
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Thu, 11 Dec 2025 11:18:14 +0200 It's not far-fetched that we'd try to read a multixid with an invalid
offset in case of bugs or corruption. Or if you call
pg_get_multixact_members() after a crash that left behind invalid but
unused multixids. Better to get a somewhat descriptive error message
if that happens.
Discussion: https://www.postgresql.org/message-id/3624730d-6dae-42bf-9458-76c4c965fb27@iki.fi M src/backend/access/transam/multixact.c
Make <assert.h> consistently available in frontend and backend
commit : 795e94c70cf13f60b2cb4010f29a1bca542d2031
author : Peter Eisentraut <peter@eisentraut.org>
date : Thu, 11 Dec 2025 09:19:17 +0100
committer: Peter Eisentraut <peter@eisentraut.org>
date : Thu, 11 Dec 2025 09:19:17 +0100 Previously, c.h made <assert.h> only available in frontends (#ifdef
FRONTEND), which was probably reasonable, because the only thing it
would give you is assert(), which you generally shouldn't use in the
backend. But with C11, <assert.h> also makes available
static_assert(), which would be useful everywhere. So this patch
moves <assert.h> to the commonly available header files in c.h and
fixes a small complication in regcustom.h that resulted from that.
Co-authored-by: Thomas Munro <thomas.munro@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/CA%2BhUKGKvr0x_oGmQTUkx%3DODgSksT2EtgCA6LmGx_jQFG%3DsDUpg%40mail.gmail.com M src/include/c.h
M src/include/regex/regcustom.h
Use palloc_object() and palloc_array(), the last change
commit : 4f7dacc5b82af19788599671abe4ac633fd7ea4c
author : Michael Paquier <michael@paquier.xyz>
date : Thu, 11 Dec 2025 14:29:12 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Thu, 11 Dec 2025 14:29:12 +0900 This is the last batch of changes that have been suggested by the
author, this part covering the non-trivial changes. Some of the changes
suggested have been discarded as they seem to lead to more instructions
generated, leaving the parts that can be qualified as in-place
replacements.
Similar work has been done in 1b105f9472bd, 0c3c5c3b06a3 and
31d3847a37be.
Author: David Geier <geidav.pg@gmail.com>
Discussion: https://postgr.es/m/ad0748d4-3080-436e-b0bc-ac8f86a3466a@gmail.com M contrib/pg_buffercache/pg_buffercache_pages.c
M contrib/pg_trgm/trgm_op.c
M contrib/postgres_fdw/postgres_fdw.c
M src/backend/executor/execPartition.c
M src/backend/partitioning/partprune.c
M src/backend/statistics/mvdistinct.c
M src/backend/storage/buffer/bufmgr.c
pg_buffercache: Fix memory allocation formula
commit : 3f83de20ba2e1d4bd557d92b3436ca04b7c947a8
author : Michael Paquier <michael@paquier.xyz>
date : Thu, 11 Dec 2025 14:11:06 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Thu, 11 Dec 2025 14:11:06 +0900 The code over-allocated the memory required for os_page_status, relying
on uint64 for its element size instead of an int, hence doubling what
was required. This could mean quite a lot of memory if dealing with a
lot of NUMA pages.
Oversight in ba2a3c2302f1.
Author: David Geier <geidav.pg@gmail.com>
Discussion: https://postgr.es/m/ad0748d4-3080-436e-b0bc-ac8f86a3466a@gmail.com
Backpatch-through: 18 M contrib/pg_buffercache/pg_buffercache_pages.c
Enhance slot synchronization API to respect promotion signal.
commit : 1362bc33e025fd2848ff38558f5672e2f0f0c7de
author : Amit Kapila <akapila@postgresql.org>
date : Thu, 11 Dec 2025 03:49:28 +0000
committer: Amit Kapila <akapila@postgresql.org>
date : Thu, 11 Dec 2025 03:49:28 +0000 Previously, during a promotion, only the slot synchronization worker was
signaled to shut down. The backend executing slot synchronization via the
pg_sync_replication_slots() SQL function was not signaled, allowing it to
complete its synchronization cycle before exiting.
An upcoming patch improves pg_sync_replication_slots() to wait until
replication slots are fully persisted before finishing. This behaviour
requires the backend to exit promptly if a promotion occurs.
This patch ensures that, during promotion, a signal is also sent to the
backend running pg_sync_replication_slots(), allowing it to be interrupted
and exit immediately.
Author: Ajin Cherian <itsajin@gmail.com>
Reviewed-by: Shveta Malik <shveta.malik@gmail.com>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>
Discussion: https://postgr.es/m/CAFPTHDZAA%2BgWDntpa5ucqKKba41%3DtXmoXqN3q4rpjO9cdxgQrw%40mail.gmail.com M src/backend/replication/logical/slotsync.c
Clarify why _bt_killitems sorts its items array.
commit : e16c6f024718cf854f5b76a4a2ed402f1a7911f1
author : Peter Geoghegan <pg@bowt.ie>
date : Wed, 10 Dec 2025 20:50:47 -0500
committer: Peter Geoghegan <pg@bowt.ie>
date : Wed, 10 Dec 2025 20:50:47 -0500 Make it clear why _bt_killitems sorts the scan's so->killedItems[]
array. Also add an assertion to the _bt_killitems loop (that iterates
through this array) to verify it accesses tuples in leaf page order.
Follow-up to commit bfb335df58.
Author: Peter Geoghegan <pg@bowt.ie>
Suggested-by: Victor Yegorov <vyegorov@gmail.com>
Discussion: https://postgr.es/m/CAGnEboirgArezZDNeFrR8FOGvKF-Xok333s2iVwWi65gZf8MEA@mail.gmail.com M src/backend/access/nbtree/nbtutils.c
Fix allocation formula in llvmjit_expr.c
commit : 06761b6096b661e838512e3a83f71345b59710b9
author : Michael Paquier <michael@paquier.xyz>
date : Thu, 11 Dec 2025 10:25:21 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Thu, 11 Dec 2025 10:25:21 +0900 An array of LLVMBasicBlockRef is allocated with the size used for an
element being "LLVMBasicBlockRef *" rather than "LLVMBasicBlockRef".
LLVMBasicBlockRef is a type that refers to a pointer, so this did not
directly cause a problem because both should have the same size, still
it is incorrect.
This issue has been spotted while reviewing a different patch, and
exists since 2a0faed9d702, so backpatch all the way down.
Discussion: https://postgr.es/m/CA+hUKGLngd9cKHtTUuUdEo2eWEgUcZ_EQRbP55MigV2t_zTReg@mail.gmail.com
Backpatch-through: 14 M src/backend/jit/llvm/llvmjit_expr.c
Fix MULTIXACT_DEBUG builds.
commit : 473cb1b9512ef8ae5ec3ea42bcebeb7d39e79ce4
author : Peter Geoghegan <pg@bowt.ie>
date : Wed, 10 Dec 2025 19:31:13 -0500
committer: Peter Geoghegan <pg@bowt.ie>
date : Wed, 10 Dec 2025 19:31:13 -0500 Oversight in commit bd8d9c9b.
Discussion: https://postgr.es/m/CAH2-WzmvwVKZ+0Z=RL_+g_aOku8QxWddDCXmtyLj02y+nYaD0g@mail.gmail.com M src/backend/access/transam/multixact.c
Allow PG_PRINTF_ATTRIBUTE to be different in C and C++ code.
commit : 0909380e4c9aa22b75dfe5a7e33393b48078db81
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Wed, 10 Dec 2025 17:09:10 -0500
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Wed, 10 Dec 2025 17:09:10 -0500 Although clang claims to be compatible with gcc's printf format
archetypes, this appears to be a falsehood: it likes __syslog__
(which gcc does not, on most platforms) and doesn't accept
gnu_printf. This means that if you try to use gcc with clang++
or clang with g++, you get compiler warnings when compiling
printf-like calls in our C++ code. This has been true for quite
awhile, but it's gotten more annoying with the recent appearance
of several buildfarm members that are configured like this.
To fix, run separate probes for the format archetype to use with the
C and C++ compilers, and conditionally define PG_PRINTF_ATTRIBUTE
depending on __cplusplus.
(We could alternatively insist that you not mix-and-match C and
C++ compilers; but if the case works otherwise, this is a poor
reason to insist on that.)
No back-patch for now, but we may want to do that if this
patch survives buildfarm testing.
Discussion: https://postgr.es/m/986485.1764825548@sss.pgh.pa.us M config/c-compiler.m4
M configure
M configure.ac
M meson.build
M src/include/c.h
M src/include/pg_config.h.in
Return TIDs in desc order during backwards scans.
commit : bfb335df58ea4274702039083c7e08fe3dba9e10
author : Peter Geoghegan <pg@bowt.ie>
date : Wed, 10 Dec 2025 15:35:30 -0500
committer: Peter Geoghegan <pg@bowt.ie>
date : Wed, 10 Dec 2025 15:35:30 -0500 Always return TIDs in descending order when returning groups of TIDs
from an nbtree posting list tuple during nbtree backwards scans. This
makes backwards scans tend to require fewer buffer hits, since the scan
is less likely to repeatedly pin and unpin the same heap page/buffer
(we'll get exactly as many buffer hits as we get with a similar forwards
scan case).
Commit 0d861bbb, which added nbtree deduplication, originally did things
this way to avoid interfering with _bt_killitems's approach to setting
LP_DEAD bits on posting list tuples. _bt_killitems makes a soft
assumption that it can always iterate through posting lists in ascending
TID order, finding corresponding killItems[]/so->currPos.items[] entries
in that same order. This worked out because of the prior _bt_readpage
backwards scan behavior. If we just changed the backwards scan posting
list logic in _bt_readpage, without altering _bt_killitems itself, it
would break its soft assumption.
Avoid that problem by sorting the so->killedItems[] array at the start
of _bt_killitems. That way the order that dead items are saved in from
btgettuple can't matter; so->killedItems[] will always be in the same
order as so->currPos.items[] in the end. Since so->currPos.items[] is
now always in leaf page order, regardless of the scan direction used
within _bt_readpage, and since so->killedItems[] is always in that same
order, the _bt_killitems loop can continue to make a uniform assumption
about everything being in page order. In fact, sorting like this makes
the previous soft assumption about item order into a hard invariant.
Also deduplicate the so->killedItems[] array after it is sorted. That
way there's no risk of the _bt_killitems loop becoming confused by a
duplicate dead item/TID. This was possible in cases that involved a
scrollable cursor that encountered the same dead TID more than once
(within the same leaf page/so->currPos context). This doesn't come up
very much in practice, but it seems best to be as consistent as possible
about how and when _bt_killitems will LP_DEAD-mark index tuples.
Author: Peter Geoghegan <pg@bowt.ie>
Reviewed-By: Mircea Cadariu <cadariu.mircea@gmail.com>
Reviewed-By: Victor Yegorov <vyegorov@gmail.com>
Discussion: https://postgr.es/m/CAH2-Wz=Wut2pKvbW-u3hJ_LXwsYeiXHiW8oN1GfbKPavcGo8Ow@mail.gmail.com M src/backend/access/nbtree/nbtreadpage.c
M src/backend/access/nbtree/nbtutils.c
Add pg_iswcased().
commit : 630706ced04e3a7a7f0070f4e8fb88f7503a1016
author : Jeff Davis <jdavis@postgresql.org>
date : Wed, 10 Dec 2025 11:56:11 -0800
committer: Jeff Davis <jdavis@postgresql.org>
date : Wed, 10 Dec 2025 11:56:11 -0800 True if character has multiple case forms. Will be a useful
multibyte-aware replacement for char_is_cased().
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Discussion: https://postgr.es/m/450ceb6260cad30d7afdf155d991a9caafee7c0d.camel@j-davis.com M src/backend/utils/adt/pg_locale.c
M src/backend/utils/adt/pg_locale_builtin.c
M src/backend/utils/adt/pg_locale_icu.c
M src/backend/utils/adt/pg_locale_libc.c
M src/include/utils/pg_locale.h
Remove char_tolower() API.
commit : 1e493158d3d25771ed066028c00cbbdb41573496
author : Jeff Davis <jdavis@postgresql.org>
date : Wed, 10 Dec 2025 11:55:59 -0800
committer: Jeff Davis <jdavis@postgresql.org>
date : Wed, 10 Dec 2025 11:55:59 -0800 It's only useful for an ILIKE optimization for the libc provider using
a single-byte encoding and a non-C locale, but it creates significant
internal complexity.
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Discussion: https://postgr.es/m/450ceb6260cad30d7afdf155d991a9caafee7c0d.camel@j-davis.com M src/backend/utils/adt/like.c
M src/backend/utils/adt/like_match.c
M src/backend/utils/adt/pg_locale.c
M src/backend/utils/adt/pg_locale_libc.c
M src/include/utils/pg_locale.h
Fix bogus extra arguments to query_safe in test
commit : 820343bab30852142ddc50db3aa81ef58d7cb676
author : Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Wed, 10 Dec 2025 19:38:07 +0200
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Wed, 10 Dec 2025 19:38:07 +0200 The test seemed to incorrectly think that query_safe() takes an
argument that describes what the query does, similar to e.g.
command_ok(). Until commit bd8d9c9bdf the extra arguments were
harmless and were just ignored, but when commit bd8d9c9bdf introduced
a new optional argument to query_safe(), the extra arguments started
clashing with that, causing the test to fail.
Backpatch to v17, that's the oldest branch where the test exists. The
extra arguments didn't cause any trouble on the older branches, but
they were clearly bogus anyway. M src/test/modules/xid_wraparound/t/004_notify_freeze.pl
Improve DDL deparsing test
commit : 343693c3c116688970be550fcbf15f7ddf55525b
author : Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Wed, 10 Dec 2025 19:27:02 +0200
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Wed, 10 Dec 2025 19:27:02 +0200 1. The test initially focuses on the "parent" table, then switches to
the "part" table, and goes back to the "parent" table. That seems a
little weird, so move the tests around so that all the commands on the
"parent" table are done first, followed by the "part" table.
2. ALTER TABLE ALTER COLUMN SET EXPRESSION was not tested, so add
that.
Author: jian he <jian.universality@gmail.com>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://www.postgresql.org/message-id/CACJufxFDi7fnwB-8xXd_ExML7-7pKbTaK4j46AJ=4-14DXvtVg@mail.gmail.com M src/test/modules/test_ddl_deparse/expected/alter_table.out
M src/test/modules/test_ddl_deparse/sql/alter_table.sql
Add comment about keeping PD_ALL_VISIBLE and VM in sync
commit : eebec3ca4b5ef13d01837966f51b391143670131
author : Melanie Plageman <melanieplageman@gmail.com>
date : Wed, 10 Dec 2025 11:10:13 -0500
committer: Melanie Plageman <melanieplageman@gmail.com>
date : Wed, 10 Dec 2025 11:10:13 -0500 The comment above heap_xlog_visible() about the critical integrity
requirement for PD_ALL_VISIBLE and the visibility map should also be in
heap_xlog_prune_freeze() where we set PD_ALL_VISIBLE.
Oversight in add323da40a6bf9e
Author: Melanie Plageman <melanieplageman@gmail.com>
Discussion: https://postgr.es/m/flat/CAAKRu_ZMw6Npd_qm2KM%2BFwQ3cMOMx1Dh3VMhp8-V7SOLxdK9-g%40mail.gmail.com M src/backend/access/heap/heapam_xlog.c
Simplify vacuum visibility assertion
commit : bd298f54a0d60a0376959e10074aa07cbad267f2
author : Melanie Plageman <melanieplageman@gmail.com>
date : Wed, 10 Dec 2025 11:10:01 -0500
committer: Melanie Plageman <melanieplageman@gmail.com>
date : Wed, 10 Dec 2025 11:10:01 -0500 Phase I vacuum gives the page a once-over after pruning and freezing to
check that the values of all_visible and all_frozen agree with the
result of heap_page_is_all_visible(). This is meant to keep the logic in
phase I for determining visibility in sync with the logic in phase III.
Rewrite the assertion to avoid an Assert(false).
Suggested by Andres Freund.
Author: Melanie Plageman <melanieplageman@gmail.com>
Discussion: https://postgr.es/m/mhf4vkmh3j57zx7vuxp4jagtdzwhu3573pgfpmnjwqa6i6yj5y%40sy4ymcdtdklo M src/backend/access/heap/vacuumlazy.c
Fix comment in GetPublicationRelations
commit : 70b4d9043931a5c4cdbf7bb08b7e3cb6e8beee1b
author : Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Wed, 10 Dec 2025 15:33:29 +0200
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Wed, 10 Dec 2025 15:33:29 +0200 This function gets the list of relations associated with the
publication but the comment said the opposite.
Author: Shlok Kyal <shlok.kyal.oss@gmail.com>
Discussion: https://www.postgresql.org/message-id/CANhcyEV3C_CGBeDtjvKjALDJDMH-Uuc9BWfSd=eck8SCXnE=fQ@mail.gmail.com M src/backend/catalog/pg_publication.c
Fix some near-bugs related to ResourceOwner function arguments
commit : fa44b8b7fbb7eb0f13546aa13976f9919a4ca201
author : Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Wed, 10 Dec 2025 11:43:16 +0200
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Wed, 10 Dec 2025 11:43:16 +0200 These functions took a ResourceOwner argument, but only checked if it
was NULL, and then used CurrentResourceOwner for the actual work.
Surely the intention was to use the passed-in resource owner. All
current callers passed CurrentResourceOwner or NULL, so this has no
consequences at the moment, but it's an accident waiting to happen for
future caller and extensions.
Author: Matthias van de Meent <boekewurm+postgres@gmail.com>
Discussion: https://www.postgresql.org/message-id/CAEze2Whnfv8VuRZaohE-Af+GxBA1SNfD_rXfm84Jv-958UCcJA@mail.gmail.com
Backpatch-through: 17 M src/backend/storage/aio/aio.c
M src/backend/utils/cache/catcache.c
libpq: Authorize pthread_exit() in libpq_check
commit : 8268e66ac64cb846517580e0808f971343391fdf
author : Michael Paquier <michael@paquier.xyz>
date : Wed, 10 Dec 2025 13:56:33 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Wed, 10 Dec 2025 13:56:33 +0900 pthread_exit() is added to the list of symbols allowed when building
libpq. This has been reported as possible when libpq is statically
linked to libcrypto, where pthread_exit() could be called.
Reported-by: Torsten Rupp <torsten.rupp@gmx.net>
Author: Nazir Bilal Yavuz <byavuz81@gmail.com>
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://postgr.es/m/19095-6d8256d0c37d4be2@postgresql.org M src/interfaces/libpq/libpq_check.pl
Fix failures with cross-version pg_upgrade tests
commit : 1d7b00dc14b8efd22f6e971756c2d9c052863234
author : Michael Paquier <michael@paquier.xyz>
date : Wed, 10 Dec 2025 12:46:45 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Wed, 10 Dec 2025 12:46:45 +0900 Buildfarm members skimmer and crake have reported that pg_upgrade
running from v18 fails due to the changes of d52c24b0f808, with the
expectations that the objects removed in the test module
injection_points should still be present post upgrades, but the test
module does not have them anymore.
The origin of the issue is that the following test modules depend on
injection_points, but they do not drop the extension once the tests
finish, leaving its traces in the dumps used for the upgrades:
- gin, down to v17
- typcache, down to v18
- nbtree, HEAD-only
Test modules have no upgrade requirements, as they are used only for..
Tests, so there is no point in keeping them around.
An alternative solution would be to drop the databases created by these
modules in AdjustUpgrade.pm, but the solution of this commit to drop the
extension is simpler. Note that there would be a catch if using a
solution based on AdjustUpgrade.pm as the database name used for the
test runs differs between configure and meson:
- configure relies on USE_MODULE_DB for the database name unicity, that
would build a database name based on the *first* entry of REGRESS, that
lists all the SQL tests.
- meson relies on a "name" field.
For example, for the test module "gin", the regression database is named
"regression_gin" under meson, while it is more complex for configure, as
of "contrib_regression_gin_incomplete_splits". So a AdjustUpgrade.pm
would need a set of DROP DATABASE IF EXISTS to solve this issue, to cope
with each build system.
The failure has been caused by d52c24b0f808, and the problem can happen
with upgrade dumps from v17 and v18 to HEAD. This problem is not
currently reachable in the back-branches, but it could be possible that
a future change in injection_points in stable branches invalidates this
theory, so this commit is applied down to v17 in the test modules that
matter.
Per discussion with Tom Lane and Heikki Linnakangas.
Discussion: https://postgr.es/m/2899652.1765167313@sss.pgh.pa.us
Backpatch-through: 17 M src/test/modules/gin/expected/gin_incomplete_splits.out
M src/test/modules/gin/sql/gin_incomplete_splits.sql
M src/test/modules/nbtree/expected/nbtree_half_dead_pages.out
M src/test/modules/nbtree/expected/nbtree_incomplete_splits.out
M src/test/modules/nbtree/sql/nbtree_half_dead_pages.sql
M src/test/modules/nbtree/sql/nbtree_incomplete_splits.sql
M src/test/modules/typcache/expected/typcache_rel_type_cache.out
M src/test/modules/typcache/sql/typcache_rel_type_cache.sql
Fix two issues with recently-introduced nbtree test
commit : 06817fc8a4b739cc2d1aa87071d9e20d483fd678
author : Michael Paquier <michael@paquier.xyz>
date : Wed, 10 Dec 2025 11:56:42 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Wed, 10 Dec 2025 11:56:42 +0900 REGRESS has forgotten about the test nbtree_half_dead_pages, and a
.gitignore was missing from the module.
Oversights in c085aab27819 for REGRESS and 1e4e5783e7d7 for the missing
.gitignore.
Discussion: https://postgr.es/m/aTipJA1Y1zVSmH3H@paquier.xyz A src/test/modules/nbtree/.gitignore
M src/test/modules/nbtree/Makefile
Fix meson warning due to missing declaration of NM
commit : 801b4ee7fae1caa962b789e72be11dcead79dcbf
author : Michael Paquier <michael@paquier.xyz>
date : Wed, 10 Dec 2025 08:10:28 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Wed, 10 Dec 2025 08:10:28 +0900 The warning was showing up in the early stages of the meson build, when
the contents of Makefile.global is generated based on the configuration
of meson for PGXS.
NM is added to pgxs_empty. This declaration is only used internally for
the libpq sanity check, so there is no point in exposing it in PGXS.
Oversight in 4a8e6f43a6b5.
Reported-by: Peter Eisentraut <peter@eisentraut.org>
Reviewed-by: Nazir Bilal Yavuz <byavuz81@gmail.com>
Discussion: https://postgr.es/m/4423e01f-1e52-4f47-a6ca-05cc8081c888@eisentraut.org M src/makefiles/meson.build
Fix typo in comment
commit : bae9d2f892bc7733667fa68f416b5abd8dd2fc57
author : Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Wed, 10 Dec 2025 01:06:03 +0200
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Wed, 10 Dec 2025 01:06:03 +0200 Author: Xuneng Zhou <xunengzhou@gmail.com>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://www.postgresql.org/message-id/CABPTF7V8CbOXGePqrad6EH3Om7DRhNiO3C0rQ-62UuT7RdU-GQ@mail.gmail.com M src/backend/storage/aio/read_stream.c
Fix misleading comment in tuplesort.c
commit : f275afc997d77ada991307d22703b08f1dedef13
author : David Rowley <drowley@postgresql.org>
date : Wed, 10 Dec 2025 12:01:14 +1300
committer: David Rowley <drowley@postgresql.org>
date : Wed, 10 Dec 2025 12:01:14 +1300 A comment in tuplesort.c was claiming that the code was defining
INITIAL_MEMTUPSIZE so that it *does not* exceed
ALLOCSET_SEPARATE_THRESHOLD, but the code actually ensures that we
purposefully *do* exceed ALLOCSET_SEPARATE_THRESHOLD for the initial
allocation of the tuples array, as per reasons detailed in the
commentary of grow_memtuples().
Also, there's not much need to repeat the mention about
ALLOCSET_SEPARATE_THRESHOLD in each location where INITIAL_MEMTUPSIZE is
used, so remove those comments.
Author: ChangAo Chen <cca5507@qq.com>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: David G. Johnston <david.g.johnston@gmail.com>
Discussion: https://postgr.es/m/tencent_6FA14F85D6B5B5291532D6789E07F4765C08%40qq.com M src/backend/utils/sort/tuplesort.c
Use palloc_object() and palloc_array() in backend code
commit : 1b105f9472bdb9a68f709778afafb494997267bd
author : Michael Paquier <michael@paquier.xyz>
date : Wed, 10 Dec 2025 07:36:46 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Wed, 10 Dec 2025 07:36:46 +0900 The idea is to encourage more the use of these new routines across the
tree, as these offer stronger type safety guarantees than palloc().
This batch of changes includes most of the trivial changes suggested by
the author for src/backend/.
A total of 334 files are updated here. Among these files, 48 of them
have their build change slightly; these are caused by line number
changes as the new allocation formulas are simpler, shaving around 100
lines of code in total.
Similar work has been done in 0c3c5c3b06a3 and 31d3847a37be.
Author: David Geier <geidav.pg@gmail.com>
Discussion: https://postgr.es/m/ad0748d4-3080-436e-b0bc-ac8f86a3466a@gmail.com M src/backend/access/brin/brin.c
M src/backend/access/brin/brin_minmax_multi.c
M src/backend/access/brin/brin_revmap.c
M src/backend/access/brin/brin_tuple.c
M src/backend/access/common/attmap.c
M src/backend/access/common/heaptuple.c
M src/backend/access/common/printtup.c
M src/backend/access/common/reloptions.c
M src/backend/access/common/tidstore.c
M src/backend/access/common/toast_internals.c
M src/backend/access/common/tupconvert.c
M src/backend/access/common/tupdesc.c
M src/backend/access/gin/ginbtree.c
M src/backend/access/gin/ginbulk.c
M src/backend/access/gin/gindatapage.c
M src/backend/access/gin/ginentrypage.c
M src/backend/access/gin/ginget.c
M src/backend/access/gin/gininsert.c
M src/backend/access/gin/ginscan.c
M src/backend/access/gin/ginutil.c
M src/backend/access/gin/ginvacuum.c
M src/backend/access/gist/gist.c
M src/backend/access/gist/gistbuild.c
M src/backend/access/gist/gistbuildbuffers.c
M src/backend/access/gist/gistproc.c
M src/backend/access/gist/gistscan.c
M src/backend/access/gist/gistsplit.c
M src/backend/access/gist/gistutil.c
M src/backend/access/gist/gistvacuum.c
M src/backend/access/hash/hash.c
M src/backend/access/hash/hashsort.c
M src/backend/access/heap/heapam.c
M src/backend/access/heap/heapam_handler.c
M src/backend/access/heap/rewriteheap.c
M src/backend/access/heap/vacuumlazy.c
M src/backend/access/index/amvalidate.c
M src/backend/access/index/genam.c
M src/backend/access/nbtree/nbtdedup.c
M src/backend/access/nbtree/nbtinsert.c
M src/backend/access/nbtree/nbtpage.c
M src/backend/access/nbtree/nbtree.c
M src/backend/access/nbtree/nbtsearch.c
M src/backend/access/nbtree/nbtsort.c
M src/backend/access/nbtree/nbtsplitloc.c
M src/backend/access/nbtree/nbtxlog.c
M src/backend/access/spgist/spgdoinsert.c
M src/backend/access/spgist/spginsert.c
M src/backend/access/spgist/spgkdtreeproc.c
M src/backend/access/spgist/spgproc.c
M src/backend/access/spgist/spgquadtreeproc.c
M src/backend/access/spgist/spgscan.c
M src/backend/access/spgist/spgtextproc.c
M src/backend/access/spgist/spgutils.c
M src/backend/access/spgist/spgvacuum.c
M src/backend/access/spgist/spgxlog.c
M src/backend/access/tablesample/system.c
M src/backend/access/transam/multixact.c
M src/backend/access/transam/parallel.c
M src/backend/access/transam/timeline.c
M src/backend/access/transam/twophase.c
M src/backend/access/transam/xact.c
M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogfuncs.c
M src/backend/access/transam/xlogprefetcher.c
M src/backend/access/transam/xlogrecovery.c
M src/backend/access/transam/xlogutils.c
M src/backend/backup/basebackup.c
M src/backend/backup/basebackup_copy.c
M src/backend/backup/basebackup_gzip.c
M src/backend/backup/basebackup_incremental.c
M src/backend/backup/basebackup_lz4.c
M src/backend/backup/basebackup_progress.c
M src/backend/backup/basebackup_server.c
M src/backend/backup/basebackup_target.c
M src/backend/backup/basebackup_throttle.c
M src/backend/backup/basebackup_zstd.c
M src/backend/backup/walsummary.c
M src/backend/bootstrap/bootstrap.c
M src/backend/catalog/dependency.c
M src/backend/catalog/heap.c
M src/backend/catalog/index.c
M src/backend/catalog/namespace.c
M src/backend/catalog/objectaddress.c
M src/backend/catalog/pg_constraint.c
M src/backend/catalog/pg_depend.c
M src/backend/catalog/pg_enum.c
M src/backend/catalog/pg_publication.c
M src/backend/catalog/pg_shdepend.c
M src/backend/catalog/pg_subscription.c
M src/backend/catalog/storage.c
M src/backend/commands/analyze.c
M src/backend/commands/cluster.c
M src/backend/commands/copy.c
M src/backend/commands/copyfrom.c
M src/backend/commands/copyto.c
M src/backend/commands/createas.c
M src/backend/commands/dbcommands.c
M src/backend/commands/event_trigger.c
M src/backend/commands/explain.c
M src/backend/commands/explain_dr.c
M src/backend/commands/explain_state.c
M src/backend/commands/extension.c
M src/backend/commands/functioncmds.c
M src/backend/commands/matview.c
M src/backend/commands/opclasscmds.c
M src/backend/commands/policy.c
M src/backend/commands/publicationcmds.c
M src/backend/commands/seclabel.c
M src/backend/commands/subscriptioncmds.c
M src/backend/commands/tablecmds.c
M src/backend/commands/trigger.c
M src/backend/commands/tsearchcmds.c
M src/backend/commands/typecmds.c
M src/backend/commands/user.c
M src/backend/commands/vacuumparallel.c
M src/backend/executor/execExpr.c
M src/backend/executor/execGrouping.c
M src/backend/executor/execIndexing.c
M src/backend/executor/execMain.c
M src/backend/executor/execParallel.c
M src/backend/executor/execReplication.c
M src/backend/executor/execTuples.c
M src/backend/executor/functions.c
M src/backend/executor/nodeAgg.c
M src/backend/executor/nodeAppend.c
M src/backend/executor/nodeFunctionscan.c
M src/backend/executor/nodeGatherMerge.c
M src/backend/executor/nodeHashjoin.c
M src/backend/executor/nodeIndexonlyscan.c
M src/backend/executor/nodeIndexscan.c
M src/backend/executor/nodeMemoize.c
M src/backend/executor/nodeMergeAppend.c
M src/backend/executor/nodeModifyTable.c
M src/backend/executor/nodeProjectSet.c
M src/backend/executor/nodeSamplescan.c
M src/backend/executor/nodeTableFuncscan.c
M src/backend/executor/nodeTidrangescan.c
M src/backend/executor/nodeTidscan.c
M src/backend/executor/nodeWindowAgg.c
M src/backend/executor/spi.c
M src/backend/executor/tqueue.c
M src/backend/executor/tstoreReceiver.c
M src/backend/foreign/foreign.c
M src/backend/jit/llvm/llvmjit.c
M src/backend/jit/llvm/llvmjit_deform.c
M src/backend/jit/llvm/llvmjit_expr.c
M src/backend/lib/bipartite_match.c
M src/backend/lib/dshash.c
M src/backend/lib/integerset.c
M src/backend/lib/pairingheap.c
M src/backend/lib/rbtree.c
M src/backend/libpq/auth-oauth.c
M src/backend/libpq/auth-scram.c
M src/backend/libpq/hba.c
M src/backend/libpq/pqcomm.c
M src/backend/nodes/nodeFuncs.c
M src/backend/nodes/queryjumblefuncs.c
M src/backend/nodes/tidbitmap.c
M src/backend/optimizer/geqo/geqo_erx.c
M src/backend/optimizer/geqo/geqo_eval.c
M src/backend/optimizer/geqo/geqo_pmx.c
M src/backend/optimizer/geqo/geqo_pool.c
M src/backend/optimizer/geqo/geqo_recombination.c
M src/backend/optimizer/path/clausesel.c
M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/path/indxpath.c
M src/backend/optimizer/path/joinrels.c
M src/backend/optimizer/plan/analyzejoins.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/plan/initsplan.c
M src/backend/optimizer/plan/planagg.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/plan/setrefs.c
M src/backend/optimizer/prep/prepjointree.c
M src/backend/optimizer/prep/prepunion.c
M src/backend/optimizer/util/appendinfo.c
M src/backend/optimizer/util/clauses.c
M src/backend/optimizer/util/extendplan.c
M src/backend/optimizer/util/plancat.c
M src/backend/optimizer/util/predtest.c
M src/backend/optimizer/util/relnode.c
M src/backend/optimizer/util/tlist.c
M src/backend/parser/analyze.c
M src/backend/parser/gram.y
M src/backend/parser/parse_clause.c
M src/backend/parser/parse_expr.c
M src/backend/parser/parse_node.c
M src/backend/parser/parse_param.c
M src/backend/parser/parse_relation.c
M src/backend/parser/parse_type.c
M src/backend/partitioning/partbounds.c
M src/backend/partitioning/partdesc.c
M src/backend/postmaster/autovacuum.c
M src/backend/postmaster/bgworker.c
M src/backend/postmaster/checkpointer.c
M src/backend/postmaster/launch_backend.c
M src/backend/postmaster/pgarch.c
M src/backend/postmaster/postmaster.c
M src/backend/postmaster/syslogger.c
M src/backend/postmaster/walsummarizer.c
M src/backend/replication/libpqwalreceiver/libpqwalreceiver.c
M src/backend/replication/logical/applyparallelworker.c
M src/backend/replication/logical/launcher.c
M src/backend/replication/logical/logical.c
M src/backend/replication/logical/logicalfuncs.c
M src/backend/replication/logical/proto.c
M src/backend/replication/logical/relation.c
M src/backend/replication/logical/reorderbuffer.c
M src/backend/replication/logical/slotsync.c
M src/backend/replication/logical/snapbuild.c
M src/backend/replication/logical/syncutils.c
M src/backend/replication/logical/worker.c
M src/backend/replication/pgoutput/pgoutput.c
M src/backend/replication/syncrep.c
M src/backend/replication/walreceiver.c
M src/backend/replication/walsender.c
M src/backend/rewrite/rewriteHandler.c
M src/backend/rewrite/rewriteManip.c
M src/backend/snowball/dict_snowball.c
M src/backend/statistics/dependencies.c
M src/backend/statistics/extended_stats.c
M src/backend/statistics/mcv.c
M src/backend/storage/file/buffile.c
M src/backend/storage/ipc/procarray.c
M src/backend/storage/ipc/shm_mq.c
M src/backend/storage/ipc/shmem.c
M src/backend/storage/lmgr/lock.c
M src/backend/storage/lmgr/predicate.c
M src/backend/storage/smgr/bulk_write.c
M src/backend/storage/smgr/md.c
M src/backend/storage/smgr/smgr.c
M src/backend/storage/sync/sync.c
M src/backend/tcop/pquery.c
M src/backend/tsearch/dict.c
M src/backend/tsearch/dict_ispell.c
M src/backend/tsearch/dict_simple.c
M src/backend/tsearch/dict_synonym.c
M src/backend/tsearch/dict_thesaurus.c
M src/backend/tsearch/spell.c
M src/backend/tsearch/to_tsany.c
M src/backend/tsearch/ts_parse.c
M src/backend/tsearch/ts_selfuncs.c
M src/backend/tsearch/ts_typanalyze.c
M src/backend/tsearch/ts_utils.c
M src/backend/tsearch/wparser.c
M src/backend/tsearch/wparser_def.c
M src/backend/utils/activity/pgstat_relation.c
M src/backend/utils/activity/wait_event.c
M src/backend/utils/adt/acl.c
M src/backend/utils/adt/array_selfuncs.c
M src/backend/utils/adt/array_typanalyze.c
M src/backend/utils/adt/array_userfuncs.c
M src/backend/utils/adt/arrayfuncs.c
M src/backend/utils/adt/arraysubs.c
M src/backend/utils/adt/date.c
M src/backend/utils/adt/datetime.c
M src/backend/utils/adt/formatting.c
M src/backend/utils/adt/geo_ops.c
M src/backend/utils/adt/geo_spgist.c
M src/backend/utils/adt/int.c
M src/backend/utils/adt/int8.c
M src/backend/utils/adt/json.c
M src/backend/utils/adt/jsonb_gin.c
M src/backend/utils/adt/jsonb_util.c
M src/backend/utils/adt/jsonfuncs.c
M src/backend/utils/adt/jsonpath_exec.c
M src/backend/utils/adt/jsonpath_gram.y
M src/backend/utils/adt/lockfuncs.c
M src/backend/utils/adt/mac.c
M src/backend/utils/adt/mac8.c
M src/backend/utils/adt/mcxtfuncs.c
M src/backend/utils/adt/misc.c
M src/backend/utils/adt/multirangetypes.c
M src/backend/utils/adt/multirangetypes_selfuncs.c
M src/backend/utils/adt/multixactfuncs.c
M src/backend/utils/adt/network.c
M src/backend/utils/adt/network_gist.c
M src/backend/utils/adt/network_spgist.c
M src/backend/utils/adt/numeric.c
M src/backend/utils/adt/orderedsetaggs.c
M src/backend/utils/adt/pg_locale_libc.c
M src/backend/utils/adt/pg_ndistinct.c
M src/backend/utils/adt/rangetypes.c
M src/backend/utils/adt/rangetypes_gist.c
M src/backend/utils/adt/rangetypes_selfuncs.c
M src/backend/utils/adt/rangetypes_spgist.c
M src/backend/utils/adt/rangetypes_typanalyze.c
M src/backend/utils/adt/regexp.c
M src/backend/utils/adt/rowtypes.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/adt/selfuncs.c
M src/backend/utils/adt/skipsupport.c
M src/backend/utils/adt/tid.c
M src/backend/utils/adt/timestamp.c
M src/backend/utils/adt/tsginidx.c
M src/backend/utils/adt/tsgistidx.c
M src/backend/utils/adt/tsquery.c
M src/backend/utils/adt/tsquery_cleanup.c
M src/backend/utils/adt/tsquery_gist.c
M src/backend/utils/adt/tsquery_op.c
M src/backend/utils/adt/tsquery_util.c
M src/backend/utils/adt/tsrank.c
M src/backend/utils/adt/tsvector.c
M src/backend/utils/adt/tsvector_op.c
M src/backend/utils/adt/tsvector_parser.c
M src/backend/utils/adt/uuid.c
M src/backend/utils/adt/varlena.c
M src/backend/utils/adt/xml.c
M src/backend/utils/cache/catcache.c
M src/backend/utils/cache/evtcache.c
M src/backend/utils/cache/inval.c
M src/backend/utils/cache/lsyscache.c
M src/backend/utils/cache/partcache.c
M src/backend/utils/cache/plancache.c
M src/backend/utils/cache/relcache.c
M src/backend/utils/cache/typcache.c
M src/backend/utils/error/elog.c
M src/backend/utils/fmgr/funcapi.c
M src/backend/utils/init/postinit.c
M src/backend/utils/mb/mbutils.c
M src/backend/utils/misc/conffiles.c
M src/backend/utils/misc/guc-file.l
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/injection_point.c
M src/backend/utils/misc/queryenvironment.c
M src/backend/utils/misc/tzparser.c
M src/backend/utils/mmgr/dsa.c
M src/backend/utils/sort/logtape.c
M src/backend/utils/sort/sharedtuplestore.c
M src/backend/utils/sort/tuplesort.c
M src/backend/utils/sort/tuplesortvariants.c
M src/backend/utils/sort/tuplestore.c
M src/backend/utils/time/snapmgr.c
Fix O_CLOEXEC flag handling in Windows port.
commit : c507ba55f5bfae900baa94f1c657e1d99da5c6dc
author : Thomas Munro <tmunro@postgresql.org>
date : Wed, 10 Dec 2025 09:01:35 +1300
committer: Thomas Munro <tmunro@postgresql.org>
date : Wed, 10 Dec 2025 09:01:35 +1300 PostgreSQL's src/port/open.c has always set bInheritHandle = TRUE
when opening files on Windows, making all file descriptors inheritable
by child processes. This meant the O_CLOEXEC flag, added to many call
sites by commit 1da569ca1f (v16), was silently ignored.
The original commit included a comment suggesting that our open()
replacement doesn't create inheritable handles, but it was a mis-
understanding of the code path. In practice, the code was creating
inheritable handles in all cases.
This hasn't caused widespread problems because most child processes
(archive_command, COPY PROGRAM, etc.) operate on file paths passed as
arguments rather than inherited file descriptors. Even if a child
wanted to use an inherited handle, it would need to learn the numeric
handle value, which isn't passed through our IPC mechanisms.
Nonetheless, the current behavior is wrong. It violates documented
O_CLOEXEC semantics, contradicts our own code comments, and makes
PostgreSQL behave differently on Windows than on Unix. It also creates
potential issues with future code or security auditing tools.
To fix, define O_CLOEXEC to _O_NOINHERIT in master, previously used by
O_DSYNC. We use different values in the back branches to preserve
existing values. In pgwin32_open_handle() we set bInheritHandle
according to whether O_CLOEXEC is specified, for the same atomic
semantics as POSIX in multi-threaded programs that create processes.
Backpatch-through: 16
Author: Bryan Green <dbryan.green@gmail.com>
Co-authored-by: Thomas Munro <thomas.munro@gmail.com> (minor adjustments)
Discussion: https://postgr.es/m/e2b16375-7430-4053-bda3-5d2194ff1880%40gmail.com M src/include/port.h
M src/include/port/win32_port.h
M src/port/open.c
M src/test/modules/Makefile
M src/test/modules/meson.build
A src/test/modules/test_cloexec/Makefile
A src/test/modules/test_cloexec/meson.build
A src/test/modules/test_cloexec/t/001_cloexec.pl
A src/test/modules/test_cloexec/test_cloexec.c
vacuumdb: Add --dry-run.
commit : d107176d27c73ea3589b949dde07b6bc38b8f583
author : Nathan Bossart <nathan@postgresql.org>
date : Tue, 9 Dec 2025 13:34:22 -0600
committer: Nathan Bossart <nathan@postgresql.org>
date : Tue, 9 Dec 2025 13:34:22 -0600 This new option instructs vacuumdb to print, but not execute, the
VACUUM and ANALYZE commands that would've been sent to the server.
Author: Corey Huinker <corey.huinker@gmail.com>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Kirill Reshke <reshkekirill@gmail.com>
Reviewed-by: Álvaro Herrera <alvherre@kurilemu.de>
Discussion: https://postgr.es/m/CADkLM%3DckHkX7Of5SrK7g0LokPUwJ%3Dkk8JU1GXGF5pZ1eBVr0%3DQ%40mail.gmail.com M doc/src/sgml/ref/vacuumdb.sgml
M src/bin/scripts/t/100_vacuumdb.pl
M src/bin/scripts/vacuumdb.c
M src/bin/scripts/vacuuming.c
M src/bin/scripts/vacuuming.h
Add ParallelSlotSetIdle().
commit : 750816971b35270971dd77f37ed1e9655fce4ed9
author : Nathan Bossart <nathan@postgresql.org>
date : Tue, 9 Dec 2025 13:34:22 -0600
committer: Nathan Bossart <nathan@postgresql.org>
date : Tue, 9 Dec 2025 13:34:22 -0600 This commit refactors the code for marking a ParallelSlot as idle
to a new static inline function. This can be used to mark a slot
that was obtained via ParallelSlotGetIdle() but that we don't
intend to actually use for a query as idle again.
This is preparatory work for a follow-up commit that will add a
--dry-run option to vacuumdb.
Reviewed-by: Corey Huinker <corey.huinker@gmail.com>
Reviewed-by: Kirill Reshke <reshkekirill@gmail.com>
Reviewed-by: Chao Li <li.evan.chao@gmail.com
Discussion: https://postgr.es/m/CADkLM%3DckHkX7Of5SrK7g0LokPUwJ%3Dkk8JU1GXGF5pZ1eBVr0%3DQ%40mail.gmail.com M src/fe_utils/parallel_slot.c
M src/include/fe_utils/parallel_slot.h
vacuumdb: Move some variables to the vacuumingOptions struct.
commit : cf1450e57799afb683ccbfc482c6f1b5827c81e7
author : Nathan Bossart <nathan@postgresql.org>
date : Tue, 9 Dec 2025 13:34:22 -0600
committer: Nathan Bossart <nathan@postgresql.org>
date : Tue, 9 Dec 2025 13:34:22 -0600 Presently, the "echo" and "quiet" variables are carted around to
various functions, which is a bit tedious. To simplify things,
this commit moves them into the vacuumingOptions struct and removes
the related function parameters. While at it, remove some
redundant initialization code in vacuumdb's main() function.
This is preparatory work for a follow-up commit that will add a
--dry-run option to vacuumdb.
Reviewed-by: Corey Huinker <corey.huinker@gmail.com>
Reviewed-by: Kirill Reshke <reshkekirill@gmail.com>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://postgr.es/m/CADkLM%3DckHkX7Of5SrK7g0LokPUwJ%3Dkk8JU1GXGF5pZ1eBVr0%3DQ%40mail.gmail.com M src/bin/scripts/vacuumdb.c
M src/bin/scripts/vacuuming.c
M src/bin/scripts/vacuuming.h
Add started_by column to pg_stat_progress_analyze view.
commit : ab40db3852dfa093b64c9266dd372fee414e993f
author : Masahiko Sawada <msawada@postgresql.org>
date : Tue, 9 Dec 2025 11:23:45 -0800
committer: Masahiko Sawada <msawada@postgresql.org>
date : Tue, 9 Dec 2025 11:23:45 -0800 The new column, started_by, indicates the initiator of the
analyze ('manual' or 'autovacuum'), helping users and monitoring tools
to better understand ANALYZE behavior.
Bump catalog version.
Author: Shinya Kato <shinya11.kato@gmail.com>
Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com>
Reviewed-by: Sami Imseih <samimseih@gmail.com>
Reviewed-by: Yu Wang <wangyu_runtime@163.com>
Discussion: https://postgr.es/m/CAA5RZ0suoicwxFeK_eDkUrzF7s0BVTaE7M%2BehCpYcCk5wiECpw%40mail.gmail.com M doc/src/sgml/monitoring.sgml
M src/backend/catalog/system_views.sql
M src/backend/commands/analyze.c
M src/include/catalog/catversion.h
M src/include/commands/progress.h
M src/test/regress/expected/rules.out
Add mode and started_by columns to pg_stat_progress_vacuum view.
commit : 0d789520619803cf6629ebf980e116d733b6756f
author : Masahiko Sawada <msawada@postgresql.org>
date : Tue, 9 Dec 2025 10:51:14 -0800
committer: Masahiko Sawada <msawada@postgresql.org>
date : Tue, 9 Dec 2025 10:51:14 -0800 The new columns, mode and started_by, indicate the vacuum
mode ('normal', 'aggressive', or 'failsafe') and the initiator of the
vacuum ('manual', 'autovacuum', or 'autovacuum_wraparound'),
respectively. This allows users and monitoring tools to better
understand VACUUM behavior.
Bump catalog version.
Author: Shinya Kato <shinya11.kato@gmail.com>
Reviewed-by: Kirill Reshke <reshkekirill@gmail.com>
Reviewed-by: Nathan Bossart <nathandbossart@gmail.com>
Reviewed-by: Robert Treat <rob@xzilla.net>
Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com>
Reviewed-by: Sami Imseih <samimseih@gmail.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Reviewed-by: Yu Wang <wangyu_runtime@163.com>
Discussion: https://postgr.es/m/CAOzEurQcOY-OBL_ouEVfEaFqe_md3vB5pXjR_m6L71Dcp1JKCQ@mail.gmail.com M doc/src/sgml/maintenance.sgml
M doc/src/sgml/monitoring.sgml
M src/backend/access/heap/vacuumlazy.c
M src/backend/catalog/system_views.sql
M src/include/catalog/catversion.h
M src/include/commands/progress.h
M src/test/regress/expected/rules.out
doc: Fix titles of some pg_buffercache functions.
commit : b237f5422bc0667754f986f9d5bfc34a13401bc1
author : Nathan Bossart <nathan@postgresql.org>
date : Tue, 9 Dec 2025 11:01:38 -0600
committer: Nathan Bossart <nathan@postgresql.org>
date : Tue, 9 Dec 2025 11:01:38 -0600 As in commit 59d6c03956, use <function> rather than <structname> in
the <title> to be consistent with how other functions in this
module are documented.
Oversights in commits dcf7e1697b and 9ccc049dfe.
Author: Noboru Saito <noborusai@gmail.com>
Discussion: https://postgr.es/m/CAAM3qn%2B7KraFkCyoJCHq6m%3DurxcoHPEPryuyYeg%3DQ0EjJxjdTA%40mail.gmail.com
Backpatch-through: 18 M doc/src/sgml/pgbuffercache.sgml
Support "j" length modifier in snprintf.c.
commit : f8715ec86608fc5f6c80f5dec3369b4cc56481a8
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Tue, 9 Dec 2025 11:43:25 -0500
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Tue, 9 Dec 2025 11:43:25 -0500 POSIX has for a long time defined the "j" length modifier for
printf conversions as meaning the size of intmax_t or uintmax_t.
We got away without supporting that so far, because we were not
using intmax_t anywhere. However, commit e6be84356 re-introduced
upstream's use of intmax_t and PRIdMAX into zic.c. It emerges
that on some platforms (at least FreeBSD and macOS), <inttypes.h>
defines PRIdMAX as "jd", so that snprintf.c falls over if that is
used. (We hadn't noticed yet because it would only be apparent
if bad data is fed to zic, resulting in an error report, and even
then the only visible symptom is a missing line number in the
error message.)
We could revert that decision from our copy of zic.c, but
on the whole it seems better to update snprintf.c to support
this standard modifier. There might well be extensions,
now or in future, that expect it to work.
I did this in the lazy man's way of translating "j" to either
"l" or "ll" depending on a compile-time sizeof() check, just
as was done long ago to support "z" for size_t. One could
imagine promoting intmax_t to have full support in snprintf.c,
for example converting fmtint()'s value argument and internal
arithmetic to use [u]intmax_t not [unsigned] long long. But
that'd be more work and I'm hesitant to do it anyway: if there
are any platforms out there where intmax_t is actually wider
than "long long", this would doubtless result in a noticeable
speed penalty to snprintf(). Let's not go there until we have
positive evidence that there's a reason to, and some way to
measure what size of penalty we're taking.
Author: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/3210703.1765236740@sss.pgh.pa.us M configure
M configure.ac
M meson.build
M src/include/pg_config.h.in
M src/port/snprintf.c
Add wait event for the group commit delay before WAL flush
commit : 3cb5808bd11c5a7ef697922335f7642f643a4e7f
author : Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Tue, 9 Dec 2025 17:06:40 +0200
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Tue, 9 Dec 2025 17:06:40 +0200 Author: Rafia Sabih <rafia.pghackers@gmail.com>
Reviewed-by: Sami Imseih <samimseih@gmail.com>
Discussion: https://www.postgresql.org/message-id/CA%2BFpmFf-hWXtrC0Q3Cr_Xo78zuP_M_VC5xgWPOYOkwqOD0T8eg@mail.gmail.com M src/backend/access/transam/xlog.c
M src/backend/utils/activity/wait_event_names.txt
Fix warning about wrong format specifier for off_t type
commit : f231a4e8c7f2ce93203cedea7a02ef3eeb744647
author : Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Tue, 9 Dec 2025 14:05:13 +0200
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Tue, 9 Dec 2025 14:05:13 +0200 Per OS X buildfarm members. M src/bin/pg_upgrade/slru_io.c
Widen MultiXactOffset to 64 bits
commit : bd8d9c9bdfa0c2168bb37edca6fa88168cacbbaa
author : Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Tue, 9 Dec 2025 13:53:03 +0200
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Tue, 9 Dec 2025 13:53:03 +0200 This eliminates MultiXactOffset wraparound and the 2^32 limit on the
total number of multixid members. Multixids are still limited to 2^31,
but this is a nice improvement because 'members' can grow much faster
than the number of multixids. On such systems, you can now run longer
before hitting hard limits or triggering anti-wraparound vacuums.
Not having to deal with MultiXactOffset wraparound also simplifies the
code and removes some gnarly corner cases.
We no longer need to perform emergency anti-wraparound freezing
because of running out of 'members' space, so the offset stop limit is
gone. But you might still not want 'members' to consume huge amounts
of disk space. For that reason, I kept the logic for lowering vacuum's
multixid freezing cutoff if a large amount of 'members' space is
used. The thresholds for that are roughly the same as the "safe" and
"danger" thresholds used before, 2 billion transactions and 4 billion
transactions. This keeps the behavior for the freeze cutoff roughly
the same as before. It might make sense to make this smarter or
configurable, now that the threshold is only needed to manage disk
usage, but that's left for the future.
Add code to pg_upgrade to convert multitransactions from the old to
the new format, rewriting the pg_multixact SLRU files. Because
pg_upgrade now rewrites the files, we can get rid of some hacks we had
put in place to deal with old bugs and upgraded clusters. Bump catalog
version for the pg_multixact/offsets format change.
Author: Maxim Orlov <orlovmg@gmail.com>
Reviewed-by: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>
Reviewed-by: Alexander Korotkov <aekorotkov@gmail.com>
Reviewed-by: wenhui qiu <qiuwenhuifx@gmail.com>
Discussion: https://www.postgresql.org/message-id/CACG%3DezaWg7_nt-8ey4aKv2w9LcuLthHknwCawmBgEeTnJrJTcw@mail.gmail.com M doc/src/sgml/ref/pg_resetwal.sgml
M src/backend/access/rmgrdesc/mxactdesc.c
M src/backend/access/rmgrdesc/xlogdesc.c
M src/backend/access/transam/multixact.c
M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogrecovery.c
M src/backend/commands/vacuum.c
M src/backend/postmaster/autovacuum.c
M src/bin/pg_controldata/pg_controldata.c
M src/bin/pg_resetwal/pg_resetwal.c
M src/bin/pg_resetwal/t/001_basic.pl
M src/bin/pg_upgrade/Makefile
M src/bin/pg_upgrade/meson.build
A src/bin/pg_upgrade/multixact_read_v18.c
A src/bin/pg_upgrade/multixact_read_v18.h
A src/bin/pg_upgrade/multixact_rewrite.c
M src/bin/pg_upgrade/pg_upgrade.c
M src/bin/pg_upgrade/pg_upgrade.h
A src/bin/pg_upgrade/slru_io.c
A src/bin/pg_upgrade/slru_io.h
A src/bin/pg_upgrade/t/007_multixact_conversion.pl
M src/include/access/multixact.h
M src/include/access/multixact_internal.h
M src/include/c.h
M src/include/catalog/catversion.h
M src/test/modules/test_slru/t/002_multixact_wraparound.pl
M src/test/perl/PostgreSQL/Test/BackgroundPsql.pm
M src/test/perl/PostgreSQL/Test/Cluster.pm
M src/tools/pgindent/typedefs.list
Move pg_multixact SLRU page format definitions to a separate header
commit : bb3b1c4f64620ca05d86a20a26c8fa4ca1cf7b78
author : Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Tue, 9 Dec 2025 13:45:01 +0200
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Tue, 9 Dec 2025 13:45:01 +0200 This makes them accessible from pg_upgrade, needed by the next commit.
I'm doing this mechanical move as a separate commit to make the next
commit's changes to these definitions more obvious.
Author: Maxim Orlov <orlovmg@gmail.com>
Discussion: https://www.postgresql.org/message-id/CACG%3DezbZo_3_fnx%3DS5BfepwRftzrpJ%2B7WET4EkTU6wnjDTsnjg@mail.gmail.com M src/backend/access/transam/multixact.c
A src/include/access/multixact_internal.h
doc: Fix statement about ON CONFLICT and deferrable constraints.
commit : e9443a55265fbf3726f7ba4d961399b7dff3ea9f
author : Dean Rasheed <dean.a.rasheed@gmail.com>
date : Tue, 9 Dec 2025 10:49:16 +0000
committer: Dean Rasheed <dean.a.rasheed@gmail.com>
date : Tue, 9 Dec 2025 10:49:16 +0000 The description of deferrable constraints in create_table.sgml states
that deferrable constraints cannot be used as conflict arbitrators in
an INSERT with an ON CONFLICT DO UPDATE clause, but in fact this
restriction applies to all ON CONFLICT clauses, not just those with DO
UPDATE. Fix this, and while at it, change the word "arbitrators" to
"arbiters", to match the terminology used elsewhere.
Author: Dean Rasheed <dean.a.rasheed@gmail.com>
Discussion: https://postgr.es/m/CAEZATCWsybvZP3ce8rGcVNx-QHuDOJZDz8y=p1SzqHwjRXyV4Q@mail.gmail.com
Backpatch-through: 14 M doc/src/sgml/ref/create_table.sgml
Fix distinctness check for queries with grouping sets
commit : f00484c170f56199c3eeacc82bd72f8c1e3baf6b
author : Richard Guo <rguo@postgresql.org>
date : Tue, 9 Dec 2025 17:09:27 +0900
committer: Richard Guo <rguo@postgresql.org>
date : Tue, 9 Dec 2025 17:09:27 +0900 query_is_distinct_for() is intended to determine whether a query never
returns duplicates of the specified columns. For queries using
grouping sets, if there are no grouping expressions, the query may
contain one or more empty grouping sets. The goal is to detect
whether there is exactly one empty grouping set, in which case the
query would return a single row and thus be distinct.
The previous logic in query_is_distinct_for() was incomplete because
the check was insufficiently thorough and could return false when it
could have returned true. It failed to consider cases where the
DISTINCT clause is used on the GROUP BY, in which case duplicate empty
grouping sets are removed, leaving only one. It also did not
correctly handle all possible structures of GroupingSet nodes that
represent a single empty grouping set.
To fix, add a check for the groupDistinct flag, and expand the query's
groupingSets tree into a flat list, then verify that the expanded list
contains only one element.
No backpatch as this could result in plan changes.
Author: Richard Guo <guofenglinux@gmail.com>
Reviewed-by: David Rowley <dgrowleyml@gmail.com>
Discussion: https://postgr.es/m/CAMbWs480Z04NtP8-O55uROq2Zego309+h3hhaZhz6ztmgWLEBw@mail.gmail.com M src/backend/optimizer/plan/analyzejoins.c
M src/test/regress/expected/join.out
M src/test/regress/sql/join.sql
Fix const-simplification for index expressions and predicate
commit : c925ad30b047ec1388247539e86729d584c34b8d
author : Richard Guo <rguo@postgresql.org>
date : Tue, 9 Dec 2025 16:56:26 +0900
committer: Richard Guo <rguo@postgresql.org>
date : Tue, 9 Dec 2025 16:56:26 +0900 Similar to the issue with constraint and statistics expressions fixed
in 317c117d6, index expressions and predicate can also suffer from
incorrect reduction of NullTest clauses during const-simplification,
due to unfixed varnos and the use of a NULL root. It has been
reported that this issue can cause the planner to fail to pick up a
partial index that it previously matched successfully.
Because we need to cache the const-simplified index expressions and
predicate in the relcache entry, we cannot fix the Vars before
applying eval_const_expressions. To ensure proper reduction of
NullTest clauses, this patch runs eval_const_expressions a second time
-- after the Vars have been fixed and with a valid root.
It could be argued that the additional call to eval_const_expressions
might increase planning time, but I don't think that's a concern. It
only runs when index expressions and predicate are present; it is
relatively cheap when run on small expression trees (which is
typically the case for index expressions and predicate), and it runs
on expressions that have already been const-simplified once, making
the second pass even cheaper. In return, in cases like the one
reported, it allows the planner to match and use partial indexes,
which can lead to significant execution-time improvements.
Bug: #19007
Reported-by: Bryan Fox <bryfox@gmail.com>
Author: Richard Guo <guofenglinux@gmail.com>
Discussion: https://postgr.es/m/19007-4cc6e252ed8aa54a@postgresql.org M src/backend/optimizer/util/plancat.c
M src/test/regress/expected/join.out
M src/test/regress/expected/predicate.out
M src/test/regress/sql/join.sql
M src/test/regress/sql/predicate.sql
Fix LOCK_TIMEOUT handling in slotsync worker.
commit : 04396eacd3faeaa4fa3d084a6749e4e384bdf0db
author : Amit Kapila <akapila@postgresql.org>
date : Tue, 9 Dec 2025 07:25:20 +0000
committer: Amit Kapila <akapila@postgresql.org>
date : Tue, 9 Dec 2025 07:25:20 +0000 Previously, the slotsync worker relied on SIGINT for graceful shutdown
during promotion. However, SIGINT is also used by the LOCK_TIMEOUT handler
to cancel queries. Since the slotsync worker can lock catalog tables while
parsing libpq tuples, this overlap caused it to ignore LOCK_TIMEOUT
signals and potentially wait indefinitely on locks.
This patch replaces the slotsync worker's SIGINT handler with
StatementCancelHandler to correctly process query-cancel interrupts.
Additionally, the startup process now uses SIGUSR1 to signal the slotsync
worker to stop during promotion. The worker exits after detecting that the
shared memory flag stopSignaled is set.
Author: Hou Zhijie <houzj.fnst@fujitsu.com>
Reviewed-by: shveta malik <shveta.malik@gmail.com>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>
Backpatch-through: 17, here it was introduced
Discussion: https://postgr.es/m/TY4PR01MB169078F33846E9568412D878C94A2A@TY4PR01MB16907.jpnprd01.prod.outlook.com M src/backend/replication/logical/slotsync.c
Remove useless casts in format arguments
commit : 2268f2b91b5513cbf430d1cca488203d66103b3a
author : Peter Eisentraut <peter@eisentraut.org>
date : Tue, 9 Dec 2025 06:58:39 +0100
committer: Peter Eisentraut <peter@eisentraut.org>
date : Tue, 9 Dec 2025 06:58:39 +0100 There were a number of useless casts in format arguments, either
where the input to the cast was already in the right type, or
seemingly uselessly casting between types instead of just using the
right format placeholder to begin with.
Reviewed-by: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/07fa29f9-42d7-4aac-8834-197918cbbab6%40eisentraut.org M contrib/amcheck/verify_heapam.c
M src/backend/access/common/printtup.c
M src/backend/access/rmgrdesc/gindesc.c
M src/backend/access/transam/xact.c
M src/backend/access/transam/xlogreader.c
M src/backend/commands/copyfromparse.c
M src/backend/commands/define.c
M src/backend/libpq/auth.c
M src/backend/libpq/pqcomm.c
M src/backend/libpq/pqmq.c
M src/backend/parser/parse_type.c
M src/backend/replication/walreceiver.c
M src/backend/storage/page/bufpage.c
M src/backend/utils/adt/format_type.c
M src/backend/utils/adt/tsvector.c
M src/backend/utils/adt/xid.c
M src/bin/pg_ctl/pg_ctl.c
M src/bin/pgbench/pgbench.c
M src/bin/psql/common.c
Clean up int64-related format strings
commit : 907caf5c392ad75177bdfd48d38cf0cc6904e8e1
author : Peter Eisentraut <peter@eisentraut.org>
date : Tue, 9 Dec 2025 06:58:39 +0100
committer: Peter Eisentraut <peter@eisentraut.org>
date : Tue, 9 Dec 2025 06:58:39 +0100 Remove some gratuitous uses of INT64_FORMAT. Make use of
PRIu64/PRId64 were appropriate, remove unnecessary casts.
Reviewed-by: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/07fa29f9-42d7-4aac-8834-197918cbbab6%40eisentraut.org M contrib/isn/isn.c
M contrib/isn/isn.h
M contrib/pageinspect/btreefuncs.c
M src/backend/backup/basebackup.c
M src/bin/pg_rewind/pg_rewind.c
Remove unnecessary casts in printf format arguments (%zu/%zd)
commit : 2b117bb014d066549c319dcd73bd538e32b0c408
author : Peter Eisentraut <peter@eisentraut.org>
date : Tue, 9 Dec 2025 06:58:39 +0100
committer: Peter Eisentraut <peter@eisentraut.org>
date : Tue, 9 Dec 2025 06:58:39 +0100 Many of these are probably left over from before use of %zu/%zd was
portable.
Reviewed-by: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/07fa29f9-42d7-4aac-8834-197918cbbab6%40eisentraut.org M src/backend/access/gist/gistutil.c
M src/backend/access/gist/gistxlog.c
M src/backend/access/hash/hash_xlog.c
M src/backend/backup/basebackup_server.c
M src/backend/libpq/auth.c
M src/backend/libpq/pqcomm.c
M src/backend/nodes/outfuncs.c
M src/backend/storage/page/bufpage.c
M src/backend/utils/adt/array_expanded.c
M src/backend/utils/adt/arrayfuncs.c
M src/backend/utils/adt/varchar.c
M src/backend/utils/misc/guc.c
M src/bin/pg_combinebackup/write_manifest.c
M src/bin/pg_dump/pg_backup_archiver.c
M src/bin/pg_rewind/libpq_source.c
M src/bin/pg_rewind/local_source.c
M src/bin/pg_rewind/pg_rewind.c
M src/interfaces/libpq/fe-connect.c
M src/interfaces/libpq/fe-misc.c
Use palloc_object() and palloc_array() in more areas of the tree
commit : 0c3c5c3b06a37c13a811ea93044202e06523b705
author : Michael Paquier <michael@paquier.xyz>
date : Tue, 9 Dec 2025 14:53:17 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Tue, 9 Dec 2025 14:53:17 +0900 The idea is to encourage more the use of these new routines across the
tree, as these offer stronger type safety guarantees than palloc().
The following paths are included in this batch, treating all the areas
proposed by the author for the most trivial changes, except src/backend
(by far the largest batch):
src/bin/
src/common/
src/fe_utils/
src/include/
src/pl/
src/test/
src/tutorial/
Similar work has been done in 31d3847a37be.
The code compiles the same before and after this commit, with the
following exceptions due to changes in line numbers because some of the
new allocation formulas are shorter:
blkreftable.c
pgfnames.c
pl_exec.c
Author: David Geier <geidav.pg@gmail.com>
Discussion: https://postgr.es/m/ad0748d4-3080-436e-b0bc-ac8f86a3466a@gmail.com M doc/src/sgml/gist.sgml
M doc/src/sgml/xfunc.sgml
M doc/src/sgml/xtypes.sgml
M src/bin/pg_basebackup/astreamer_inject.c
M src/bin/pg_combinebackup/load_manifest.c
M src/bin/pg_dump/common.c
M src/bin/pg_verifybackup/astreamer_verify.c
M src/bin/pg_verifybackup/pg_verifybackup.c
M src/bin/scripts/vacuuming.c
M src/common/blkreftable.c
M src/common/parse_manifest.c
M src/common/pgfnames.c
M src/common/rmtree.c
M src/common/stringinfo.c
M src/fe_utils/astreamer_file.c
M src/fe_utils/astreamer_gzip.c
M src/fe_utils/astreamer_lz4.c
M src/fe_utils/astreamer_tar.c
M src/fe_utils/astreamer_zstd.c
M src/include/lib/radixtree.h
M src/pl/plperl/plperl.c
M src/pl/plpgsql/src/pl_comp.c
M src/pl/plpgsql/src/pl_exec.c
M src/pl/plpgsql/src/pl_gram.y
M src/pl/plpython/plpy_procedure.c
M src/pl/plpython/plpy_spi.c
M src/pl/plpython/plpy_typeio.c
M src/pl/tcl/pltcl.c
M src/test/modules/dummy_index_am/dummy_index_am.c
M src/test/modules/spgist_name_ops/spgist_name_ops.c
M src/test/modules/test_bitmapset/test_bitmapset.c
M src/test/modules/test_integerset/test_integerset.c
M src/test/modules/test_json_parser/test_json_parser_incremental.c
M src/test/modules/test_parser/test_parser.c
M src/test/modules/test_radixtree/test_radixtree.c
M src/test/modules/test_regex/test_regex.c
M src/test/modules/test_resowner/test_resowner_many.c
M src/test/modules/test_rls_hooks/test_rls_hooks.c
M src/test/modules/worker_spi/worker_spi.c
M src/test/regress/regress.c
M src/timezone/pgtz.c
M src/tutorial/complex.c
M src/tutorial/funcs.c
Improve documentation for pg_atomic_unlocked_write_u32()
commit : aa749bde323364039f369784071f315ad53c1325
author : Andres Freund <andres@anarazel.de>
date : Mon, 8 Dec 2025 23:03:54 -0500
committer: Andres Freund <andres@anarazel.de>
date : Mon, 8 Dec 2025 23:03:54 -0500 After my recent commit 7902a47c20b, Nathan noticed that
pg_atomic_unlocked_write_u64() was not accurately described by the comments
for the 32bit version. Turns out the 32bit version has suffered from
copy-and-paste-itis since its introduction. Fix.
Reported-by: Nathan Bossart <nathandbossart@gmail.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Nathan Bossart <nathandbossart@gmail.com>
Discussion: https://postgr.es/m/aTGt7q4Jvn97uGAx@nathan M src/include/port/atomics.h
Doc: fix typo in hash index documentation
commit : 52382feb782b76c42552e96f0bc382a87fd7c1e4
author : David Rowley <drowley@postgresql.org>
date : Tue, 9 Dec 2025 14:41:30 +1300
committer: David Rowley <drowley@postgresql.org>
date : Tue, 9 Dec 2025 14:41:30 +1300 Plus a similar fix to the README.
Backpatch as far back as the sgml issue exists. The README issue does
exist in v14, but that seems unlikely to harm anyone.
Author: David Geier <geidav.pg@gmail.com>
Discussion: https://postgr.es/m/ed3db7ea-55b4-4809-86af-81ad3bb2c7d3@gmail.com
Backpatch-through: 15 M doc/src/sgml/hash.sgml
M src/backend/access/hash/README
libpq: Refactor logic checking for exit() in shared library builds
commit : 4a8e6f43a6b56289cd3806b239c20ae31aa4cf2e
author : Michael Paquier <michael@paquier.xyz>
date : Tue, 9 Dec 2025 10:39:08 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Tue, 9 Dec 2025 10:39:08 +0900 This commit refactors the sanity check done by libpq to ensure that
there is no exit() reference in the build, moving the check from a
standalone Makefile rule to a perl script.
Platform-specific checks are now part of the script, avoiding most of
the duplication created by the introduction of this check for meson, but
not all of them:
- Solaris and Windows skipped in the script.
- Whitelist of symbols is in the script.
- nm availability, with its path given as an option of the script. Its
execution is checked in the script.
- Check is disabled if coverage reports are enabled. This part is not
pushed down to the script.
- Check is disabled for static builds of libpq. This part is filtered
out in each build script.
A trick is required for the stamp file, in the shape of an optional
argument that can be given to the script. Meson expects the stamp in
output and uses this argument, generating the stamp file in the script.
Meson is able to handle the removal of the stamp file internally when
libpq needs to be rebuilt and the check done again.
This refactoring piece has come up while discussing the addition of more
items in the symbols considered as acceptable.
This sanity check has never been run by meson since its introduction in
dc227eb82ea8, so it is possible that this fails in some of the buildfarm
members. At least the CI is happy with it, but let's see how it goes.
Author: Nazir Bilal Yavuz <byavuz81@gmail.com>
Co-authored-by: VASUKI M <vasukim1992002@gmail.com>
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://postgr.es/m/19095-6d8256d0c37d4be2@postgresql.org M configure
M configure.ac
M meson.build
M src/Makefile.global.in
M src/interfaces/libpq/Makefile
A src/interfaces/libpq/libpq_check.pl
M src/interfaces/libpq/meson.build
Fix minor portability issue in pg_resetwal.c.
commit : c004d68c9395812bfcff82c2d7c4e56d36e72f1c
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Mon, 8 Dec 2025 19:06:36 -0500
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Mon, 8 Dec 2025 19:06:36 -0500 The argument of isspace() (like other <ctype.h> functions)
must be cast to unsigned char to ensure portable results.
Per NetBSD buildfarm members. Oversight in 636c1914b. M src/bin/pg_resetwal/pg_resetwal.c
Avoid pointer chasing in _bt_readpage inner loop.
commit : 83a26ba59b1819cbd61705a3ff6aa572081ccc4b
author : Peter Geoghegan <pg@bowt.ie>
date : Mon, 8 Dec 2025 13:48:09 -0500
committer: Peter Geoghegan <pg@bowt.ie>
date : Mon, 8 Dec 2025 13:48:09 -0500 Make _bt_readpage pass down the current scan direction to various
utility functions within its pstate variable. Also have _bt_readpage
work off of a local copy of scan->ignore_killed_tuples within its
per-tuple loop (rather than using scan->ignore_killed_tuples directly).
Testing has shown that this significantly benefits large range scans,
which are naturally able to take full advantage of the pstate.startikey
optimization added by commit 8a510275. Running a pgbench script with a
"SELECT abalance FROM pgbench_accounts WHERE aid BETWEEN ..." query
shows an increase in transaction throughput of over 5%. There also
appears to be a small performance benefit when running pgbench's
built-in select-only script.
Follow-up to commit 65d6acbc.
Author: Peter Geoghegan <pg@bowt.ie>
Reviewed-By: Victor Yegorov <vyegorov@gmail.com>
Discussion: https://postgr.es/m/CAH2-WzmwMwcwKFgaf+mYPwiz3iL4AqpXnwtW_O0vqpWPXRom9Q@mail.gmail.com M src/backend/access/nbtree/nbtreadpage.c
Unify some more messages
commit : d0d0ba6cf66c4043501f6f7bf508ad920645e415
author : Álvaro Herrera <alvherre@kurilemu.de>
date : Mon, 8 Dec 2025 19:23:38 +0100
committer: Álvaro Herrera <alvherre@kurilemu.de>
date : Mon, 8 Dec 2025 19:23:38 +0100 No backpatch here because of message wording changes.
Author: Álvaro Herrera <alvherre@kurilemu.de>
Reviewed-by: Nathan Bossart <nathandbossart@gmail.com>
Discussion: https://postgr.es/m/202512081537.ahw5gwoencou@alvherre.pgsql M src/backend/commands/matview.c
M src/backend/postmaster/checkpointer.c
M src/test/regress/expected/matview.out
M src/test/regress/expected/stats.out
Relocate _bt_readpage and related functions.
commit : 65d6acbc564989af15102f69978c63c3cdb5fdbc
author : Peter Geoghegan <pg@bowt.ie>
date : Mon, 8 Dec 2025 13:15:00 -0500
committer: Peter Geoghegan <pg@bowt.ie>
date : Mon, 8 Dec 2025 13:15:00 -0500 Quite a bit of code within nbtutils.c is only called by _bt_readpage.
Move _bt_readpage and all of the nbtutils.c functions it depends on into
a new .c file, nbtreadpage.c. Also reorder some of the functions within
the new file for clarity.
This commit has no functional impact. It is strictly mechanical.
Author: Peter Geoghegan <pg@bowt.ie>
Reviewed-By: Victor Yegorov <vyegorov@gmail.com>
Discussion: https://postgr.es/m/CAH2-WzmwMwcwKFgaf+mYPwiz3iL4AqpXnwtW_O0vqpWPXRom9Q@mail.gmail.com M src/backend/access/nbtree/Makefile
M src/backend/access/nbtree/meson.build
A src/backend/access/nbtree/nbtreadpage.c
M src/backend/access/nbtree/nbtree.c
M src/backend/access/nbtree/nbtsearch.c
M src/backend/access/nbtree/nbtutils.c
M src/include/access/nbtree.h
Unify error messages
commit : 502e256f2262351e92994878eea3332da64834b0
author : Álvaro Herrera <alvherre@kurilemu.de>
date : Mon, 8 Dec 2025 16:30:52 +0100
committer: Álvaro Herrera <alvherre@kurilemu.de>
date : Mon, 8 Dec 2025 16:30:52 +0100 No visible changes, just refactor how messages are constructed. M src/backend/catalog/aclchk.c
M src/backend/commands/cluster.c
M src/backend/commands/dbcommands.c
M src/backend/commands/explain_state.c
M src/backend/commands/indexcmds.c
M src/backend/commands/vacuum.c
M src/backend/postmaster/checkpointer.c
M src/backend/replication/walsender.c
M src/bin/pg_basebackup/pg_createsubscriber.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dumpall.c
M src/bin/pg_dump/pg_restore.c
pg_resetwal: Use separate flags for whether an option is given
commit : 978cf02bb8caeafd6fe5178e67016ffd898599b4
author : Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Mon, 8 Dec 2025 16:54:54 +0200
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Mon, 8 Dec 2025 16:54:54 +0200 Currently, we use special values that are otherwise invalid for each
option to indicate "option was not given". Replace that with separate
boolean variables for each option. It seems more clear to be explicit.
We were already doing that for the -m option, because there were no
invalid values for nextMulti that we could use (since commit
94939c5f3a).
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://www.postgresql.org/message-id/81adf5f3-36ad-4bcd-9ba5-1b95c7b7a807@iki.fi M src/bin/pg_resetwal/pg_resetwal.c
pg_resetwal: Reject negative and out of range arguments
commit : 636c1914b483bab0eaabdec30cf1f2c743606d7f
author : Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Mon, 8 Dec 2025 16:54:50 +0200
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Mon, 8 Dec 2025 16:54:50 +0200 The strtoul() function that we used to parse many of the options
accepts negative values, and silently wraps them to the equivalent
unsigned values. For example, -1 becomes 0xFFFFFFFF, on platforms
where unsigned long is 32 bits wide. Also, on platforms where
"unsigned long" is 64 bits wide, we silently casted values larger than
UINT32_MAX to the equivalent 32-bit value. Both of those behaviors
seem undesirable, so tighten up the parsing to reject them.
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://www.postgresql.org/message-id/81adf5f3-36ad-4bcd-9ba5-1b95c7b7a807@iki.fi M src/bin/pg_resetwal/pg_resetwal.c
M src/bin/pg_resetwal/t/001_basic.pl
Make ecpg parse.pl more robust with braces
commit : 7f88553ceaca4af0e5bd483ab77f9f442578c18a
author : Peter Eisentraut <peter@eisentraut.org>
date : Mon, 8 Dec 2025 15:53:52 +0100
committer: Peter Eisentraut <peter@eisentraut.org>
date : Mon, 8 Dec 2025 15:53:52 +0100 When parse.pl processes braces, it does not take into account that
braces could also be their own token if single quoted ('{', '}').
This is not currently used but a future patch wants to make use of it.
This fixes that by using lookaround assertions to detect the quotes.
To make sure all Perl versions in play support this and to avoid
surprises later on, let's give this a spin on the buildfarm now. It
can exist independently of future work.
Reviewed-by: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/a855795d-e697-4fa5-8698-d20122126567@eisentraut.org M src/interfaces/ecpg/preproc/parse.pl
Use PGAlignedXLogBlock for some code simplification
commit : 804046b39a27973751c920f8f41504697f3f52d5
author : Peter Eisentraut <peter@eisentraut.org>
date : Mon, 8 Dec 2025 13:52:42 +0100
committer: Peter Eisentraut <peter@eisentraut.org>
date : Mon, 8 Dec 2025 13:52:42 +0100 The code in BootStrapXLOG() and in pg_test_fsync.c tried to align WAL
buffers in complicated ways. Also, they still used XLOG_BLCKSZ for
the alignment, even though that should now be PG_IO_ALIGN_SIZE. This
can now be simplified and made more consistent by using
PGAlignedXLogBlock, either directly in BootStrapXLOG() and using
alignas in pg_test_fsync.c.
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Thomas Munro <thomas.munro@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/f462a175-b608-44a1-b428-bdf351e914f4%40eisentraut.org M src/backend/access/transam/xlog.c
M src/bin/pg_test_fsync/pg_test_fsync.c
test_custom_stats: Test module for custom cumulative statistics
commit : 31280d96a64850f5a9a924088890ab43a2905237
author : Michael Paquier <michael@paquier.xyz>
date : Mon, 8 Dec 2025 15:23:09 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Mon, 8 Dec 2025 15:23:09 +0900 This test module acts as a replacement that existed prior to
d52c24b0f808 in the test module injection_points. It uses a more
flexible structure than its ancestor:
- Two libraries are built, one for fixed-sized stats and one for
variable-sized stats.
- No GUCs required. The stats are enabled only if one or both libraries
are loaded with shared_preload_libraries.
- Same kind IDs reserved: 25 (variable-sized) and 26 (fixed-sized)
The goal of this redesign is to be able to easier extend the code
coverage provided by this module for other changes that are currently
under discussion, and injection_points was not suited for these.
Injection points are also now widely used in the tree now, so extending
more the test coverage for custom pgstats in the test module
injection_points would be a riskier long-term move.
The new code is mostly a copy of what existed previously in the test
module injection_points, with the same callbacks defined for fixed-sized
and variable-sized stats, but a simpler overall structure in terms of
the stats counters updated.
The test coverage should remain the same as previously: one TAP test is
used to check data reports, crash recovery and clean restart scenarios.
Tests are added for the manual reset of fixed-sized stats, something
not tested until now.
Author: Sami Imseih <samimseih@gmail.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://postgr.es/m/CAA5RZ0sJgO6GAwgFxmzg9MVP=rM7Us8KKcWpuqxe-f5qxmpE0g@mail.gmail.com M doc/src/sgml/xfunc.sgml
M src/test/modules/Makefile
M src/test/modules/meson.build
A src/test/modules/test_custom_stats/.gitignore
A src/test/modules/test_custom_stats/Makefile
A src/test/modules/test_custom_stats/meson.build
A src/test/modules/test_custom_stats/t/001_custom_stats.pl
A src/test/modules/test_custom_stats/test_custom_fixed_stats–1.0.sql
A src/test/modules/test_custom_stats/test_custom_fixed_stats.c
A src/test/modules/test_custom_stats/test_custom_fixed_stats.control
A src/test/modules/test_custom_stats/test_custom_var_stats–1.0.sql
A src/test/modules/test_custom_stats/test_custom_var_stats.c
A src/test/modules/test_custom_stats/test_custom_var_stats.control
M src/tools/pgindent/typedefs.list
Prevent invalidation of newly created replication slots.
commit : 006dd4b2e5b33a3d0c2780f0bf307f6311ed776b
author : Amit Kapila <akapila@postgresql.org>
date : Mon, 8 Dec 2025 05:19:28 +0000
committer: Amit Kapila <akapila@postgresql.org>
date : Mon, 8 Dec 2025 05:19:28 +0000 A race condition could cause a newly created replication slot to become
invalidated between WAL reservation and a checkpoint.
Previously, if the required WAL was removed, we retried the reservation
process. However, the slot could still be invalidated before the retry if
the WAL was not yet removed but the checkpoint advanced the redo pointer
beyond the slot's intended restart LSN and computed the minimum LSN that
needs to be preserved for the slots.
The fix is to acquire an exclusive lock on ReplicationSlotAllocationLock
during WAL reservation to serialize WAL reservation and checkpoint's
minimum restart_lsn computation. This ensures that, if WAL reservation
occurs first, the checkpoint waits until restart_lsn is updated before
removing WAL. If the checkpoint runs first, subsequent WAL reservations
pick a position at or after the latest checkpoint's redo pointer.
We can't use the same fix for branch 17 and prior because commit
2090edc6f3 changed to compute to the minimum restart_LSN among slot's at
the beginning of checkpoint (or restart point). The fix for 17 and prior
branches is under discussion and will be committed separately.
Reported-by: suyu.cmj <mengjuan.cmj@alibaba-inc.com>
Author: Hou Zhijie <houzj.fnst@fujitsu.com>
Reviewed-by: Vitaly Davydov <v.davydov@postgrespro.ru>
Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com>
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>
Backpatch-through: 18
Discussion: https://postgr.es/m/5e045179-236f-4f8f-84f1-0f2566ba784c.mengjuan.cmj@alibaba-inc.com M src/backend/replication/slot.c
injection_points: Remove portions related to custom pgstats
commit : d52c24b0f808a6644fd839c507625eafd6bb9f12
author : Michael Paquier <michael@paquier.xyz>
date : Mon, 8 Dec 2025 12:45:20 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Mon, 8 Dec 2025 12:45:20 +0900 The test module injection_points has been used as a landing spot to
provide coverage for the custom pgstats APIs, for both fixed-sized and
variable-sized stats kinds. Some recent work related to pgstats is
proving that this structure makes the implementation of new tests
harder.
This commit removes the code related to pgstats from injection_points,
and an equivalent will be reintroduced as a separate test module in a
follow-up commit. This removal is done in its own commit for clarity.
Using injection_points for this test coverage was perhaps not the best
way to design things, but this was good enough while working on the
first flavor of the custom pgstats APIs. Using a new test module will
make easier the introduction of new tests, and we will not need to worry
about the impact of new changes related to custom pgstats could have
with the internals of injection_points.
Author: Sami Imseih <samimseih@gmail.com>
Discussion: https://postgr.es/m/CAA5RZ0sJgO6GAwgFxmzg9MVP=rM7Us8KKcWpuqxe-f5qxmpE0g@mail.gmail.com M doc/src/sgml/xfunc.sgml
M src/test/modules/injection_points/Makefile
M src/test/modules/injection_points/injection_points–1.0.sql
M src/test/modules/injection_points/injection_points.c
D src/test/modules/injection_points/injection_stats.c
D src/test/modules/injection_points/injection_stats.h
D src/test/modules/injection_points/injection_stats_fixed.c
M src/test/modules/injection_points/meson.build
D src/test/modules/injection_points/t/001_stats.pl
M src/tools/pgindent/typedefs.list
Improve error messages of input functions for pg_dependencies and pg_ndistinct
commit : f68597ee777d0a177e84cf86b8386ea51c66b52e
author : Michael Paquier <michael@paquier.xyz>
date : Mon, 8 Dec 2025 10:23:48 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Mon, 8 Dec 2025 10:23:48 +0900 The error details updated in this commit can be reached in the
regression tests. They did not follow the project style, and they
should be written them as full sentences.
Some of the errors are switched to use an elog(), for cases that involve
paths that cannot be reached based on the previous state of the parser
processing the input data (array start, object end, etc.). The error
messages for these cases use now a more consistent style across the
board, with the state of the parser reported for debugging.
Reported-by: Tom Lane <tgl@sss.pgh.pa.us>
Author: Michael Paquier <michael@paquier.xyz>
Co-authored-by: Corey Huinker <corey.huinker@gmail.com>
Discussion: https://postgr.es/m/1353179.1764901790@sss.pgh.pa.us M src/backend/utils/adt/pg_dependencies.c
M src/backend/utils/adt/pg_ndistinct.c
M src/test/regress/expected/pg_dependencies.out
M src/test/regress/expected/pg_ndistinct.out
ecpg: refactor to eliminate cast-away-const in find_variable().
commit : 4eda42e8bdf5bd3bf69576d54a45c10e7cbc3b35
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Sun, 7 Dec 2025 14:32:36 -0500
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Sun, 7 Dec 2025 14:32:36 -0500 find_variable() and its subroutines transiently scribble on the
passed-in "name" string, even though we've declared that "const".
The string is in fact temporary, so this is not very harmful,
but it's confusing and will produce compiler warnings with
late-model gcc. Rearrange the code so that instead of modifying
the given string, we make temporary copies of the parts that we
need separated out. (I used loc_alloc so that the copies are
short-lived and don't need to be freed explicitly.)
This code is poorly structured and confusing, to the point where
my first attempt to fix it was wrong. It is also under-tested,
allowing the broken v1 patch to nonetheless pass regression.
I'll restrain myself from rewriting it completely, and just add
some comments and more test cases.
We will probably want to back-patch this once gcc 15.2 becomes
more widespread, but for now just put it in master.
Author: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/1324889.1764886170@sss.pgh.pa.us M src/interfaces/ecpg/preproc/variable.c
M src/interfaces/ecpg/test/expected/preproc-array_of_struct.c
M src/interfaces/ecpg/test/expected/preproc-array_of_struct.stderr
M src/interfaces/ecpg/test/expected/preproc-pointer_to_struct.c
M src/interfaces/ecpg/test/expected/preproc-pointer_to_struct.stderr
M src/interfaces/ecpg/test/preproc/array_of_struct.pgc
M src/interfaces/ecpg/test/preproc/pointer_to_struct.pgc
Micro-optimize datatype conversions in datum_to_jsonb_internal.
commit : 005a2907dc304eadb00719e5b6e08cd2cf329829
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Sun, 7 Dec 2025 11:54:33 -0500
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Sun, 7 Dec 2025 11:54:33 -0500 The general case for converting to a JSONB numeric value is to run the
source datatype's output function and then numeric_in, but we can do
substantially better than that for integer and numeric source values.
This patch improves the speed of jsonb_agg by 30% for integer input,
and nearly 2X for numeric input.
Sadly, the obvious idea of using float4_numeric and float8_numeric
to speed up those cases doesn't work: they are actually slower than
the generic coerce-via-I/O method, and not by a small amount.
They might round off differently than this code has historically done,
too. Leave that alone pending possible changes in those functions.
We can also do better than the existing code for text/varchar/bpchar
source data; this optimization is similar to one that already exists
in the json_agg() code. That saves 20% or so for such inputs.
Also make a couple of other minor improvements, such as not giving
JSONTYPE_CAST its own special case outside the switch when it could
perfectly well be handled inside, and not using dubious string hacking
to detect infinity and NaN results.
Author: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: jian he <jian.universality@gmail.com>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://postgr.es/m/1060917.1753202222@sss.pgh.pa.us M src/backend/utils/adt/jsonb.c
Remove fundamentally-redundant processing in jsonb_agg() et al.
commit : b61aa76e4585b4b71098b0990b208813a85dbbf5
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Sun, 7 Dec 2025 11:52:22 -0500
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Sun, 7 Dec 2025 11:52:22 -0500 The various variants of jsonb_agg() operate as follows,
for each aggregate input value:
1. Build a JsonbValue tree representation of the input value.
2. Flatten the JsonbValue tree into a Jsonb in on-disk format.
3. Iterate through the Jsonb, building a JsonbValue that is part
of the aggregate's state stored in aggcontext, but is otherwise
identical to what phase 1 built.
This is very slightly less silly than it sounds, because phase 1
involves calling non-JSONB code such as datatype output functions,
which are likely to leak memory, and we don't want to leak into the
aggcontext. Nonetheless, phases 2 and 3 are accomplishing exactly
nothing that is useful if we can make phase 1 put the JsonbValue
tree where we need it. We could probably do that with a bunch of
MemoryContextSwitchTo's, but what seems more robust is to give
pushJsonbValue the responsibility of building the JsonbValue tree
in a specified non-current memory context. The previous patch
created the infrastructure for that, and this patch simply makes
the aggregate functions use it and then rips out phases 2 and 3.
For me, this makes jsonb_agg() with a text column as input run
about 2X faster than before. It's not yet on par with json_agg(),
but this removes a whole lot of the difference.
Author: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: jian he <jian.universality@gmail.com>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://postgr.es/m/1060917.1753202222@sss.pgh.pa.us M src/backend/utils/adt/jsonb.c
Revise APIs for pushJsonbValue() and associated routines.
commit : 0986e95161cec929d8f39c01e9848f34526be421
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Sun, 7 Dec 2025 11:46:49 -0500
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Sun, 7 Dec 2025 11:46:49 -0500 Instead of passing "JsonbParseState **" to pushJsonbValue(),
pass a pointer to a JsonbInState, which will contain the
parseState stack pointer as well as other useful fields.
Also, instead of returning a JsonbValue pointer that is often
meaningless/ignored, return the top-level JsonbValue pointer
in the "result" field of the JsonbInState.
This involves a lot of (mostly mechanical) edits, but I think
the results are notationally cleaner and easier to understand.
Certainly the business with sometimes capturing the result of
pushJsonbValue() and sometimes not was bug-prone and incapable of
mechanical verification. In the new arrangement, JsonbInState.result
remains null until we've completed a valid sequence of pushes, so
that an incorrect sequence will result in a null-pointer dereference,
not mistaken use of a partial result.
However, this isn't simply an exercise in prettier notation.
The real reason for doing it is to provide a mechanism whereby
pushJsonbValue() can be told to construct the JsonbValue tree
in a context that is not CurrentMemoryContext. That happens
when a non-null "outcontext" is specified in the JsonbInState.
No callers exercise that option in this patch, but the next
patch in the series will make use of it.
I tried to improve the comments in this area too.
Author: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: jian he <jian.universality@gmail.com>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://postgr.es/m/1060917.1753202222@sss.pgh.pa.us M contrib/hstore/hstore_io.c
M contrib/jsonb_plperl/jsonb_plperl.c
M contrib/jsonb_plpython/jsonb_plpython.c
M src/backend/utils/adt/jsonb.c
M src/backend/utils/adt/jsonb_util.c
M src/backend/utils/adt/jsonfuncs.c
M src/backend/utils/adt/jsonpath_exec.c
M src/include/utils/jsonb.h
Add a macro for the declared typlen of type timetz.
commit : 3628af42107d588af73280d7e96d1c6188aadad7
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Sun, 7 Dec 2025 11:33:35 -0500
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Sun, 7 Dec 2025 11:33:35 -0500 pg_type.typlen says 12 for the size of timetz, but sizeof(TimeTzADT)
will be 16 on most platforms due to alignment padding. Using the
sizeof number is no problem for usages such as palloc'ing a result
datum, but in usages such as datumCopy we really ought to match
what pg_type says. Add a macro TIMETZ_TYPLEN so that we have a
symbolic way to write that rather than hard-coding "12".
I cannot find any place where we've needed this so far, but an
upcoming patch requires it.
Author: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://postgr.es/m/2329959.1765047648@sss.pgh.pa.us M src/include/utils/date.h
Handle constant inputs to corr() and related aggregates more precisely.
commit : 6498287696dafc1ebd380ea4eb249124989294d3
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Sat, 6 Dec 2025 18:31:26 -0500
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Sat, 6 Dec 2025 18:31:26 -0500 The SQL standard says that corr() and friends should return NULL in
the mathematically-undefined case where all the inputs in one of
the columns have the same value. We were checking that by seeing
if the sums Sxx and Syy were zero, but that approach is very
vulnerable to roundoff error: if a sum is close to zero but not
exactly that, we'd come out with a pretty silly non-NULL result.
Instead, directly track whether the inputs are all equal by
remembering the common value in each column. Once we detect
that a new input is different from before, represent that by
storing NaN for the common value. (An objection to this scheme
is that if the inputs are all NaN, we will consider that they
were not all equal. But under IEEE float arithmetic rules,
one NaN is never equal to another, so this behavior is arguably
correct. Moreover it matches what we did before in such cases.)
Then, leave the sums at their exact value of zero for as long
as we haven't detected different input values.
This solution requires the aggregate transition state to contain
8 float values not 6, which is not problematic, and it seems to add
less than 1% to the aggregates' runtime, which seems acceptable.
While we're here, improve corr()'s final function to cope with
overflow/underflow in the final calculation, and to clamp its
result to [-1, 1] in case of roundoff error.
Although this is arguably a bug fix, it requires a catversion bump
due to the change in aggregates' initial states, so it can't be
back-patched.
Patch written by me, but many of the ideas are due to Dean Rasheed,
who also did a deal of testing.
Bug: #19340
Reported-by: Oleg Ivanov <o15611@gmail.com>
Author: Tom Lane <tgl@sss.pgh.pa.us>
Co-authored-by: Dean Rasheed <dean.a.rasheed@gmail.com>
Discussion: https://postgr.es/m/19340-6fb9f6637f562092@postgresql.org M src/backend/utils/adt/float.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_aggregate.dat
M src/test/regress/expected/aggregates.out
M src/test/regress/sql/aggregates.sql
Doc: include JSON in the list of SQL-standard types.
commit : 25303961d09c7e2354a48cbce511a06cce691907
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Sat, 6 Dec 2025 13:34:48 -0500
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Sat, 6 Dec 2025 13:34:48 -0500 Oversight I guess, it's been in the standard for awhile.
Reported-by: Bob Kline <bkline@rksystems.com>
Discussion: https://postgr.es/m/CAGjKmVoP4qVeJgkaBtQ6L46+OLARzmym53uQGhp5COw4wp65yQ@mail.gmail.com M doc/src/sgml/datatype.sgml
Improve error reporting of recovery test 027_stream_regress
commit : 47da198934e9a764ad3c60c5e573ab13b4e2d591
author : Michael Paquier <michael@paquier.xyz>
date : Sat, 6 Dec 2025 14:41:29 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Sat, 6 Dec 2025 14:41:29 +0900 Previously, the 027_stream_regress test reported the full contents of
regression.diffs upon a test failure, when the standby and the primary
were still alive. If a test fails quite badly, the amount of
information reported can be really high, bloating the reports in the
buildfarm, the CI, or even local runs.
In most cases, we have noticed that having all this information is not
necessary when attempting to identify the source of a problem in this
test. This commit changes the situation by including the head and tail
of regression.diffs in the reports generated on failure rather than its
full contents, building upon b93f4e2f98b3 to optionally control the size
of the reports with the new environment variable
PG_TEST_FILE_READ_LINES.
This will perhaps require some more tuning, but the hope is to reduce
some of the buildfarm report bloat while making the information good
enough to deduce what is happening when something is going wrong, be it
in the buildfarm or some tests run in the CI, at least.
Suggested-by: Andres Freund <andres@anarazel.de>
Author: Nazir Bilal Yavuz <byavuz81@gmail.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://postgr.es/m/CAN55FZ1D6KXvjSs7YGsDeadqCxNF3UUhjRAfforzzP0k-cE=bA@mail.gmail.com M src/test/recovery/t/027_stream_regress.pl
Add PostgreSQL::Test::Cluster::read_head_tail() helper to PostgreSQL/Utils.pm
commit : b93f4e2f98b384596a307b6ce54ce2affadc518a
author : Michael Paquier <michael@paquier.xyz>
date : Sat, 6 Dec 2025 14:27:53 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Sat, 6 Dec 2025 14:27:53 +0900 This function reads the lines from a file and filters its contents to
report its head and tail contents. The amount of contents to read from
a file can be tuned by the environment variable PG_TEST_FILE_READ_LINES,
that can be used to override the default of 50 lines. If the file whose
content is read has less lines than two times PG_TEST_FILE_READ_LINES,
the whole file is returned.
This will be used in a follow-up commit to limit the amount of
information reported by some of the TAP tests on failure, where we have
noticed that the contents reported by the buildfarm can be heavily
bloated in some cases, with the head and tail contents of a report being
able to provide enough information to be useful for debugging.
Author: Nazir Bilal Yavuz <byavuz81@gmail.com>
Co-authored-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://postgr.es/m/CAN55FZ1D6KXvjSs7YGsDeadqCxNF3UUhjRAfforzzP0k-cE=bA@mail.gmail.com M doc/src/sgml/regress.sgml
M src/test/perl/PostgreSQL/Test/Utils.pm
Fix text substring search for non-deterministic collations.
commit : 6dfce8420e99d8cf41ffb7da698caee57fd73eb7
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Fri, 5 Dec 2025 20:10:33 -0500
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Fri, 5 Dec 2025 20:10:33 -0500 Due to an off-by-one error, the code failed to find matches at the
end of the haystack. Fix by rewriting the loop.
While at it, fix a comment that claimed that the function could find
a zero-length match. Such a match could send a caller into an endless
loop. However, zero-length matches only make sense with an empty
search string, and that case is explicitly excluded by all callers.
To make sure it stays that way, add an Assert and a comment.
Bug: #19341
Reported-by: Adam Warland <adam.warland@infor.com>
Author: Laurenz Albe <laurenz.albe@cybertec.at>
Reviewed-by: Heikki Linnakangas <hlinnaka@iki.fi>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/19341-1d9a22915edfec58@postgresql.org
Backpatch-through: 18 M src/backend/utils/adt/varlena.c
M src/test/regress/expected/collate.icu.utf8.out
M src/test/regress/sql/collate.icu.utf8.sql
Fix test to work with non-8kB block sizes
commit : 7c2061bdfba7c738dac1e2c14db51faeef3f34b1
author : Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Fri, 5 Dec 2025 23:39:01 +0200
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Fri, 5 Dec 2025 23:39:01 +0200 Author: Maxim Orlov <orlovmg@gmail.com>
Discussion: https://www.postgresql.org/message-id/CACG%3Dezbtm%2BLOzEMyLX7rzGcAv3ez3F6nNpSJjvZeMzed0Oe6Pw%40mail.gmail.com M src/test/modules/test_slru/t/002_multixact_wraparound.pl
Add commit 86b276a4a9 to .git-blame-ignore-revs.
commit : d0d873c382cd23f3a49511e2bda35b4bf068c92d
author : Nathan Bossart <nathan@postgresql.org>
date : Fri, 5 Dec 2025 14:21:12 -0600
committer: Nathan Bossart <nathan@postgresql.org>
date : Fri, 5 Dec 2025 14:21:12 -0600 M .git-blame-ignore-revs
Don't reset the pathlist of partitioned joinrels.
commit : 014f9a831a320666bf2195949f41710f970c54ad
author : Robert Haas <rhaas@postgresql.org>
date : Fri, 5 Dec 2025 11:05:12 -0500
committer: Robert Haas <rhaas@postgresql.org>
date : Fri, 5 Dec 2025 11:05:12 -0500 apply_scanjoin_target_to_paths wants to avoid useless work and
platform-specific dependencies by throwing away the path list created
prior to applying the final scan/join target and constructing a whole
new one using the final scan/join target. However, this is only valid
when we'll consider all the same strategies after the pathlist reset
as before.
After resetting the path list, we reconsider Append and MergeAppend
paths with the modified target list; therefore, it's only valid for a
partitioned relation. However, what the previous coding missed is that
it cannot be a partitioned join relation, because that also has paths
that are not Append or MergeAppend paths and will not be reconsidered.
Thus, before this patch, we'd sometimes choose a partitionwise strategy
with a higher total cost than cheapest non-partitionwise strategy,
which is not good.
We had a surprising number of tests cases that were relying on this
bug to work as they did. A big part of the reason for this is that row
counts in regression test cases tend to be low, which brings the cost
of partitionwise and non-partitionwise strategies very close together,
especially for merge joins, where the real and perceived advantages of
a partitionwise approach are minimal. In addition, one test case
included a row-count-inflating join. In such cases, a partitionwise
join can easily be a loser on cost, because the total number of tuples
passing through an Append node is much higher than it is with a
non-partitionwise strategy. That test case is adjusted by adding
additional join clauses to avoid the row count inflation.
Although the failure of the planner to choose the lowest-cost path is a
bug, we generally do not back-patch fixes of this type, because planning
is not an exact science and there is always a possibility that some user
will end up with a plan that has a lower estimated cost but actually
runs more slowly. Hence, no backpatch here, either.
The code change here is exactly what was originally proposed by
Ashutosh, but the changes to the comments and test cases have been
very heavily rewritten by me, helped along by some very useful advice
from Richard Guo.
Reported-by: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>
Author: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>
Author: Robert Haas <rhaas@postgresql.org>
Reviewed-by: Jakub Wartak <jakub.wartak@enterprisedb.com>
Reviewed-by: Arne Roland <arne.roland@malkut.net>
Reviewed-by: Richard Guo <guofenglinux@gmail.com>
Discussion: http://postgr.es/m/CAExHW5toze58+jL-454J3ty11sqJyU13Sz5rJPQZDmASwZgWiA@mail.gmail.com M src/backend/optimizer/plan/planner.c
M src/test/regress/expected/partition_join.out
M src/test/regress/expected/subselect.out
M src/test/regress/sql/partition_join.sql
M src/test/regress/sql/subselect.sql
Fix some cases of indirectly casting away const.
commit : 8f1791c61836d213acbf85d368c8762705ad9d51
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Fri, 5 Dec 2025 11:17:14 -0500
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Fri, 5 Dec 2025 11:17:14 -0500 Newest versions of gcc are able to detect cases where code implicitly
casts away const by assigning the result of strchr() or a similar
function applied to a "const char *" value to a target variable
that's just "char *". This of course creates a hazard of not getting
a compiler warning about scribbling on a string one was not supposed
to, so fixing up such cases is good.
This patch fixes a dozen or so places where we were doing that.
Most are trivial additions of "const" to the target variable,
since no actually-hazardous change was occurring. There is one
place in ecpg.trailer where we were indeed violating the intention
of not modifying a string passed in as "const char *". I believe
that's harmless not a live bug, but let's fix it by copying the
string before modifying it.
There is a remaining trouble spot in ecpg/preproc/variable.c,
which requires more complex surgery. I've left that out of this
commit because I want to study that code a bit more first.
We probably will want to back-patch this once compilers that detect
this pattern get into wider circulation, but for now I'm just
going to apply it to master to see what the buildfarm says.
Thanks to Bertrand Drouvot for finding a couple more spots than
I had.
Author: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Discussion: https://postgr.es/m/1324889.1764886170@sss.pgh.pa.us M src/backend/catalog/pg_type.c
M src/backend/tsearch/spell.c
M src/backend/utils/adt/formatting.c
M src/backend/utils/adt/pg_locale.c
M src/backend/utils/adt/xid8funcs.c
M src/bin/pg_waldump/pg_waldump.c
M src/bin/pgbench/pgbench.c
M src/common/compression.c
M src/interfaces/ecpg/pgtypeslib/datetime.c
M src/interfaces/ecpg/preproc/ecpg.trailer
M src/port/chklocale.c
M src/port/getopt_long.c
M src/port/win32setlocale.c
M src/test/regress/pg_regress.c
M src/timezone/zic.c
Stabilize tests some more
commit : a4a0fa0c7587eb05b36c1f184d966dd5524a4b74
author : Álvaro Herrera <alvherre@kurilemu.de>
date : Fri, 5 Dec 2025 16:16:27 +0100
committer: Álvaro Herrera <alvherre@kurilemu.de>
date : Fri, 5 Dec 2025 16:16:27 +0100 Tests added by commits 90eae926abbb, 2bc7e886fc1b, bc32a12e0db2
have occasionally failed, depending on timing. Add some dependency
markers to the spec to try and remove the instability.
Author: Mihail Nikalayeu <mihailnikalayeu@gmail.com>
Discussion: https://postgr.es/m/202512041739.sgg3tb2yobe2@alvherre.pgsql M src/test/modules/injection_points/specs/reindex-concurrently-upsert-on-constraint.spec
M src/test/modules/injection_points/specs/reindex-concurrently-upsert-partitioned.spec
M src/test/modules/injection_points/specs/reindex-concurrently-upsert.spec
Fix setting next multixid's offset at offset wraparound
commit : 4d936c3fff1ac8dead2cc240ba3da2ed6337257c
author : Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Fri, 5 Dec 2025 11:32:38 +0200
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Fri, 5 Dec 2025 11:32:38 +0200 In commit 789d65364c, we started updating the next multixid's offset
too when recording a multixid, so that it can always be used to
calculate the number of members. I got it wrong at offset wraparound:
we need to skip over offset 0. Fix that.
Discussion: https://www.postgresql.org/message-id/d9996478-389a-4340-8735-bfad456b313c@iki.fi
Backpatch-through: 14 M src/backend/access/transam/multixact.c
Use more palloc_object() and palloc_array() in contrib/
commit : 31d3847a37bec060fb4177b2fc6c0fdfc7a08011
author : Michael Paquier <michael@paquier.xyz>
date : Fri, 5 Dec 2025 16:40:26 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Fri, 5 Dec 2025 16:40:26 +0900 The idea is to encourage more the use of these new routines across the
tree, as these offer stronger type safety guarantees than palloc(). In
an ideal world, palloc() would then act as an internal routine of these
flavors, whose footprint in the tree is minimal.
The patch sent by the author is very large, and this chunk of changes
represents something like 10% of the overall patch submitted.
The code compiled is the same before and after this commit, using
objdump to do some validation with a difference taken in-between. There
are some diffs, which are caused by changes in line numbers because some
of the new allocation formulas are shorter, for the following files:
trgm_regexp.c, xpath.c and pg_walinspect.c.
Author: David Geier <geidav.pg@gmail.com>
Discussion: https://postgr.es/m/ad0748d4-3080-436e-b0bc-ac8f86a3466a@gmail.com M contrib/amcheck/verify_gin.c
M contrib/amcheck/verify_heapam.c
M contrib/amcheck/verify_nbtree.c
M contrib/basebackup_to_shell/basebackup_to_shell.c
M contrib/bloom/blinsert.c
M contrib/bloom/blscan.c
M contrib/bloom/blutils.c
M contrib/bloom/blvacuum.c
M contrib/btree_gin/btree_gin.c
M contrib/btree_gist/btree_inet.c
M contrib/btree_gist/btree_interval.c
M contrib/btree_gist/btree_time.c
M contrib/btree_gist/btree_ts.c
M contrib/btree_gist/btree_utils_num.c
M contrib/btree_gist/btree_utils_var.c
M contrib/btree_gist/btree_uuid.c
M contrib/cube/cube.c
M contrib/dict_int/dict_int.c
M contrib/dict_xsyn/dict_xsyn.c
M contrib/file_fdw/file_fdw.c
M contrib/hstore/hstore_gist.c
M contrib/hstore/hstore_io.c
M contrib/intarray/_int_bool.c
M contrib/intarray/_int_gin.c
M contrib/intarray/_int_gist.c
M contrib/intarray/_intbig_gist.c
M contrib/jsonb_plperl/jsonb_plperl.c
M contrib/jsonb_plpython/jsonb_plpython.c
M contrib/ltree/_ltree_gist.c
M contrib/ltree/_ltree_op.c
M contrib/ltree/ltree_gist.c
M contrib/ltree/ltree_io.c
M contrib/ltree/ltree_op.c
M contrib/ltree/ltxtquery_io.c
M contrib/pageinspect/brinfuncs.c
M contrib/pageinspect/btreefuncs.c
M contrib/pageinspect/ginfuncs.c
M contrib/pageinspect/hashfuncs.c
M contrib/pageinspect/heapfuncs.c
M contrib/pg_overexplain/pg_overexplain.c
M contrib/pg_trgm/trgm_gin.c
M contrib/pg_trgm/trgm_gist.c
M contrib/pg_trgm/trgm_regexp.c
M contrib/pg_visibility/pg_visibility.c
M contrib/pg_walinspect/pg_walinspect.c
M contrib/pgcrypto/mbuf.c
M contrib/pgcrypto/openssl.c
M contrib/pgcrypto/pgp-cfb.c
M contrib/pgcrypto/pgp-compress.c
M contrib/pgcrypto/pgp-decrypt.c
M contrib/pgcrypto/pgp-encrypt.c
M contrib/pgcrypto/pgp-pgsql.c
M contrib/pgcrypto/pgp-pubkey.c
M contrib/pgcrypto/px-hmac.c
M contrib/pgcrypto/px.c
M contrib/seg/seg.c
M contrib/sepgsql/label.c
M contrib/sepgsql/uavc.c
M contrib/spi/refint.c
M contrib/sslinfo/sslinfo.c
M contrib/tablefunc/tablefunc.c
M contrib/test_decoding/test_decoding.c
M contrib/tsm_system_rows/tsm_system_rows.c
M contrib/tsm_system_time/tsm_system_time.c
M contrib/unaccent/unaccent.c
M contrib/xml2/xpath.c
M contrib/xml2/xslt_proc.c
Improve test output of extended statistics for ndistinct and dependencies
commit : 2f04110225ab30fbd9889d6f5d73fd6b3e1b308b
author : Michael Paquier <michael@paquier.xyz>
date : Fri, 5 Dec 2025 14:15:21 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Fri, 5 Dec 2025 14:15:21 +0900 Corey Huinker has come up with a recipe that is more compact and more
pleasant to the eye for extended stats because we know that all of them
are 1-dimension JSON arrays. This commit switches the extended stats
tests to use replace() instead of jsonb_pretty(), splitting the data so
as one line is used for each item in the extended stats object.
This results in the removal of a good chunk of test output, that is now
easier to debug with one line used for each item in a stats object.
This patch has not been provided by Corey. This is some post-commit
cleanup work that I have noticed as good enough to do on its own while
reviewing the rest of the patch set Corey has posted.
Discussion: https://postgr.es/m/CADkLM=csMd52i39Ye8-PUUHyzBb3546eSCUTh-FBQ7bzT2uZ4Q@mail.gmail.com M src/test/regress/expected/stats_ext.out
M src/test/regress/sql/stats_ext.sql
Rename column slotsync_skip_at to slotsync_last_skip.
commit : 5db6a344abc2dfbc5df454cd93a096443ea4dd3e
author : Amit Kapila <akapila@postgresql.org>
date : Fri, 5 Dec 2025 04:12:55 +0000
committer: Amit Kapila <akapila@postgresql.org>
date : Fri, 5 Dec 2025 04:12:55 +0000 Commit 76b78721ca introduced two new columns in pg_stat_replication_slots
to improve monitoring of slot synchronization. One of these columns was
named slotsync_skip_at, which is inconsistent with the naming convention
used for similar columns in other system views.
Columns that store timestamps of the most recent event typically use the
'last_' in the column name (e.g., last_autovacuum, checksum_last_failure).
Renaming slotsync_skip_at to slotsync_last_skip aligns with this pattern,
making the purpose of the column clearer and improving overall consistency
across the views.
Author: Shlok Kyal <shlok.kyal.oss@gmail.com>
Reviewed-by: Michael Banck <mbanck@gmx.net>
Discussion: https://postgr.es/m/20251128091552.GB13635@p46.dedyn.io;lightning.p46.dedyn.io
Discussion: https://postgr.es/m/CAE9k0PkhfKrTEAsGz4DjOhEj1nQ+hbQVfvWUxNacD38ibW3a1g@mail.gmail.com M contrib/test_decoding/expected/stats.out
M doc/src/sgml/monitoring.sgml
M src/backend/catalog/system_views.sql
M src/backend/utils/activity/pgstat_replslot.c
M src/backend/utils/adt/pgstatfuncs.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/include/pgstat.h
M src/test/regress/expected/rules.out
Fix some compiler warnings
commit : 7bc88c3d6f3af3af5330c0e209c8a3c411267d00
author : Michael Paquier <michael@paquier.xyz>
date : Fri, 5 Dec 2025 12:30:43 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Fri, 5 Dec 2025 12:30:43 +0900 Some of the buildfarm members with some old gcc versions have been
complaining about an always-true test for a NULL pointer caused by a
combination of SOFT_ERROR_OCCURRED() and a local ErrorSaveContext
variable.
These warnings are taken care of by removing SOFT_ERROR_OCCURRED(),
switching to a direct variable check, like 56b1e88c804b.
Oversights in e1405aa5e3ac and 44eba8f06e55.
Reported-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/1341064.1764895052@sss.pgh.pa.us M src/backend/utils/adt/pg_dependencies.c
M src/backend/utils/adt/pg_ndistinct.c
Show version of nodes in output of TAP tests
commit : 83f2f8413e8d9687fda7d5881c82b89b8d9d4043
author : Michael Paquier <michael@paquier.xyz>
date : Fri, 5 Dec 2025 09:21:13 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Fri, 5 Dec 2025 09:21:13 +0900 This commit adds the version information of a node initialized by
Cluster.pm, that may vary depending on the install_path given by the
test. The code was written so as the node information, that includes
the version number, was dumped before the version number was set.
This is particularly useful for the pg_upgrade TAP tests, that may mix
several versions for cross-version runs. The TAP infrastructure also
allows mixing nodes with different versions, so this information can be
useful for out-of-core tests.
Backpatch down to v15, where Cluster.pm and the pg_upgrade TAP tests
have been introduced.
Author: Potapov Alexander <a.potapov@postgrespro.com>
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>
Discussion: https://postgr.es/m/e59bb-692c0a80-5-6f987180@170377126
Backpatch-through: 15 M src/test/perl/PostgreSQL/Test/Cluster.pm
Suppress spurious Coverity warning in prune freeze logic
commit : 904f9f5ea0e00a88e2429682d01f2ec946bf553a
author : Melanie Plageman <melanieplageman@gmail.com>
date : Thu, 4 Dec 2025 18:55:02 -0500
committer: Melanie Plageman <melanieplageman@gmail.com>
date : Thu, 4 Dec 2025 18:55:02 -0500 Adjust the prune_freeze_setup() parameter types of new_relfrozen_xid and
new_relmin_mxid to prevent misleading Coverity analysis.
heap_page_prune_and_freeze() compared these values against NULL when
passing them to prune_freeze_setup(), causing Coverity to assume they
could be NULL and flag a possible null-pointer dereference later, even
though it occurs inside a directly related conditional.
Reported-by: Coverity
Author: Melanie Plageman <melanieplageman@gmail.com> M src/backend/access/heap/pruneheap.c
Fix key size of PrivateRefCountHash.
commit : 80f6e2fb4addb03e2e163a380b5e6e1f4b321286
author : Nathan Bossart <nathan@postgresql.org>
date : Thu, 4 Dec 2025 15:42:18 -0600
committer: Nathan Bossart <nathan@postgresql.org>
date : Thu, 4 Dec 2025 15:42:18 -0600 The key is the first member of PrivateRefCountEntry, which has type
Buffer. This commit changes the key size from sizeof(int32) to
sizeof(Buffer). This appears to be an oversight in commit
4b4b680c3d, but it's of no consequence because Buffer has been a
signed 32-bit integer for a long time.
Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Discussion: https://postgr.es/m/aS77DTpl0fOkIKSZ%40ip-10-97-1-34.eu-west-3.compute.internal M src/backend/storage/buffer/bufmgr.c
Remove no longer needed casts from Pointer
commit : e158fd4d68f44d0872c1d2053067fe306cc9d2b2
author : Peter Eisentraut <peter@eisentraut.org>
date : Thu, 4 Dec 2025 20:44:52 +0100
committer: Peter Eisentraut <peter@eisentraut.org>
date : Thu, 4 Dec 2025 20:44:52 +0100 These casts used to be required when Pointer was char *, but now it's
void * (commit 1b2bb5077e9), so they are not needed anymore.
Author: Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>
Discussion: https://www.postgresql.org/message-id/4154950a-47ae-4223-bd01-1235cc50e933%40eisentraut.org M contrib/amcheck/verify_gin.c
M contrib/pg_trgm/trgm_gin.c
M src/backend/access/gin/ginentrypage.c
M src/backend/utils/adt/jsonb_gin.c
Remove no longer needed casts to Pointer
commit : c6be3daa054a2fac67331f3bfc348b9bfd6f690c
author : Peter Eisentraut <peter@eisentraut.org>
date : Thu, 4 Dec 2025 19:40:08 +0100
committer: Peter Eisentraut <peter@eisentraut.org>
date : Thu, 4 Dec 2025 19:40:08 +0100 These casts used to be required when Pointer was char *, but now it's
void * (commit 1b2bb5077e9), so they are not needed anymore.
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Discussion: https://www.postgresql.org/message-id/4154950a-47ae-4223-bd01-1235cc50e933%40eisentraut.org M contrib/btree_gist/btree_utils_var.h
M src/backend/access/heap/heaptoast.c
M src/backend/catalog/aclchk.c
M src/backend/catalog/pg_constraint.c
M src/backend/utils/adt/arrayfuncs.c
M src/backend/utils/adt/datum.c
M src/backend/utils/adt/like_support.c
M src/backend/utils/adt/numeric.c
M src/backend/utils/adt/rangetypes.c
M src/backend/utils/adt/rowtypes.c
M src/backend/utils/cache/evtcache.c
M src/include/fmgr.h
amcheck: Fix snapshot usage in bt_index_parent_check
commit : 6bd469d26aca6ea413b35bfcb611dfa3a8f5ea45
author : Álvaro Herrera <alvherre@kurilemu.de>
date : Thu, 4 Dec 2025 18:12:08 +0100
committer: Álvaro Herrera <alvherre@kurilemu.de>
date : Thu, 4 Dec 2025 18:12:08 +0100 We were using SnapshotAny to do some index checks, but that's wrong and
causes spurious errors when used on indexes created by CREATE INDEX
CONCURRENTLY. Fix it to use an MVCC snapshot, and add a test for it.
This problem came in with commit 5ae2087202af, which introduced
uniqueness check. Backpatch to 17.
Author: Mihail Nikalayeu <mihailnikalayeu@gmail.com>
Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Backpatch-through: 17
Discussion: https://postgr.es/m/CANtu0ojmVd27fEhfpST7RG2KZvwkX=dMyKUqg0KM87FkOSdz8Q@mail.gmail.com M contrib/amcheck/t/002_cic.pl
M contrib/amcheck/verify_nbtree.c
M doc/src/sgml/amcheck.sgml
headerscheck ccache support
commit : 40bdd839f52a3e18a0e003f556cab3512510f633
author : Peter Eisentraut <peter@eisentraut.org>
date : Thu, 4 Dec 2025 11:23:23 +0100
committer: Peter Eisentraut <peter@eisentraut.org>
date : Thu, 4 Dec 2025 11:23:23 +0100 Currently, headerscheck and cpluspluscheck are very slow, and they
defeat use of ccache. This fixes that, and now they are much faster.
The problem was that the test files are created in a randomly-named
directory (`mktemp -d /tmp/$me.XXXXXX`), and this directory is
mentioned on the compiler command line, which is part of the cache
key.
The solution is to create the test files in the build directory. For
example, for src/include/storage/ipc.h, we generate
tmp_headerscheck_c/src_include_storage_ipc_h.c (or .cpp)
Now ccache works. (And it's also a bit easier to debug everything
with this naming.)
(The subdirectory is used to keep the cleanup trap simple.)
The observed speedup on Cirrus CI for headerscheck plus cpluspluscheck
is from about 1min 20s to only 20s. In local use, the speedups are
similar.
Co-authored-by: Thomas Munro <thomas.munro@gmail.com>
Reviewed-by: Álvaro Herrera <alvherre@kurilemu.de>
Reviewed-by: Andres Freund <andres@anarazel.de>
Discussion: https://www.postgresql.org/message-id/flat/b49e74d4-3cf9-4d1c-9dce-09f75e55d026%40eisentraut.org M .cirrus.tasks.yml
M src/tools/pginclude/headerscheck
headerscheck: Use LLVM_CPPFLAGS
commit : d0b7a0b4c8f49ea96f171883d09e902483083d98
author : Peter Eisentraut <peter@eisentraut.org>
date : Fri, 28 Nov 2025 11:36:41 +0100
committer: Peter Eisentraut <peter@eisentraut.org>
date : Fri, 28 Nov 2025 11:36:41 +0100 Otherwise, headerscheck will fail if the LLVM headers are in a
location not reached by the normal CFLAGS/CPPFLAGS.
Discussion: https://www.postgresql.org/message-id/flat/b49e74d4-3cf9-4d1c-9dce-09f75e55d026%40eisentraut.org M src/tools/pginclude/headerscheck
Fix incorrect assertion bound in WaitForLSN()
commit : d6ef8ee3ee29ffa404bcd920e02fb4b196e07b0d
author : Alexander Korotkov <akorotkov@postgresql.org>
date : Thu, 4 Dec 2025 10:38:12 +0200
committer: Alexander Korotkov <akorotkov@postgresql.org>
date : Thu, 4 Dec 2025 10:38:12 +0200 The assertion checking MyProcNumber used MaxBackends as the upper
bound, but the procInfos array is allocated with size
MaxBackends + NUM_AUXILIARY_PROCS. This inconsistency would cause
a false assertion failure if an auxiliary process calls WaitForLSN().
Author: Xuneng Zhou <xunengzhou@gmail.com> M src/backend/access/transam/xlogwait.c
Rename BUFFERPIN wait event class to BUFFER
commit : 6c5c393b74031351721f8a44e55bfaf6f249eefb
author : Andres Freund <andres@anarazel.de>
date : Wed, 3 Dec 2025 18:38:20 -0500
committer: Andres Freund <andres@anarazel.de>
date : Wed, 3 Dec 2025 18:38:20 -0500 In an upcoming patch more wait events will be added to the wait event
class (for buffer locking), making the current name too
specific. Alternatively we could introduce a dedicated wait event class for
those, but it seems somewhat confusing to have a BUFFERPIN and a BUFFER wait
event class.
Reviewed-by: Melanie Plageman <melanieplageman@gmail.com>
Discussion: https://postgr.es/m/fvfmkr5kk4nyex56ejgxj3uzi63isfxovp2biecb4bspbjrze7@az2pljabhnff M doc/src/sgml/monitoring.sgml
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/ipc/standby.c
M src/backend/utils/activity/wait_event.c
M src/backend/utils/activity/wait_event_names.txt
M src/include/utils/wait_classes.h
M src/test/recovery/t/048_vacuum_horizon_floor.pl
M src/test/regress/expected/sysviews.out
M src/tools/pgindent/typedefs.list
Add pg_atomic_unlocked_write_u64
commit : 7902a47c20b1d5c0b7d20071f9ada6a0185bf39b
author : Andres Freund <andres@anarazel.de>
date : Wed, 3 Dec 2025 18:38:20 -0500
committer: Andres Freund <andres@anarazel.de>
date : Wed, 3 Dec 2025 18:38:20 -0500 The 64bit equivalent of pg_atomic_unlocked_write_u32(), to be used in an
upcoming patch converting BufferDesc.state into a 64bit atomic.
Reviewed-by: Melanie Plageman <melanieplageman@gmail.com>
Discussion: https://postgr.es/m/fvfmkr5kk4nyex56ejgxj3uzi63isfxovp2biecb4bspbjrze7@az2pljabhnff M src/include/port/atomics.h
M src/include/port/atomics/generic.h
bufmgr: Turn BUFFER_LOCK_* into an enum
commit : 156680055dc523425f28ff5e61acf0f5bc99294b
author : Andres Freund <andres@anarazel.de>
date : Wed, 3 Dec 2025 18:38:20 -0500
committer: Andres Freund <andres@anarazel.de>
date : Wed, 3 Dec 2025 18:38:20 -0500 It seems cleaner to use an enum to tie the different values together. It also
helps to have a more descriptive type in the argument to various functions.
Reviewed-by: Melanie Plageman <melanieplageman@gmail.com>
Discussion: https://postgr.es/m/fvfmkr5kk4nyex56ejgxj3uzi63isfxovp2biecb4bspbjrze7@az2pljabhnff M src/backend/storage/buffer/bufmgr.c
M src/include/storage/bufmgr.h
M src/tools/pgindent/typedefs.list
Make stats_ext test faster under cache-clobbering test conditions.
commit : 8d61228717e619b90b8ebd1d219d006b920e00e5
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Wed, 3 Dec 2025 13:23:45 -0500
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Wed, 3 Dec 2025 13:23:45 -0500 Commit 1eccb9315 added a test case that will cause a large number
of evaluations of a plpgsql function. With -DCLOBBER_CACHE_ALWAYS,
that takes an unreasonable amount of time (hours) because the
function's cache entries are repeatedly deleted and rebuilt.
That doesn't add any useful test coverage --- other test cases
already exercise plpgsql well enough --- and it's not part of what
this test intended to cover. We can get the same planner coverage,
if not more, by making the test directly invoke numeric_lt().
Reported-by: Tomas Vondra <tomas@vondra.me>
Author: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/baf1ae02-83bd-4f5d-872a-1d04f11a9073@vondra.me M src/test/regress/expected/stats_ext.out
M src/test/regress/sql/stats_ext.sql
Add test for multixid wraparound
commit : 7b81be9b42678c7ab69c3e8f565172f1d8d9e86f
author : Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Wed, 3 Dec 2025 19:39:34 +0200
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Wed, 3 Dec 2025 19:39:34 +0200 Author: Andrey Borodin <amborodin@acm.org>
Discussion: https://www.postgresql.org/message-id/7de697df-d74d-47db-9f73-e069b7349c4b@iki.fi M src/test/modules/test_slru/meson.build
A src/test/modules/test_slru/t/002_multixact_wraparound.pl
Set next multixid's offset when creating a new multixid
commit : 789d65364cdecd81e4bf822eec468ea3d34d28af
author : Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Wed, 3 Dec 2025 19:15:08 +0200
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Wed, 3 Dec 2025 19:15:08 +0200 With this commit, the next multixid's offset will always be set on the
offsets page, by the time that a backend might try to read it, so we
no longer need the waiting mechanism with the condition variable. In
other words, this eliminates "corner case 2" mentioned in the
comments.
The waiting mechanism was broken in a few scenarios:
- When nextMulti was advanced without WAL-logging the next
multixid. For example, if a later multixid was already assigned and
WAL-logged before the previous one was WAL-logged, and then the
server crashed. In that case the next offset would never be set in
the offsets SLRU, and a query trying to read it would get stuck
waiting for it. Same thing could happen if pg_resetwal was used to
forcibly advance nextMulti.
- In hot standby mode, a deadlock could happen where one backend waits
for the next multixid assignment record, but WAL replay is not
advancing because of a recovery conflict with the waiting backend.
The old TAP test used carefully placed injection points to exercise
the old waiting code, but now that the waiting code is gone, much of
the old test is no longer relevant. Rewrite the test to reproduce the
IPC/MultixactCreation hang after crash recovery instead, and to verify
that previously recorded multixids stay readable.
Backpatch to all supported versions. In back-branches, we still need
to be able to read WAL that was generated before this fix, so in the
back-branches this includes a hack to initialize the next offsets page
when replaying XLOG_MULTIXACT_CREATE_ID for the last multixid on a
page. On 'master', bump XLOG_PAGE_MAGIC instead to indicate that the
WAL is not compatible.
Author: Andrey Borodin <amborodin@acm.org>
Reviewed-by: Dmitry Yurichev <dsy.075@yandex.ru>
Reviewed-by: Álvaro Herrera <alvherre@kurilemu.de>
Reviewed-by: Kirill Reshke <reshkekirill@gmail.com>
Reviewed-by: Ivan Bykov <i.bykov@modernsys.ru>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://www.postgresql.org/message-id/172e5723-d65f-4eec-b512-14beacb326ce@yandex.ru
Backpatch-through: 14 M src/backend/access/transam/multixact.c
M src/include/access/xlog_internal.h
M src/test/modules/test_slru/t/001_multixact.pl
M src/test/modules/test_slru/test_multixact.c
Use "foo(void)" for definitions of functions with no parameters.
commit : 9b05e2ec08a3d174accb2a9e1c59e52e94799acc
author : Nathan Bossart <nathan@postgresql.org>
date : Wed, 3 Dec 2025 10:54:37 -0600
committer: Nathan Bossart <nathan@postgresql.org>
date : Wed, 3 Dec 2025 10:54:37 -0600 Standard practice in PostgreSQL is to use "foo(void)" instead of
"foo()", as the latter looks like an "old-style" function
declaration. Similar changes were made in commits cdf4b9aff2,
0e72b9d440, 7069dbcc31, f1283ed6cc, 7b66e2c086, e95126cf04, and
9f7c527af3.
Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Reviewed-by: Matthias van de Meent <boekewurm+postgres@gmail.com>
Discussion: https://postgr.es/m/aTBObQPg%2Bps5I7vl%40ip-10-97-1-34.eu-west-3.compute.internal M src/backend/access/common/heaptuple.c
M src/backend/access/index/genam.c
M src/backend/replication/logical/applyparallelworker.c
M src/backend/replication/logical/sequencesync.c
M src/backend/replication/logical/slotsync.c
M src/backend/replication/logical/tablesync.c
M src/backend/replication/logical/worker.c
M src/backend/utils/adt/uuid.c
M src/bin/pg_basebackup/pg_createsubscriber.c
Put back alternative-output expected files
commit : be25c77677285d3b1365bd19280b27771a1efbce
author : Álvaro Herrera <alvherre@kurilemu.de>
date : Wed, 3 Dec 2025 16:37:06 +0100
committer: Álvaro Herrera <alvherre@kurilemu.de>
date : Wed, 3 Dec 2025 16:37:06 +0100 These were removed in 5dee7a603f66, but that was too optimistic, per
buildfarm member prion as reported by Tom Lane. Mea (Álvaro's) culpa.
Author: Mihail Nikalayeu <mihailnikalayeu@gmail.com>
Discussion: https://postgr.es/m/570630.1764737028@sss.pgh.pa.us A src/test/modules/injection_points/expected/index-concurrently-upsert-predicate_1.out
A src/test/modules/injection_points/expected/index-concurrently-upsert_1.out
doc: Consistently use restartpoint in the documentation
commit : 64527a17a5053fdd52322dfe32a5a13e5d3f577c
author : Daniel Gustafsson <dgustafsson@postgresql.org>
date : Wed, 3 Dec 2025 15:22:38 +0100
committer: Daniel Gustafsson <dgustafsson@postgresql.org>
date : Wed, 3 Dec 2025 15:22:38 +0100 The majority of cases already used "restartpoint" with just a few
instances of "restart point". Changing the latter spelling to the
former ensures consistency in the user facing documentation. Code
comments are not affected by this since it is not worth the churn
to change anything there.
Author: Daniel Gustafsson <daniel@yesql.se>
Reviewed-by: Laurenz Albe <laurenz.albe@cybertec.at>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://postgr.es/m/0F6E38D0-649F-4489-B2C1-43CD937E6636@yesql.se M doc/src/sgml/config.sgml
Fix stray references to SubscriptRef
commit : 9790affcce032710c907aced834e968f2fc41bce
author : Peter Eisentraut <peter@eisentraut.org>
date : Wed, 3 Dec 2025 14:41:12 +0100
committer: Peter Eisentraut <peter@eisentraut.org>
date : Wed, 3 Dec 2025 14:41:12 +0100 This type never existed. SubscriptingRef was meant instead.
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://www.postgresql.org/message-id/flat/2eaa45e3-efc5-4d75-b082-f8159f51445f%40eisentraut.org M contrib/hstore/hstore_subs.c
M src/backend/utils/adt/arraysubs.c
M src/backend/utils/adt/jsonbsubs.c
M src/include/nodes/subscripting.h
Change Pointer to void *
commit : 1b2bb5077e9e9deac60a3e92e742465e7bcd3a21
author : Peter Eisentraut <peter@eisentraut.org>
date : Wed, 3 Dec 2025 10:22:17 +0100
committer: Peter Eisentraut <peter@eisentraut.org>
date : Wed, 3 Dec 2025 10:22:17 +0100 The comment for the Pointer type said 'XXX Pointer arithmetic is done
with this, so it can't be void * under "true" ANSI compilers.'. This
has been fixed in the previous commit 756a4368932. This now changes
the definition of the type from char * to void *, as envisaged by that
comment.
Extension code that relies on using Pointer for pointer arithmetic
will need to make changes similar to commit 756a4368932, but those
changes would be backward compatible.
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Discussion: https://www.postgresql.org/message-id/4154950a-47ae-4223-bd01-1235cc50e933%40eisentraut.org M src/include/c.h
Don't rely on pointer arithmetic with Pointer type
commit : 756a43689324b473ee07549a6eb7a53a203df5ad
author : Peter Eisentraut <peter@eisentraut.org>
date : Wed, 3 Dec 2025 09:54:15 +0100
committer: Peter Eisentraut <peter@eisentraut.org>
date : Wed, 3 Dec 2025 09:54:15 +0100 The comment for the Pointer type says 'XXX Pointer arithmetic is done
with this, so it can't be void * under "true" ANSI compilers.'. This
fixes that. Change from Pointer to use char * explicitly where
pointer arithmetic is needed. This makes the meaning of the code
clearer locally and removes a dependency on the actual definition of
the Pointer type. (The definition of the Pointer type is not changed
in this commit.)
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Discussion: https://www.postgresql.org/message-id/4154950a-47ae-4223-bd01-1235cc50e933%40eisentraut.org M contrib/bloom/bloom.h
M contrib/bloom/blutils.c
M contrib/bloom/blvacuum.c
M src/backend/access/gin/gindatapage.c
M src/backend/access/gin/ginxlog.c
M src/backend/access/rmgrdesc/genericdesc.c
M src/backend/utils/adt/multirangetypes.c
M src/backend/utils/adt/rangetypes.c
Use more appropriate DatumGet* function
commit : 8c6bbd674ed810df9af5ec42f6b38c205e3ad365
author : Peter Eisentraut <peter@eisentraut.org>
date : Wed, 3 Dec 2025 08:52:28 +0100
committer: Peter Eisentraut <peter@eisentraut.org>
date : Wed, 3 Dec 2025 08:52:28 +0100 Use DatumGetCString() instead of DatumGetPointer() for returning a C
string. Right now, they are the same, but that doesn't always have to
be so.
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Discussion: https://www.postgresql.org/message-id/4154950a-47ae-4223-bd01-1235cc50e933%40eisentraut.org M src/test/modules/test_resowner/test_resowner_basic.c
Remove useless casts to Pointer
commit : 623801b3bdb4e16df39f945b6aa5f109744c7b6b
author : Peter Eisentraut <peter@eisentraut.org>
date : Wed, 3 Dec 2025 08:40:33 +0100
committer: Peter Eisentraut <peter@eisentraut.org>
date : Wed, 3 Dec 2025 08:40:33 +0100 in arguments of memcpy() and memmove() calls
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Discussion: https://www.postgresql.org/message-id/4154950a-47ae-4223-bd01-1235cc50e933%40eisentraut.org M contrib/bloom/blutils.c
M contrib/bloom/blvacuum.c
M src/backend/access/gin/ginxlog.c
M src/backend/utils/adt/multirangetypes.c
Fix shadow variable warning in subscriptioncmds.c.
commit : c252d37d8ca8f254fa715ec24fcb23a035a88993
author : Amit Kapila <akapila@postgresql.org>
date : Wed, 3 Dec 2025 03:31:31 +0000
committer: Amit Kapila <akapila@postgresql.org>
date : Wed, 3 Dec 2025 03:31:31 +0000 Author: Shlok Kyal <shlok.kyal.oss@gmail.com>
Author: Peter Smith <smithpb2250@gmail.com>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Vignesh C <vignesh21@gmail.com>
Discussion: https://postgr.es/m/CAHut+PsF8R0Bt4J3c92+T2F0mun0rRfK=-GH+iBv2s-O8ahJJw@mail.gmail.com M src/backend/commands/subscriptioncmds.c
Use LW_SHARED in dsa.c where possible.
commit : a6d05c819380b0940fcfb428aa298f2d7e76e5c6
author : Nathan Bossart <nathan@postgresql.org>
date : Tue, 2 Dec 2025 16:40:23 -0600
committer: Nathan Bossart <nathan@postgresql.org>
date : Tue, 2 Dec 2025 16:40:23 -0600 Both dsa_get_total_size() and dsa_get_total_size_from_handle() take
an exclusive lock just to read a variable. This commit reduces the
lock level to LW_SHARED in those functions.
Reviewed-by: Sami Imseih <samimseih@gmail.com>
Discussion: https://postgr.es/m/aS8fMzWs9e8iHxk2%40nathan M src/backend/utils/mmgr/dsa.c
Fix amcheck's handling of half-dead B-tree pages
commit : cbe04e5d729f292bcf9b06f5d774884b4511b18a
author : Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Tue, 2 Dec 2025 21:11:15 +0200
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Tue, 2 Dec 2025 21:11:15 +0200 amcheck incorrectly reported the following error if there were any
half-dead pages in the index:
ERROR: mismatch between parent key and child high key in index
"amchecktest_id_idx"
It's expected that a half-dead page does not have a downlink in the
parent level, so skip the test.
Reported-by: Konstantin Knizhnik <knizhnik@garret.ru>
Reviewed-by: Peter Geoghegan <pg@bowt.ie>
Reviewed-by: Mihail Nikalayeu <mihailnikalayeu@gmail.com>
Discussion: https://www.postgresql.org/message-id/33e39552-6a2a-46f3-8b34-3f9f8004451f@garret.ru
Backpatch-through: 14 M contrib/amcheck/verify_nbtree.c
M src/test/modules/nbtree/expected/nbtree_half_dead_pages.out
M src/test/modules/nbtree/sql/nbtree_half_dead_pages.sql
Add a test for half-dead pages in B-tree indexes
commit : c085aab2781989f487364fab2978d9ee791559a4
author : Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Tue, 2 Dec 2025 21:11:05 +0200
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Tue, 2 Dec 2025 21:11:05 +0200 To increase our test coverage in general, and because I will use this
in the next commit to test a bug we currently have in amcheck.
Reviewed-by: Peter Geoghegan <pg@bowt.ie>
Discussion: https://www.postgresql.org/message-id/33e39552-6a2a-46f3-8b34-3f9f8004451f@garret.ru M src/backend/access/nbtree/nbtpage.c
A src/test/modules/nbtree/expected/nbtree_half_dead_pages.out
M src/test/modules/nbtree/meson.build
A src/test/modules/nbtree/sql/nbtree_half_dead_pages.sql
Fix amcheck's handling of incomplete root splits in B-tree
commit : 6c05ef5729c04d47400660cd994305bc44a3c757
author : Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Tue, 2 Dec 2025 21:10:51 +0200
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Tue, 2 Dec 2025 21:10:51 +0200 When the root page is being split, it's normal that root page
according to the metapage is not marked BTP_ROOT. Fix bogus error in
amcheck about that case.
Reviewed-by: Peter Geoghegan <pg@bowt.ie>
Discussion: https://www.postgresql.org/message-id/abd65090-5336-42cc-b768-2bdd66738404@iki.fi
Backpatch-through: 14 M contrib/amcheck/verify_nbtree.c
M src/test/modules/nbtree/Makefile
M src/test/modules/nbtree/expected/nbtree_incomplete_splits.out
M src/test/modules/nbtree/sql/nbtree_incomplete_splits.sql
Add a test for incomplete splits in B-tree indexes
commit : 1e4e5783e7d77adb283ae7fa1ac99b0910a041b2
author : Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Tue, 2 Dec 2025 21:10:47 +0200
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Tue, 2 Dec 2025 21:10:47 +0200 To increase our test coverage in general, and because I will add onto
this in the next commit to also test amcheck with incomplete splits.
This is copied from the similar test we had for GIN indexes. B-tree's
incomplete splits work similarly to GIN's, so with small changes, the
same test works for B-tree too.
Reviewed-by: Peter Geoghegan <pg@bowt.ie>
Discussion: https://www.postgresql.org/message-id/abd65090-5336-42cc-b768-2bdd66738404@iki.fi M src/backend/access/nbtree/nbtinsert.c
M src/test/modules/meson.build
A src/test/modules/nbtree/Makefile
A src/test/modules/nbtree/expected/nbtree_incomplete_splits.out
A src/test/modules/nbtree/meson.build
A src/test/modules/nbtree/sql/nbtree_incomplete_splits.sql
Show size of DSAs and dshashes in pg_dsm_registry_allocations.
commit : f894acb24a12cf1f369a45af36c8f4049f9af571
author : Nathan Bossart <nathan@postgresql.org>
date : Tue, 2 Dec 2025 10:29:45 -0600
committer: Nathan Bossart <nathan@postgresql.org>
date : Tue, 2 Dec 2025 10:29:45 -0600 Presently, this view reports NULL for the size of DSAs and dshash
tables because 1) the current backend might not be attached to them
and 2) the registry doesn't save the pointers to the dsa_area or
dshash_table in local memory. Also, the view doesn't show
partially-initialized entries to avoid ambiguity, since those
entries would report a NULL size as well.
This commit introduces a function that looks up the size of a DSA
given its handle (transiently attaching to the control segment if
needed) and teaches pg_dsm_registry_allocations to use it to show
the size of successfully-initialized DSA and dshash entries.
Furthermore, the view now reports partially-initialized entries
with a NULL size.
Reviewed-by: Rahila Syed <rahilasyed90@gmail.com>
Reviewed-by: Robert Haas <robertmhaas@gmail.com>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://postgr.es/m/aSeEDeznAsHR1_YF%40nathan M doc/src/sgml/system-views.sgml
M src/backend/storage/ipc/dsm_registry.c
M src/backend/utils/mmgr/dsa.c
M src/include/utils/dsa.h
M src/test/modules/test_dsm_registry/expected/test_dsm_registry.out
M src/test/modules/test_dsm_registry/sql/test_dsm_registry.sql
Remove doc and code comments about ON CONFLICT deficiencies
commit : 758479213d574d6e2fbbdfee5328edef3d60da61
author : Álvaro Herrera <alvherre@kurilemu.de>
date : Tue, 2 Dec 2025 16:47:18 +0100
committer: Álvaro Herrera <alvherre@kurilemu.de>
date : Tue, 2 Dec 2025 16:47:18 +0100 They have been fixed, so we don't need this text anymore. This reverts
commit 8b18ed6dfbb8.
Author: Mihail Nikalayeu <mihailnikalayeu@gmail.com>
Discussion: https://postgr.es/m/CADzfLwWo+FV9WSeOah9F1r=4haa6eay1hNvYYy_WfziJeK+aLQ@mail.gmail.com M doc/src/sgml/ref/insert.sgml
M src/backend/optimizer/util/plancat.c
Avoid use of NOTICE to wait for snapshot invalidation
commit : 5dee7a603f664115f8fe9819b0c19abd8209cd02
author : Álvaro Herrera <alvherre@kurilemu.de>
date : Tue, 2 Dec 2025 16:43:27 +0100
committer: Álvaro Herrera <alvherre@kurilemu.de>
date : Tue, 2 Dec 2025 16:43:27 +0100 This idea (implemented in commits and bc32a12e0db2 and 9e8fa05d3412) of
using notices to detect that a session is sleeping was unreliable, so
simplify the concurrency controller session to just look at
pg_stat_activity for a process sleeping on the injection point we want
it to hit. This change allows us to remove a secondary injection point
and the alternative expected output files.
Reproduced by Alexander Lakhin following a report in buildfarm member
skink (which runs the server under valgrind).
Author: Mihail Nikalayeu <mihailnikalayeu@gmail.com>
Reported-by: Alexander Lakhin <exclusion@gmail.com>
Reviewed-by: Álvaro Herrera <alvherre@kurilemu.de>
Discussion: https://postgr.es/m/3e302c96-cdd2-45ec-af84-03dbcdccde4a@gmail.com M src/backend/utils/time/snapmgr.c
M src/test/modules/injection_points/expected/index-concurrently-upsert-predicate.out
D src/test/modules/injection_points/expected/index-concurrently-upsert-predicate_1.out
M src/test/modules/injection_points/expected/index-concurrently-upsert.out
D src/test/modules/injection_points/expected/index-concurrently-upsert_1.out
M src/test/modules/injection_points/specs/index-concurrently-upsert-predicate.spec
M src/test/modules/injection_points/specs/index-concurrently-upsert.spec
Fix ON CONFLICT with REINDEX CONCURRENTLY and partitions
commit : 90eae926abbbcedbbea2ad5302722185e8652dca
author : Álvaro Herrera <alvherre@kurilemu.de>
date : Tue, 2 Dec 2025 13:51:19 +0100
committer: Álvaro Herrera <alvherre@kurilemu.de>
date : Tue, 2 Dec 2025 13:51:19 +0100 When planning queries with ON CONFLICT on partitioned tables, the
indexes to consider as arbiters for each partition are determined based
on those found in the parent table. However, it's possible for an index
on a partition to be reindexed, and in that case, the auxiliary indexes
created on the partition must be considered as arbiters as well; failing
to do that may result in spurious "duplicate key" errors given
sufficient bad luck.
We fix that in this commit by matching every index that doesn't have a
parent to each initially-determined arbiter index. Every unparented
matching index is considered an additional arbiter index.
Closely related to the fixes in bc32a12e0db2 and 2bc7e886fc1b, and for
identical reasons, not backpatched (for now) even though it's a
longstanding issue.
Author: Mihail Nikalayeu <mihailnikalayeu@gmail.com>
Reviewed-by: Álvaro Herrera <alvherre@kurilemu.de>
Discussion: https://postgr.es/m/CANtu0ojXmqjmEzp-=aJSxjsdE76iAsRgHBoK0QtYHimb_mEfsg@mail.gmail.com M src/backend/executor/execPartition.c
M src/test/modules/injection_points/Makefile
A src/test/modules/injection_points/expected/reindex-concurrently-upsert-partitioned.out
M src/test/modules/injection_points/meson.build
A src/test/modules/injection_points/specs/reindex-concurrently-upsert-partitioned.spec
Remove useless casting to same type
commit : 4f941d432b42eccd99ba0d22e3a59c073ac2406a
author : Peter Eisentraut <peter@eisentraut.org>
date : Tue, 2 Dec 2025 10:05:12 +0100
committer: Peter Eisentraut <peter@eisentraut.org>
date : Tue, 2 Dec 2025 10:05:12 +0100 This removes some casts where the input already has the same type as
the type specified by the cast. Their presence could cause risks of
hiding actual type mismatches in the future or silently discarding
qualifiers. It also improves readability. Same kind of idea as
7f798aca1d5 and ef8fe693606. (This does not change all such
instances, but only those hand-picked by the author.)
Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Reviewed-by: Nathan Bossart <nathandbossart@gmail.com>
Reviewed-by: Jacob Champion <jacob.champion@enterprisedb.com>
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Discussion: https://www.postgresql.org/message-id/flat/aSQy2JawavlVlEB0%40ip-10-97-1-34.eu-west-3.compute.internal M contrib/btree_gist/btree_utils_num.c
M contrib/cube/cube.c
M contrib/fuzzystrmatch/dmetaphone.c
M contrib/pgcrypto/mbuf.c
M src/backend/access/common/indextuple.c
M src/backend/access/gin/gindatapage.c
M src/backend/access/gin/gininsert.c
M src/backend/access/hash/hash_xlog.c
M src/backend/access/transam/twophase.c
M src/backend/catalog/aclchk.c
M src/backend/commands/tablecmds.c
M src/backend/executor/execExpr.c
M src/backend/executor/execExprInterp.c
M src/backend/executor/execPartition.c
M src/backend/executor/nodeTableFuncscan.c
M src/backend/optimizer/geqo/geqo_pool.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/util/pathnode.c
M src/backend/parser/analyze.c
M src/backend/parser/parse_expr.c
M src/backend/port/sysv_shmem.c
M src/backend/replication/walsender.c
M src/backend/rewrite/rewriteHandler.c
M src/backend/statistics/dependencies.c
M src/backend/statistics/extended_stats.c
M src/backend/statistics/mcv.c
M src/backend/storage/aio/aio.c
M src/backend/storage/aio/method_io_uring.c
M src/backend/storage/ipc/waiteventset.c
M src/backend/storage/lmgr/predicate.c
M src/backend/storage/lmgr/proc.c
M src/backend/utils/adt/arrayfuncs.c
M src/backend/utils/adt/jsonfuncs.c
M src/backend/utils/adt/ruleutils.c
M src/bin/pg_dump/pg_dump.c
M src/common/sha1.c
M src/interfaces/ecpg/ecpglib/descriptor.c
M src/interfaces/ecpg/ecpglib/execute.c
M src/interfaces/ecpg/ecpglib/prepare.c
M src/port/win32ntdll.c
M src/test/modules/test_radixtree/test_radixtree.c
Simplify hash_xlog_split_allocate_page()
commit : 35988b31db7767ba446009611b9928add1d40f98
author : Peter Eisentraut <peter@eisentraut.org>
date : Tue, 2 Dec 2025 09:10:02 +0100
committer: Peter Eisentraut <peter@eisentraut.org>
date : Tue, 2 Dec 2025 09:10:02 +0100 Instead of complicated pointer arithmetic, overlay a uint32 array and
just access the array members. That's safe thanks to
XLogRecGetBlockData() returning a MAXALIGNed buffer.
Reviewed-by: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Reviewed-by: Jacob Champion <jacob.champion@enterprisedb.com>
Discussion: https://www.postgresql.org/message-id/flat/aSQy2JawavlVlEB0%40ip-10-97-1-34.eu-west-3.compute.internal M src/backend/access/hash/hash_xlog.c
Replace pointer comparisons and assignments to literal zero with NULL
commit : ec782f56b0c30ef493e8356b46e1131612f01d9f
author : Peter Eisentraut <peter@eisentraut.org>
date : Tue, 2 Dec 2025 08:39:24 +0100
committer: Peter Eisentraut <peter@eisentraut.org>
date : Tue, 2 Dec 2025 08:39:24 +0100 While 0 is technically correct, NULL is the semantically appropriate
choice for pointers.
Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Discussion: https://www.postgresql.org/message-id/aS1AYnZmuRZ8g%2B5G%40ip-10-97-1-34.eu-west-3.compute.internal M src/backend/nodes/copyfuncs.c
M src/backend/postmaster/postmaster.c
M src/backend/utils/adt/pg_locale.c
M src/backend/utils/adt/timestamp.c
M src/interfaces/ecpg/ecpglib/prepare.c
Update comment related to C99
commit : 376c649634bb3fbfad79940f996e2fcb4c2ea6bf
author : Peter Eisentraut <peter@eisentraut.org>
date : Tue, 2 Dec 2025 08:18:50 +0100
committer: Peter Eisentraut <peter@eisentraut.org>
date : Tue, 2 Dec 2025 08:18:50 +0100 One could do more work here to eliminate the Windows difference
described in the comment, but that can be a separate project. The
purpose of this change is to update comments that might confusingly
indicate that C99 is not required.
Reviewed-by: Thomas Munro <thomas.munro@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/170308e6-a7a3-4484-87b2-f960bb564afa%40eisentraut.org M src/bin/pg_dump/dumputils.h
Update some timestamp[tz] functions to use soft-error reporting
commit : 713d9a847e6409a2a722aed90975eef6d75dc701
author : Michael Paquier <michael@paquier.xyz>
date : Tue, 2 Dec 2025 09:30:23 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Tue, 2 Dec 2025 09:30:23 +0900 This commit updates two functions that convert "timestamptz" to
"timestamp", and vice-versa, to use the soft error reporting rather than
a their own logic to do the same. These are now named as follows:
- timestamp2timestamptz_safe()
- timestamptz2timestamp_safe()
These functions were suffixed with "_opt_overflow", previously.
This shaves some code, as it is possible to detect how a timestamp[tz]
overflowed based on the returned value rather than a custom state. It
is optionally possible for the callers of these functions to rely on the
error generated internally by these functions, depending on the error
context.
Similar work has been done in d03668ea0566 and 4246a977bad6.
Reviewed-by: Amul Sul <sulamul@gmail.com>
Discussion: https://postgr.es/m/aS09YF2GmVXjAxbJ@paquier.xyz M contrib/btree_gin/btree_gin.c
M src/backend/utils/adt/timestamp.c
M src/include/utils/timestamp.h
Make regex "max_chr" depend on encoding, not provider.
commit : 19b966243c38196a33b033fb0c259dcf760c0d69
author : Jeff Davis <jdavis@postgresql.org>
date : Mon, 1 Dec 2025 11:06:17 -0800
committer: Jeff Davis <jdavis@postgresql.org>
date : Mon, 1 Dec 2025 11:06:17 -0800 The regex mechanism scans through the first "max_chr" character values
to cache character property ranges (isalpha, etc.). For single-byte
encodings, there's no sense in scanning beyond UCHAR_MAX; but for
UTF-8 it makes sense to cache higher code point values (though not all
of them; only up to MAX_SIMPLE_CHR).
Prior to 5a38104b36, the logic about how many character values to scan
was based on the pg_regex_strategy, which was dependent on the
provider. Commit 5a38104b36 preserved that logic exactly, allowing
different providers to define the "max_chr".
Now, change it to depend only on the encoding and whether
ctype_is_c. For this specific calculation, distinguishing between
providers creates more complexity than it's worth.
Discussion: https://postgr.es/m/450ceb6260cad30d7afdf155d991a9caafee7c0d.camel@j-davis.com
Reviewed-by: Chao Li <li.evan.chao@gmail.com> M src/backend/regex/regc_pg_locale.c
M src/backend/utils/adt/pg_locale_libc.c
M src/include/utils/pg_locale.h
Change some callers to use pg_ascii_toupper().
commit : 99cd8890becacf9d7059297c3d75cd388ad83ac0
author : Jeff Davis <jdavis@postgresql.org>
date : Mon, 1 Dec 2025 09:24:03 -0800
committer: Jeff Davis <jdavis@postgresql.org>
date : Mon, 1 Dec 2025 09:24:03 -0800 The input is ASCII anyway, so it's better to be clear that it's not
locale-dependent.
Discussion: https://postgr.es/m/450ceb6260cad30d7afdf155d991a9caafee7c0d.camel@j-davis.com M src/backend/access/transam/xlogfuncs.c
M src/backend/utils/adt/cash.c
Fix ON CONFLICT ON CONSTRAINT during REINDEX CONCURRENTLY
commit : 2bc7e886fc1baaeee3987a141bff3ac490037d12
author : Álvaro Herrera <alvherre@kurilemu.de>
date : Mon, 1 Dec 2025 17:34:13 +0100
committer: Álvaro Herrera <alvherre@kurilemu.de>
date : Mon, 1 Dec 2025 17:34:13 +0100 When REINDEX CONCURRENTLY is processing the index that supports a
constraint, there are periods during which multiple indexes match the
constraint index's definition. Those must all be included in the set of
inferred index for INSERT ON CONFLICT, in order to avoid spurious
"duplicate key" errors.
To fix, we set things up to match all indexes against attributes,
expressions and predicates of the constraint index, then return all
indexes that match those, rather than just the one constraint index.
This is more onerous than before, where we would just test the named
constraint for validity, but it's not more onerous than processing
"conventional" inference (where a list of attribute names etc is given).
This is closely related to the misbehaviors fixed by bc32a12e0db2, for a
different situation. We're not backpatching this one for now either,
for the same reasons.
Author: Mihail Nikalayeu <mihailnikalayeu@gmail.com>
Reviewed-by: Álvaro Herrera <alvherre@kurilemu.de>
Discussion: https://postgr.es/m/CANtu0ojXmqjmEzp-=aJSxjsdE76iAsRgHBoK0QtYHimb_mEfsg@mail.gmail.com M src/backend/optimizer/util/plancat.c
M src/test/modules/injection_points/Makefile
A src/test/modules/injection_points/expected/reindex-concurrently-upsert-on-constraint.out
M src/test/modules/injection_points/meson.build
A src/test/modules/injection_points/specs/reindex-concurrently-upsert-on-constraint.spec
Fix a strict aliasing violation
commit : 2fcc5a715130fbe9fb6eadf338e3bfe560eb0cb5
author : Peter Eisentraut <peter@eisentraut.org>
date : Mon, 1 Dec 2025 16:34:19 +0100
committer: Peter Eisentraut <peter@eisentraut.org>
date : Mon, 1 Dec 2025 16:34:19 +0100 This one is almost a textbook example of an aliasing violation, and it
is straightforward to fix, so clean it up. (The warning only shows up
if you remove the -fno-strict-aliasing option.) Also, move the code
after the error checking. Doesn't make a difference technically, but
it seems strange to do actions before errors are checked.
Reported-by: Tatsuo Ishii <ishii@postgresql.org>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://www.postgresql.org/message-id/flat/20240724.155525.366150353176322967.ishii%40postgresql.org M src/backend/replication/logical/origin.c
Move WAL sequence code into its own file
commit : a87987cafca683e9076c424f99bae117211a83a4
author : Michael Paquier <michael@paquier.xyz>
date : Mon, 1 Dec 2025 16:21:41 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Mon, 1 Dec 2025 16:21:41 +0900 This split exists for most of the other RMGRs, and makes cleaner the
separation between the WAL code, the redo code and the record
description code (already in its own file) when it comes to the sequence
RMGR. The redo and masking routines are moved to a new file,
sequence_xlog.c. All the RMGR routines are now located in a new header,
sequence_xlog.h.
This separation is useful for a different patch related to sequences
that I have been working on, where it makes a refactoring of sequence.c
easier if its RMGR routines and its core routines are split.
Reviewed-by: Heikki Linnakangas <hlinnaka@iki.fi>
Reviewed-by: Kirill Reshke <reshkekirill@gmail.com>
Discussion: https://postgr.es/m/aSfTxIWjiXkTKh1E@paquier.xyz M src/backend/access/rmgrdesc/seqdesc.c
M src/backend/access/transam/rmgr.c
M src/backend/commands/Makefile
M src/backend/commands/meson.build
M src/backend/commands/sequence.c
A src/backend/commands/sequence_xlog.c
M src/bin/pg_waldump/rmgrdesc.c
M src/include/commands/sequence.h
A src/include/commands/sequence_xlog.h
Switch some date/timestamp functions to use the soft error reporting
commit : d03668ea0566b53522cf2628ab7aa630247640a4
author : Michael Paquier <michael@paquier.xyz>
date : Mon, 1 Dec 2025 15:22:20 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Mon, 1 Dec 2025 15:22:20 +0900 This commit changes some functions related to the data types date and
timestamp to use the soft error reporting rather than a custom boolean
flag called "overflow", used to let the callers of these functions know
if an overflow happens.
This results in the removal of some boilerplate code, as it is possible
to rely on an error context rather than a custom state, with the
possibility to use the error generated inside the functions updated
here, if necessary.
These functions were suffixed with "_opt_overflow". They are now
renamed to use "_safe" as suffix.
This work is similar to 4246a977bad6.
Author: Amul Sul <sulamul@gmail.com>
Reviewed-by: Amit Langote <amitlangote09@gmail.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://postgr.es/m/CAAJ_b95HEmFyzHZfsdPquSHeswcopk8MCG1Q_vn4tVkZ+xxofw@mail.gmail.com M contrib/btree_gin/btree_gin.c
M src/backend/utils/adt/date.c
M src/include/utils/date.h
Don't call simplify_aggref with a NULL PlannerInfo
commit : 5424f4da9031ac4681ab002d20f021232070c96a
author : David Rowley <drowley@postgresql.org>
date : Sun, 30 Nov 2025 12:55:34 +1300
committer: David Rowley <drowley@postgresql.org>
date : Sun, 30 Nov 2025 12:55:34 +1300 42473b3b3 added prosupport infrastructure to allow simplification of
Aggrefs during constant-folding. In some cases the context->root that's
given to eval_const_expressions_mutator() can be NULL. 42473b3b3 failed
to take that into account, which could result in a crash.
To fix, add a check and only call simplify_aggref() when the PlannerInfo
is set.
Author: David Rowley <dgrowleyml@gmail.com>
Reported-by: Birler, Altan <altan.birler@tum.de>
Discussion: https://postgr.es/m/132d4da23b844d5ab9e352d34096eab5@tum.de M src/backend/optimizer/util/clauses.c
Update obsolete row compare preprocessing comments.
commit : c902bd57af998b52bde98c87916190309639129e
author : Peter Geoghegan <pg@bowt.ie>
date : Sat, 29 Nov 2025 16:41:51 -0500
committer: Peter Geoghegan <pg@bowt.ie>
date : Sat, 29 Nov 2025 16:41:51 -0500 We have some limited ability to detect redundant and contradictory
conditions involving an nbtree row comparison key following commits
f09816a0 and bd3f59fd: we can do so in simple cases involving IS NULL
and IS NOT NULL keys on a row compare key's first column. We can
likewise determine that a scan's qual is unsatisfiable given a row
compare whose first subkey's arg is NULL. Update obsolete comments that
claimed that we merely copied row compares into the output key array
"without any editorialization".
Also update another _bt_preprocess_keys header comment paragraph: add a
parenthetical remark that points out that preprocessing will generate a
skip array for the preceding example qual. That will ultimate lead to
preprocessing marking the example's lower-order y key required -- which
is exactly what the example supposes cannot happen. Keep the original
comment, though, since it accurately describes the mechanical rules that
determine which keys get marked required in the absence of skip arrays
(which can occasionally still matter). This fixes an oversight in
commit 92fe23d9, which added the nbtree skip scan optimization.
Author: Peter Geoghegan <pg@bowt.ie>
Backpatch-through: 18 M src/backend/access/nbtree/nbtpreprocesskeys.c
Avoid rewriting data-modifying CTEs more than once.
commit : 3881561d7715647dbb4a5bc27f116504903daf1b
author : Dean Rasheed <dean.a.rasheed@gmail.com>
date : Sat, 29 Nov 2025 12:28:59 +0000
committer: Dean Rasheed <dean.a.rasheed@gmail.com>
date : Sat, 29 Nov 2025 12:28:59 +0000 Formerly, when updating an auto-updatable view, or a relation with
rules, if the original query had any data-modifying CTEs, the rewriter
would rewrite those CTEs multiple times as RewriteQuery() recursed
into the product queries. In most cases that was harmless, because
RewriteQuery() is mostly idempotent. However, if the CTE involved
updating an always-generated column, it would trigger an error because
any subsequent rewrite would appear to be attempting to assign a
non-default value to the always-generated column.
This could perhaps be fixed by attempting to make RewriteQuery() fully
idempotent, but that looks quite tricky to achieve, and would probably
be quite fragile, given that more generated-column-type features might
be added in the future.
Instead, fix by arranging for RewriteQuery() to rewrite each CTE
exactly once (by tracking the number of CTEs already rewritten as it
recurses). This has the advantage of being simpler and more efficient,
but it does make RewriteQuery() dependent on the order in which
rewriteRuleAction() joins the CTE lists from the original query and
the rule action, so care must be taken if that is ever changed.
Reported-by: Bernice Southey <bernice.southey@gmail.com>
Author: Bernice Southey <bernice.southey@gmail.com>
Author: Dean Rasheed <dean.a.rasheed@gmail.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Kirill Reshke <reshkekirill@gmail.com>
Discussion: https://postgr.es/m/CAEDh4nyD6MSH9bROhsOsuTqGAv_QceU_GDvN9WcHLtZTCYM1kA@mail.gmail.com
Backpatch-through: 14 M src/backend/rewrite/rewriteHandler.c
M src/test/regress/expected/with.out
M src/test/regress/sql/with.sql
Generate translator comments for GUC parameter descriptions
commit : 87c6f8b047d5b0790e6f8b8532f4adf58dc60f67
author : Peter Eisentraut <peter@eisentraut.org>
date : Fri, 28 Nov 2025 16:00:57 +0100
committer: Peter Eisentraut <peter@eisentraut.org>
date : Fri, 28 Nov 2025 16:00:57 +0100 Automatically generate comments like
/* translator: GUC parameter "client_min_messages" short description */
in the generated guc_tables.inc.c.
This provides translators more context.
Reviewed-by: Pavlo Golub <pavlo.golub@gmail.com>
Reviewed-by: Álvaro Herrera <alvherre@kurilemu.de>
Reviewed-by: Stéphane Schildknecht <sas.postgresql@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/1a89b3f0-e588-41ef-b712-aba766143cad%40eisentraut.org M src/backend/utils/misc/gen_guc_tables.pl
Fix pg_isblank()
commit : 8b3e2c622a85208b94808c54d9b40b10b030d304
author : Peter Eisentraut <peter@eisentraut.org>
date : Fri, 28 Nov 2025 07:53:12 +0100
committer: Peter Eisentraut <peter@eisentraut.org>
date : Fri, 28 Nov 2025 07:53:12 +0100 There was a pg_isblank() function that claimed to be a replacement for
the standard isblank() function, which was thought to be "not very
portable yet". We can now assume that it's portable (it's in C99).
But pg_isblank() actually diverged from the standard isblank() by also
accepting '\r', while the standard one only accepts space and tab.
This was added to support parsing pg_hba.conf under Windows. But the
hba parsing code now works completely differently and already handles
line endings before we get to pg_isblank(). The other user of
pg_isblank() is for ident protocol message parsing, which also handles
'\r' separately. So this behavior is now obsolete and confusing.
To improve clarity, I separated those concerns. The ident parsing now
gets its own function that hardcodes the whitespace characters
mentioned by the relevant RFC. pg_isblank() is now static in hba.c
and is a wrapper around the standard isblank(), with some extra logic
to ensure robust treatment of non-ASCII characters.
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://www.postgresql.org/message-id/flat/170308e6-a7a3-4484-87b2-f960bb564afa%40eisentraut.org M src/backend/libpq/auth.c
M src/backend/libpq/hba.c
M src/include/libpq/hba.h
Add slotsync_skip_reason column to pg_replication_slots view.
commit : e68b6adad96d414fdf24e072fdb1d41fb4b8f0b7
author : Amit Kapila <akapila@postgresql.org>
date : Fri, 28 Nov 2025 05:21:35 +0000
committer: Amit Kapila <akapila@postgresql.org>
date : Fri, 28 Nov 2025 05:21:35 +0000 Introduce a new column, slotsync_skip_reason, in the pg_replication_slots
view. This column records the reason why the last slot synchronization was
skipped. It is primarily relevant for logical replication slots on standby
servers where the 'synced' field is true. The value is NULL when
synchronization succeeds.
Author: Shlok Kyal <shlok.kyal.oss@gmail.com>
Reviewed-by: shveta malik <shveta.malik@gmail.com>
Reviewed-by: Hayato Kuroda <kuroda.hayato@fujitsu.com>
Reviewed-by: Ashutosh Sharma <ashu.coek88@gmail.com>
Reviewed-by: Hou Zhijie <houzj.fnst@fujitsu.com>
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>
Discussion: https://postgr.es/m/CAE9k0PkhfKrTEAsGz4DjOhEj1nQ+hbQVfvWUxNacD38ibW3a1g@mail.gmail.com M doc/src/sgml/monitoring.sgml
M doc/src/sgml/system-views.sgml
M src/backend/catalog/system_views.sql
M src/backend/replication/logical/slotsync.c
M src/backend/replication/slot.c
M src/backend/replication/slotfuncs.c
M src/backend/utils/activity/pgstat_replslot.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/include/replication/slot.h
M src/test/recovery/t/040_standby_failover_slots_sync.pl
M src/test/regress/expected/rules.out
M src/tools/pgindent/typedefs.list
pg_buffercache: Add pg_buffercache_mark_dirty{,_relation,_all}()
commit : 9ccc049dfe655ca9927f7c62559ec32f4d1f94dd
author : Michael Paquier <michael@paquier.xyz>
date : Fri, 28 Nov 2025 09:04:04 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Fri, 28 Nov 2025 09:04:04 +0900 This commit introduces three new functions for marking shared buffers as
dirty by using the functions introduced in 9660906dbd69:
* pg_buffercache_mark_dirty() for one shared buffer.
- pg_buffercache_mark_dirt_relation() for all the shared buffers in a
relation.
* pg_buffercache_mark_dirty_all() for all the shared buffers in pool.
The "_all" and "_relation" flavors are designed to address the
inefficiency of repeatedly calling pg_buffercache_mark_dirty() for each
individual buffer, which can be time-consuming when dealing with with
large shared buffers pool.
These functions are intended as developer tools and are available only
to superusers. There is no need to bump the version of pg_buffercache,
4b203d499c61 having done this job in this release cycle.
Author: Nazir Bilal Yavuz <byavuz81@gmail.com>
Reviewed-by: Andres Freund <andres@anarazel.de>
Reviewed-by: Aidar Imamov <a.imamov@postgrespro.ru>
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>
Reviewed-by: Joseph Koshakow <koshy44@gmail.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Reviewed-by: Yuhang Qiu <iamqyh@gmail.com>
Reviewed-by: Xuneng Zhou <xunengzhou@gmail.com>
Discussion: https://postgr.es/m/CAN55FZ0h_YoSqqutxV6DES1RW8ig6wcA8CR9rJk358YRMxZFmw@mail.gmail.com M contrib/pg_buffercache/expected/pg_buffercache.out
M contrib/pg_buffercache/pg_buffercache–1.6–1.7.sql
M contrib/pg_buffercache/pg_buffercache_pages.c
M contrib/pg_buffercache/sql/pg_buffercache.sql
M doc/src/sgml/pgbuffercache.sgml
Fix possibly uninitialized HeapScanDesc.rs_startblock
commit : d167c19295da46be1998dd474841f94170e32597
author : David Rowley <drowley@postgresql.org>
date : Fri, 28 Nov 2025 12:40:50 +1300
committer: David Rowley <drowley@postgresql.org>
date : Fri, 28 Nov 2025 12:40:50 +1300 The solution used in 0ca3b1697 to determine the Parallel TID Range
Scan's start location was to modify the signature of
table_block_parallelscan_startblock_init() to allow the startblock
to be passed in as a parameter. This allows the scan limits to be
adjusted before that function is called so that the limits are picked up
when the parallel scan starts. The commit made it so the call to
table_block_parallelscan_startblock_init uses the HeapScanDesc's
rs_startblock to pass the startblock to the parallel scan. That all
works ok for Parallel TID Range scans as the HeapScanDesc rs_startblock
gets set by heap_setscanlimits(), but for Parallel Seq Scans, initscan()
does not initialize rs_startblock, and that results in passing an
uninitialized value to table_block_parallelscan_startblock_init() as
noted by the buildfarm member skink, running Valgrind.
To fix this issue, make it so initscan() sets the rs_startblock for
parallel scans unless we're doing a rescan. This makes it so
table_block_parallelscan_startblock_init() will be called with the
startblock set to InvalidBlockNumber, and that'll allow the syncscan
code to find the correct start location (when enabled). For Parallel
TID Range Scans, this InvalidBlockNumber value will be overwritten in
the call to heap_setscanlimits().
initscan() is a bit light on documentation on what's meant to get
initialized where for parallel scans. From what I can tell, it looks like
it just didn't matter prior to 0ca3b1697 that rs_startblock was left
uninitialized for parallel scans. To address the light documentation,
I've also added some comments to mention that the syncscan location for
parallel scans is figured out in table_block_parallelscan_startblock_init.
I've also taken the liberty to adjust the if/else if/else code in
initscan() to make it clearer which parts apply to parallel scans and
which parts are for the serial scans.
Author: David Rowley <dgrowleyml@gmail.com>
Discussion: https://postgr.es/m/CAApHDvqALm+k7FyfdQdCw1yF_8HojvR61YRrNhwRQPE=zSmnQA@mail.gmail.com M src/backend/access/heap/heapam.c
doc: Add missing tags in pg_buffercache page
commit : c75bf57a90e05bf35afa00e66986b9210833bdaf
author : Michael Paquier <michael@paquier.xyz>
date : Fri, 28 Nov 2025 08:00:23 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Fri, 28 Nov 2025 08:00:23 +0900 Issue noticed while looking at this area of the documentation, for a
different patch. This is a matter of style, so no backpatch is done.
Discussion: https://postgr.es/m/CAN55FZ0h_YoSqqutxV6DES1RW8ig6wcA8CR9rJk358YRMxZFmw@mail.gmail.com M doc/src/sgml/pgbuffercache.sgml
Add routines for marking buffers dirty efficiently
commit : 9660906dbd696146da2c1d8bfdce26b1a2bed1c3
author : Michael Paquier <michael@paquier.xyz>
date : Fri, 28 Nov 2025 07:39:33 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Fri, 28 Nov 2025 07:39:33 +0900 This commit introduces new internal bufmgr routines for marking shared
buffers as dirty:
* MarkDirtyUnpinnedBuffer()
* MarkDirtyRelUnpinnedBuffers()
* MarkDirtyAllUnpinnedBuffers()
These functions provide an efficient mechanism to respectively mark one
buffer, all the buffers of a relation, or the entire shared buffer pool
as dirty, something that can be useful to force patterns for the
checkpointer. MarkDirtyUnpinnedBufferInternal(), an extra routine, is
used by these three, to mark as dirty an unpinned buffer.
They are intended as developer tools to manipulate buffer dirtiness in
bulk, and will be used in a follow-up commit.
Author: Nazir Bilal Yavuz <byavuz81@gmail.com>
Reviewed-by: Andres Freund <andres@anarazel.de>
Reviewed-by: Aidar Imamov <a.imamov@postgrespro.ru>
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>
Reviewed-by: Joseph Koshakow <koshy44@gmail.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Reviewed-by: Yuhang Qiu <iamqyh@gmail.com>
Reviewed-by: Xuneng Zhou <xunengzhou@gmail.com>
Discussion: https://postgr.es/m/CAN55FZ0h_YoSqqutxV6DES1RW8ig6wcA8CR9rJk358YRMxZFmw@mail.gmail.com M src/backend/storage/buffer/bufmgr.c
M src/include/storage/bufmgr.h
Allow indexscans on partial hash indexes with implied quals.
commit : 5528e8d1046062698b7db179e4280817eaeb5f30
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Thu, 27 Nov 2025 13:09:59 -0500
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Thu, 27 Nov 2025 13:09:59 -0500 Normally, if a WHERE clause is implied by the predicate of a partial
index, we drop that clause from the set of quals used with the index,
since it's redundant to test it if we're scanning that index.
However, if it's a hash index (or any !amoptionalkey index), this
could result in dropping all available quals for the index's first
key, preventing us from generating an indexscan.
It's fair to question the practical usefulness of this case. Since
hash only supports equality quals, the situation could only arise
if the index's predicate is "WHERE indexkey = constant", implying
that the index contains only one hash value, which would make hash
a really poor choice of index type. However, perhaps there are
other !amoptionalkey index AMs out there with which such cases are
more plausible.
To fix, just don't filter the candidate indexquals this way if
the index is !amoptionalkey. That's a bit hokey because it may
result in testing quals we didn't need to test, but to do it
more accurately we'd have to redundantly identify which candidate
quals are actually usable with the index, something we don't know
at this early stage of planning. Doesn't seem worth the effort.
Reported-by: Sergei Glukhov <s.glukhov@postgrespro.ru>
Author: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: David Rowley <dgrowleyml@gmail.com>
Discussion: https://postgr.es/m/e200bf38-6b45-446a-83fd-48617211feff@postgrespro.ru
Backpatch-through: 14 M src/backend/optimizer/path/indxpath.c
M src/test/regress/expected/hash_index.out
M src/test/regress/sql/hash_index.sql
doc: Fix misleading synopsis for CREATE/ALTER PUBLICATION.
commit : 246ec4a51c16f27133a293f63aa8bc86ca4fe630
author : Fujii Masao <fujii@postgresql.org>
date : Thu, 27 Nov 2025 23:29:57 +0900
committer: Fujii Masao <fujii@postgresql.org>
date : Thu, 27 Nov 2025 23:29:57 +0900 The documentation for CREATE/ALTER PUBLICATION previously showed:
[ ONLY ] table_name [ * ] [ ( column_name [, ... ] ) ] [ WHERE ( expression ) ] [, ... ]
to indicate that the table/column specification could be repeated.
However, placing [, ... ] directly after a multi-part construct was
misleading and made it unclear which portion was repeatable.
This commit introduces a new term, table_and_columns, to represent:
[ ONLY ] table_name [ * ] [ ( column_name [, ... ] ) ] [ WHERE ( expression ) ]
and updates the synopsis to use:
table_and_columns [, ... ]
which clearly identifies the repeatable element.
Backpatched to v15, where the misleading syntax was introduced.
Author: Peter Smith <smithpb2250@gmail.com>
Reviewed-by: Chao Li <lic@highgo.com>
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>
Discussion: https://postgr.es/m/CAHut+PtsyvYL3KmA6C8f0ZpXQ=7FEqQtETVy-BOF+cm9WPvfMQ@mail.gmail.com
Backpatch-through: 15 M doc/src/sgml/ref/alter_publication.sgml
M doc/src/sgml/ref/create_publication.sgml
Fix new test for CATCACHE_FORCE_RELEASE builds
commit : 9e8fa05d3412d6adea453a8ec24d9a794498f4cf
author : Álvaro Herrera <alvherre@kurilemu.de>
date : Thu, 27 Nov 2025 13:10:56 +0100
committer: Álvaro Herrera <alvherre@kurilemu.de>
date : Thu, 27 Nov 2025 13:10:56 +0100 Two of the isolation tests introduce by commit bc32a12e0db2 had a
problem under CATCACHE_FORCE_RELEASE, as evidenced by buildfarm member
prion. An injection point is hit ahead of what the test spec expects,
so a session goes to sleep and there's no one there to wait it up. Fix
in the simplest possible way, which is to conditionally wake the process
up if it's waiting. An alternative output file is necessary to cover
both cases.
This suggests a couple of possible improvements to the injection points
infrastructure: a conditional wakeup (doing nothing if no one is
sleeping, as opposed to throwing an error), as well as a way to attach
to a point in "deactivated" mode, activated later.
Author: Álvaro Herrera <alvherre@kurilemu.de>
Reviewed-by: Mihail Nikalayeu <mihailnikalayeu@gmail.com>
Discussion: https://postgr.es/m/202511261817.fyixgtt3hqdr@alvherre.pgsql M src/test/modules/injection_points/expected/index-concurrently-upsert-predicate.out
A src/test/modules/injection_points/expected/index-concurrently-upsert-predicate_1.out
M src/test/modules/injection_points/expected/index-concurrently-upsert.out
A src/test/modules/injection_points/expected/index-concurrently-upsert_1.out
M src/test/modules/injection_points/specs/index-concurrently-upsert-predicate.spec
M src/test/modules/injection_points/specs/index-concurrently-upsert.spec
doc: Fix typo in pg_dump documentation
commit : e396a18f32e1a174be2492a83e7a8bfce568e6ab
author : Daniel Gustafsson <dgustafsson@postgresql.org>
date : Thu, 27 Nov 2025 09:25:56 +0100
committer: Daniel Gustafsson <dgustafsson@postgresql.org>
date : Thu, 27 Nov 2025 09:25:56 +0100 Reported-by: Erik Rijkers <er@xs4all.nl>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://postgr.es/m/7596672c-43e8-a030-0850-2dd09af98cac@xs4all.nl M doc/src/sgml/ref/pg_dump.sgml
Use C11 alignas in pg_atomic_uint64 definitions
commit : e7075a3405cc831128a71e83b2e39d464aa67fe8
author : Peter Eisentraut <peter@eisentraut.org>
date : Thu, 27 Nov 2025 07:39:25 +0100
committer: Peter Eisentraut <peter@eisentraut.org>
date : Thu, 27 Nov 2025 07:39:25 +0100 They were already using pg_attribute_aligned. This replaces that with
alignas and moves that into the required syntactic position. This
ends up making these three atomics implementations appear a bit more
consistent, but shouldn't change anything otherwise.
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/46f05236-d4d4-4b4e-84d4-faa500f14691%40eisentraut.org M src/include/port/atomics/arch-ppc.h
M src/include/port/atomics/generic-gcc.h
M src/include/port/atomics/generic-msvc.h
Fix error reporting for SQL/JSON path type mismatches
commit : 519fa0433b37701b357753a568080bee2c47d238
author : Amit Langote <amitlan@postgresql.org>
date : Thu, 27 Nov 2025 10:43:29 +0900
committer: Amit Langote <amitlan@postgresql.org>
date : Thu, 27 Nov 2025 10:43:29 +0900 transformJsonFuncExpr() used exprType()/exprLocation() on the
possibly coerced path expression, which could be NULL when
coercion to jsonpath failed, leading to "cache lookup failed
for type 0" errors.
Preserve the original expression node so that type and location
in the "must be of type jsonpath" error are reported correctly.
Add regression tests to cover these cases.
Reported-by: Jian He <jian.universality@gmail.com>
Author: Jian He <jian.universality@gmail.com>
Reviewed-by: Kirill Reshke <reshkekirill@gmail.com>
Discussion: https://postgr.es/m/CACJufxHunVg81JMuNo8Yvv_hJD0DicgaVN2Wteu8aJbVJPBjZA@mail.gmail.com
Backpatch-through: 17 M src/backend/parser/parse_expr.c
M src/test/regress/expected/sqljson_queryfuncs.out
M src/test/regress/sql/sqljson_queryfuncs.sql
Add parallelism support for TID Range Scans
commit : 0ca3b16973a8bb1c185f56e65edcadc0d9d2c406
author : David Rowley <drowley@postgresql.org>
date : Thu, 27 Nov 2025 14:05:04 +1300
committer: David Rowley <drowley@postgresql.org>
date : Thu, 27 Nov 2025 14:05:04 +1300 In v14, bb437f995 added support for scanning for ranges of TIDs using a
dedicated executor node for the purpose. Here, we allow these scans to
be parallelized. The range of blocks to scan is divvied up similarly to
how a Parallel Seq Scans does that, where 'chunks' of blocks are
allocated to each worker and the size of those chunks is slowly reduced
down to 1 block per worker by the time we're nearing the end of the
scan. Doing that means workers finish at roughly the same time.
Allowing TID Range Scans to be parallelized removes the dilemma from the
planner as to whether a Parallel Seq Scan will cost less than a
non-parallel TID Range Scan due to the CPU concurrency of the Seq Scan
(disk costs are not divided by the number of workers). It was possible
the planner could choose the Parallel Seq Scan which would result in
reading additional blocks during execution than the TID Scan would have.
Allowing Parallel TID Range Scans removes the trade-off the planner
makes when choosing between reduced CPU costs due to parallelism vs
additional I/O from the Parallel Seq Scan due to it scanning blocks from
outside of the required TID range. There is also, of course, the
traditional parallelism performance benefits to be gained as well, which
likely doesn't need to be explained here.
Author: Cary Huang <cary.huang@highgo.ca>
Author: David Rowley <dgrowleyml@gmail.com>
Reviewed-by: Junwang Zhao <zhjwpku@gmail.com>
Reviewed-by: Rafia Sabih <rafia.pghackers@gmail.com>
Reviewed-by: Steven Niu <niushiji@gmail.com>
Discussion: https://postgr.es/m/18f2c002a24.11bc2ab825151706.3749144144619388582@highgo.ca M doc/src/sgml/parallel.sgml
M src/backend/access/heap/heapam.c
M src/backend/access/table/tableam.c
M src/backend/executor/execParallel.c
M src/backend/executor/nodeTidrangescan.c
M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/path/tidpath.c
M src/backend/optimizer/util/pathnode.c
M src/include/access/relscan.h
M src/include/access/tableam.h
M src/include/executor/nodeTidrangescan.h
M src/include/nodes/execnodes.h
M src/include/optimizer/pathnode.h
M src/test/regress/expected/tidrangescan.out
M src/test/regress/sql/tidrangescan.sql
Have the planner replace COUNT(ANY) with COUNT(*), when possible
commit : 42473b3b31238b15cc3c030b4416b2ee79508d8c
author : David Rowley <drowley@postgresql.org>
date : Thu, 27 Nov 2025 10:43:28 +1300
committer: David Rowley <drowley@postgresql.org>
date : Thu, 27 Nov 2025 10:43:28 +1300 This adds SupportRequestSimplifyAggref to allow pg_proc.prosupport
functions to receive an Aggref and allow them to determine if there is a
way that the Aggref call can be optimized.
Also added is a support function to allow transformation of COUNT(ANY)
into COUNT(*). This is possible to do when the given "ANY" cannot be
NULL and also that there are no ORDER BY / DISTINCT clauses within the
Aggref. This is a useful transformation to do as it is common that
people write COUNT(1), which until now has added unneeded overhead.
When counting a NOT NULL column. The overheads can be worse as that
might mean deforming more of the tuple, which for large fact tables may
be many columns in.
It may be possible to add prosupport functions for other aggregates. We
could consider if ORDER BY could be dropped for some calls, e.g. the
ORDER BY is quite useless in MAX(c ORDER BY c).
There is a little bit of passing fallout from adjusting
expr_is_nonnullable() to handle Const which results in a plan change in
the aggregates.out regression test. Previously, nothing was able to
determine that "One-Time Filter: (100 IS NOT NULL)" was always true,
therefore useless to include in the plan.
Author: David Rowley <dgrowleyml@gmail.com>
Reviewed-by: Corey Huinker <corey.huinker@gmail.com>
Reviewed-by: Matheus Alcantara <matheusssilv97@gmail.com>
Discussion: https://postgr.es/m/CAApHDvqGcPTagXpKfH=CrmHBqALpziThJEDs_MrPqjKVeDF9wA@mail.gmail.com M contrib/postgres_fdw/expected/postgres_fdw.out
M src/backend/optimizer/plan/initsplan.c
M src/backend/optimizer/util/clauses.c
M src/backend/utils/adt/int8.c
M src/include/nodes/supportnodes.h
M src/include/optimizer/optimizer.h
M src/test/regress/expected/aggregates.out
M src/test/regress/sql/aggregates.sql
M src/tools/pgindent/typedefs.list
Teach DSM registry to retry entry initialization if needed.
commit : dbdc717ac6743074c3a55fc5c380638c91d24afd
author : Nathan Bossart <nathan@postgresql.org>
date : Wed, 26 Nov 2025 15:12:25 -0600
committer: Nathan Bossart <nathan@postgresql.org>
date : Wed, 26 Nov 2025 15:12:25 -0600 If DSM registry entry initialization fails, backends could try to
use an uninitialized DSM segment, DSA, or dshash table (since the
entry is still added to the registry). To fix, restructure the
code so that the registry retries initialization as needed. This
commit also modifies pg_get_dsm_registry_allocations() to leave out
partially-initialized entries, as they shouldn't have any allocated
memory.
DSM registry entry initialization shouldn't fail often in practice,
but retrying was deemed better than leaving entries in a
permanently failed state (as was done by commit 1165a933aa, which
has since been reverted).
Suggested-by: Robert Haas <robertmhaas@gmail.com>
Reviewed-by: Robert Haas <robertmhaas@gmail.com>
Discussion: https://postgr.es/m/E1vJHUk-006I7r-37%40gemulon.postgresql.org
Backpatch-through: 17 M src/backend/storage/ipc/dsm_registry.c
Allow pg_locale_t APIs to work when ctype_is_c.
commit : 147602822597204aa436415ebe295926b268ab5c
author : Jeff Davis <jdavis@postgresql.org>
date : Wed, 26 Nov 2025 12:45:06 -0800
committer: Jeff Davis <jdavis@postgresql.org>
date : Wed, 26 Nov 2025 12:45:06 -0800 Previously, the caller needed to check ctype_is_c first for some
routines and not others. Now, the APIs consistently work, and the
caller can just check ctype_is_c for optimization purposes.
Discussion: https://postgr.es/m/450ceb6260cad30d7afdf155d991a9caafee7c0d.camel@j-davis.com
Reviewed-by: Chao Li <li.evan.chao@gmail.com> M src/backend/utils/adt/pg_locale.c
M src/backend/utils/adt/pg_locale_libc.c
Check for correct version of perltidy
commit : 1cdb84bb1bcd6de4abcb5b2137f57c6c7463f4ab
author : Daniel Gustafsson <dgustafsson@postgresql.org>
date : Wed, 26 Nov 2025 20:43:09 +0100
committer: Daniel Gustafsson <dgustafsson@postgresql.org>
date : Wed, 26 Nov 2025 20:43:09 +0100 pgperltidy requires a particular version of perltidy, but the version
wasn't checked like how pgindent checks the underlying indent binary.
Fix by checking the version of perltidy and error out if an incorrect
version is used.
Author: Daniel Gustafsson <daniel@yesql.se>
Reported-by: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>
Reviewed-by: Álvaro Herrera <alvherre@kurilemu.de>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Andrew Dunstan <andrew@dunslane.net>
Discussion: https://postgr.es/m/1209850.1764092152@sss.pgh.pa.us M src/tools/pgindent/pgperltidy
Add #define for UNICODE_CASEMAP_BUFSZ.
commit : 8d299052fe5858319fbd9be5f234026711bbc91b
author : Jeff Davis <jdavis@postgresql.org>
date : Wed, 26 Nov 2025 10:05:11 -0800
committer: Jeff Davis <jdavis@postgresql.org>
date : Wed, 26 Nov 2025 10:05:11 -0800 Useful for mapping a single codepoint at a time into a
statically-allocated buffer.
Discussion: https://postgr.es/m/450ceb6260cad30d7afdf155d991a9caafee7c0d.camel@j-davis.com
Reviewed-by: Chao Li <li.evan.chao@gmail.com> M src/include/utils/pg_locale.h
Inline pg_ascii_tolower() and pg_ascii_toupper().
commit : ec4997a9d733e91b614d0c2f3e6445cc2905fd16
author : Jeff Davis <jdavis@postgresql.org>
date : Wed, 26 Nov 2025 10:04:32 -0800
committer: Jeff Davis <jdavis@postgresql.org>
date : Wed, 26 Nov 2025 10:04:32 -0800 Discussion: https://postgr.es/m/450ceb6260cad30d7afdf155d991a9caafee7c0d.camel@j-davis.com
Reviewed-by: Chao Li <li.evan.chao@gmail.com> M src/include/port.h
M src/port/pgstrcasecmp.c
Revert "Teach DSM registry to ERROR if attaching to an uninitialized entry."
commit : 2dd506b859cfacf8afaae81256ddec8cca0c0d6f
author : Nathan Bossart <nathan@postgresql.org>
date : Wed, 26 Nov 2025 11:37:21 -0600
committer: Nathan Bossart <nathan@postgresql.org>
date : Wed, 26 Nov 2025 11:37:21 -0600 This reverts commit 1165a933aa (and the corresponding commits on
the back-branches). In a follow-up commit, we'll teach the
registry to retry entry initialization instead of leaving it in a
permanently failed state.
Reviewed-by: Robert Haas <robertmhaas@gmail.com>
Discussion: https://postgr.es/m/E1vJHUk-006I7r-37%40gemulon.postgresql.org
Backpatch-through: 17 M src/backend/storage/ipc/dsm_registry.c
Split heap_page_prune_and_freeze() into helpers
commit : e135e044572e88291343f45ce65b406ac963b0e7
author : Melanie Plageman <melanieplageman@gmail.com>
date : Wed, 26 Nov 2025 10:57:50 -0500
committer: Melanie Plageman <melanieplageman@gmail.com>
date : Wed, 26 Nov 2025 10:57:50 -0500 Refactor the setup and planning phases of pruning and freezing into
helpers. This streamlines heap_page_prune_and_freeze() and makes it more
clear when the examination of tuples ends and page modifications begin.
No code change beyond what was required to extract the code into helper
functions.
Author: Melanie Plageman <melanieplageman@gmail.com>
Reviewed-by: Andres Freund <andres@anarazel.de>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://postgr.es/m/mhf4vkmh3j57zx7vuxp4jagtdzwhu3573pgfpmnjwqa6i6yj5y%40sy4ymcdtdklo M src/backend/access/heap/pruneheap.c
Remove a few unused struct members.
commit : 9446f918ace9c407805ba7d0a73e8370070b12f9
author : Nathan Bossart <nathan@postgresql.org>
date : Wed, 26 Nov 2025 09:50:00 -0600
committer: Nathan Bossart <nathan@postgresql.org>
date : Wed, 26 Nov 2025 09:50:00 -0600 Oversights in commits ab9e0e718a, f3049a603a, and 247ce06b88.
Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Discussion: https://postgr.es/m/aScUuBSawPWogUxs%40ip-10-97-1-34.eu-west-3.compute.internal M src/backend/libpq/auth-scram.c
M src/backend/storage/aio/method_worker.c
M src/backend/utils/sort/sharedtuplestore.c
ssl: Add connection and reload tests for key passphrases
commit : 348020caa7beaa2e4b1bc10b1ea6eb2c97b894c0
author : Daniel Gustafsson <dgustafsson@postgresql.org>
date : Wed, 26 Nov 2025 14:24:34 +0100
committer: Daniel Gustafsson <dgustafsson@postgresql.org>
date : Wed, 26 Nov 2025 14:24:34 +0100 ssl_passphrase_command_supports_reload was not covered by the SSL
testsuite, and connection tests after unlocking secrets with the
passphrase was also missing. This adds test coverage for reloads
of passphrase commands as well as connection attempts which tests
the different codepaths for Windows and non-EXEC_BACKEND builds.
Author: Daniel Gustafsson <daniel@yesql.se>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Álvaro Herrera <alvherre@kurilemu.de>
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Discussion: https://postgr.es/m/5F301096-921A-427D-8EC1-EBAEC2A35082@yesql.se M src/test/ssl/t/001_ssltests.pl
M src/test/ssl/t/SSL/Server.pm
Add GUC to show EXEC_BACKEND state
commit : b3fe098d330ff6a7c23019d66a600072b1d4664d
author : Daniel Gustafsson <dgustafsson@postgresql.org>
date : Wed, 26 Nov 2025 14:24:27 +0100
committer: Daniel Gustafsson <dgustafsson@postgresql.org>
date : Wed, 26 Nov 2025 14:24:27 +0100 There is no straightforward way to determine if a cluster is running
in EXEC_BACKEND mode or not, which is useful for tests to know. This
adds a GUC debug_exec_backend similar to debug_assertions which will
be true when the server is running in EXEC_BACKEND mode.
Author: Daniel Gustafsson <daniel@yesql.se>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Álvaro Herrera <alvherre@kurilemu.de>
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Discussion: https://postgr.es/m/5F301096-921A-427D-8EC1-EBAEC2A35082@yesql.se M doc/src/sgml/config.sgml
M src/backend/utils/misc/guc_parameters.dat
M src/backend/utils/misc/guc_tables.c
doc: Clarify passphrase command reloading on Windows
commit : 0f4f45772c5a87ca2f228ee3bea36d313dca0b51
author : Daniel Gustafsson <dgustafsson@postgresql.org>
date : Wed, 26 Nov 2025 14:24:04 +0100
committer: Daniel Gustafsson <dgustafsson@postgresql.org>
date : Wed, 26 Nov 2025 14:24:04 +0100 When running on Windows (or EXEC_BACKEND) the SSL configuration will
be reloaded on each backend start, so the passphrase command will be
reloaded along with it. This implies that passphrase command reload
must be enabled on Windows for connections to work at all. Document
this since it wasn't mentioned explicitly, and will there add markup
for parameter value to match the rest of the docs.
Backpatch to all supported versions.
Author: Daniel Gustafsson <daniel@yesql.se>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Álvaro Herrera <alvherre@kurilemu.de>
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Discussion: https://postgr.es/m/5F301096-921A-427D-8EC1-EBAEC2A35082@yesql.se
Backpatch-through: 14 M doc/src/sgml/config.sgml
Replace internal C function pg_hypot() by standard hypot()
commit : 8fe4aef8297b9f6b27a8f9422f3fdef1f79bb189
author : Peter Eisentraut <peter@eisentraut.org>
date : Wed, 26 Nov 2025 07:46:33 +0100
committer: Peter Eisentraut <peter@eisentraut.org>
date : Wed, 26 Nov 2025 07:46:33 +0100 The code comment said, "It is expected that this routine will
eventually be replaced with the C99 hypot() function.", so let's do
that now.
This function is tested via the geometry regression test, so if it is
faulty on any platform, it will show up there.
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://www.postgresql.org/message-id/flat/170308e6-a7a3-4484-87b2-f960bb564afa%40eisentraut.org M src/backend/access/spgist/spgproc.c
M src/backend/utils/adt/geo_ops.c
M src/backend/utils/adt/geo_spgist.c
M src/include/utils/geo_decls.h
oauth_validator: Shorten JSON responses in test logs
commit : 47c7a7ebc89eb6b8cf81c937885864f994784d38
author : Jacob Champion <jchampion@postgresql.org>
date : Tue, 25 Nov 2025 20:32:52 -0800
committer: Jacob Champion <jchampion@postgresql.org>
date : Tue, 25 Nov 2025 20:32:52 -0800 Response padding from the oauth_validator abuse tests was adding a
couple megabytes to the test logs. We don't need the buildfarm to hold
onto that, and we don't need to read it when debugging; truncate it.
Reported-by: Álvaro Herrera <alvherre@kurilemu.de>
Discussion: https://postgr.es/m/202511251218.zfs4nu2qnh2m%40alvherre.pgsql
Backpatch-through: 18 M src/test/modules/oauth_validator/t/oauth_server.py
Fix test failure caused by commit 76b78721ca.
commit : e3e787ca023449127ac370e13a3887fe03eed0f4
author : Amit Kapila <akapila@postgresql.org>
date : Wed, 26 Nov 2025 03:26:57 +0000
committer: Amit Kapila <akapila@postgresql.org>
date : Wed, 26 Nov 2025 03:26:57 +0000 The test failed because it assumed that a newly created logical
replication slot could be synced to the standby by the slotsync worker.
However, the presence of an existing physical slot caused the new logical
slot to use a non-latest xmin. On the standby, the DDL had already been
replayed, advancing xmin, which led to the slotsync worker failing to sync
the lagging logical slot.
To resolve this, we moved the slot sync statistics tests to run after the
tests that do not require the newly created slot to be sync-ready.
As per buildfarm.
Author: Hou Zhijie <houzj.fnst@fujitsu.com>
Reviewed-by: Hayato Kuroda <kuroda.hayato@fujitsu.com>
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>
Discussion: https://postgr.es/m/OSCPR01MB14966FE0BFB6C212298BFFEDEF5D1A@OSCPR01MB14966.jpnprd01.prod.outlook.com M src/test/recovery/t/040_standby_failover_slots_sync.pl
Add input function for data type pg_dependencies
commit : e1405aa5e3acd55a77838b0b7944198735ffccdf
author : Michael Paquier <michael@paquier.xyz>
date : Wed, 26 Nov 2025 10:53:16 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Wed, 26 Nov 2025 10:53:16 +0900 pg_dependencies is used as data type for the contents of dependencies
extended statistics. This new input function consumes the format that
has been established by e76defbcf09e for the output function of
pg_dependencies, enforcing some sanity checks for:
- Checks for the input object, which should be a one-dimension array
with correct attributes and values.
- The key names: "attributes", "dependency", "degree". All are
required, other key names are blocked.
- Value types for each key: "attributes" requires an array of integers,
"dependency" an attribute number, "degree" a float.
- List of attributes. In this case, it is possible that some
dependencies are not listed in the statistics data, as items with a
degree of 0 are discarded when building the statistics. This commit
includes checks for simple scenarios, like duplicated attributes, or
overlapping values between the list of "attributes" and the "dependency"
value. Even if the input function considers the input as valid, a value
still needs to be cross-checked with the attributes defined in a
statistics object at import.
- Based on the discussion, the checks on the values are loose, as there
is also an argument for potentially stats injection. For example,
"degree" should be defined in [0.0,1.0], but a check is not enforced.
This is required for a follow-up patch that aims to implement the import
of extended statistics. Some tests are added to check the code paths of
the JSON parser checking the shape of the pg_dependencies inputs, with
91% of code coverage reached. The tests are located in their own new
test file, for clarity.
Author: Corey Huinker <corey.huinker@gmail.com>
Reviewed-by: Jian He <jian.universality@gmail.com>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Reviewed-by: Yuefei Shi <shiyuefei1004@gmail.com>
Discussion: https://postgr.es/m/CADkLM=dpz3KFnqP-dgJ-zvRvtjsa8UZv8wDAQdqho=qN3kX0Zg@mail.gmail.com M src/backend/utils/adt/pg_dependencies.c
A src/test/regress/expected/pg_dependencies.out
M src/test/regress/parallel_schedule
A src/test/regress/sql/pg_dependencies.sql
M src/tools/pgindent/typedefs.list
Add input function for data type pg_ndistinct
commit : 44eba8f06e5568be35fa3d112ab781e931fe04ae
author : Michael Paquier <michael@paquier.xyz>
date : Wed, 26 Nov 2025 10:13:18 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Wed, 26 Nov 2025 10:13:18 +0900 pg_ndistinct is used as data type for the contents of ndistinct extended
statistics. This new input function consumes the format that has been
established by 1f927cce4498 for the output function of pg_ndistinct,
enforcing some sanity checks for:
- Checks for the input object, which should be a one-dimension array
with correct attributes and values.
- The key names: "attributes", "ndistinct". Both are required, other
key names are blocked.
- Value types for each key: "attributes" requires an array of integers,
and "ndistinct" an integer.
- List of attributes. Note that this enforces a check so as an
attribute list has to be a subset of the longest attribute list found.
This does not enforce that a full group of attribute sets exist, based
on how the groups are generated when the ndistinct objects are
generated, making the list of ndistinct items a bit loose. Note a check
would still be required at import to see if the attributes listed match
with the attribute numbers set in the definition of a statistics object.
- Based on the discussion, the checks on the values are loose, as there
is also an argument for potentially stats injection. The relation and
attribute level stats follow the same line of argument for the values.
This is required for a follow-up patch that aims to implement the import
of extended statistics. Some tests are added to check the code paths of
the JSON parser checking the shape of the pg_ndistinct inputs, with 90%
of code coverage reached. The tests are located in their own new test
file, for clarity.
Author: Corey Huinker <corey.huinker@gmail.com>
Reviewed-by: Jian He <jian.universality@gmail.com>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Reviewed-by: Yuefei Shi <shiyuefei1004@gmail.com>
Discussion: https://postgr.es/m/CADkLM=dpz3KFnqP-dgJ-zvRvtjsa8UZv8wDAQdqho=qN3kX0Zg@mail.gmail.com M src/backend/utils/adt/pg_ndistinct.c
A src/test/regress/expected/pg_ndistinct.out
M src/test/regress/parallel_schedule
A src/test/regress/sql/pg_ndistinct.sql
M src/tools/pgindent/typedefs.list
Assert that cutoffs are provided if freezing will be attempted
commit : cd38b7e77315c729ea1e52ca7b8bb0d7c20d2a3b
author : Melanie Plageman <melanieplageman@gmail.com>
date : Tue, 25 Nov 2025 16:39:56 -0500
committer: Melanie Plageman <melanieplageman@gmail.com>
date : Tue, 25 Nov 2025 16:39:56 -0500 heap_page_prune_and_freeze() requires the caller to initialize
PruneFreezeParams->cutoffs so that the function can correctly evaluate
whether tuples should be frozen. This requirement previously existed
only in comments and was easy to miss, especially after “cutoffs” was
converted from a direct function parameter to a field of the newly
introduced PruneFreezeParams struct (added in 1937ed70621). Adding an
assert makes this requirement explicit and harder to violate.
Also, fix a minor typo while we're at it.
Author: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Melanie Plageman <melanieplageman@gmail.com>
Discussion: https://postgr.es/m/0AC177F5-5E26-45EE-B273-357C51212AC5%40gmail.com M src/backend/access/heap/pruneheap.c
Remove a useless length check.
commit : 3b9c118920580b97d0f6f618954876227a50a14a
author : Jeff Davis <jdavis@postgresql.org>
date : Tue, 25 Nov 2025 11:38:45 -0800
committer: Jeff Davis <jdavis@postgresql.org>
date : Tue, 25 Nov 2025 11:38:45 -0800 Author: Chao Li <lic@highgo.com>
Discussion: https://postgr.es/m/CAEoWx2mW0P8CByavV58zm3=eb2MQHaKOcDEF5B2UJYRyC2c3ig@mail.gmail.com M src/backend/utils/adt/pg_locale_libc.c
pg_dump tests: don't put dumps in stdout
commit : 33bb3dc2d855c0d4472372f0eb7877725af67a39
author : Álvaro Herrera <alvherre@kurilemu.de>
date : Tue, 25 Nov 2025 19:08:36 +0100
committer: Álvaro Herrera <alvherre@kurilemu.de>
date : Tue, 25 Nov 2025 19:08:36 +0100 This bloats the regression log files for no reason.
Backpatch to 18; no further only because it fails to apply cleanly.
(It's just whitespace change that conflicts, but I don't think this
warrants more effort than this.)
Discussion: https://postgr.es/m/202511251218.zfs4nu2qnh2m@alvherre.pgsql M src/bin/pg_dump/t/002_pg_dump.pl
Improve test case stability
commit : 417ac9c1eeebc5dd8186a9089055b8af43b2450e
author : Álvaro Herrera <alvherre@kurilemu.de>
date : Tue, 25 Nov 2025 18:20:06 +0100
committer: Álvaro Herrera <alvherre@kurilemu.de>
date : Tue, 25 Nov 2025 18:20:06 +0100 Given unlucky timing, some of the new tests added by commit bc32a12e0db2
can fail spuriously. We haven't seen such failures yet in buildfarm,
but allegedly we can prevent them with this tweak.
While at it, remove an unused injection point I (Álvaro) added.
Author: Mihail Nikalayeu <mihailnikalayeu@gmail.com>
Discussion: https://postgr.es/m/CADzfLwUc=jtSUEaQCtyt8zTeOJ-gHZ8=w_KJsVjDOYSLqaY9Lg@mail.gmail.com
Discussion: https://postgr.es/m/CADzfLwV5oQq-Vg_VmG_o4SdL6yHjDoNO4T4pMtgJLzYGmYf74g@mail.gmail.com M src/backend/executor/execIndexing.c
M src/backend/utils/time/snapmgr.c
M src/test/modules/injection_points/expected/index-concurrently-upsert-predicate.out
M src/test/modules/injection_points/expected/index-concurrently-upsert.out
M src/test/modules/injection_points/specs/index-concurrently-upsert-predicate.spec
M src/test/modules/injection_points/specs/index-concurrently-upsert.spec
gen_guc_tables.pl: Validate required GUC fields before code generation
commit : 7169c0b96bb8929c939c8e96a52b42571085efe9
author : Peter Eisentraut <peter@eisentraut.org>
date : Tue, 25 Nov 2025 16:50:34 +0100
committer: Peter Eisentraut <peter@eisentraut.org>
date : Tue, 25 Nov 2025 16:50:34 +0100 Previously, gen_guc_tables.pl would emit "Use of uninitialized value"
warnings if required fields were missing in guc_parameters.dat (for
example, when an integer or real GUC omitted the 'max' value). The
resulting error messages were unclear and did not identify which GUC
entry was problematic.
Add explicit validation of required fields depending on the parameter
type, and fail with a clear and specific message such as:
guc_parameters.dat:1909: error: entry "max_index_keys" of type "int" is missing required field "max"
No changes to generated guc_tables.c.
Author: Chao Li <lic@highgo.com>
Reviewed-by: Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Discussion: https://www.postgresql.org/message-id/flat/CAEoWx2%3DoP4LgHi771_OKhPPUS7B-CTqCs%3D%3DuQcNXWrwBoAm5Vg%40mail.gmail.com M src/backend/utils/misc/gen_guc_tables.pl
backend/nodes cleanup: Move loop variables definitions into for statement
commit : 2256af4ba223e114d08208fd17a27cbce30cda9e
author : Peter Eisentraut <peter@eisentraut.org>
date : Tue, 25 Nov 2025 15:38:23 +0100
committer: Peter Eisentraut <peter@eisentraut.org>
date : Tue, 25 Nov 2025 15:38:23 +0100 Author: Chao Li (Evan) <lic@highgo.com>
Discussion: https://www.postgresql.org/message-id/flat/CAEoWx2nP12qwAaiJutbn1Kw50atN6FbMJNQ4bh4%2BfP_Ay_u7Eg%40mail.gmail.com M src/backend/nodes/bitmapset.c
M src/backend/nodes/nodeFuncs.c
M src/backend/nodes/outfuncs.c
M src/backend/nodes/params.c
M src/backend/nodes/readfuncs.c
M src/backend/nodes/tidbitmap.c
Fix a BF failure caused by commit 76b78721ca.
commit : 3df4df53b06df2a2af56a77bf44cffa6393534fe
author : Amit Kapila <akapila@postgresql.org>
date : Tue, 25 Nov 2025 08:49:46 +0000
committer: Amit Kapila <akapila@postgresql.org>
date : Tue, 25 Nov 2025 08:49:46 +0000 The issue occurred because the replication slot was not released in the
slotsync worker when a slot synchronization cycle was skipped. This skip
happened because the required WAL was not received and flushed on the
standby server. As a result, in the next cycle, when attempting to acquire
the slot, an assertion failure was triggered.
Author: Hou Zhijie <houzj.fnst@fujitsu.com>
Discussion: https://postgr.es/m/CAA4eK1KMwYUYy=oAVHu9mam+vX50ixxfhO4_C=kgQC8VCQHEfw@mail.gmail.com M src/backend/replication/logical/slotsync.c
Add slotsync skip statistics.
commit : 76b78721ca49c16dfcbfbd2f4f87fcdb2db2bbb6
author : Amit Kapila <akapila@postgresql.org>
date : Tue, 25 Nov 2025 06:47:49 +0000
committer: Amit Kapila <akapila@postgresql.org>
date : Tue, 25 Nov 2025 06:47:49 +0000 This patch adds two new columns to the pg_stat_replication_slots view:
slotsync_skip_count - the total number of times a slotsync operation was
skipped.
slotsync_skip_at - the timestamp of the most recent skip.
These additions provide better visibility into replication slot
synchronization behavior.
A future patch will introduce the slotsync_skip_reason column in
pg_replication_slots to capture the reason for skip.
Author: Shlok Kyal <shlok.kyal.oss@gmail.com>
Reviewed-by: shveta malik <shveta.malik@gmail.com>
Reviewed-by: Hayato Kuroda <kuroda.hayato@fujitsu.com>
Reviewed-by: Ashutosh Sharma <ashu.coek88@gmail.com>
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>
Discussion: https://postgr.es/m/CAE9k0PkhfKrTEAsGz4DjOhEj1nQ+hbQVfvWUxNacD38ibW3a1g@mail.gmail.com M contrib/test_decoding/expected/stats.out
M doc/src/sgml/monitoring.sgml
M src/backend/catalog/system_views.sql
M src/backend/replication/logical/slotsync.c
M src/backend/utils/activity/pgstat_replslot.c
M src/backend/utils/adt/pgstatfuncs.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/include/pgstat.h
M src/test/recovery/t/040_standby_failover_slots_sync.pl
M src/test/regress/expected/rules.out
Remove obsolete comment
commit : c581c9a7ac2af2c75567013f25125bd294d49ff2
author : Peter Eisentraut <peter@eisentraut.org>
date : Tue, 25 Nov 2025 06:26:49 +0100
committer: Peter Eisentraut <peter@eisentraut.org>
date : Tue, 25 Nov 2025 06:26:49 +0100 This comment should probably have been moved to pg_locale_libc.c in
commit 66ac94cdc79 (2024), but upon closer examination it was already
completely obsolete then.
The first part of the comment has been obsolete since commit
85feb77aa09 (2017), which required that the system provides the
required wide-character functions.
The second part has been obsolete since commit e9931bfb751 (2024),
which eliminated code paths depending on the global LC_CTYPE setting.
Discussion: https://www.postgresql.org/message-id/flat/170308e6-a7a3-4484-87b2-f960bb564afa%40eisentraut.org M src/backend/utils/adt/formatting.c
Rename routines for write/read of pgstats file
commit : ed823da12891232a6542168a0a1b7d2d1c5f3e9a
author : Michael Paquier <michael@paquier.xyz>
date : Tue, 25 Nov 2025 10:55:40 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Tue, 25 Nov 2025 10:55:40 +0900 This commit renames write_chunk and read_chunk to respectively
pgstat_write_chunk() and pgstat_read_chunk(), along with the *_s
convenience macros.
These are made available for plug-ins, so as any code that decides to
write and/or read stats data can rely on a single code path for this
work.
Extracted from a larger patch by the same author.
Author: Sami Imseih <samimseih@gmail.com>
Discussion: https://postgr.es/m/CAA5RZ0s9SDOu+Z6veoJCHWk+kDeTktAtC-KY9fQ9Z6BJdDUirQ@mail.gmail.com M src/backend/utils/activity/pgstat.c
M src/include/utils/pgstat_internal.h
lwlock: Fix, currently harmless, bug in LWLockWakeup()
commit : 81f773895321ac69d3d71fe9d203e09d072f9c36
author : Andres Freund <andres@anarazel.de>
date : Mon, 24 Nov 2025 17:37:09 -0500
committer: Andres Freund <andres@anarazel.de>
date : Mon, 24 Nov 2025 17:37:09 -0500 Accidentally the code in LWLockWakeup() checked the list of to-be-woken up
processes to see if LW_FLAG_HAS_WAITERS should be unset. That means that
HAS_WAITERS would not get unset immediately, but only during the next,
unnecessary, call to LWLockWakeup().
Luckily, as the code stands, this is just a small efficiency issue.
However, if there were (as in a patch of mine) a case in which LWLockWakeup()
would not find any backend to wake, despite the wait list not being empty,
we'd wrongly unset LW_FLAG_HAS_WAITERS, leading to potentially hanging.
While the consequences in the backbranches are limited, the code as-is
confusing, and it is possible that there are workloads where the additional
wait list lock acquisitions hurt, therefore backpatch.
Discussion: https://postgr.es/m/fvfmkr5kk4nyex56ejgxj3uzi63isfxovp2biecb4bspbjrze7@az2pljabhnff
Backpatch-through: 14 M src/backend/storage/lmgr/lwlock.c
Avoid global LC_CTYPE dependency in pg_locale_libc.c.
commit : f81bf78ce12b9fd3e50eb00dd875440007262ec4
author : Jeff Davis <jdavis@postgresql.org>
date : Mon, 24 Nov 2025 14:55:09 -0800
committer: Jeff Davis <jdavis@postgresql.org>
date : Mon, 24 Nov 2025 14:55:09 -0800 Call tolower_l() directly instead of through pg_tolower(), because the
latter depends on the global LC_CTYPE.
Discussion: https://postgr.es/m/8186b28a1a39e61a0d833a4c25a8909ebbbabd48.camel@j-davis.com M src/backend/utils/adt/pg_locale_libc.c
Improve detection of implicitly-temporary views.
commit : 698fa924b11a4ff55ac83b340dbae1e6cee00e59
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Mon, 24 Nov 2025 17:00:16 -0500
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Mon, 24 Nov 2025 17:00:16 -0500 We've long had a practice of making views temporary by default if they
reference any temporary tables. However the implementation was pretty
incomplete, in that it only searched for RangeTblEntry references to
temp relations. Uses of temporary types, regclass constants, etc
were not detected even though the dependency mechanism considers them
grounds for dropping the view. Thus a view not believed to be temp
could silently go away at session exit anyhow.
To improve matters, replace the ad-hoc isQueryUsingTempRelation()
logic with use of the dependency-based infrastructure introduced by
commit 572c40ba9. This is complete by definition, and it's less code
overall.
While we're at it, we can also extend the warning NOTICE (or ERROR
in the case of a materialized view) to mention one of the temp
objects motivating the classification of the view as temp, as was
done for functions in 572c40ba9.
Author: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Jim Jones <jim.jones@uni-muenster.de>
Discussion: https://postgr.es/m/19cf6ae1-04cd-422c-a760-d7e75fe6cba9@uni-muenster.de M src/backend/catalog/dependency.c
M src/backend/commands/view.c
M src/backend/parser/analyze.c
M src/backend/parser/parse_relation.c
M src/include/catalog/dependency.h
M src/include/parser/parse_relation.h
M src/test/regress/expected/create_view.out
M src/test/regress/expected/groupingsets.out
M src/test/regress/expected/matview.out
M src/test/regress/expected/window.out
M src/test/regress/sql/create_view.sql
M src/test/regress/sql/matview.sql
Reorganize pqcomm.h a bit
commit : 0664aa4ff89a640e5c0362cdcfc6cfc3eb63a659
author : Jacob Champion <jchampion@postgresql.org>
date : Mon, 24 Nov 2025 10:01:30 -0800
committer: Jacob Champion <jchampion@postgresql.org>
date : Mon, 24 Nov 2025 10:01:30 -0800 Group the PG_PROTOCOL() codes, add a comment to AuthRequest now that the
AUTH_REQ codes live in a different header, and make some small
adjustments to spacing and comment style for the sake of scannability.
Reviewed-by: Jelte Fennema-Nio <postgres@jeltef.nl>
Reviewed-by: Heikki Linnakangas <hlinnaka@iki.fi>
Discussion: https://postgr.es/m/CAOYmi%2B%3D6zg4oXXOQtifrVao_YKiujTDa3u6bxnU08r0FsSig4g%40mail.gmail.com M src/include/libpq/pqcomm.h
postgres: Use pg_{add,mul}_size_overflow()
commit : e2ceff13d83a85c634dc358b8291c7ae301e95e1
author : Jacob Champion <jchampion@postgresql.org>
date : Mon, 24 Nov 2025 09:59:54 -0800
committer: Jacob Champion <jchampion@postgresql.org>
date : Mon, 24 Nov 2025 09:59:54 -0800 The backend implementations of add_size() and mul_size() can now make
use of the APIs provided in common/int.h.
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://postgr.es/m/CAOYmi%2B%3D%2BpqUd2MUitvgW1pAJuXgG_TKCVc3_Ek7pe8z9nkf%2BAg%40mail.gmail.com M src/backend/storage/ipc/shmem.c
Add pg_add_size_overflow() and friends
commit : 8934f2136cd82333fd148954a13a8ab01f7bd7ef
author : Jacob Champion <jchampion@postgresql.org>
date : Mon, 24 Nov 2025 09:59:38 -0800
committer: Jacob Champion <jchampion@postgresql.org>
date : Mon, 24 Nov 2025 09:59:38 -0800 Commit 600086f47 added (several bespoke copies of) size_t addition with
overflow checks to libpq. Move this to common/int.h, along with
its subtraction and multiplication counterparts.
pg_neg_size_overflow() is intentionally omitted; I'm not sure we should
add SSIZE_MAX to win32_port.h for the sake of a function with no
callers.
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://postgr.es/m/CAOYmi%2B%3D%2BpqUd2MUitvgW1pAJuXgG_TKCVc3_Ek7pe8z9nkf%2BAg%40mail.gmail.com M src/include/common/int.h
M src/interfaces/libpq/fe-exec.c
M src/interfaces/libpq/fe-print.c
M src/interfaces/libpq/fe-protocol3.c
Make some use of anonymous unions [libpq-oauth]
commit : f1881c7dd32cf5f429f6bd525b5cbacef3bb9c99
author : Jacob Champion <jchampion@postgresql.org>
date : Mon, 24 Nov 2025 09:55:16 -0800
committer: Jacob Champion <jchampion@postgresql.org>
date : Mon, 24 Nov 2025 09:55:16 -0800 Make some use of anonymous unions, which are allowed as of C11, as
examples and encouragement for future code, and to test compilers.
This commit changes the json_field struct.
Reviewed-by: Nathan Bossart <nathandbossart@gmail.com>
Discussion: https://postgr.es/m/CAOYmi%2BnV25oC5uXFgWodydGrHkfWMDCLUcjbAreM3mNX%3DF2JWw%40mail.gmail.com M src/interfaces/libpq-oauth/oauth-curl.c
Fix infer_arbiter_index during concurrent index operations
commit : bc32a12e0db2df203a9cb2315461578e08568b9c
author : Álvaro Herrera <alvherre@kurilemu.de>
date : Mon, 24 Nov 2025 17:03:10 +0100
committer: Álvaro Herrera <alvherre@kurilemu.de>
date : Mon, 24 Nov 2025 17:03:10 +0100 Previously, we would only consider indexes marked indisvalid as usable
for INSERT ON CONFLICT. But that's problematic during CREATE INDEX
CONCURRENTLY and REINDEX CONCURRENTLY, because concurrent transactions
would end up with inconsistents lists of inferred indexes, leading to
deadlocks and spurious errors about unique key violations (because two
transactions are operating on different indexes for the speculative
insertion tokens). Change this function to return indexes even if
invalid. This fixes the spurious errors and deadlocks.
Because such indexes might not be complete, we still need uniqueness to
be verified in a different way. We do that by requiring that at least
one index marked valid is part of the set of indexes returned. It is
that index that is going to help ensure that the inserted tuple is
indeed unique.
This does not fix similar problems occurring with partitioned tables or
with named constraints. These problems will be fixed in follow-up
commits.
We have no user report of this problem, even though it exists in all
branches. Because of that and given that the fix is somewhat tricky, I
decided not to backpatch for now.
Author: Mihail Nikalayeu <mihailnikalayeu@gmail.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Reviewed-by: Álvaro Herrera <alvherre@kurilemu.de>
Discussion: https://postgr.es/m/CANtu0ogv+6wqRzPK241jik4U95s1pW3MCZ3rX5ZqbFdUysz7Qw@mail.gmail.com M src/backend/commands/indexcmds.c
M src/backend/executor/execIndexing.c
M src/backend/executor/execPartition.c
M src/backend/executor/nodeModifyTable.c
M src/backend/optimizer/util/plancat.c
M src/backend/utils/time/snapmgr.c
M src/test/modules/injection_points/Makefile
A src/test/modules/injection_points/expected/index-concurrently-upsert-predicate.out
A src/test/modules/injection_points/expected/index-concurrently-upsert.out
A src/test/modules/injection_points/expected/reindex-concurrently-upsert.out
M src/test/modules/injection_points/meson.build
A src/test/modules/injection_points/specs/index-concurrently-upsert-predicate.spec
A src/test/modules/injection_points/specs/index-concurrently-upsert.spec
A src/test/modules/injection_points/specs/reindex-concurrently-upsert.spec
Move isolation test index-killtuples to src/test/modules/index/
commit : e429c3cecb4ac55d997acea0f76c5f06d6cb0ab3
author : Michael Paquier <michael@paquier.xyz>
date : Mon, 24 Nov 2025 19:33:51 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Mon, 24 Nov 2025 19:33:51 +0900 index-killtuples test depends on the contrib modules btree_gin and
btree_gist, which would not be installed in a temporary installation
with an execution of the main isolation test suite like this one:
make -C src/test/isolation/ check
src/test/isolation/ should not depend on contrib/, and EXTRA_INSTALL has
no effect in this case as this test suite uses its own Makefile rules.
This commit moves index-killtuples into its new module, called "index",
whose name looks like the best fit there can be as it depends on more
than one index AM. btree_gin and btree_gist are now pulled in the
temporary installation with EXTRA_INSTALL. The test is renamed to
"killtuples", for simplicity.
Author: Nazir Bilal Yavuz <byavuz81@gmail.com>
Suggested-by: Andres Freund <andres@anarazel.de>
Suggested-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://postgr.es/m/aKJsWedftW7UX1WM@paquier.xyz M src/test/isolation/isolation_schedule
M src/test/modules/Makefile
A src/test/modules/index/.gitignore
A src/test/modules/index/Makefile
R100 src/test/isolation/expected/index-killtuples.out src/test/modules/index/expected/killtuples.out
A src/test/modules/index/meson.build
R100 src/test/isolation/specs/index-killtuples.spec src/test/modules/index/specs/killtuples.spec
M src/test/modules/meson.build
C11 alignas instead of unions -- extended alignments
commit : d4c0f91f7d57066b9d62c0eccb2a913d40c14066
author : Peter Eisentraut <peter@eisentraut.org>
date : Mon, 24 Nov 2025 07:36:49 +0100
committer: Peter Eisentraut <peter@eisentraut.org>
date : Mon, 24 Nov 2025 07:36:49 +0100 This replaces some uses of pg_attribute_aligned() with the standard
alignas() for cases where extended alignment (larger than max_align_t)
is required.
This patch stipulates that all supported compilers must support
alignments up to PG_IO_ALIGN_SIZE, but that seems pretty likely.
We can then also desupport the case where direct I/O is disabled
because pg_attribute_aligned is not supported.
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/46f05236-d4d4-4b4e-84d4-faa500f14691%40eisentraut.org M src/include/c.h
M src/include/storage/fd.h
pg_buffercache: Add pg_buffercache_os_pages
commit : 4b203d499c610160e9867e6add2366780429344c
author : Michael Paquier <michael@paquier.xyz>
date : Mon, 24 Nov 2025 14:29:15 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Mon, 24 Nov 2025 14:29:15 +0900 ba2a3c2302f has added a way to check if a buffer is spread across
multiple pages with some NUMA information, via a new view
pg_buffercache_numa that depends on pg_buffercache_numa_pages(), a SQL
function. These can only be queried when support for libnuma exists,
generating an error if not.
However, it can be useful to know how shared buffers and OS pages map
when NUMA is not supported or not available. This commit expands the
capabilities around pg_buffercache_numa:
- pg_buffercache_numa_pages() is refactored as an internal function,
able to optionally process NUMA. Its SQL definition prior to this
commit is still around to ensure backward-compatibility with v1.6.
- A SQL function called pg_buffercache_os_pages() is added, able to work
with or without NUMA.
- The view pg_buffercache_numa is redefined to use
pg_buffercache_os_pages().
- A new view is added, called pg_buffercache_os_pages. This ignores
NUMA for its result processing, for a better efficiency.
The implementation is done so as there is no code duplication between
the NUMA and non-NUMA views/functions, relying on one internal function
that does the job for all of them. The module is bumped to v1.7.
Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Reviewed-by: Mircea Cadariu <cadariu.mircea@gmail.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://postgr.es/m/Z/fFA2heH6lpSLlt@ip-10-97-1-34.eu-west-3.compute.internal M contrib/pg_buffercache/Makefile
M contrib/pg_buffercache/expected/pg_buffercache.out
M contrib/pg_buffercache/meson.build
A contrib/pg_buffercache/pg_buffercache–1.6–1.7.sql
M contrib/pg_buffercache/pg_buffercache.control
M contrib/pg_buffercache/pg_buffercache_pages.c
M contrib/pg_buffercache/sql/pg_buffercache.sql
M doc/src/sgml/pgbuffercache.sgml
M src/tools/pgindent/typedefs.list
Fix incorrect IndexOptInfo header comment
commit : 07d1dc3aebe4391a2711e951c69df2bb56447f8a
author : David Rowley <drowley@postgresql.org>
date : Mon, 24 Nov 2025 17:00:01 +1300
committer: David Rowley <drowley@postgresql.org>
date : Mon, 24 Nov 2025 17:00:01 +1300 The comment incorrectly indicated that indexcollations[] stored
collations for both key columns and INCLUDE columns, but in reality it
only has elements for the key columns. canreturn[] didn't get a mention,
so add that while we're here.
Author: Junwang Zhao <zhjwpku@gmail.com>
Reviewed-by: David Rowley <dgrowleyml@gmail.com>
Discussion: https://postgr.es/m/CAEG8a3LwbZgMKOQ9CmZarX5DEipKivdHp5PZMOO-riL0w%3DL%3D4A%40mail.gmail.com
Backpatch-through: 14 M src/include/nodes/pathnodes.h
Issue a NOTICE if a created function depends on any temp objects.
commit : 572c40ba94ef6350c8dd51539ac7d932c1d1a12a
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Sun, 23 Nov 2025 15:02:55 -0500
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Sun, 23 Nov 2025 15:02:55 -0500 We don't have an official concept of temporary functions. (You can
make one explicitly in pg_temp, but then you have to explicitly
schema-qualify it on every call.) However, until now we were quite
laissez-faire about whether a non-temporary function could depend on
a temporary object, such as a temp table or view. If one does,
it will silently go away at end of session, due to the automatic
DROP ... CASCADE on the session's temporary objects. People have
complained that that's surprising; however, we can't really forbid
it because other people (including our own regression tests) rely
on being able to do it. Let's compromise by emitting a NOTICE
at CREATE FUNCTION time. This is somewhat comparable to our
ancient practice of emitting a NOTICE when forcing a view to
become temp because it depends on temp tables.
Along the way, refactor recordDependencyOnExpr() so that the
dependencies of an expression can be combined with other
dependencies, instead of being emitted separately and perhaps
duplicatively.
We should probably make the implementation of temp-by-default
views use the same infrastructure used here, but that's for
another patch. It's unclear whether there are any other object
classes that deserve similar treatment.
Author: Jim Jones <jim.jones@uni-muenster.de>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/19cf6ae1-04cd-422c-a760-d7e75fe6cba9@uni-muenster.de M src/backend/catalog/dependency.c
M src/backend/catalog/pg_proc.c
M src/backend/commands/functioncmds.c
M src/backend/commands/typecmds.c
M src/include/catalog/dependency.h
M src/test/isolation/expected/temp-schema-cleanup.out
M src/test/regress/expected/create_function_sql.out
M src/test/regress/expected/rangefuncs.out
M src/test/regress/expected/returning.out
M src/test/regress/expected/rowtypes.out
M src/test/regress/sql/create_function_sql.sql
psql: Improve tab-completion for PREPARE.
commit : 81966c5458fb0a441c69b21f63d43f04cdb0d2d6
author : Fujii Masao <fujii@postgresql.org>
date : Sun, 23 Nov 2025 23:03:53 +0900
committer: Fujii Masao <fujii@postgresql.org>
date : Sun, 23 Nov 2025 23:03:53 +0900 This commit enhances tab-completion for PREPARE xx AS to also suggest
MERGE INTO, VALUES, WITH, and TABLE.
Author: Haruna Miwa <miwa@sraoss.co.jp>
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>
Discussion: https://postgr.es/m/TY7P286MB5466B859BD6C5BE64E961878F1CEA@TY7P286MB5466.JPNP286.PROD.OUTLOOK.COM M src/bin/psql/tab-complete.in.c
pg_buffercache: Remove unused fields from BufferCacheNumaRec
commit : 7d9043aee803bf9bf3307ce5f45f3464ea288cb1
author : Michael Paquier <michael@paquier.xyz>
date : Sun, 23 Nov 2025 13:37:42 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Sun, 23 Nov 2025 13:37:42 +0900 These fields have been added in commit ba2a3c2302f, and have never been
used. While on it, this commit moves a comment that was out of place,
improving it.
Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Discussion: https://postgr.es/m/aSBOKX6pLJzumbmF@ip-10-97-1-34.eu-west-3.compute.internal M contrib/pg_buffercache/pg_buffercache_pages.c
Add SupportRequestInlineInFrom planner support request.
commit : b140c8d7a3f3a5de4e4cc4a0b52909aa13060d4c
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Sat, 22 Nov 2025 19:33:34 -0500
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Sat, 22 Nov 2025 19:33:34 -0500 This request allows a support function to replace a function call
appearing in FROM (typically a set-returning function) with an
equivalent SELECT subquery. The subquery will then be subject
to the planner's usual optimizations, potentially allowing a much
better plan to be generated. While the planner has long done this
automatically for simple SQL-language functions, it's now possible
for extensions to do it for functions outside that group.
Notably, this could be useful for functions that are presently
implemented in PL/pgSQL and work by generating and then EXECUTE'ing
a SQL query.
Author: Paul A Jungwirth <pj@illuminatedcomputing.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/09de6afa-c33d-4d94-a5cb-afc6cea0d2bb@illuminatedcomputing.com M doc/src/sgml/xfunc.sgml
M src/backend/optimizer/prep/prepjointree.c
M src/backend/optimizer/util/clauses.c
M src/include/nodes/supportnodes.h
M src/include/optimizer/clauses.h
M src/test/regress/expected/misc_functions.out
M src/test/regress/regress.c
M src/test/regress/sql/misc_functions.sql
M src/tools/pgindent/typedefs.list
tools: remove src/tools/codelines
commit : c0bc9af15197e3604a6ec205a7485de21b0b21af
author : Bruce Momjian <bruce@momjian.us>
date : Sat, 22 Nov 2025 12:01:56 -0500
committer: Bruce Momjian <bruce@momjian.us>
date : Sat, 22 Nov 2025 12:01:56 -0500 This is a one-line script never gained general usage since being added
in 2005.
Backpatch-through: master D src/tools/codelines
Add range_minus_multi and multirange_minus_multi functions
commit : 5eed8ce50ce9df1067b95593dde9f4fc526dfc72
author : Peter Eisentraut <peter@eisentraut.org>
date : Sat, 22 Nov 2025 09:40:00 +0100
committer: Peter Eisentraut <peter@eisentraut.org>
date : Sat, 22 Nov 2025 09:40:00 +0100 The existing range_minus function raises an exception when the range is
"split", because then the result can't be represented by a single range.
For example '[0,10)'::int4range - '[4,5)' would be '[0,4)' and '[5,10)'.
This commit adds new set-returning functions so that callers can get
results even in the case of splits. There is no risk of an exception for
multiranges, but a set-returning function lets us handle them the same
way we handle ranges.
Both functions return zero results if the subtraction would give an
empty range/multirange.
The main use-case for these functions is to implement UPDATE/DELETE FOR
PORTION OF, which must compute the application-time of "temporal
leftovers": the part of history in an updated/deleted row that was not
changed. To preserve the untouched history, we will implicitly insert
one record for each result returned by range/multirange_minus_multi.
Using a set-returning function will also let us support user-defined
types for application-time update/delete in the future.
Author: Paul A. Jungwirth <pj@illuminatedcomputing.com>
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/ec498c3d-5f2b-48ec-b989-5561c8aa2024%40illuminatedcomputing.com M doc/src/sgml/func/func-range.sgml
M src/backend/utils/adt/multirangetypes.c
M src/backend/utils/adt/rangetypes.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/include/utils/rangetypes.h
M src/test/regress/expected/multirangetypes.out
M src/test/regress/expected/rangetypes.out
M src/test/regress/sql/multirangetypes.sql
M src/test/regress/sql/rangetypes.sql
jit: Adjust AArch64-only code for LLVM 21.
commit : 0dceba21d74f01e63aa690879b44808bbb74a9c3
author : Thomas Munro <tmunro@postgresql.org>
date : Sat, 22 Nov 2025 20:51:16 +1300
committer: Thomas Munro <tmunro@postgresql.org>
date : Sat, 22 Nov 2025 20:51:16 +1300 LLVM 21 changed the arguments of RTDyldObjectLinkingLayer's
constructor, breaking compilation with the backported
SectionMemoryManager from commit 9044fc1d.
https://github.com/llvm/llvm-project/commit/cd585864c0bbbd74ed2a2b1ccc191eed4d1c8f90
Backpatch-through: 14
Author: Holger Hoffstätte <holger@applied-asynchrony.com>
Reviewed-by: Anthonin Bonnefoy <anthonin.bonnefoy@datadoghq.com>
Discussion: https://postgr.es/m/d25e6e4a-d1b4-84d3-2f8a-6c45b975f53d%40applied-asynchrony.com M src/backend/jit/llvm/llvmjit_wrap.cpp
Add 'make check-tests' behavior to the meson based builds
commit : 51da766494dcc84b6f8d793ecaa064363a9243c2
author : Andrew Dunstan <andrew@dunslane.net>
date : Fri, 21 Nov 2025 17:08:46 -0500
committer: Andrew Dunstan <andrew@dunslane.net>
date : Fri, 21 Nov 2025 17:08:46 -0500 There was no easy way to run specific tests in the meson based builds.
Author: Nazir Bilal Yavuz <byavuz81@gmail.com>
Reviewed-by: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>
Reviewed-by: Jian He <jian.universality@gmail.com>
Discussion: postgr.es/m/CAExHW5tK-QqayUN0%2BN3MF5bjV6vLKDCkRuGwoDJwc7vGjwCygQ%40mail.gmail.com M meson.build
M src/tools/testwrap
Fix typo in documentation about application time
commit : 51364113d5a00e53f9447de1f7056c440e0892d5
author : Peter Eisentraut <peter@eisentraut.org>
date : Fri, 21 Nov 2025 17:36:25 +0100
committer: Peter Eisentraut <peter@eisentraut.org>
date : Fri, 21 Nov 2025 17:36:25 +0100 Author: Paul A. Jungwirth <pj@illuminatedcomputing.com> M doc/src/sgml/ddl.sgml
Remove useless casts to (void *)
commit : ef8fe693606add7edb563e6c8a63c6ef608338c0
author : Peter Eisentraut <peter@eisentraut.org>
date : Fri, 21 Nov 2025 16:49:40 +0100
committer: Peter Eisentraut <peter@eisentraut.org>
date : Fri, 21 Nov 2025 16:49:40 +0100 Their presence causes (small) risks of hiding actual type mismatches
or silently discarding qualifiers. Some have been missed in
7f798aca1d5 and some are new ones along the same lines.
Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/aR8Yv%2BuATLKbJCgI%40ip-10-97-1-34.eu-west-3.compute.internal M src/backend/catalog/pg_publication.c
M src/backend/commands/copyfromparse.c
M src/backend/commands/extension.c
M src/backend/storage/lmgr/lock.c
M src/backend/tsearch/wparser.c
M src/backend/utils/cache/inval.c
M src/backend/utils/misc/injection_point.c
M src/backend/utils/mmgr/bump.c
M src/backend/utils/sort/tuplesortvariants.c
Use strtoi64() in pgbench, replacing its open-coded implementation
commit : 2aabaa52dffdb78fbefaef95163881c15e18ef29
author : Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Fri, 21 Nov 2025 15:03:11 +0200
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Fri, 21 Nov 2025 15:03:11 +0200 Makes the code a little simpler.
The old implementation accepted trailing whitespace, but that was
unnecessary. Firstly, its sibling function for parsing decimals,
strtodouble(), does not accept trailing whitespace. Secondly, none of
the callers can pass a string with trailing whitespace to it.
In the passing, check specifically for ERANGE before printing the "out
of range" error. On some systems, strtoul() and strtod() return EINVAL
on an empty or all-spaces string, and "invalid input syntax" is more
appropriate for that than "out of range". For the existing
strtodouble() function this is purely academical because it's never
called with errorOK==false, but let's be tidy. (Perhaps we should
remove the dead codepaths altogether, but I'll leave that for another
day.)
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Yuefei Shi <shiyuefei1004@gmail.com>
Reviewed-by: Neil Chen <carpenter.nail.cz@gmail.com>
Discussion: https://www.postgresql.org/message-id/861dd5bd-f2c9-4ff5-8aa0-f82bdb75ec1f@iki.fi M src/bin/pgbench/pgbench.c
Update timezone to C99
commit : e6be84356bbbaf9f88b6a738e690d6fdff6fe483
author : Peter Eisentraut <peter@eisentraut.org>
date : Fri, 21 Nov 2025 13:01:30 +0100
committer: Peter Eisentraut <peter@eisentraut.org>
date : Fri, 21 Nov 2025 13:01:30 +0100 This reverts changes done in PostgreSQL over the upstream code to
avoid relying on C99 <stdint.h> and <inttypes.h>.
In passing, there were a few other minor and cosmetic changes that I
left in to improve alignment with upstream, including some C11 feature
use (_Noreturn).
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://www.postgresql.org/message-id/flat/9ad2749f-77ab-4ecb-a321-1ca915480b05%40eisentraut.org M src/timezone/README
M src/timezone/localtime.c
M src/timezone/pgtz.h
M src/timezone/private.h
M src/timezone/zic.c
M src/tools/pgindent/typedefs.list
C11 alignas instead of unions
commit : 97e04c74bedb902327b89eb8a9e6aea01aabdad2
author : Peter Eisentraut <peter@eisentraut.org>
date : Fri, 21 Nov 2025 09:57:06 +0100
committer: Peter Eisentraut <peter@eisentraut.org>
date : Fri, 21 Nov 2025 09:57:06 +0100 This changes a few union members that only existed to ensure
alignments and replaces them with the C11 alignas specifier.
This change only uses fundamental alignments (meaning approximately
alignments of basic types), which all C11 compilers must support.
There are opportunities for similar changes using extended alignments,
for example in PGIOAlignedBlock, but these are not necessarily
supported by all compilers, so they are kept as a separate change.
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/46f05236-d4d4-4b4e-84d4-faa500f14691%40eisentraut.org M src/backend/access/common/toast_internals.c
M src/backend/commands/async.c
M src/backend/storage/large_object/inv_api.c
M src/include/c.h
Use "COPY table TO" for partitioned tables in initial table synchronization.
commit : 266543a62055541ddefe4e66797e0e1e4aa8705a
author : Masahiko Sawada <msawada@postgresql.org>
date : Thu, 20 Nov 2025 14:50:27 -0800
committer: Masahiko Sawada <msawada@postgresql.org>
date : Thu, 20 Nov 2025 14:50:27 -0800 Commit 4bea91f added support for "COPY table TO" with partitioned
tables. This commit enhances initial table synchronization in logical
replication to use "COPY table TO" for partitioned tables if possible,
instead of "COPY (SELECT ...) TO" variant, improving performance.
Author: Ajin Cherian <itsajin@gmail.com>
Discussion: https://postgr.es/m/CAFPTHDY=w+xmEof=yyjhbDzaLxhBkoBzKcksEofXcT6EcjMbtQ@mail.gmail.com M src/backend/replication/logical/tablesync.c
Split PruneFreezeParams initializers to one field per line
commit : 1e14edcea5e1a122d4bf76d30fc963715e4dfe5e
author : Melanie Plageman <melanieplageman@gmail.com>
date : Thu, 20 Nov 2025 17:36:40 -0500
committer: Melanie Plageman <melanieplageman@gmail.com>
date : Thu, 20 Nov 2025 17:36:40 -0500 This conforms more closely with the style of other struct initializers
in the code base. Initializing multiple fields on a single line is
unpopular in part because pgindent won't permit a space after the comma
before the next field's period.
Author: Melanie Plageman <melanieplageman@gmail.com>
Reported-by: Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>
Discussion: https://postgr.es/m/87see87fnq.fsf%40wibble.ilmari.org M src/backend/access/heap/pruneheap.c
M src/backend/access/heap/vacuumlazy.c
tools: update tools/codelines to use "git ls-files"
commit : 5d4dc112c7c6c10be739d61e8be012f20e9fdbbf
author : Bruce Momjian <bruce@momjian.us>
date : Thu, 20 Nov 2025 15:23:39 -0500
committer: Bruce Momjian <bruce@momjian.us>
date : Thu, 20 Nov 2025 15:23:39 -0500 This generates a more accurate code count because 'make distclean'
doesn't always remove build files.
Author: idea from David Rowley
Discussion: https://postgr.es/m/aR4hoOotVHB7TXo5@momjian.us
Backpatch-through: master M src/tools/codelines
Update PruneState.all_[visible|frozen] earlier in pruning
commit : 65ec565b19fc35e9b09edcba4aecac350334ce87
author : Melanie Plageman <melanieplageman@gmail.com>
date : Thu, 20 Nov 2025 11:40:36 -0500
committer: Melanie Plageman <melanieplageman@gmail.com>
date : Thu, 20 Nov 2025 11:40:36 -0500 During pruning and freezing in phase I of vacuum, we delay clearing
all_visible and all_frozen in the presence of dead items. This allows
opportunistic freezing if the page would otherwise be fully frozen,
since those dead items are later removed in vacuum phase III.
To move the VM update into the same WAL record that
prunes and freezes tuples, we must know whether the page will
be marked all-visible/all-frozen before emitting WAL. Previously we
waited until after emitting WAL to update all_visible/all_frozen to
their correct values.
The only barrier to updating these flags immediately after deciding
whether to opportunistically freeze was that while emitting WAL for a
record freezing tuples, we use the pre-corrected value of all_frozen to
compute the snapshot conflict horizon. By determining the conflict
horizon earlier, we can update the flags immediately after making the
opportunistic freeze decision.
This is required to set the VM in the XLOG_HEAP2_PRUNE_VACUUM_SCAN
record emitted by pruning and freezing.
Author: Melanie Plageman <melanieplageman@gmail.com>
Reviewed-by: Kirill Reshke <reshkekirill@gmail.com>
Discussion: https://postgr.es/m/flat/CAAKRu_ZMw6Npd_qm2KM%2BFwQ3cMOMx1Dh3VMhp8-V7SOLxdK9-g%40mail.gmail.com M src/backend/access/heap/pruneheap.c
Keep all_frozen updated in heap_page_prune_and_freeze
commit : 351d7e244183ee33400c19e4b52c5446eb29038c
author : Melanie Plageman <melanieplageman@gmail.com>
date : Thu, 20 Nov 2025 10:58:34 -0500
committer: Melanie Plageman <melanieplageman@gmail.com>
date : Thu, 20 Nov 2025 10:58:34 -0500 Previously, we relied on all_visible and all_frozen being used together
to ensure that all_frozen was correct, but it is better to keep both
fields updated.
Future changes will separate their usage, so we should not depend on
all_visible for the validity of all_frozen.
Author: Melanie Plageman <melanieplageman@gmail.com>
Reviewed-by: Kirill Reshke <reshkekirill@gmail.com>
Discussion: https://postgr.es/m/flat/CAAKRu_ZMw6Npd_qm2KM%2BFwQ3cMOMx1Dh3VMhp8-V7SOLxdK9-g%40mail.gmail.com M src/backend/access/heap/pruneheap.c
M src/backend/access/heap/vacuumlazy.c
Refactor heap_page_prune_and_freeze() parameters into a struct
commit : 1937ed70621e203c99e651ce4430dd217743d150
author : Melanie Plageman <melanieplageman@gmail.com>
date : Thu, 20 Nov 2025 10:30:43 -0500
committer: Melanie Plageman <melanieplageman@gmail.com>
date : Thu, 20 Nov 2025 10:30:43 -0500 heap_page_prune_and_freeze() had accumulated an unwieldy number of input
parameters and upcoming work to handle VM updates in this function will
add even more.
Introduce a new PruneFreezeParams struct to group the function’s input
parameters, improving readability and maintainability.
Author: Melanie Plageman <melanieplageman@gmail.com>
Reviewed-by: Kirill Reshke <reshkekirill@gmail.com>
Discussion: https://postgr.es/m/yn4zp35kkdsjx6wf47zcfmxgexxt4h2og47pvnw2x5ifyrs3qc%407uw6jyyxuyf7 M src/backend/access/heap/pruneheap.c
M src/backend/access/heap/vacuumlazy.c
M src/include/access/heapam.h
M src/tools/pgindent/typedefs.list
doc: Assorted documentation improvements
commit : fa0ffa28778fbf4056a77f7b76361d295a737df6
author : Daniel Gustafsson <dgustafsson@postgresql.org>
date : Thu, 20 Nov 2025 15:04:41 +0100
committer: Daniel Gustafsson <dgustafsson@postgresql.org>
date : Thu, 20 Nov 2025 15:04:41 +0100 A set of wording improvements and spelling fixes.
Author: Oleg Sibiryakov <o.sibiryakov@postgrespro.ru>
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Discussion: https://postgr.es/m/e62bedb5-c26f-4d37-b4ed-ce9b55f1e980@postgrespro.ru M doc/src/sgml/config.sgml
M doc/src/sgml/installation.sgml
M doc/src/sgml/postgres-fdw.sgml
M doc/src/sgml/postgres.sgml
M doc/src/sgml/protocol.sgml
M doc/src/sgml/ref/pg_recvlogical.sgml
M doc/src/sgml/ref/pgbench.sgml
M doc/src/sgml/regress.sgml
M doc/src/sgml/system-views.sgml
M doc/src/sgml/xfunc.sgml
doc: Document how to run a subset of regress tests
commit : 20bff3d7945ec23b44322232d608f5776a1f0e35
author : Daniel Gustafsson <dgustafsson@postgresql.org>
date : Thu, 20 Nov 2025 14:49:33 +0100
committer: Daniel Gustafsson <dgustafsson@postgresql.org>
date : Thu, 20 Nov 2025 14:49:33 +0100 This patch was originally submitted a year ago, but never
ended up getting committed. It was later brought up again
on a recent thread on the same subject.
Original patch by Paul A Jungwirth with some wordsmithing
by me based on the review from the original thread.
Author: Paul A. Jungwirth <pj@illuminatedcomputing.com>
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>
Reviewed-by: Viktor Holmberg <v@viktorh.net>
Reviewed-by: Nazir Bilal Yavuz <byavuz81@gmail.com>
Discussion: https://postgr.es/m/CA+renyXB5jYG9r5-CaDc4g607EB398QwTk_efEXTzarrO8bPzw@mail.gmail.com
Discussion: https://postgr.es/m/CACJufxHOcmeTkoh2CxFHKv9GRnp9sLVzN=LZhqTgvqT++PXZNQ@mail.gmail.com M doc/src/sgml/regress.sgml
Handle EPERM in pg_numa_init
commit : 599336c64fc9ef75727ec3ba4684644dc23f8ddb
author : Tomas Vondra <tomas.vondra@postgresql.org>
date : Thu, 20 Nov 2025 12:51:58 +0100
committer: Tomas Vondra <tomas.vondra@postgresql.org>
date : Thu, 20 Nov 2025 12:51:58 +0100 When running in Docker, the container may not have privileges needed by
get_mempolicy(). This is called by numa_available() in libnuma, but
versions prior to 2.0.19 did not expect that. The numa_available() call
seemingly succeeds, but then we get unexpected failures when trying to
query status of pages:
postgres =# select * from pg_shmem_allocations_numa;
ERROR: XX000: failed NUMA pages inquiry status: Operation not
permitted
LOCATION: pg_get_shmem_allocations_numa, shmem.c:691
The best solution is to call get_mempolicy() first, and proceed to
numa_available() only when it does not fail with EPERM. Otherwise we'd
need to treat older libnuma versions as insufficient, which seems a bit
too harsh, as this only affects containerized systems.
Fix by me, based on suggestions by Christoph. Backpatch to 18, where the
NUMA functions were introduced.
Reported-by: Christoph Berg <myon@debian.org>
Reviewed-by: Christoph Berg <myon@debian.org>
Discussion: https://postgr.es/m/aPDZOxjrmEo_1JRG@msg.df7cb.de
Backpatch-through: 18 M src/port/pg_numa.c
Remove obsolete cast
commit : b5623cc5e4197b59d37b869fbd92c1778be0438e
author : Peter Eisentraut <peter@eisentraut.org>
date : Thu, 20 Nov 2025 07:47:48 +0100
committer: Peter Eisentraut <peter@eisentraut.org>
date : Thu, 20 Nov 2025 07:47:48 +0100 The upstream timezone code uses a bool variable as an array subscript.
Back when PostgreSQL's bool was char, this would have caused a warning
from gcc -Wchar-subscripts, which is included in -Wall. But this has
been obsolete since probably commit d26a810ebf9, but certainly since
bool is now the C standard bool. So we can remove this deviation from
the upstream code, to make future code merges simpler.
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://www.postgresql.org/message-id/flat/9ad2749f-77ab-4ecb-a321-1ca915480b05%40eisentraut.org M src/timezone/localtime.c
doc: Update pg_upgrade documentation to match recent description changes.
commit : aaf035790aebb4de6d85b60f8f3089c3c656b325
author : Fujii Masao <fujii@postgresql.org>
date : Thu, 20 Nov 2025 09:18:51 +0900
committer: Fujii Masao <fujii@postgresql.org>
date : Thu, 20 Nov 2025 09:18:51 +0900 Commit 792353f7d52 updated the pg_dump and pg_dumpall documentation to
clarify which statistics are not included in their output. The pg_upgrade
documentation contained a nearly identical description, but it was not updated
at the same time.
This commit updates the pg_upgrade documentation to match those changes.
Backpatch to v18, where commit 792353f7d52 was backpatched to.
Author: Fujii Masao <masao.fujii@gmail.com>
Reviewed-by: Bruce Momjian <bruce@momjian.us>
Discussion: https://postgr.es/m/CAHGQGwFnfgdGz8aGWVzgFCFwoWQU7KnFFjmxinf4RkQAkzmR+w@mail.gmail.com
Backpatch-through: 18 M doc/src/sgml/ref/pgupgrade.sgml
Add HINT listing valid encodings to encode() and decode() errors.
commit : 99780da7209605bf9f226eac3eac30ab2bc9427c
author : Fujii Masao <fujii@postgresql.org>
date : Thu, 20 Nov 2025 09:14:02 +0900
committer: Fujii Masao <fujii@postgresql.org>
date : Thu, 20 Nov 2025 09:14:02 +0900 This commit updates encode() and decode() so that when an invalid encoding
is specified, their error message includes a HINT listing all valid encodings.
This helps users quickly see which encodings are supported without needing
to consult the documentation.
Author: Shinya Sugamoto <shinya34892@gmail.com>
Reviewed-by: Chao Li <lic@highgo.com>
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>
Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com>
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Reviewed-by: Nathan Bossart <nathandbossart@gmail.com>
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>
Discussion: https://postgr.es/m/CAAe3y+99sfPv8UDF1VM-rC1i5HBdqxUh=2HrbJJFm2+i=1OwOw@mail.gmail.com M src/backend/utils/adt/encode.c
M src/test/regress/expected/strings.out
M src/test/regress/sql/strings.sql
Drop support for MSVCRT's float formatting quirk.
commit : 6b46669883fac9521c20fe4e2c55ccfbee778591
author : Thomas Munro <tmunro@postgresql.org>
date : Thu, 20 Nov 2025 10:23:44 +1300
committer: Thomas Munro <tmunro@postgresql.org>
date : Thu, 20 Nov 2025 10:23:44 +1300 Commit f1885386 added code to remove an unnecessary leading zero from
the exponent in a float formatted by the system snprintf(). The C
standard doesn't allow unnecessary digits beyond two, and the tests pass
without this on Windows' modern UCRT (required since commit 1758d424).
Discussion: https://postgr.es/m/CA%2BhUKGJnmzTqiODmTjf-23yZ%3DE3HXqFTtKoyp3TF-MpB93hTMQ%40mail.gmail.com M src/port/snprintf.c
Drop support for MSVCRT's %I64 format strings.
commit : 7ab9b34614c2d6f69070a667787e0b091ecb72b1
author : Thomas Munro <tmunro@postgresql.org>
date : Thu, 20 Nov 2025 10:04:11 +1300
committer: Thomas Munro <tmunro@postgresql.org>
date : Thu, 20 Nov 2025 10:04:11 +1300 MSVCRT predated C99 and invented non-standard placeholders for 64-bit
numbers, and then later used them in standard macros when C99
<inttypes.h> arrived. The macros just use %lld etc when building with
UCRT, so there should be no way for our interposed sprintf.c code to
receive the pre-standard kind these days. Time to drop the code that
parses them.
That code was in fact already dead when commit 962da900 landed, as we'd
disclaimed MSVCRT support a couple of weeks earlier in commit 1758d424,
but patch development overlapped and the history of these macros hadn't
been investigated.
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Discussion: https://postgr.es/m/4d8b1a67-aab2-4429-b44b-f03988095939%40eisentraut.org M src/port/snprintf.c
Speed up eqjoinsel() with lots of MCV entries.
commit : 057012b205a082ec930cd7bb7f6663516be011e2
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Wed, 19 Nov 2025 13:22:12 -0500
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Wed, 19 Nov 2025 13:22:12 -0500 If both sides of the operator have most-common-value statistics,
eqjoinsel wants to check which MCVs have matches on the other side.
Formerly it did this with a dumb compare-all-the-entries loop,
which had O(N^2) behavior for long MCV lists. When that code was
written, twenty-plus years ago, that seemed tolerable; but nowadays
people frequently use much larger statistics targets, so that the
O(N^2) behavior can hurt quite a bit.
To add insult to injury, when asked for semijoin semantics, the
entire comparison loop was done over, even though we frequently
know that it will yield exactly the same results.
To improve matters, switch to using a hash table to perform the
matching. Testing suggests that depending on the data type, we may
need up to about 100 MCVs on each side to amortize the extra costs
of setting up the hash table and performing hash-value computations;
so continue to use the old looping method when there are fewer MCVs
than that.
Also, refactor so that we don't repeat the matching work unless
we really need to, which occurs only in the uncommon case where
eqjoinsel_semi decides to truncate the set of inner MCVs it
considers. The refactoring also got rid of the need to use the
presented operator's commutator. Real-world operators that are
using eqjoinsel should pretty much always have commutators, but
at the very least this saves a few syscache lookups.
Author: Ilia Evdokimov <ilya.evdokimov@tantorlabs.com>
Co-authored-by: David Geier <geidav.pg@gmail.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/20ea8bf5-3569-4e46-92ef-ebb2666debf6@tantorlabs.com M src/backend/utils/adt/selfuncs.c
M src/tools/pgindent/typedefs.list
Print new OldestXID value in pg_resetwal when it's being changed
commit : d5b4f3a6d4e0c065562d1c0c69e7c4aba2623910
author : Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Wed, 19 Nov 2025 18:05:42 +0200
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Wed, 19 Nov 2025 18:05:42 +0200 Commit 74cf7d46a91d added the --oldest-transaction-id option to
pg_resetwal, but forgot to update the code that prints all the new
values that are being set. Fix that.
Reviewed-by: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Discussion: https://www.postgresql.org/message-id/5461bc85-e684-4531-b4d2-d2e57ad18cba@iki.fi
Backpatch-through: 14 M src/bin/pg_resetwal/pg_resetwal.c
doc: Update formula for vacuum insert threshold.
commit : cbdce71b9984e9bb2d8b3a4a8de466cbb2c32ea7
author : Nathan Bossart <nathan@postgresql.org>
date : Wed, 19 Nov 2025 10:01:37 -0600
committer: Nathan Bossart <nathan@postgresql.org>
date : Wed, 19 Nov 2025 10:01:37 -0600 Oversight in commit 06eae9e621.
Reviewed-by: Melanie Plageman <melanieplageman@gmail.com>
Discussion: https://postgr.es/m/aRODeqFUVkGDJSPP%40nathan
Backpatch-through: 18 M doc/src/sgml/maintenance.sgml
Fix indentation
commit : 86b276a4a9b4b2c63ef00765f0e2867e1bcac4ca
author : Peter Eisentraut <peter@eisentraut.org>
date : Wed, 19 Nov 2025 10:41:28 +0100
committer: Peter Eisentraut <peter@eisentraut.org>
date : Wed, 19 Nov 2025 10:41:28 +0100 for commit 0fc33b00536 M src/backend/utils/misc/guc.c
Fix NLS for incorrect GUC enum value hint message
commit : 0fc33b00536cf395b44260b6fc76b6b1d6fc0bcb
author : Peter Eisentraut <peter@eisentraut.org>
date : Wed, 19 Nov 2025 08:46:31 +0100
committer: Peter Eisentraut <peter@eisentraut.org>
date : Wed, 19 Nov 2025 08:46:31 +0100 The translation markers were applied at the wrong place, so no string
was extracted for translation.
Also add translator comments here and in a similar place.
Reviewed-by: Álvaro Herrera <alvherre@kurilemu.de>
Discussion: https://www.postgresql.org/message-id/2c961fa1-14f6-44a2-985c-e30b95654e8d%40eisentraut.org M src/backend/replication/logical/relation.c
M src/backend/utils/misc/guc.c
Add <stdalign.h> to c.h
commit : 300c8f532478a387cc772a9b985b9d7a4b4dd093
author : Peter Eisentraut <peter@eisentraut.org>
date : Wed, 19 Nov 2025 08:02:05 +0100
committer: Peter Eisentraut <peter@eisentraut.org>
date : Wed, 19 Nov 2025 08:02:05 +0100 This allows using the C11 constructs alignas and alignof (not done in
this patch).
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/46f05236-d4d4-4b4e-84d4-faa500f14691%40eisentraut.org M src/include/c.h
Fix typo in nodeHash.c
commit : 4d3f623ea887a7b6e74d7567e3e0c4b66fd58e50
author : Richard Guo <rguo@postgresql.org>
date : Wed, 19 Nov 2025 11:04:03 +0900
committer: Richard Guo <rguo@postgresql.org>
date : Wed, 19 Nov 2025 11:04:03 +0900 Replace "overlow" with "overflow".
Author: Tender Wang <tndrwang@gmail.com>
Discussion: https://postgr.es/m/CAHewXNnzFjAjYLTkP78HE2PQ17MjBqFdQQg+0X6Wo7YMUb68xA@mail.gmail.com M src/backend/executor/nodeHash.c
Fix pg_popcount_aarch64.c to build with ancient glibc releases.
commit : 3e83bdd35a5f38511b396a40f060cbc49b62e74d
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Tue, 18 Nov 2025 16:16:46 -0500
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Tue, 18 Nov 2025 16:16:46 -0500 Like commit 6d969ca68, except here we are mopping up after 519338ace.
(There are no other uses of <sys/auxv.h> in the tree, so we should
be done now.)
Reported-by: GaoZengqi <pgf00a@gmail.com>
Author: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/CAFmBtr3Av62-jBzdhFkDHXJF9vQmNtSnH2upwODjnRcsgdTytw@mail.gmail.com
Backpatch-through: 18 M src/port/pg_popcount_aarch64.c
Fix typo
commit : 77fb3959a45d1a748cb28f3f58da18c6645b45d3
author : Álvaro Herrera <alvherre@kurilemu.de>
date : Tue, 18 Nov 2025 19:31:23 +0100
committer: Álvaro Herrera <alvherre@kurilemu.de>
date : Tue, 18 Nov 2025 19:31:23 +0100 M src/backend/executor/nodeHash.c
M src/bin/pg_dump/t/005_pg_dump_filterfile.pl
M src/interfaces/libpq/fe-secure-openssl.c
Don't allow CTEs to determine semantic levels of aggregates.
commit : 35b5c62c3ad9a28ca145691219d889c638c82e37
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Tue, 18 Nov 2025 12:56:55 -0500
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Tue, 18 Nov 2025 12:56:55 -0500 The fix for bug #19055 (commit b0cc0a71e) allowed CTE references in
sub-selects within aggregate functions to affect the semantic levels
assigned to such aggregates. It turns out this broke some related
cases, leading to assertion failures or strange planner errors such
as "unexpected outer reference in CTE query". After experimenting
with some alternative rules for assigning the semantic level in
such cases, we've come to the conclusion that changing the level
is more likely to break things than be helpful.
Therefore, this patch undoes what b0cc0a71e changed, and instead
installs logic to throw an error if there is any reference to a
CTE that's below the semantic level that standard SQL rules would
assign to the aggregate based on its contained Var and Aggref nodes.
(The SQL standard disallows sub-selects within aggregate functions,
so it can't reach the troublesome case and hence has no rule for
what to do.)
Perhaps someone will come along with a legitimate query that this
logic rejects, and if so probably the example will help us craft
a level-adjustment rule that works better than what b0cc0a71e did.
I'm not holding my breath for that though, because the previous
logic had been there for a very long time before bug #19055 without
complaints, and that bug report sure looks to have originated from
fuzzing not from real usage.
Like b0cc0a71e, back-patch to all supported branches, though
sadly that no longer includes v13.
Bug: #19106
Reported-by: Kamil Monicz <kamil@monicz.dev>
Author: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/19106-9dd3668a0734cd72@postgresql.org
Backpatch-through: 14 M src/backend/parser/parse_agg.c
M src/test/regress/expected/with.out
M src/test/regress/sql/with.sql
Add commit f63ae72bbc to .git-blame-ignore-revs.
commit : faf4128ad36425045c1ffb48537d094253bba0ef
author : Nathan Bossart <nathan@postgresql.org>
date : Tue, 18 Nov 2025 10:32:22 -0600
committer: Nathan Bossart <nathan@postgresql.org>
date : Tue, 18 Nov 2025 10:32:22 -0600 M .git-blame-ignore-revs
Check for tabs in postgresql.conf.sample.
commit : 379f0e9f72b3e2504641aaabc7db2b03c00b146b
author : Nathan Bossart <nathan@postgresql.org>
date : Tue, 18 Nov 2025 10:28:36 -0600
committer: Nathan Bossart <nathan@postgresql.org>
date : Tue, 18 Nov 2025 10:28:36 -0600 The previous commit updated this file to use spaces instead of
tabs. This commit adds a test to ensure that no new tabs are
added.
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://postgr.es/m/aReNUKdMgKxLqmq7%40nathan M src/test/modules/test_misc/t/003_check_guc.pl
Switch from tabs to spaces in postgresql.conf.sample.
commit : f63ae72bbcea057534144eaf27ffe3f6e9267511
author : Nathan Bossart <nathan@postgresql.org>
date : Tue, 18 Nov 2025 10:28:36 -0600
committer: Nathan Bossart <nathan@postgresql.org>
date : Tue, 18 Nov 2025 10:28:36 -0600 This file is written for 8-space tabs, since we expect that most
users who edit their configuration files use 8-space tabs.
However, most of PostgreSQL is written for 4-space tabs, and at
least one popular web interface defaults to 4-space tabs. Rather
than trying to standardize on a particular tab width for this file,
let's just switch to spaces.
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://postgr.es/m/aReNUKdMgKxLqmq7%40nathan M src/backend/utils/misc/postgresql.conf.sample
Update .editorconfig and .gitattributes for postgresql.conf.sample.
commit : aeebb49b7cfeff525fafe8ae105e091c923193fb
author : Nathan Bossart <nathan@postgresql.org>
date : Tue, 18 Nov 2025 10:28:36 -0600
committer: Nathan Bossart <nathan@postgresql.org>
date : Tue, 18 Nov 2025 10:28:36 -0600 This commit updates .editorconfig and .gitattributes in preparation
for a follow-up commit that will modify this file to use spaces
instead of tabs.
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://postgr.es/m/aReNUKdMgKxLqmq7%40nathan M .editorconfig
M .gitattributes
Log a note at program start when running in dry-run mode
commit : c05dee191125f2dcbd0ac40534373cfc7266c0da
author : Álvaro Herrera <alvherre@kurilemu.de>
date : Tue, 18 Nov 2025 16:13:29 +0100
committer: Álvaro Herrera <alvherre@kurilemu.de>
date : Tue, 18 Nov 2025 16:13:29 +0100 Users might get some peace of mind knowing their data is not being
destroyed or whatever.
Author: Peter Smith <smithpb2250@gmail.com>
Reviewed-by: Álvaro Herrera <alvherre@kurilemu.de>
Discussion: https://postgr.es/m/CAHut+PsvQJQnQO0KT0S2oegenkvJ8FUuY-QS5syyqmT24R2xFQ@mail.gmail.com M src/bin/pg_archivecleanup/pg_archivecleanup.c
M src/bin/pg_basebackup/pg_createsubscriber.c
M src/bin/pg_combinebackup/pg_combinebackup.c
M src/bin/pg_rewind/pg_rewind.c
Optimize shared memory usage for WaitLSNProcInfo
commit : 75e82b2f5a6f5de6b42dbd9ea73be5ff36a931b1
author : Alexander Korotkov <akorotkov@postgresql.org>
date : Tue, 18 Nov 2025 09:50:12 +0200
committer: Alexander Korotkov <akorotkov@postgresql.org>
date : Tue, 18 Nov 2025 09:50:12 +0200 We need separate pairing heaps for different WaitLSNType's, because there
might be waiters for different LSN's at the same time. However, one process
can wait only for one type of LSN at a time. So, no need for inHeap
and heapNode fields to be arrays.
Discussion: https://postgr.es/m/CAPpHfdsBR-7sDtXFJ1qpJtKiohfGoj%3DvqzKVjWxtWsWidx7G_A%40mail.gmail.com
Author: Alexander Korotkov <aekorotkov@gmail.com>
Reviewed-by: Xuneng Zhou <xunengzhou@gmail.com> M src/backend/access/transam/xlogwait.c
M src/include/access/xlogwait.h
pg_buffercache: Fix incorrect result cast for relforknumber
commit : 694b4ab33b24dfe1f9cc00fbbd5326f0feadee4a
author : Michael Paquier <michael@paquier.xyz>
date : Tue, 18 Nov 2025 15:46:43 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Tue, 18 Nov 2025 15:46:43 +0900 pg_buffercache_pages.relforknumber is defined as an int2, but its value
was stored with ObjectIdGetDatum() rather than Int16GetDatum() in the
result record.
Author: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>
Discussion: https://postgr.es/m/CAExHW5s2_qwSdhKpVnUzjRMf0cf1PvmhUHQDLaFM3QzKbP1OyQ@mail.gmail.com M contrib/pg_buffercache/pg_buffercache_pages.c
doc: Fix style of description for pg_buffercache_numa.os_page_num
commit : fce13424b9c56abf8693684ab41d8fca864c1e79
author : Michael Paquier <michael@paquier.xyz>
date : Tue, 18 Nov 2025 14:17:54 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Tue, 18 Nov 2025 14:17:54 +0900 Extracted from a larger patch by the same author.
Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Discussion: https://postgr.es/m/Z/fFA2heH6lpSLlt@ip-10-97-1-34.eu-west-3.compute.internal M doc/src/sgml/pgbuffercache.sgml
Rename two columns in pg_stat_subscription_stats.
commit : 3edaf29fa5e0d4fd6419c7eb73fd6df5b0406789
author : Amit Kapila <akapila@postgresql.org>
date : Tue, 18 Nov 2025 03:58:55 +0000
committer: Amit Kapila <akapila@postgresql.org>
date : Tue, 18 Nov 2025 03:58:55 +0000 This patch renames the sync_error_count column to sync_table_error_count
in the pg_stat_subscription_stats view. The new name makes the purpose
explicit now that a separate column exists to track sequence
synchronization errors.
Additionally, the column seq_sync_error_count is renamed to
sync_seq_error_count to maintain a consistent naming pattern, making it
easier for users to group, and query synchronization related counters.
Author: Vignesh C <vignesh21@gmail.com>
Reviewed-by: Peter Smith <smithpb2250@gmail.com>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://postgr.es/m/CALDaNm3WwJmz=-4ybTkhniB-Nf3qmFG9Zx1uKjyLLoPF5NYYXA@mail.gmail.com M doc/src/sgml/monitoring.sgml
M src/backend/catalog/system_views.sql
M src/backend/utils/activity/pgstat_subscription.c
M src/backend/utils/adt/pgstatfuncs.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/include/pgstat.h
M src/test/regress/expected/rules.out
M src/test/subscription/t/026_stats.pl
Doc: Use <structfield> markup for sequence fields.
commit : c677f2b09f24a1a92789bcbc0ee6599cfd034f27
author : Amit Kapila <akapila@postgresql.org>
date : Tue, 18 Nov 2025 03:48:00 +0000
committer: Amit Kapila <akapila@postgresql.org>
date : Tue, 18 Nov 2025 03:48:00 +0000 Following commit 980a855c5c, update documentation to use <structfield> for
sequence columns. Previously, these were incorrectly marked up as <literal>.
Author: Peter Smith <smithpb2250@gmail.com>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://postgr.es/m/CAHut+PtpDMUE3Kd1p=1ff9pw2HMbgQCpowE_0Hd6gs5v2pKfQg@mail.gmail.com M doc/src/sgml/func/func-sequence.sgml
M doc/src/sgml/ref/alter_sequence.sgml
M doc/src/sgml/ref/create_sequence.sgml
doc: clarify that pg_upgrade preserves "optimizer" stats.
commit : 792353f7d520482414e3bb5e44ed344cf78b54c6
author : Bruce Momjian <bruce@momjian.us>
date : Mon, 17 Nov 2025 18:55:41 -0500
committer: Bruce Momjian <bruce@momjian.us>
date : Mon, 17 Nov 2025 18:55:41 -0500 Reported-by: Rambabu V
Author: Robert Treat
Discussion: https://postgr.es/m/CADtiZxrUzRRX6edyN2y-7U5HA8KSXttee7K=EFTLXjwG1SCE4A@mail.gmail.com
Backpatch-through: 18 M doc/src/sgml/ref/pg_dump.sgml
M doc/src/sgml/ref/pg_dumpall.sgml
Use streaming read I/O in BRIN vacuum scan.
commit : a6eac2273e6e762003e763f45b880261fbd473a4
author : Masahiko Sawada <msawada@postgresql.org>
date : Mon, 17 Nov 2025 13:22:20 -0800
committer: Masahiko Sawada <msawada@postgresql.org>
date : Mon, 17 Nov 2025 13:22:20 -0800 This commit implements streaming read I/O for BRIN vacuum
scans. Although BRIN indexes tend to be relatively small by design,
performance tests have shown performance improvements.
Author: Arseniy Mukhin <arseniy.mukhin.dev@gmail.com>
Discussion: https://postgr.es/m/CAE7r3ML01aiq9Th_1OSz7U7Aq2pWbhMLoz5T%2BPXcg8J9ZAPFFA%40mail.gmail.com M src/backend/access/brin/brin.c
Fix pg_crc32c_armv8_choose.c to build with ancient glibc releases.
commit : 6d969ca687b4b2d4387d318c3fbcf3fc606ea55b
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Mon, 17 Nov 2025 15:24:34 -0500
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Mon, 17 Nov 2025 15:24:34 -0500 If you go back as far as the RHEL7 era, <sys/auxv.h> does not provide
the HWCAPxxx macros needed with elf_aux_info or getauxval, so you need
to get those from the kernel header <asm/hwcap.h> instead. We knew
that for the 32-bit case but failed to extrapolate to the 64-bit case.
Oversight in commit aac831caf.
Reported-by: GaoZengqi <pgf00a@gmail.com>
Author: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/CAFmBtr3Av62-jBzdhFkDHXJF9vQmNtSnH2upwODjnRcsgdTytw@mail.gmail.com
Backpatch-through: 18 M src/port/pg_crc32c_armv8_choose.c
Clean up match_orclause_to_indexcol().
commit : ed931377abc0403ce137d9a7f7ded67cb9355c8d
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Mon, 17 Nov 2025 13:54:52 -0500
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Mon, 17 Nov 2025 13:54:52 -0500 Remove bogus stripping of RelabelTypes: that can result in building
an output SAOP tree with incorrect exposed exprType for the operands,
which might confuse polymorphic operators. Moreover it demonstrably
prevents folding some OR-trees to SAOPs when the RHS expressions
have different base types that were coerced to the same type by
RelabelTypes.
Reduce prohibition on type_is_rowtype to just disallow type RECORD.
We need that because otherwise we would happily fold multiple RECORD
Consts into a RECORDARRAY Const even if they aren't the same record
type. (We could allow that perhaps, if we checked that they all have
the same typmod, but the case doesn't seem worth that much effort.)
However, there is no reason at all to disallow the transformation
for named composite types, nor domains over them: as long as we can
find a suitable array type we're good.
Remove some assertions that seem rather out of place (it's not
this code's duty to verify that the RestrictInfo structure is
sane). Rewrite some comments.
The issues with RelabelType stripping seem severe enough to
back-patch this into v18 where the code was introduced.
Author: Tender Wang <tndrwang@gmail.com>
Co-authored-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/CAHewXN=aH7GQBk4fXU-WaEeVmQWUmBAeNyBfJ3VKzPphyPKUkQ@mail.gmail.com
Backpatch-through: 18 M src/backend/optimizer/path/indxpath.c
doc: Document default values for some pg_recvlogical options.
commit : 6793d6a839c1e4eac495fd0c48b75dc1871425c8
author : Fujii Masao <fujii@postgresql.org>
date : Mon, 17 Nov 2025 23:24:39 +0900
committer: Fujii Masao <fujii@postgresql.org>
date : Mon, 17 Nov 2025 23:24:39 +0900 The documentation did not previously mention the default values for
the --fsync-interval and --plugin options, even though pg_recvlogical --help
shows them. This omission made it harder for users to understand
the tool's behavior from the documentation alone.
This commit adds the missing default value descriptions for both options
to the pg_recvlogical documentation.
Author: Fujii Masao <masao.fujii@gmail.com>
Reviewed-by: Laurenz Albe <laurenz.albe@cybertec.at>
Discussion: https://postgr.es/m/CAHGQGwFqssPBjkWMFofGq32e_tANOeWN-cM=6biAP3nnFUXMRw@mail.gmail.com M doc/src/sgml/ref/pg_recvlogical.sgml
Fix typos in logical replication code comments
commit : ab805989b2ee500cfa060ea36a9133b355bb4f0f
author : Daniel Gustafsson <dgustafsson@postgresql.org>
date : Mon, 17 Nov 2025 13:37:25 +0100
committer: Daniel Gustafsson <dgustafsson@postgresql.org>
date : Mon, 17 Nov 2025 13:37:25 +0100 Author: Chao Li <lic@highgo.com>
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>
Discussion: https://postgr.es/m/CAEoWx2kt8m7wV39_zOBds5SNXx9EAkDqb5cPshk7Bxw6Js4Zpg@mail.gmail.com M src/backend/commands/subscriptioncmds.c
M src/backend/replication/logical/launcher.c
Mention md5 deprecation in postgresql.conf.sample
commit : 721bf9ce18b63c096104efd419af7e59053a333a
author : Daniel Gustafsson <dgustafsson@postgresql.org>
date : Mon, 17 Nov 2025 12:18:18 +0100
committer: Daniel Gustafsson <dgustafsson@postgresql.org>
date : Mon, 17 Nov 2025 12:18:18 +0100 PostgreSQL 18 deprecated password_encryption='md5', but the
comments for this GUC in the sample configuration file did
not mention the deprecation. Update comments with a notice
to make as many users as possible aware of it. Also add a
comment to the related md5_password_warnings GUC while there.
Author: Michael Banck <mbanck@gmx.net>
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>
Reviewed-by: Nathan Bossart <nathandbossart@gmail.com>
Reviewed-by: Robert Treat <rob@xzilla.net>
Backpatch-through: 18 M src/backend/utils/misc/postgresql.conf.sample
Rework output format of pg_dependencies
commit : e76defbcf09e22941d8cea462e2deef36d43fa04
author : Michael Paquier <michael@paquier.xyz>
date : Mon, 17 Nov 2025 10:44:26 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Mon, 17 Nov 2025 10:44:26 +0900 The existing format of pg_dependencies uses a single-object JSON
structure, with each key value embedding all the knowledge about the
set attributes tracked, like:
{"1 => 5": 1.000000, "5 => 1": 0.423130}
While this is a very compact format, it is confusing to read and it is
difficult to manipulate the values within the object, particularly when
tracking multiple attributes.
The new output format introduced in this commit is a JSON array of
objects, with:
- A key named "degree", with a float value.
- A key named "attributes", with an array of attribute numbers.
- A key named "dependency", with an attribute number.
The values use the same underlying type as previously when printed, with
a new output format that shows now as follows:
[{"degree": 1.000000, "attributes": [1], "dependency": 5},
{"degree": 0.423130, "attributes": [5], "dependency": 1}]
This new format will become handy for a follow-up set of changes, so as
it becomes possible to inject extended statistics rather than require an
ANALYZE, like in a dump/restore sequence or after pg_upgrade on a new
cluster.
This format has been suggested by Tomas Vondra. The key names are
defined in the header introduced by 1f927cce4498, to ease the
integration of frontend-specific changes that are still under
discussion. (Again a personal note: if anybody comes up with better
name for the keys, of course feel free.)
The bulk of the changes come from the regression tests, where
jsonb_pretty() is now used to make the outputs generated easier to
parse.
Author: Corey Huinker <corey.huinker@gmail.com>
Reviewed-by: Jian He <jian.universality@gmail.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://postgr.es/m/CADkLM=dpz3KFnqP-dgJ-zvRvtjsa8UZv8wDAQdqho=qN3kX0Zg@mail.gmail.com M doc/src/sgml/perform.sgml
M src/backend/utils/adt/pg_dependencies.c
M src/include/statistics/statistics_format.h
M src/test/regress/expected/stats_ext.out
M src/test/regress/sql/stats_ext.sql
Rework output format of pg_ndistinct
commit : 1f927cce44983ed59a3c1eccc95ad2946ac13b42
author : Michael Paquier <michael@paquier.xyz>
date : Mon, 17 Nov 2025 09:52:20 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Mon, 17 Nov 2025 09:52:20 +0900 The existing format of pg_ndistinct uses a single-object JSON structure
where each key is itself a comma-separated list of attnums, like:
{"3, 4": 11, "3, 6": 11, "4, 6": 11, "3, 4, 6": 11}
While this is a very compact format, it is confusing to read and it is
difficult to manipulate the values within the object.
The new output format introduced in this commit is an array of objects,
with:
- A key named "attributes", that contains an array of attribute numbers.
- A key named "ndistinct", represented as an integer.
The values use the same underlying type as previously when printed, with
a new output format that shows now as follows:
[{"ndistinct": 11, "attributes": [3,4]},
{"ndistinct": 11, "attributes": [3,6]},
{"ndistinct": 11, "attributes": [4,6]},
{"ndistinct": 11, "attributes": [3,4,6]}]
This new format will become handy for a follow-up set of changes, so as
it becomes possible to inject extended statistics rather than require an
ANALYZE, like in a dump/restore sequence or after pg_upgrade on a new
cluster.
This format has been suggested by Tomas Vondra. The key names are
defined in a new header, to ease with the integration of
frontend-specific changes that are still under discussion. (Personal
note: I am not specifically wedded to these key names, but if there are
better name suggestions for this release, feel free.)
The bulk of the changes come from the regression tests, where
jsonb_pretty() is now used to make the outputs generated easier to
parse.
Author: Corey Huinker <corey.huinker@gmail.com>
Reviewed-by: Jian He <jian.universality@gmail.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://postgr.es/m/CADkLM=dpz3KFnqP-dgJ-zvRvtjsa8UZv8wDAQdqho=qN3kX0Zg@mail.gmail.com M doc/src/sgml/perform.sgml
M src/backend/utils/adt/pg_ndistinct.c
A src/include/statistics/statistics_format.h
M src/test/regress/expected/stats_ext.out
M src/test/regress/sql/stats_ext.sql
Define PS_USE_CLOBBER_ARGV on GNU/Hurd.
commit : 32b236644d33f6877a2ba0a8e18e17c985f502ce
author : Thomas Munro <tmunro@postgresql.org>
date : Mon, 17 Nov 2025 12:01:12 +1300
committer: Thomas Munro <tmunro@postgresql.org>
date : Mon, 17 Nov 2025 12:01:12 +1300 Until d2ea2d310dfdc40328aca5b6c52225de78432e01, the PS_USE_PS_STRINGS
option was used on the GNU/Hurd. As this option got removed and
PS_USE_CLOBBER_ARGV appears to work fine nowadays on the Hurd, define
this one to re-enable process title changes on this platform.
In the 14 and 15 branches, the existing test for __hurd__ (added 25
years ago by commit 209aa77d, removed in 16 by the above commit) is left
unchanged for now as it was activating slightly different code paths and
would need investigation by a Hurd user.
Author: Michael Banck <mbanck@debian.org>
Discussion: https://postgr.es/m/CA%2BhUKGJMNGUAqf27WbckYFrM-Mavy0RKJvocfJU%3DJ2XcAZyv%2Bw%40mail.gmail.com
Backpatch-through: 16 M src/backend/utils/misc/ps_status.c
Adjust MemSet macro to use size_t rather than long
commit : 586d63214e369283472b5c03fdbaf59833209b3e
author : David Rowley <drowley@postgresql.org>
date : Mon, 17 Nov 2025 12:27:00 +1300
committer: David Rowley <drowley@postgresql.org>
date : Mon, 17 Nov 2025 12:27:00 +1300 Likewise for MemSetAligned.
"long" wasn't the most suitable type for these macros as with MSVC in
64-bit builds, sizeof(long) == 4, which is narrower than the processor's
word size, therefore these macros had to perform twice as many loops as
they otherwise might.
Author: David Rowley <dgrowleyml@gmail.com>
Reviewed-by: Heikki Linnakangas <hlinnaka@iki.fi>
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Discussion: https://postgr.es/m/CAApHDvoGFjSA3aNyVQ3ivbyc4ST=CC5L-_VjEUQ92HbE2Cxovg@mail.gmail.com M src/include/c.h
Get rid of long datatype in CATCACHE_STATS enabled builds
commit : 9c047da51f270b25fe03ee114e1de0c64aa9cc18
author : David Rowley <drowley@postgresql.org>
date : Mon, 17 Nov 2025 12:26:41 +1300
committer: David Rowley <drowley@postgresql.org>
date : Mon, 17 Nov 2025 12:26:41 +1300 "long" is 32 bits on Windows 64-bit. Switch to a datatype that's 64-bit
on all platforms. While we're there, use an unsigned type as these
fields count things that have occurred, of which it's not possible to
have negative numbers of.
Author: David Rowley <dgrowleyml@gmail.com>
Reviewed-by: Heikki Linnakangas <hlinnaka@iki.fi>
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Discussion: https://postgr.es/m/CAApHDvoGFjSA3aNyVQ3ivbyc4ST=CC5L-_VjEUQ92HbE2Cxovg@mail.gmail.com M src/backend/utils/cache/catcache.c
M src/include/utils/catcache.h
Add test for temporary file removal and WITH HOLD cursor
commit : e7cde9dad285acb579b189e82a57fa7b98f23a11
author : Michael Paquier <michael@paquier.xyz>
date : Mon, 17 Nov 2025 08:01:04 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Mon, 17 Nov 2025 08:01:04 +0900 This new test, added in 009_log_temp_files, checks that the temporary
files created by a WITH HOLD cursor are dropped at the end of the
transaction where the transaction has been created.
The portal's executor is shutdown in PersistHoldablePortal(), after for
example some forced detoast, so as the cursor data can be accessed
without requiring a snapshot.
Author: Mircea Cadariu <cadariu.mircea@gmail.com>
Discussion: https://postgr.es/m/0a666d28-9080-4239-90d6-f6345bb43468@gmail.com M src/test/modules/test_misc/t/009_log_temp_files.pl
Fix Assert failure in EXPLAIN ANALYZE MERGE with a concurrent update.
commit : 1b92fe7bb9d8b8977bf7e48912b12f97f128ec1d
author : Dean Rasheed <dean.a.rasheed@gmail.com>
date : Sun, 16 Nov 2025 22:14:06 +0000
committer: Dean Rasheed <dean.a.rasheed@gmail.com>
date : Sun, 16 Nov 2025 22:14:06 +0000 When instrumenting a MERGE command containing both WHEN NOT MATCHED BY
SOURCE and WHEN NOT MATCHED BY TARGET actions using EXPLAIN ANALYZE, a
concurrent update of the target relation could lead to an Assert
failure in show_modifytable_info(). In a non-assert build, this would
lead to an incorrect value for "skipped" tuples in the EXPLAIN output,
rather than a crash.
This could happen if the concurrent update caused a matched row to no
longer match, in which case ExecMerge() treats the single originally
matched row as a pair of not matched rows, and potentially executes 2
not-matched actions for the single source row. This could then lead to
a state where the number of rows processed by the ModifyTable node
exceeds the number of rows produced by its source node, causing
"skipped_path" in show_modifytable_info() to be negative, triggering
the Assert.
Fix this in ExecMergeMatched() by incrementing the instrumentation
tuple count on the source node whenever a concurrent update of this
kind is detected, if both kinds of merge actions exist, so that the
number of source rows matches the number of actions potentially
executed, and the "skipped" tuple count is correct.
Back-patch to v17, where support for WHEN NOT MATCHED BY SOURCE
actions was introduced.
Bug: #19111
Reported-by: Dilip Kumar <dilipbalaut@gmail.com>
Author: Dean Rasheed <dean.a.rasheed@gmail.com>
Reviewed-by: Dilip Kumar <dilipbalaut@gmail.com>
Discussion: https://postgr.es/m/19111-5b06624513d301b3@postgresql.org
Backpatch-through: 17 M src/backend/executor/nodeModifyTable.c
M src/test/isolation/expected/merge-update.out
M src/test/isolation/specs/merge-update.spec
Doc: include MERGE in variable substitution command list
commit : 2b54a1abdbb09a4b170bca82726dabe7b2d6555b
author : David Rowley <drowley@postgresql.org>
date : Mon, 17 Nov 2025 10:51:26 +1300
committer: David Rowley <drowley@postgresql.org>
date : Mon, 17 Nov 2025 10:51:26 +1300 Backpatch to 15, where MERGE was introduced.
Reported-by: <emorgunov@mail.ru>
Author: David Rowley <dgrowleyml@gmail.com>
Discussion: https://postgr.es/m/176278494385.770.15550176063450771532@wrigleys.postgresql.org
Backpatch-through: 15 M doc/src/sgml/plpgsql.sgml
Fix incorrect function name in comments
commit : 23792d7381583d04c4bbd0a8507566401ec013d3
author : Alexander Korotkov <akorotkov@postgresql.org>
date : Sat, 15 Nov 2025 12:16:54 +0200
committer: Alexander Korotkov <akorotkov@postgresql.org>
date : Sat, 15 Nov 2025 12:16:54 +0200 Update comments to reference WaitForLSN() instead of the outdated
WaitForLSNReplay() function name.
Discussion: https://postgr.es/m/CABPTF7UieOYbOgH3EnQCasaqcT1T4N6V2wammwrWCohQTnD_Lw%40mail.gmail.com
Author: Xuneng Zhou <xunengzhou@gmail.com>
Reviewed-by: Alexander Korotkov <aekorotkov@gmail.com> M src/backend/commands/wait.c
M src/include/access/xlogwait.h
Fix WaitLSNWakeup() fast-path check for InvalidXLogRecPtr
commit : ede6acef49673df0a880edae405ca69393bb48d0
author : Alexander Korotkov <akorotkov@postgresql.org>
date : Sat, 15 Nov 2025 12:16:23 +0200
committer: Alexander Korotkov <akorotkov@postgresql.org>
date : Sat, 15 Nov 2025 12:16:23 +0200 WaitLSNWakeup() incorrectly returned early when called with
InvalidXLogRecPtr (meaning "wake all waiters"), because the fast-path
check compared minWaitedLSN > 0 without validating currentLSN first.
This caused WAIT FOR LSN commands to wait indefinitely during standby
promotion until random signals woke them.
Add an XLogRecPtrIsValid() check before the comparison so that
InvalidXLogRecPtr bypasses the fast-path and wakes all waiters immediately.
Discussion: https://postgr.es/m/CABPTF7UieOYbOgH3EnQCasaqcT1T4N6V2wammwrWCohQTnD_Lw%40mail.gmail.com
Author: Xuneng Zhou <xunengzhou@gmail.com>
Reviewed-by: Alexander Korotkov <aekorotkov@gmail.com> M src/backend/access/transam/xlogwait.c
Add test for postgresql.conf.sample line syntax
commit : 446568c22207795da02e26b6b2956a61bd17e912
author : Daniel Gustafsson <dgustafsson@postgresql.org>
date : Fri, 14 Nov 2025 23:44:56 +0100
committer: Daniel Gustafsson <dgustafsson@postgresql.org>
date : Fri, 14 Nov 2025 23:44:56 +0100 All GUCs in postgresql.conf.sample should be set to the default
value and be commented out. This syntax was however not tested
for, making omissions easy to miss. Add a test which check all
lines for syntax.
Author: Daniel Gustafsson <daniel@yesql.se>
Reviewed-by: Andrew Dunstan <andrew@dunslane.net>
Discussion: https://postgr.es/m/19727040-3EE4-4719-AF4F-2548544113D7@yesql.se M src/test/modules/test_misc/t/003_check_guc.pl
Comment out autovacuum_worker_slots in postgresql.conf.sample.
commit : 478c4814a05262c0312c813bf393c4736d76f3f9
author : Nathan Bossart <nathan@postgresql.org>
date : Fri, 14 Nov 2025 13:45:04 -0600
committer: Nathan Bossart <nathan@postgresql.org>
date : Fri, 14 Nov 2025 13:45:04 -0600 All settings in this file should be commented out. In addition to
fixing that, also fix the indentation for this line.
Oversight in commit c758119e5b.
Reported-by: Daniel Gustafsson <daniel@yesql.se>
Author: Daniel Gustafsson <daniel@yesql.se>
Discussion: https://postgr.es/m/19727040-3EE4-4719-AF4F-2548544113D7%40yesql.se
Backpatch-through: 18 M src/backend/utils/misc/postgresql.conf.sample
Add note about CreateStatistics()'s selective use of check_rights.
commit : 7506bdbbf45ea757f67162a352196976379ccdd7
author : Nathan Bossart <nathan@postgresql.org>
date : Fri, 14 Nov 2025 13:20:09 -0600
committer: Nathan Bossart <nathan@postgresql.org>
date : Fri, 14 Nov 2025 13:20:09 -0600 Commit 5e4fcbe531 added a check_rights parameter to this function
for use by ALTER TABLE commands that re-create statistics objects.
However, we intentionally ignore check_rights when verifying
relation ownership because this function's lookup could return a
different answer than the caller's. This commit adds a note to
this effect so that we remember it down the road.
Reviewed-by: Noah Misch <noah@leadboat.com>
Backpatch-through: 14 M src/backend/commands/statscmds.c
doc: clarify that logical slots track transaction activity
commit : 4c00960772237325bcdf75f1a068c712e392a69b
author : Bruce Momjian <bruce@momjian.us>
date : Fri, 14 Nov 2025 10:45:59 -0500
committer: Bruce Momjian <bruce@momjian.us>
date : Fri, 14 Nov 2025 10:45:59 -0500 Previously it only mentioned WAL retention.
Discussion: https://postgr.es/m/pexmenhqptw5h4ma4qasz3cvjtynivxprqifgghdjtmkxdig2g@djg7bk2p6pts
Backpatch-through: master M doc/src/sgml/logical-replication.sgml
doc: double-quote use of %f, %p, and %r in literal commands.
commit : 43e6929bb2945553df021874914ade88743abc1f
author : Bruce Momjian <bruce@momjian.us>
date : Fri, 14 Nov 2025 09:08:53 -0500
committer: Bruce Momjian <bruce@momjian.us>
date : Fri, 14 Nov 2025 09:08:53 -0500 Path expansion might expose characters like spaces which would cause
command failure, so double-quote the examples. While %f doesn't need
quoting since it uses a fixed character set, it is best to be
consistent.
Discussion: https://postgr.es/m/aROPCQCfvKp9Htk4@momjian.us
Backpatch-through: master M doc/src/sgml/backup.sgml
M doc/src/sgml/config.sgml
M doc/src/sgml/high-availability.sgml
M doc/src/sgml/ref/pgarchivecleanup.sgml
M src/backend/utils/misc/postgresql.conf.sample
doc: remove verbiage about "receiving" data from rep. slots
commit : a554389fb5f96baba834c28bd4fc802fa1c8065f
author : Bruce Momjian <bruce@momjian.us>
date : Fri, 14 Nov 2025 08:55:42 -0500
committer: Bruce Momjian <bruce@momjian.us>
date : Fri, 14 Nov 2025 08:55:42 -0500 The slots are just LSN markers, not something to receive from.
Backpatch-through: master M doc/src/sgml/logical-replication.sgml
pgbench: Fix assertion failure with multiple \syncpipeline in pipeline mode.
commit : 4aa0ac05765edf6b5f0c13e18ac677287ce78206
author : Fujii Masao <fujii@postgresql.org>
date : Fri, 14 Nov 2025 22:40:39 +0900
committer: Fujii Masao <fujii@postgresql.org>
date : Fri, 14 Nov 2025 22:40:39 +0900 Previously, when pgbench ran a custom script that triggered retriable errors
(e.g., deadlocks) followed by multiple \syncpipeline commands in pipeline mode,
the following assertion failure could occur:
Assertion failed: (res == ((void*)0)), function discardUntilSync, file pgbench.c, line 3594.
The issue was that discardUntilSync() assumed a pipeline sync result
(PGRES_PIPELINE_SYNC) would always be followed by either another sync result
or NULL. This assumption was incorrect: when multiple sync requests were sent,
a sync result could instead be followed by another result type. In such cases,
discardUntilSync() mishandled the results, leading to the assertion failure.
This commit fixes the issue by making discardUntilSync() correctly handle cases
where a pipeline sync result is followed by other result types. It now continues
discarding results until another pipeline sync followed by NULL is reached.
Backpatched to v17, where support for \syncpipeline command in pgbench was
introduced.
Author: Yugo Nagata <nagata@sraoss.co.jp>
Reviewed-by: Chao Li <lic@highgo.com>
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>
Discussion: https://postgr.es/m/20251111105037.f3fc554616bc19891f926c5b@sraoss.co.jp
Backpatch-through: 17 M src/bin/pgbench/pgbench.c
Doc: add IDs to copy.sgml's <varlistentry> and <refsect1>
commit : e4018f891dec09ff95ac97e5b1a2307349aeeffa
author : Álvaro Herrera <alvherre@kurilemu.de>
date : Fri, 14 Nov 2025 11:29:50 +0100
committer: Álvaro Herrera <alvherre@kurilemu.de>
date : Fri, 14 Nov 2025 11:29:50 +0100 In the spirit of commit 78ee60ed84bb.
Author: jian he <jian.universality@gmail.com>
Discussion: https://postgr.es/m/CACJufxFsPXCwSVR+_vScZ3bysh4-dpE19iVyeta30uNHwnwnSw@mail.gmail.com M doc/src/sgml/ref/copy.sgml
Revert "Drop unnamed portal immediately after execution to completion"
commit : 910690415b661186ae44e3b5e538e23eaa48de1b
author : Michael Paquier <michael@paquier.xyz>
date : Fri, 14 Nov 2025 14:37:10 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Fri, 14 Nov 2025 14:37:10 +0900 This reverts commit 1fd981f05369, based on concerns that the logging
improvements do not justify the protocol breakage of dropping an unnamed
portal once its execution has completed.
It seems unlikely that one would try to send an execute or describe
message after the portal has been used, but if they do such
post-completion messages would not be able to process as the previous
versions. Let's revert this change for now so as we keep compatibility
and consider a different solution.
The tests added by 76bba033128a track the pre-1fd981f05369 behavior, and
are still valid.
Discussion: https://postgr.es/m/CA+TgmoYFJyJNQw3RT7veO3M2BWRE9Aw4hprC5rOcawHZti-f8g@mail.gmail.com M doc/src/sgml/protocol.sgml
M src/backend/tcop/postgres.c
M src/test/modules/test_misc/t/009_log_temp_files.pl
doc: adjust "Replication Slot" to mention physical & logical
commit : 8fa6b9030d689c856578e5769088a2527b7283d6
author : Bruce Momjian <bruce@momjian.us>
date : Thu, 13 Nov 2025 21:53:13 -0500
committer: Bruce Momjian <bruce@momjian.us>
date : Thu, 13 Nov 2025 21:53:13 -0500 Much of the "Replication Slot" chapter applies to physical and logical
slots, but it was sloppy in mentioning mostly physical slots. This
patch clarified which parts of the text apply to which slot types.
This chapter is referenced from the logical slot/subscriber chapter, so
it needs to do double duty.
Backpatch-through: master M doc/src/sgml/high-availability.sgml
doc: clarify "logical" replication slots
commit : ada78cd7f80a818de1924180ff5a0647cf59ccfb
author : Bruce Momjian <bruce@momjian.us>
date : Thu, 13 Nov 2025 21:35:28 -0500
committer: Bruce Momjian <bruce@momjian.us>
date : Thu, 13 Nov 2025 21:35:28 -0500 Also mention that logical replication slots are created by default when
subscriptions are created. This should clarify the text.
Backpatch-through: master M doc/src/sgml/logical-replication.sgml
doc: clarify "physical" replication slot creation on the primary
commit : a5b69e30731fb623715ecf4c8073c0f2dee41678
author : Bruce Momjian <bruce@momjian.us>
date : Thu, 13 Nov 2025 20:44:00 -0500
committer: Bruce Momjian <bruce@momjian.us>
date : Thu, 13 Nov 2025 20:44:00 -0500 Previously it was not clear that "physical" replication slots were being
discussed, and that they needed to be created on the primary and not the
standby.
Backpatch-through: master M doc/src/sgml/high-availability.sgml
doc: reorder logical replication benefits in a logical order
commit : acbc9beaaed6ee88416e1dcef5df77fd5baba0be
author : Bruce Momjian <bruce@momjian.us>
date : Thu, 13 Nov 2025 18:12:37 -0500
committer: Bruce Momjian <bruce@momjian.us>
date : Thu, 13 Nov 2025 18:12:37 -0500 The previous ordering was hard to understand and remember. Also adjust
wording to be more consistent with surrounding items.
Backpatch-through: master M doc/src/sgml/logical-replication.sgml
Document that pg_getaddrinfo_all does not accept null hints
commit : d22cc7326ce0fe5033f2c6e3f711047d263c1c86
author : Daniel Gustafsson <dgustafsson@postgresql.org>
date : Thu, 13 Nov 2025 16:35:07 +0100
committer: Daniel Gustafsson <dgustafsson@postgresql.org>
date : Thu, 13 Nov 2025 16:35:07 +0100 While the underlying getaddrinfo call accepts a null pointer for
the hintp parameter, pg_getaddrinfo_all does not. Document this
difference with a comment to make it clear.
Author: Daniel Gustafsson <daniel@yesql.se>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Reported-by: Sergey Tatarintsev <s.tatarintsev@postgrespro.ru>
Discussion: https://postgr.es/m/1e5efc94-407e-40b8-8b10-4d25f823c6d7@postgrespro.ru M src/common/ip.c
doc: Improve description of RLS policies applied by command type.
commit : 7dc4fa91413d62c47f41043c0fce0be536f51e13
author : Dean Rasheed <dean.a.rasheed@gmail.com>
date : Thu, 13 Nov 2025 12:00:56 +0000
committer: Dean Rasheed <dean.a.rasheed@gmail.com>
date : Thu, 13 Nov 2025 12:00:56 +0000 On the CREATE POLICY page, the "Policies Applied by Command Type"
table was missing MERGE ... THEN DELETE and some of the policies
applied during INSERT ... ON CONFLICT and MERGE. Fix that, and try to
improve readability by listing the various MERGE cases separately,
rather than together with INSERT/UPDATE/DELETE. Mention COPY ... TO
along with SELECT, since it behaves in the same way. In addition,
document which policy violations cause errors to be thrown, and which
just cause rows to be silently ignored.
Also, a paragraph above the table states that INSERT ... ON CONFLICT
DO UPDATE only checks the WITH CHECK expressions of INSERT policies
for rows appended to the relation by the INSERT path, which is
incorrect -- all rows proposed for insertion are checked, regardless
of whether they end up being inserted. Fix that, and also mention that
the same applies to INSERT ... ON CONFLICT DO NOTHING.
In addition, in various other places on that page, clarify how the
different types of policy are applied to different commands, and
whether or not errors are thrown when policy checks do not pass.
Backpatch to all supported versions. Prior to v17, MERGE did not
support RETURNING, and so MERGE ... THEN INSERT would never check new
rows against SELECT policies. Prior to v15, MERGE was not supported at
all.
Author: Dean Rasheed <dean.a.rasheed@gmail.com>
Reviewed-by: Viktor Holmberg <v@viktorh.net>
Reviewed-by: Jian He <jian.universality@gmail.com>
Discussion: https://postgr.es/m/CAEZATCWqnfeChjK=n1V_dYZT4rt4mnq+ybf9c0qXDYTVMsy8pg@mail.gmail.com
Backpatch-through: 14 M doc/src/sgml/ref/create_policy.sgml
Add some missing #include <limits.h>.
commit : 017249b828880073140a3e4cc13858804b4418de
author : Thomas Munro <tmunro@postgresql.org>
date : Thu, 13 Nov 2025 22:56:08 +1300
committer: Thomas Munro <tmunro@postgresql.org>
date : Thu, 13 Nov 2025 22:56:08 +1300 These files relied on transitive inclusion via port/atomics.h for
constants CHAR_BIT and INT_MAX.
Reviewed-by: Heikki Linnakangas <hlinnaka@iki.fi>
Discussion: https://postgr.es/m/536409d2-c9df-4ef3-808d-1ffc3182868c@iki.fi M src/backend/access/brin/brin_bloom.c
M src/backend/lib/dshash.c
M src/backend/storage/lmgr/condition_variable.c
Add commit c2b0e3a0351e to .git-blame-ignore-revs.
commit : e6c9186e68382d2a91e23da9225261a781a667f7
author : Michael Paquier <michael@paquier.xyz>
date : Thu, 13 Nov 2025 14:27:24 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Thu, 13 Nov 2025 14:27:24 +0900 M .git-blame-ignore-revs
Fix indentation issue
commit : c2b0e3a0351e021dea9b61fe2f759570d3fedb70
author : Michael Paquier <michael@paquier.xyz>
date : Thu, 13 Nov 2025 14:25:21 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Thu, 13 Nov 2025 14:25:21 +0900 Issue introduced by 84fb27511dbe. I have missed this diff while
adding pgoff_t to the typedef list of pgindent, while addressing a
separate indentation issue.
Per buildfarm member koel. M src/bin/pg_dump/pg_backup_archiver.c
Replace off_t by pgoff_t in I/O routines
commit : 84fb27511dbeaa0fb0d48249083d71f6cbbd4b98
author : Michael Paquier <michael@paquier.xyz>
date : Thu, 13 Nov 2025 12:41:40 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Thu, 13 Nov 2025 12:41:40 +0900 PostgreSQL's Windows port has never been able to handle files larger
than 2GB due to the use of off_t for file offsets, only 32-bit on
Windows. This causes signed integer overflow at exactly 2^31 bytes when
trying to handle files larger than 2GB, for the routines touched by this
commit.
Note that large files are forbidden by ./configure (3c6248a828af) and
meson (recent change, see 79cd66f28c65). This restriction also exists
in v16 and older versions for the now-dead MSVC scripts.
The code base already defines pgoff_t as __int64 (64-bit) on Windows for
this purpose, and some function declarations in headers use it, but many
internals still rely on off_t. This commit switches more routines to
use pgoff_t, offering more portability, for areas mainly related to file
extensions and storage.
These are not critical for WAL segments yet, which have currently a
maximum size allowed of 1GB (well, this opens the door at allowing a
larger size for them). This matters more for segment files if we want
to lift the large file restriction in ./configure and meson in the
future, which would make sense to remove once/if all traces of off_t are
gone from the tree. This can additionally matter for out-of-core code
that may want files larger than 2GB in places where off_t is four bytes
in size.
Note that off_t is still used in other parts of the tree like
buffile.c, WAL sender/receiver, base backup, pg_combinebackup, etc.
These other code paths can be addressed separately, and their update
will be required if we want to remove the large file restriction in the
future. This commit is a good first cut in itself towards more
portability, hopefully.
On Unix-like systems, pgoff_t is defined as off_t, so this change only
affects Windows behavior.
Author: Bryan Green <dbryan.green@gmail.com>
Reviewed-by: Thomas Munro <thomas.munro@gmail.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://postgr.es/m/0f238ff4-c442-42f5-adb8-01b762c94ca1@gmail.com M src/backend/access/transam/xlogreader.c
M src/backend/access/transam/xlogrecovery.c
M src/backend/replication/walreceiver.c
M src/backend/storage/file/fd.c
M src/backend/storage/smgr/md.c
M src/common/file_utils.c
M src/include/common/file_utils.h
M src/include/port/pg_iovec.h
M src/include/port/win32_port.h
M src/include/storage/fd.h
M src/port/win32pread.c
M src/port/win32pwrite.c
M src/tools/pgindent/typedefs.list
Fix incorrect assignment of InvalidXLogRecPtr to a non-LSN variable.
commit : 705601c5aeab56aef62dd69ac2b7acf662f08e9c
author : Fujii Masao <fujii@postgresql.org>
date : Thu, 13 Nov 2025 08:44:33 +0900
committer: Fujii Masao <fujii@postgresql.org>
date : Thu, 13 Nov 2025 08:44:33 +0900 pg_logical_slot_get_changes_guts() previously assigned InvalidXLogRecPtr to
the local variable upto_nchanges, which is of type int32, not XLogRecPtr.
While this caused no functional issue since InvalidXLogRecPtr is defined as 0,
it was semantically incorrect.
This commit fixes the issue by updating pg_logical_slot_get_changes_guts()
to set upto_nchanges to 0 instead of InvalidXLogRecPtr.
No backpatch is needed, as the previous behavior was harmless.
Author: Fujii Masao <masao.fujii@gmail.com>
Reviewed-by: Steven Niu <niushiji@gmail.com>
Reviewed-by: Xuneng Zhou <xunengzhou@gmail.com>
Discussion: https://postgr.es/m/CAHGQGwHKHuR5NGnGxU3+ebz7cbC1ZAR=AgG4Bueq==Lj6iX8Sw@mail.gmail.com M src/backend/replication/logical/logicalfuncs.c
Remove obsolete autovacuum comment.
commit : 180e7abe68040375b77450d389dafbb0f11186e7
author : Nathan Bossart <nathan@postgresql.org>
date : Wed, 12 Nov 2025 15:13:08 -0600
committer: Nathan Bossart <nathan@postgresql.org>
date : Wed, 12 Nov 2025 15:13:08 -0600 This comment seems to refer to some stuff that was removed during
development in 2005.
Reviewed-by: David Rowley <dgrowleyml@gmail.com>
Reviewed-by: Álvaro Herrera <alvherre@kurilemu.de>
Discussion: https://postgr.es/m/aRJFDxKJLFE_1Iai%40nathan M src/backend/postmaster/autovacuum.c
test_dsa: Avoid leaking LWLock tranches.
commit : c5c74282f2ea222beb7e07fc91b7afd7a06020c2
author : Nathan Bossart <nathan@postgresql.org>
date : Wed, 12 Nov 2025 14:57:48 -0600
committer: Nathan Bossart <nathan@postgresql.org>
date : Wed, 12 Nov 2025 14:57:48 -0600 Since this is a test module, leaking a couple of LWLock tranches is
fine, but we want to discourage that pattern in third-party code.
This commit teaches the module to create only one tranche and to
store its ID in shared memory for use by other backends.
Reported-by: Alexander Lakhin <exclusion@gmail.com>
Reviewed-by: Sami Imseih <samimseih@gmail.com>
Discussion: https://postgr.es/m/dd36d384-55df-4fc2-825c-5bc56c950fa9%40gmail.com M src/test/modules/test_dsa/test_dsa.c
Teach DSM registry to ERROR if attaching to an uninitialized entry.
commit : 1165a933aab1355757a43cfd9193b6cce06f573b
author : Nathan Bossart <nathan@postgresql.org>
date : Wed, 12 Nov 2025 14:30:11 -0600
committer: Nathan Bossart <nathan@postgresql.org>
date : Wed, 12 Nov 2025 14:30:11 -0600 If DSM entry initialization fails, backends could try to use an
uninitialized DSM segment, DSA, or dshash table (since the entry is
still added to the registry). To fix, keep track of whether
initialization completed, and ERROR if a backend tries to attach to
an uninitialized entry. We could instead retry initialization as
needed, but that seemed complicated, error prone, and unlikely to
help most cases. Furthermore, such problems probably indicate a
coding error.
Reported-by: Alexander Lakhin <exclusion@gmail.com>
Reviewed-by: Sami Imseih <samimseih@gmail.com>
Discussion: https://postgr.es/m/dd36d384-55df-4fc2-825c-5bc56c950fa9%40gmail.com
Backpatch-through: 17 M src/backend/storage/ipc/dsm_registry.c
Clear 'xid' in dummy async notify entries written to fill up pages
commit : 0bdc777e80071abd77674f1e66258d410a010aa9
author : Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Wed, 12 Nov 2025 21:19:03 +0200
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Wed, 12 Nov 2025 21:19:03 +0200 Before we started to freeze async notify entries (commit 8eeb4a0f7c),
no one looked at the 'xid' on an entry with invalid 'dboid'. But now
we might actually need to freeze it later. Initialize them with
InvalidTransactionId to begin with, to avoid that work later.
Álvaro pointed this out in review of commit 8eeb4a0f7c, but I forgot
to include this change there.
Author: Álvaro Herrera <alvherre@kurilemu.de>
Discussion: https://www.postgresql.org/message-id/202511071410.52ll56eyixx7@alvherre.pgsql
Backpatch-through: 14 M src/backend/commands/async.c
Fix remaining race condition with CLOG truncation and LISTEN/NOTIFY
commit : 797e9ea6e54b06c3e6c79b468dab89fdbf6be179
author : Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Wed, 12 Nov 2025 20:59:44 +0200
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Wed, 12 Nov 2025 20:59:44 +0200 Previous commit fixed a bug where VACUUM would truncate the CLOG
that's still needed to check the commit status of XIDs in the async
notify queue, but as mentioned in the commit message, it wasn't a full
fix. If a backend is executing asyncQueueReadAllNotifications() and
has just made a local copy of an async SLRU page which contains old
XIDs, vacuum can concurrently truncate the CLOG covering those XIDs,
and the backend still gets an error when it calls
TransactionIdDidCommit() on those XIDs in the local copy. This commit
fixes that race condition.
To fix, hold the SLRU bank lock across the TransactionIdDidCommit()
calls in NOTIFY processing.
Per Tom Lane's idea. Backpatch to all supported versions.
Reviewed-by: Joel Jacobson <joel@compiler.org>
Reviewed-by: Arseniy Mukhin <arseniy.mukhin.dev@gmail.com>
Discussion: https://www.postgresql.org/message-id/2759499.1761756503@sss.pgh.pa.us
Backpatch-through: 14 M src/backend/commands/async.c
Fix bug where we truncated CLOG that was still needed by LISTEN/NOTIFY
commit : 8eeb4a0f7c061ece7a8836e738ea8b7764617d3b
author : Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Wed, 12 Nov 2025 20:59:36 +0200
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Wed, 12 Nov 2025 20:59:36 +0200 The async notification queue contains the XID of the sender, and when
processing notifications we call TransactionIdDidCommit() on the
XID. But we had no safeguards to prevent the CLOG segments containing
those XIDs from being truncated away. As a result, if a backend didn't
for some reason process its notifications for a long time, or when a
new backend issued LISTEN, you could get an error like:
test=# listen c21;
ERROR: 58P01: could not access status of transaction 14279685
DETAIL: Could not open file "pg_xact/000D": No such file or directory.
LOCATION: SlruReportIOError, slru.c:1087
To fix, make VACUUM "freeze" the XIDs in the async notification queue
before truncating the CLOG. Old XIDs are replaced with
FrozenTransactionId or InvalidTransactionId.
Note: This commit is not a full fix. A race condition remains, where a
backend is executing asyncQueueReadAllNotifications() and has just
made a local copy of an async SLRU page which contains old XIDs, while
vacuum concurrently truncates the CLOG covering those XIDs. When the
backend then calls TransactionIdDidCommit() on those XIDs from the
local copy, you still get the error. The next commit will fix that
remaining race condition.
This was first reported by Sergey Zhuravlev in 2021, with many other
people hitting the same issue later. Thanks to:
- Alexandra Wang, Daniil Davydov, Andrei Varashen and Jacques Combrink
for investigating and providing reproducable test cases,
- Matheus Alcantara and Arseniy Mukhin for review and earlier proposed
patches to fix this,
- Álvaro Herrera and Masahiko Sawada for reviews,
- Yura Sokolov aka funny-falcon for the idea of marking transactions
as committed in the notification queue, and
- Joel Jacobson for the final patch version. I hope I didn't forget
anyone.
Backpatch to all supported versions. I believe the bug goes back all
the way to commit d1e027221d, which introduced the SLRU-based async
notification queue.
Discussion: https://www.postgresql.org/message-id/16961-25f29f95b3604a8a@postgresql.org
Discussion: https://www.postgresql.org/message-id/18804-bccbbde5e77a68c2@postgresql.org
Discussion: https://www.postgresql.org/message-id/CAK98qZ3wZLE-RZJN_Y%2BTFjiTRPPFPBwNBpBi5K5CU8hUHkzDpw@mail.gmail.com
Backpatch-through: 14 M src/backend/commands/async.c
M src/backend/commands/vacuum.c
M src/include/commands/async.h
M src/test/modules/xid_wraparound/meson.build
A src/test/modules/xid_wraparound/t/004_notify_freeze.pl
Escalate ERRORs during async notify processing to FATAL
commit : 1b4699090eaf54d35caf13024957fb5fdefde630
author : Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Wed, 12 Nov 2025 20:59:28 +0200
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Wed, 12 Nov 2025 20:59:28 +0200 Previously, if async notify processing encountered an error, we would
report the error to the client and advance our read position past the
offending entry to prevent trying to process it over and over
again. Trying to continue after an error has a few problems however:
- We have no way of telling the client that a notification was
lost. They get an ERROR, but that doesn't tell you much. As such,
it's not clear if keeping the connection alive after losing a
notification is a good thing. Depending on the application logic,
missing a notification could cause the application to get stuck
waiting, for example.
- If the connection is idle, PqCommReadingMsg is set and any ERROR is
turned into FATAL anyway.
- We bailed out of the notification processing loop on first error
without processing any subsequent notifications. The subsequent
notifications would not be processed until another notify interrupt
arrives. For example, if there were two notifications pending, and
processing the first one caused an ERROR, the second notification
would not be processed until someone sent a new NOTIFY.
This commit changes the behavior so that any ERROR while processing
async notifications is turned into FATAL, causing the client
connection to be terminated. That makes the behavior more consistent
as that's what happened in idle state already, and terminating the
connection is a clear signal to the application that it might've
missed some notifications.
The reason to do this now is that the next commits will change the
notification processing code in a way that would make it harder to
skip over just the offending notification entry on error.
Reviewed-by: Matheus Alcantara <matheusssilv97@gmail.com>
Reviewed-by: Álvaro Herrera <alvherre@kurilemu.de>
Reviewed-by: Arseniy Mukhin <arseniy.mukhin.dev@gmail.com>
Discussion: https://www.postgresql.org/message-id/fedbd908-4571-4bbe-b48e-63bfdcc38f64@iki.fi
Backpatch-through: 14 M src/backend/commands/async.c
doc: Document effects of ownership change on privileges
commit : d36acd6f5c924bfe6a8618df49512cf05f898324
author : Daniel Gustafsson <dgustafsson@postgresql.org>
date : Wed, 12 Nov 2025 17:04:35 +0100
committer: Daniel Gustafsson <dgustafsson@postgresql.org>
date : Wed, 12 Nov 2025 17:04:35 +0100 Explicitly document that privileges are transferred along with the
ownership. Backpatch to all supported versions since this behavior
has always been present.
Author: Laurenz Albe <laurenz.albe@cybertec.at>
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>
Reviewed-by: David G. Johnston <david.g.johnston@gmail.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Josef Šimánek <josef.simanek@gmail.com>
Reported-by: Gilles Parc <gparc@free.fr>
Discussion: https://postgr.es/m/2023185982.281851219.1646733038464.JavaMail.root@zimbra15-e2.priv.proxad.net
Backpatch-through: 14 M doc/src/sgml/ddl.sgml
Split out innards of pg_tablespace_location()
commit : 877a024902a73732d9f976804aee9699dcbe1d90
author : Álvaro Herrera <alvherre@kurilemu.de>
date : Wed, 12 Nov 2025 16:39:55 +0100
committer: Álvaro Herrera <alvherre@kurilemu.de>
date : Wed, 12 Nov 2025 16:39:55 +0100 This creates a src/backend/catalog/pg_tablespace.c supporting file
containing a new function get_tablespace_location(), which lets the code
underlying pg_tablespace_location() be reused for other purposes.
Author: Manni Wood <manni.wood@enterprisedb.com>
Author: Nishant Sharma <nishant.sharma@enterprisedb.com>
Reviewed-by: Vaibhav Dalvi <vaibhav.dalvi@enterprisedb.com>
Reviewed-by: Ian Lawrence Barwick <barwick@gmail.com>
Reviewed-by: Jim Jones <jim.jones@uni-muenster.de>
Reviewed-by: Álvaro Herrera <alvherre@kurilemu.de>
Discussion: https://postgr.es/m/CAKWEB6rmnmGKUA87Zmq-s=b3Scsnj02C0kObQjnbL2ajfPWGEw@mail.gmail.com M src/backend/catalog/Makefile
M src/backend/catalog/meson.build
A src/backend/catalog/pg_tablespace.c
M src/backend/utils/adt/misc.c
M src/include/catalog/pg_tablespace.h
Add tab completion support for the WAIT FOR command
commit : a1f7f91be2c24c0a9e8d5b9e75bc43437d5476c2
author : Alexander Korotkov <akorotkov@postgresql.org>
date : Wed, 12 Nov 2025 16:11:14 +0200
committer: Alexander Korotkov <akorotkov@postgresql.org>
date : Wed, 12 Nov 2025 16:11:14 +0200 This commit implements tab completion for the WAIT FOR LSN command in psql.
Discussion: https://postgr.es/m/CABPTF7WnLPKcoTGCGge1dDpOieZ2HGF7OVqhNXDcRLPPdSw%3DxA%40mail.gmail.com
Author: Xuneng Zhou <xunengzhou@gmail.com>
Reviewed-by: Alexander Korotkov <aekorotkov@gmail.com> M src/bin/psql/tab-complete.in.c
Fix range for commit_siblings in sample conf
commit : b4e32a076c95877031f34ed0f0fa5dd3a6f06421
author : Daniel Gustafsson <dgustafsson@postgresql.org>
date : Wed, 12 Nov 2025 13:51:53 +0100
committer: Daniel Gustafsson <dgustafsson@postgresql.org>
date : Wed, 12 Nov 2025 13:51:53 +0100 The range for commit_siblings was incorrectly listed as starting on 1
instead of 0 in the sample configuration file. Backpatch down to all
supported branches.
Author: Man Zeng <zengman@halodbtech.com>
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>
Discussion: https://postgr.es/m/tencent_53B70BA72303AE9C6889E78E@qq.com
Backpatch-through: 14 M src/backend/utils/misc/postgresql.conf.sample
libpq: threadsafety for SSL certificate callback
commit : 9122ff65a1be0fe4d55a34c6d6f7403209f326aa
author : Daniel Gustafsson <dgustafsson@postgresql.org>
date : Wed, 12 Nov 2025 12:37:40 +0100
committer: Daniel Gustafsson <dgustafsson@postgresql.org>
date : Wed, 12 Nov 2025 12:37:40 +0100 In order to make the errorhandling code in backend libpq be thread-
safe the global variable used by the certificate verification call-
back need to be replaced with passing private data.
This moves the threadsafety needle a little but forwards, the call
to strerror_r also needs to be replaced with the error buffer made
thread local. This is left as future work for when add the thread
primitives required for this to the tree.
Author: Daniel Gustafsson <daniel@yesql.se>
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Discussion: https://postgr.es/m/353226C7-97A1-4507-A380-36AA92983AE6@yesql.se M src/backend/libpq/be-secure-openssl.c
Change coding pattern for CURL_IGNORE_DEPRECATION()
commit : 78aae2983091c30e4ddc801c507c17a77b6b1b58
author : Álvaro Herrera <alvherre@kurilemu.de>
date : Wed, 12 Nov 2025 12:35:14 +0100
committer: Álvaro Herrera <alvherre@kurilemu.de>
date : Wed, 12 Nov 2025 12:35:14 +0100 Instead of having to write a semicolon inside the macro argument, we can
insert a semicolon with another macro layer. This no longer gives
pg_bsd_indent indigestion, so we can remove the digestive aids that had
to be installed in the pgindent Perl script.
Author: Álvaro Herrera <alvherre@kurilemu.de>
Reviewed-by: Andrew Dunstan <andrew@dunslane.net>
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/202511111134.njrwf5w5nbjm@alvherre.pgsql
Backpatch-through: 18 M src/interfaces/libpq-oauth/oauth-curl.c
M src/tools/pgindent/pgindent
Fix comments of output routines for pg_ndistinct and pg_dependencies
commit : 040a39ed25bf8480bbd1947a2edeb0167f1e0789
author : Michael Paquier <michael@paquier.xyz>
date : Wed, 12 Nov 2025 20:24:10 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Wed, 12 Nov 2025 20:24:10 +0900 Oversights in 7b504eb282ca (for pg_ndistinct) and 2686ee1b7ccf (for
pg_dependencies).
Reported-by: Man Zeng <zengman@halodbtech.com>
Discussion: https://postgr.es/m/176293711658.2081918.12019224686811870203.pgcf@coridan.postgresql.org M src/backend/utils/adt/pg_dependencies.c
M src/backend/utils/adt/pg_ndistinct.c
Fix pg_upgrade around multixid and mxoff wraparound
commit : 94939c5f3ab0a390e52c0802c7141c42673a48b4
author : Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Wed, 12 Nov 2025 12:20:16 +0200
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Wed, 12 Nov 2025 12:20:16 +0200 pg_resetwal didn't accept multixid 0 or multixact offset UINT32_MAX,
but they are both valid values that can appear in the control file.
That caused pg_upgrade to fail if you tried to upgrade a cluster
exactly at multixid or offset wraparound, because pg_upgrade calls
pg_resetwal to restore multixid/offset on the new cluster to the
values from the old cluster. To fix, allow those values in
pg_resetwal.
Fixes bugs #18863 and #18865 reported by Dmitry Kovalenko.
Backpatch down to v15. Version 14 has the same bug, but the patch
doesn't apply cleanly there. It could be made to work but it doesn't
seem worth the effort given how rare it is to hit this problem with
pg_upgrade, and how few people are upgrading to v14 anymore.
Author: Maxim Orlov <orlovmg@gmail.com>
Discussion: https://www.postgresql.org/message-id/CACG%3DezaApSMTjd%3DM2Sfn5Ucuggd3FG8Z8Qte8Xq9k5-%2BRQis-g@mail.gmail.com
Discussion: https://www.postgresql.org/message-id/18863-72f08858855344a2@postgresql.org
Discussion: https://www.postgresql.org/message-id/18865-d4c66cf35c2a67af@postgresql.org
Backpatch-through: 15 M src/bin/pg_resetwal/pg_resetwal.c
M src/bin/pg_resetwal/t/001_basic.pl
Doc: Add documentation for sequence synchronization.
commit : 55cefadde874e52b57f7b3c2232744e331f9d6bb
author : Amit Kapila <akapila@postgresql.org>
date : Wed, 12 Nov 2025 08:38:32 +0000
committer: Amit Kapila <akapila@postgresql.org>
date : Wed, 12 Nov 2025 08:38:32 +0000 Add documentation describing sequence synchronization support in logical
replication. It explains how sequence changes are synchronized from the
publisher to the subscriber, the configuration requirements, and provide
examples illustrating setup and usage.
Additionally, document the pg_get_sequence_data() function, which allows
users to query sequence details on the publisher to determine when to
refresh corresponding sequences on the subscriber.
Author: Vignesh C <vignesh21@gmail.com>
Reviewed-by: Peter Smith <smithpb2250@gmail.com>
Reviewed-by: shveta malik <shveta.malik@gmail.com>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>
Discussion: https://postgr.es/m/CAA4eK1LC+KJiAkSrpE_NwvNdidw9F2os7GERUeSxSKv71gXysQ@mail.gmail.com M doc/src/sgml/catalogs.sgml
M doc/src/sgml/config.sgml
M doc/src/sgml/func/func-sequence.sgml
M doc/src/sgml/logical-replication.sgml
M doc/src/sgml/monitoring.sgml
M doc/src/sgml/ref/alter_subscription.sgml
M doc/src/sgml/ref/create_subscription.sgml
Move code specific to pg_dependencies to new file
commit : 2ddc8d9e9baae28ba63a9f1c85f0a36deb9112aa
author : Michael Paquier <michael@paquier.xyz>
date : Wed, 12 Nov 2025 16:53:19 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Wed, 12 Nov 2025 16:53:19 +0900 This new file is named pg_dependencies.c and includes all the code
directly related to the data type pg_dependencies, extracted from the
extended statistics code.
Some patches are under discussion to change its input and output
functions, and this separation makes the follow-up changes cleaner by
separating the logic related to the data type and the functional
dependencies statistics core logic in dependencies.c.
Author: Corey Huinker <corey.huinker@gmail.com>
Co-authored-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://postgr.es/m/aQ2k8--a0FfwSwX9@paquier.xyz M src/backend/statistics/dependencies.c
M src/backend/utils/adt/Makefile
M src/backend/utils/adt/meson.build
A src/backend/utils/adt/pg_dependencies.c
Move code specific to pg_ndistinct to new file
commit : a5523123430f39ba26a0d0250fbe10a396ab0703
author : Michael Paquier <michael@paquier.xyz>
date : Wed, 12 Nov 2025 16:34:52 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Wed, 12 Nov 2025 16:34:52 +0900 This new file is named pg_ndistinct.c and includes all the code directly
related to the data type pg_ndistinct, extracted from the extended
statistics code.
Some patches are under discussion to change its input and output
functions, and this separation makes the follow-up changes cleaner by
separating the logic related to the data type and the multivariate
ndistinct coefficient core logic in mvdistinct.c.
Author: Corey Huinker <corey.huinker@gmail.com>
Co-authored-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://postgr.es/m/aQ2k8--a0FfwSwX9@paquier.xyz M src/backend/statistics/mvdistinct.c
M src/backend/utils/adt/Makefile
M src/backend/utils/adt/meson.build
A src/backend/utils/adt/pg_ndistinct.c
doc: Fix incorrect synopsis for ALTER PUBLICATION ... DROP ...
commit : df53fa1c1ebf9bb3e8c17217f7cc1435107067fb
author : Fujii Masao <fujii@postgresql.org>
date : Wed, 12 Nov 2025 13:37:58 +0900
committer: Fujii Masao <fujii@postgresql.org>
date : Wed, 12 Nov 2025 13:37:58 +0900 The synopsis for the ALTER PUBLICATION ... DROP ... command incorrectly
implied that a column list and WHERE clause could be specified as part of
the publication object. However, these options are not allowed for
DROP operations, making the documentation misleading.
This commit corrects the synopsis to clearly show only the valid forms
of publication objects.
Backpatched to v15, where the incorrect synopsis was introduced.
Author: Peter Smith <smithpb2250@gmail.com>
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>
Discussion: https://postgr.es/m/CAHut+PsPu+47Q7b0o6h1r-qSt90U3zgbAHMHUag5o5E1Lo+=uw@mail.gmail.com
Backpatch-through: 15 M doc/src/sgml/ref/alter_publication.sgml
Remove unused assignment in CREATE PUBLICATION grammar.
commit : bfb7419b0bbea96d6edde2a6063718a9cc6a1560
author : Amit Kapila <akapila@postgresql.org>
date : Wed, 12 Nov 2025 03:28:17 +0000
committer: Amit Kapila <akapila@postgresql.org>
date : Wed, 12 Nov 2025 03:28:17 +0000 Commit 96b3784973 extended the grammar for CREATE PUBLICATION to support
the ALL SEQUENCES variant. However, it unnecessarily prepared publication
objects for this variant, which is not required. This was a copy-paste
oversight in that commit.
Additionally, rename pub_obj_type_list to pub_all_obj_type_list to better
reflect its purpose.
Author: Shlok Kyal <shlok.kyal.oss@gmail.com>
Reviewed-by: Vignesh C <vignesh21@gmail.com>
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>
Discussion: https://postgr.es/m/CANhcyEWbjkFvk3mSy5LFs9+0z4K1gDwQeFj7GUjOe+L4vxs4AA@mail.gmail.com
Discussion: https://postgr.es/m/CAA4eK1LC+KJiAkSrpE_NwvNdidw9F2os7GERUeSxSKv71gXysQ@mail.gmail.com M src/backend/parser/gram.y
Prefer spelling "cacheable" over "cachable".
commit : 2421ade663e96e7245e6bbf960b0f6861e39e455
author : Thomas Munro <tmunro@postgresql.org>
date : Wed, 12 Nov 2025 14:20:49 +1300
committer: Thomas Munro <tmunro@postgresql.org>
date : Wed, 12 Nov 2025 14:20:49 +1300 Previously we had both in code and comments. Keep the more common and
accepted variant.
Author: Chao Li <lic@highgo.com>
Reviewed-by: Peter Smith <smithpb2250@gmail.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/5EBF1771-0566-4D08-9F9B-CDCDEF4BDC98@gmail.com M src/backend/access/heap/heapam.c
M src/backend/utils/cache/catcache.c
injection_points: Add tests for name limits
commit : fb9bff04542138d7217e79fc5e1bb9d5fabd9026
author : Michael Paquier <michael@paquier.xyz>
date : Wed, 12 Nov 2025 10:32:50 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Wed, 12 Nov 2025 10:32:50 +0900 The maximum limits for point name, library name, function name and
private area size were not kept track of in the tests. The new function
introduced in 16a2f706951e gives a way to trigger them. This is not
critical but cheap to cover.
While on it, this commit cleans up some of the tests introduced by
16a2f706951e for NULL inputs by using more consistent argument values.
The coverage does not change, but it makes the whole less confusing with
argument values that are correct based their position in the SQL
function called.
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>
Reviewed-by: Xuneng Zhou <xunengzhou@gmail.com>
Discussion: https://postgr.es/m/aRE7zhu6wOA29gFf@paquier.xyz M src/test/modules/injection_points/expected/injection_points.out
M src/test/modules/injection_points/sql/injection_points.sql
Report better object limits in error messages for injection points
commit : 6e1535308c843dc7413a02c83a41f70449c58fb3
author : Michael Paquier <michael@paquier.xyz>
date : Wed, 12 Nov 2025 10:18:50 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Wed, 12 Nov 2025 10:18:50 +0900 Previously, error messages for oversized injection point names, libraries,
and functions showed buffer sizes (64, 128, 128) instead of the usable
character limits (63, 127, 127) as it did not count for the
zero-terminated byte, which was confusing. These messages are adjusted
to show better the reality.
The limit enforced for the private area was also too strict by one byte,
as specifying a zone worth exactly INJ_PRIVATE_MAXLEN should be able to
work because three is no zero-terminated byte in this case.
This is a stylistic change (well, mostly, a private_area size of exactly
1024 bytes can be defined with this change, something that nobody seem
to care about based on the lack of complaints). However, this is a
testing facility let's keep the logic consistent across all the branches
where this code exists, as there is an argument in favor of out-of-core
extensions that use injection points.
Author: Xuneng Zhou <xunengzhou@gmail.com>
Co-authored-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://postgr.es/m/CABPTF7VxYp4Hny1h+7ejURY-P4O5-K8WZg79Q3GUx13cQ6B2kg@mail.gmail.com
Backpatch-through: 17 M src/backend/utils/misc/injection_point.c
Add check for large files in meson.build
commit : 79cd66f28c65abbdc0ed695a9583a530fe6ece14
author : Michael Paquier <michael@paquier.xyz>
date : Wed, 12 Nov 2025 09:02:27 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Wed, 12 Nov 2025 09:02:27 +0900 A similar check existed in the MSVC scripts that have been removed in
v17 by 1301c80b2167, but nothing of the kind was checked in meson when
building with a 4-byte off_t.
This commit adds a check to fail the builds when trying to use a
relation file size higher than 1GB when off_t is 4 bytes, like
./configure, rather than detecting these failures at runtime because the
code is not able to handle large files in this case.
Backpatch down to v16, where meson has been introduced.
Discussion: https://postgr.es/m/aQ0hG36IrkaSGfN8@paquier.xyz
Backpatch-through: 16 M meson.build
Add warning to pg_controldata on PG_CONTROL_VERSION mismatch
commit : 6956bca515e2a07a16c6d68b208766e97b275ddc
author : Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Tue, 11 Nov 2025 19:00:41 +0200
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Tue, 11 Nov 2025 19:00:41 +0200 If you run pg_controldata on a cluster that has been initialized with
different PG_CONTROL_VERSION than what the pg_controldata program has
been compiled with, pg_controldata will still try to interpret the
control file, but the result is likely to be somewhat nonsensical. How
nonsensical it is depends on the differences between the versions. If
sizeof(ControlFileData) differs between the versions, the CRC will not
match and you get a warning of that, but otherwise you get no
warning.
Looking back at recent PG_CONTROL_VERSION updates, all changes that
would mess up the printed values have also changed
sizeof(ControlFileData), but there's no guarantee of that in future
versions.
Add an explicit check and warning for version number mismatch before
the CRC check. That way, you get a more clear warning if you use the
pg_controldata binary from wrong version, and if we change the control
file in the future in a way that doesn't change
sizeof(ControlFileData), this ensures that you get a warning in that
case too.
Discussion: https://www.postgresql.org/message-id/2afded89-f9f0-4191-84d8-8b8668e029a1@iki.fi M src/bin/pg_controldata/pg_controldata.c
M src/bin/pg_controldata/t/001_pg_controldata.pl
Add pg_resetwal and pg_controldata support for new control file field
commit : 676cd9ac07430282df71532b8d0a4f3c09831f76
author : Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Tue, 11 Nov 2025 19:00:34 +0200
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Tue, 11 Nov 2025 19:00:34 +0200 I forgot these in commit 3e0ae46d90.
Discussion: https://www.postgresql.org/message-id/2afded89-f9f0-4191-84d8-8b8668e029a1@iki.fi M src/bin/pg_controldata/pg_controldata.c
M src/bin/pg_resetwal/pg_resetwal.c
Clean up qsort comparison function for GUC entries
commit : d2f24df19b7a42a0944a6926a0ca54168dcefe3a
author : Peter Eisentraut <peter@eisentraut.org>
date : Tue, 11 Nov 2025 07:48:54 +0100
committer: Peter Eisentraut <peter@eisentraut.org>
date : Tue, 11 Nov 2025 07:48:54 +0100 guc_var_compare() is invoked from qsort() on an array of struct
config_generic, but the function accesses these directly as
strings (char *). This relies on the name being the first field, so
this works. But we can write this more clearly by using the struct
and then accessing the field through the struct. Before the
reorganization of the GUC structs (commit a13833c35f9), the old code
was probably more convenient, but now we can write this more clearly
and correctly.
After this change, it is no longer required that the name is the first
field in struct config_generic, so remove that comment.
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://www.postgresql.org/message-id/2c961fa1-14f6-44a2-985c-e30b95654e8d%40eisentraut.org M src/backend/utils/misc/guc.c
M src/include/utils/guc_tables.h
Bump PG_CONTROL_VERSION for commit 3e0ae46d90
commit : e510378358540703a13b77090a0021853bae0745
author : Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Mon, 10 Nov 2025 19:12:08 +0200
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Mon, 10 Nov 2025 19:12:08 +0200 Commit 3e0ae46d90 added a field to ControlFileData and bumped
CATALOG_VERSION_NO, but CATALOG_VERSION_NO is not the right version
number for ControlFileData changes. Bumping either one will force an
initdb, but PG_CONTROL_VERSION is more accurate. Bump
PG_CONTROL_VERSION now.
Reported-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://www.postgresql.org/message-id/1874404.1762787779@sss.pgh.pa.us M src/include/catalog/pg_control.h
Check for CREATE privilege on the schema in CREATE STATISTICS.
commit : 5e4fcbe531c668b4112beedde97aac79724074c5
author : Nathan Bossart <nathan@postgresql.org>
date : Mon, 10 Nov 2025 09:00:00 -0600
committer: Nathan Bossart <nathan@postgresql.org>
date : Mon, 10 Nov 2025 09:00:00 -0600 This omission allowed table owners to create statistics in any
schema, potentially leading to unexpected naming conflicts. For
ALTER TABLE commands that require re-creating statistics objects,
skip this check in case the user has since lost CREATE on the
schema. The addition of a second parameter to CreateStatistics()
breaks ABI compatibility, but we are unaware of any impacted
third-party code.
Reported-by: Jelte Fennema-Nio <postgres@jeltef.nl>
Author: Jelte Fennema-Nio <postgres@jeltef.nl>
Co-authored-by: Nathan Bossart <nathandbossart@gmail.com>
Reviewed-by: Noah Misch <noah@leadboat.com>
Reviewed-by: Álvaro Herrera <alvherre@kurilemu.de>
Security: CVE-2025-12817
Backpatch-through: 13 M src/backend/commands/statscmds.c
M src/backend/commands/tablecmds.c
M src/backend/tcop/utility.c
M src/include/commands/defrem.h
M src/test/regress/expected/stats_ext.out
M src/test/regress/sql/stats_ext.sql
libpq: Prevent some overflows of int/size_t
commit : 600086f471a3bb57ff4953accf1d3f8d2efe0201
author : Jacob Champion <jchampion@postgresql.org>
date : Mon, 10 Nov 2025 06:02:34 -0800
committer: Jacob Champion <jchampion@postgresql.org>
date : Mon, 10 Nov 2025 06:02:34 -0800 Several functions could overflow their size calculations, when presented
with very large inputs from remote and/or untrusted locations, and then
allocate buffers that were too small to hold the intended contents.
Switch from int to size_t where appropriate, and check for overflow
conditions when the inputs could have plausibly originated outside of
the libpq trust boundary. (Overflows from within the trust boundary are
still possible, but these will be fixed separately.) A version of
add_size() is ported from the backend to assist with code that performs
more complicated concatenation.
Reported-by: Aleksey Solovev (Positive Technologies)
Reviewed-by: Noah Misch <noah@leadboat.com>
Reviewed-by: Álvaro Herrera <alvherre@kurilemu.de>
Security: CVE-2025-12818
Backpatch-through: 13 M src/interfaces/libpq/fe-connect.c
M src/interfaces/libpq/fe-exec.c
M src/interfaces/libpq/fe-print.c
M src/interfaces/libpq/fe-protocol3.c
M src/interfaces/libpq/libpq-int.h
Move SLRU_PAGES_PER_SEGMENT to pg_config_manual.h
commit : 3e0ae46d907dd5f36342dd288841f4502bd571f6
author : Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Mon, 10 Nov 2025 16:11:41 +0200
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Mon, 10 Nov 2025 16:11:41 +0200 It seems plausible that someone might want to experiment with
different values. The pressing reason though is that I'm reviewing a
patch that requires pg_upgrade to manipulate SLRU files. That patch
needs to access SLRU_PAGES_PER_SEGMENT from pg_upgrade code, and
slru.h, where SLRU_PAGES_PER_SEGMENT is currently defined, cannot be
included from frontend code. Moving it to pg_config_manual.h makes it
accessible.
Now that it's a little more likely that someone might change
SLRU_PAGES_PER_SEGMENT, add a cluster compatibility check for it.
Bump catalog version because of the new field in the control file.
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>
Reviewed-by: Álvaro Herrera <alvherre@kurilemu.de>
Discussion: https://www.postgresql.org/message-id/c7a4ea90-9f7b-4953-81be-b3fcb47db057@iki.fi M src/backend/access/transam/xlog.c
M src/include/access/slru.h
M src/include/catalog/catversion.h
M src/include/catalog/pg_control.h
M src/include/pg_config_manual.h
Fix typos in nodeWindowAgg comments
commit : 3a872ddd64f908ac3dd65c544c2439ecbe737799
author : Daniel Gustafsson <dgustafsson@postgresql.org>
date : Mon, 10 Nov 2025 12:51:47 +0100
committer: Daniel Gustafsson <dgustafsson@postgresql.org>
date : Mon, 10 Nov 2025 12:51:47 +0100 One of them submitted by the author, with another one other
spotted during review so this fixes both.
Author: Tender Wang <tndrwang@gmail.com>
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>
Discussion: https://postgr.es/m/CAHewXN=eNx2oJ_hzxJrkSvy-1A5Qf45SM8pxERWXE+6RoZyFrw@mail.gmail.com M src/backend/executor/nodeWindowAgg.c
Add more tests for relation statistics with rewrites
commit : b23fe993e13612424faaee7ed35c4b830a2c0dfc
author : Michael Paquier <michael@paquier.xyz>
date : Mon, 10 Nov 2025 14:30:10 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Mon, 10 Nov 2025 14:30:10 +0900 While there are many tests related to relation rewrites, nothing existed
to check how the cumulative statistics behave in such cases for
relations.
A different patch is under discussion to move the relation statistics to
be tracked on a per-relfilenode basis, so as these could be rebuilt
during crash recovery. This commit gives us a way to check (and perhaps
change) the existing behaviors for several rewrite scenarios, mixing
transactions, sub-transactions, two-phase commit and VACUUM.
Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://postgr.es/m/aQ3X20hbqoThQXgp@ip-10-97-1-34.eu-west-3.compute.internal A src/test/regress/expected/stats_rewrite.out
A src/test/regress/expected/stats_rewrite_1.out
M src/test/regress/parallel_schedule
A src/test/regress/sql/stats_rewrite.sql
Doc: more uppercase keywords in SQLs
commit : 812367f3d48768b662e64bf2693703bbca8575d2
author : David Rowley <drowley@postgresql.org>
date : Mon, 10 Nov 2025 17:15:03 +1300
committer: David Rowley <drowley@postgresql.org>
date : Mon, 10 Nov 2025 17:15:03 +1300 Per 49d43faa8. These ones were missed.
Reported-by: jian he <jian.universality@gmail.com>
Author: Erik Wienhold <ewie@ewie.name>
Discussion: https://postgr.es/m/CACJufxG5UaQtoYFQKdMCYjpz_5Kggvdgm1gVEW4sNEa_W__FKA@mail.gmail.com M doc/src/sgml/func/func-matching.sgml
injection_points: Add variant for injection_point_attach()
commit : 16a2f706951edc1b284a66902c9e582217d37d31
author : Michael Paquier <michael@paquier.xyz>
date : Mon, 10 Nov 2025 09:52:14 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Mon, 10 Nov 2025 09:52:14 +0900 This new function is able to take in input more data than the existing
injection_point_attach():
- A library name.
- A function name.
- Some private data.
This gives more flexibility for tests so as these would not need to
reinvent a wrapper for InjectionPointAttach() when attaching a callback
from a library other than "injection_points". injection_point_detach()
can be used with both versions of injection_point_attach().
Author: Rahila Syed <rahilasyed.90@gmail.com>
Reviewed-by: Mihail Nikalayeu <mihailnikalayeu@gmail.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://postgr.es/m/CAH2L28sOG2b_TKkZU51dy+pWJtny1mqDmeFiFoUASGa0X0iiKQ@mail.gmail.com M src/test/modules/injection_points/expected/injection_points.out
M src/test/modules/injection_points/injection_points–1.0.sql
M src/test/modules/injection_points/injection_points.c
M src/test/modules/injection_points/sql/injection_points.sql
Fix comment in copyto.c
commit : 9d7e851a2118286f123fd8cfc699e3db9318fba8
author : Michael Paquier <michael@paquier.xyz>
date : Sun, 9 Nov 2025 08:17:31 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Sun, 9 Nov 2025 08:17:31 +0900 Author: Tatsuya Kawata <kawatatatsuya0913@gmail.com>
Discussion: https://postgr.es/m/CAHza6qeNbqgMfgDi15Dv6E6GWx+8maRAqe97OwzYz3qpEFouJQ@mail.gmail.com M src/backend/commands/copyto.c
doc: consistently use "structname" and "structfield" markup
commit : 980a855c5c2e21e964a739694e24004f72e03fdf
author : Bruce Momjian <bruce@momjian.us>
date : Sat, 8 Nov 2025 09:49:43 -0500
committer: Bruce Momjian <bruce@momjian.us>
date : Sat, 8 Nov 2025 09:49:43 -0500 Previously "literal" and "classname" were used, inconsistently, for
SQL table and column names.
Reported-by: Peter Smith
Author: Peter Smith
Discussion: https://postgr.es/m/CAHut+Pvtf24r+bdPgBind84dBLPvgNL7aB+=HxAUupdPuo2gRg@mail.gmail.com
Backpatch-through: master M doc/src/sgml/advanced.sgml
M doc/src/sgml/ddl.sgml
M doc/src/sgml/ecpg.sgml
M doc/src/sgml/func/func-json.sgml
M doc/src/sgml/indices.sgml
M doc/src/sgml/information_schema.sgml
M doc/src/sgml/libpq.sgml
M doc/src/sgml/logical-replication.sgml
M doc/src/sgml/plperl.sgml
M doc/src/sgml/queries.sgml
M doc/src/sgml/ref/cluster.sgml
M doc/src/sgml/ref/comment.sgml
M doc/src/sgml/ref/create_foreign_table.sgml
M doc/src/sgml/ref/create_function.sgml
M doc/src/sgml/ref/create_index.sgml
M doc/src/sgml/ref/create_table.sgml
M doc/src/sgml/ref/create_table_as.sgml
M doc/src/sgml/ref/create_trigger.sgml
M doc/src/sgml/ref/create_view.sgml
M doc/src/sgml/ref/delete.sgml
M doc/src/sgml/ref/grant.sgml
M doc/src/sgml/ref/insert.sgml
M doc/src/sgml/ref/pg_dump.sgml
M doc/src/sgml/ref/psql-ref.sgml
M doc/src/sgml/ref/reindex.sgml
M doc/src/sgml/ref/reindexdb.sgml
M doc/src/sgml/ref/select.sgml
M doc/src/sgml/ref/select_into.sgml
M doc/src/sgml/ref/truncate.sgml
M doc/src/sgml/ref/vacuum.sgml
M doc/src/sgml/rules.sgml
M doc/src/sgml/syntax.sgml
M doc/src/sgml/xfunc.sgml
docs: fix text by adding/removing parentheses
commit : e8bfad4ca842733b957c01e732ec009778f952cd
author : Bruce Momjian <bruce@momjian.us>
date : Fri, 7 Nov 2025 22:19:09 -0500
committer: Bruce Momjian <bruce@momjian.us>
date : Fri, 7 Nov 2025 22:19:09 -0500 Reported-by: Daisuke Higuchi
Author: Daisuke Higuchi, Erik Wienhold
Reviewed-by: Erik Wienhold
Discussion: https://postgr.es/m/CAEVT6c9FRQcFCzQ8AO=QoeQNA-w6RhTkfOUHzY6N2xD5YnBxhg@mail.gmail.com
Backpatch-through: master M doc/src/sgml/client-auth.sgml
M doc/src/sgml/ltree.sgml
M doc/src/sgml/trigger.sgml
Remove blank line in C code.
commit : 6204d07ad602f15c421e9b6488f0daf37ee1355c
author : Bruce Momjian <bruce@momjian.us>
date : Fri, 7 Nov 2025 21:53:59 -0500
committer: Bruce Momjian <bruce@momjian.us>
date : Fri, 7 Nov 2025 21:53:59 -0500 Was added in commit 5e89985928795f243dc287210c2aa016dfd00bfe.
Reported-by: Ashutosh Bapat
Author: Ashutosh Bapat
Discussion: https://postgr.es/m/CAExHW5tba_biyuMrd_iPVzq-+XvsMdPcEnjQ+d+__V=cjYj8Pg@mail.gmail.com
Backpatch-through: master M src/backend/storage/buffer/freelist.c
Fix generic read and write barriers for Clang.
commit : c5d34f4a550f26583a0b92e294eff7d001e318d3
author : Thomas Munro <tmunro@postgresql.org>
date : Sat, 8 Nov 2025 12:25:45 +1300
committer: Thomas Munro <tmunro@postgresql.org>
date : Sat, 8 Nov 2025 12:25:45 +1300 generic-gcc.h maps our read and write barriers to C11 acquire and
release fences using compiler builtins, for platforms where we don't
have our own hand-rolled assembler. This is apparently enough for GCC,
but the C11 memory model is only defined in terms of atomic accesses,
and our barriers for non-atomic, non-volatile accesses were not always
respected under Clang's stricter interpretation of the standard.
This explains the occasional breakage observed on new RISC-V + Clang
animal greenfly in lock-free PgAioHandle manipulation code containing a
repeating pattern of loads and read barriers. The problem can also be
observed in code generated for MIPS and LoongAarch, though we aren't
currently testing those with Clang, and on x86, though we use our own
assembler there. The scariest aspect is that we use the generic version
on very common ARM systems, but it doesn't seem to reorder the relevant
code there (or we'd have debugged this long ago).
Fix by inserting an explicit compiler barrier. It expands to an empty
assembler block declared to have memory side-effects, so registers are
flushed and reordering is prevented. In those respects this is like the
architecture-specific assembler versions, but the compiler is still in
charge of generating the appropriate fence instruction. Done for write
barriers on principle, though concrete problems have only been observed
with read barriers.
Reported-by: Alexander Lakhin <exclusion@gmail.com>
Tested-by: Alexander Lakhin <exclusion@gmail.com>
Discussion: https://postgr.es/m/d79691be-22bd-457d-9d90-18033b78c40a%40gmail.com
Backpatch-through: 13 M src/include/port/atomics/generic-gcc.h
Fix checking for recovery state in WaitForLSN()
commit : 7742f99a02ed1679eb6baeb35491ea3cf8a3a36e
author : Alexander Korotkov <akorotkov@postgresql.org>
date : Fri, 7 Nov 2025 23:34:50 +0200
committer: Alexander Korotkov <akorotkov@postgresql.org>
date : Fri, 7 Nov 2025 23:34:50 +0200 We only need to do it for WAIT_LSN_TYPE_REPLAY. WAIT_LSN_TYPE_FLUSH can work
for both primary and follower. M src/backend/access/transam/xlogwait.c
doc: Fix incorrect wording for --file in pg_dump
commit : 07961ef86625be91e243f1dff8911cb1d70e443f
author : Daniel Gustafsson <dgustafsson@postgresql.org>
date : Fri, 7 Nov 2025 15:10:50 +0100
committer: Daniel Gustafsson <dgustafsson@postgresql.org>
date : Fri, 7 Nov 2025 15:10:50 +0100 The documentation stated that the directory specified by --file
must not exist, but pg_dump does allow for empty directories to
be specified and used.
Author: Daniel Gustafsson <daniel@yesql.se>
Reviewed-by: Bruce Momjian <bruce@momjian.us>
Discussion: https://postgr.es/m/534AA60D-CF6B-432F-9882-E9737B33D1B7@gmail.com M doc/src/sgml/ref/pg_dump.sgml
pgbench: Add --continue-on-error option.
commit : 0ab208fa505c04e2b3483de53a73edb71f9b9106
author : Fujii Masao <fujii@postgresql.org>
date : Fri, 7 Nov 2025 19:17:37 +0900
committer: Fujii Masao <fujii@postgresql.org>
date : Fri, 7 Nov 2025 19:17:37 +0900 This commit adds the --continue-on-error option, allowing pgbench clients
to continue running even when SQL statements fail for reasons other than
serialization or deadlock errors. Without this option (by default),
the clients aborts in such cases, which was the only available behavior
previously.
This option is useful for benchmarks using custom scripts that may
raise errors, such as unique constraint violations, where users want
pgbench to complete the run despite individual statement failures.
Author: Rintaro Ikeda <ikedarintarof@oss.nttdata.com>
Co-authored-by: Yugo Nagata <nagata@sraoss.co.jp>
Co-authored-by: Fujii Masao <masao.fujii@gmail.com>
Reviewed-by: Stepan Neretin <slpmcf@gmail.com>
Reviewed-by: Matthias van de Meent <boekewurm+postgres@gmail.com>
Reviewed-by: Dilip Kumar <dilipbalaut@gmail.com>
Reviewed-by: Srinath Reddy Sadipiralla <srinath2133@gmail.com>
Reviewed-by: Hayato Kuroda <kuroda.hayato@fujitsu.com>
Reviewed-by: Anthonin Bonnefoy <anthonin.bonnefoy@datadoghq.com>
Reviewed-by: Chao Li <lic@highgo.com>
Discussion: https://postgr.es/m/44334231a4d214fac382a69cceb7d9fc@oss.nttdata.com M doc/src/sgml/ref/pgbench.sgml
M src/bin/pgbench/pgbench.c
M src/bin/pgbench/t/001_pgbench_with_server.pl
Fix "inconsistent DLL linkage" warning on Windows MSVC
commit : a3ea5330fcf47390c8ab420bbf433a97a54505d6
author : Peter Eisentraut <peter@eisentraut.org>
date : Fri, 7 Nov 2025 10:11:44 +0100
committer: Peter Eisentraut <peter@eisentraut.org>
date : Fri, 7 Nov 2025 10:11:44 +0100 This warning was disabled in meson.build (warning 4273). If you
enable it, it looks like this:
../src/backend/utils/misc/ps_status.c(27): warning C4273: '__p__environ': inconsistent dll linkage
C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt\stdlib.h(1158): note: see previous definition of '__p__environ'
The declaration in ps_status.c was:
#if !defined(WIN32) || defined(_MSC_VER)
extern char **environ;
#endif
The declaration in the OS header file is:
_DCRTIMP char*** __cdecl __p__environ (void);
#define _environ (*__p__environ())
So it is evident that this could be problematic.
The old declaration was required by the old MSVCRT library, but we
don't support that anymore with MSVC.
To fix, disable the re-declaration in ps_status.c, and also in some
other places that use the same code pattern but didn't trigger the
warning.
Then we can also re-enable the warning (delete the disablement in
meson.build).
Reviewed-by: Bryan Green <dbryan.green@gmail.com>
Reviewed-by: Andres Freund <andres@anarazel.de>
Discussion: https://www.postgresql.org/message-id/flat/bf060644-47ff-441b-97cf-c685d0827757@eisentraut.org M meson.build
M src/backend/postmaster/postmaster.c
M src/backend/utils/misc/ps_status.c
M src/test/regress/regress.c
Add seq_sync_error_count to subscription statistics.
commit : f6a4c498dcf6f05b4ef79051e95de12cc48bdeee
author : Amit Kapila <akapila@postgresql.org>
date : Fri, 7 Nov 2025 08:05:08 +0000
committer: Amit Kapila <akapila@postgresql.org>
date : Fri, 7 Nov 2025 08:05:08 +0000 This commit adds a new column, seq_sync_error_count, to the
pg_stat_subscription_stats view. This counter tracks the number of errors
encountered by the sequence synchronization worker during operation.
Since a single worker handles the synchronization of all sequences, this
value may reflect errors from multiple sequences. This addition improves
observability of sequence synchronization behavior and helps monitor
potential issues during replication.
Author: Vignesh C <vignesh21@gmail.com>
Reviewed-by: shveta malik <shveta.malik@gmail.com>
Reviewed-by: Peter Smith <smithpb2250@gmail.com>
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>
Discussion: https://postgr.es/m/CAA4eK1LC+KJiAkSrpE_NwvNdidw9F2os7GERUeSxSKv71gXysQ@mail.gmail.com M doc/src/sgml/monitoring.sgml
M src/backend/catalog/system_views.sql
M src/backend/replication/logical/sequencesync.c
M src/backend/replication/logical/tablesync.c
M src/backend/replication/logical/worker.c
M src/backend/utils/activity/pgstat_subscription.c
M src/backend/utils/adt/pgstatfuncs.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/include/pgstat.h
M src/test/regress/expected/rules.out
M src/test/subscription/t/026_stats.pl
doc: Fix descriptions of some PGC_POSTMASTER parameters.
commit : c32e32f763b4c70cb0a85af9f12ee6badd9c860b
author : Fujii Masao <fujii@postgresql.org>
date : Fri, 7 Nov 2025 14:54:36 +0900
committer: Fujii Masao <fujii@postgresql.org>
date : Fri, 7 Nov 2025 14:54:36 +0900 The following parameters can only be set at server start because
their context is PGC_POSTMASTER, but this information was missing
or incorrectly documented. This commit adds or corrects
that information for the following parameters:
* debug_io_direct
* dynamic_shared_memory_type
* event_source
* huge_pages
* io_max_combine_limit
* max_notify_queue_pages
* shared_memory_type
* track_commit_timestamp
* wal_decode_buffer_size
Backpatched to all supported branches.
Author: Karina Litskevich <litskevichkarina@gmail.com>
Reviewed-by: Chao Li <lic@highgo.com>
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>
Discussion: https://postgr.es/m/CAHGQGwGfPzcin-_6XwPgVbWTOUFVZgHF5g9ROrwLUdCTfjy=0A@mail.gmail.com
Backpatch-through: 13 M doc/src/sgml/config.sgml
doc: Clarify units for io_combine_limit and io_max_combine_limit.
commit : 6fba6cb05ddfb177ac1c4efa508707e879fb8bd3
author : Fujii Masao <fujii@postgresql.org>
date : Fri, 7 Nov 2025 14:42:17 +0900
committer: Fujii Masao <fujii@postgresql.org>
date : Fri, 7 Nov 2025 14:42:17 +0900 If these parameters are set without units, the values are interpreted
as blocks. This detail was previously missing from the documentation,
so this commit adds it.
Backpatch to v17 where io_combine_limit was added.
Author: Karina Litskevich <litskevichkarina@gmail.com>
Reviewed-by: Chao Li <lic@highgo.com>
Reviewed-by: Xuneng Zhou <xunengzhou@gmail.com>
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>
Discussion: https://postgr.es/m/CACiT8iZCDkz1bNYQNQyvGhXWJExSnJULRTYT894u4-Ti7Yh6jw@mail.gmail.com
Backpatch-through: 17 M doc/src/sgml/config.sgml
bufmgr: Use atomic sub for unpinning buffers
commit : 5310fac6e0fcb1c7fcefb3446767673f9107328c
author : Andres Freund <andres@anarazel.de>
date : Thu, 6 Nov 2025 16:43:16 -0500
committer: Andres Freund <andres@anarazel.de>
date : Thu, 6 Nov 2025 16:43:16 -0500 The prior commit made it legal to modify BufferDesc.state while the buffer
header spinlock is held. This allows us to replace the CAS loop
inUnpinBufferNoOwner() with an atomic sub. This improves scalability
significantly. See the prior commits for more background.
Reviewed-by: Matthias van de Meent <boekewurm+postgres@gmail.com>
Discussion: https://postgr.es/m/fvfmkr5kk4nyex56ejgxj3uzi63isfxovp2biecb4bspbjrze7@az2pljabhnff M src/backend/storage/buffer/bufmgr.c
bufmgr: Allow some buffer state modifications while holding header lock
commit : c75ebc657ffce8dab76471da31aafb79fbe3fda2
author : Andres Freund <andres@anarazel.de>
date : Thu, 6 Nov 2025 16:42:10 -0500
committer: Andres Freund <andres@anarazel.de>
date : Thu, 6 Nov 2025 16:42:10 -0500 Until now BufferDesc.state was not allowed to be modified while the buffer
header spinlock was held. This meant that operations like unpinning buffers
needed to use a CAS loop, waiting for the buffer header spinlock to be
released before updating.
The benefit of that restriction is that it allowed us to unlock the buffer
header spinlock with just a write barrier and an unlocked write (instead of a
full atomic operation). That was important to avoid regressions in
48354581a49c. However, since then the hottest buffer header spinlock uses have
been replaced with atomic operations (in particular, the most common use of
PinBuffer_Locked(), in GetVictimBuffer() (formerly in BufferAlloc()), has been
removed in 5e899859287).
This change will allow, in a subsequent commit, to release buffer pins with a
single atomic-sub operation. This previously was not possible while such
operations were not allowed while the buffer header spinlock was held, as an
atomic-sub would not have allowed a race-free check for the buffer header lock
being held.
Using atomic-sub to unpin buffers is a nice scalability win, however it is not
the primary motivation for this change (although it would be sufficient). The
primary motivation is that we would like to merge the buffer content lock into
BufferDesc.state, which will result in more frequent changes of the state
variable, which in some situations can cause a performance regression, due to
an increased CAS failure rate when unpinning buffers. The regression entirely
vanishes when using atomic-sub.
Naively implementing this would require putting CAS loops in every place
modifying the buffer state while holding the buffer header lock. To avoid
that, introduce UnlockBufHdrExt(), which can set/add flags as well as the
refcount, together with releasing the lock.
Reviewed-by: Robert Haas <robertmhaas@gmail.com>
Reviewed-by: Matthias van de Meent <boekewurm+postgres@gmail.com>
Discussion: https://postgr.es/m/fvfmkr5kk4nyex56ejgxj3uzi63isfxovp2biecb4bspbjrze7@az2pljabhnff M contrib/pg_buffercache/pg_buffercache_pages.c
M contrib/pg_prewarm/autoprewarm.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/buffer/freelist.c
M src/include/storage/buf_internals.h
M src/test/modules/test_aio/test_aio.c
Tidyup WARNING ereports in subscriptioncmds.c
commit : 448b6a4173d007c75ba30fed666b60f0bd1afe8b
author : David Rowley <drowley@postgresql.org>
date : Fri, 7 Nov 2025 09:50:02 +1300
committer: David Rowley <drowley@postgresql.org>
date : Fri, 7 Nov 2025 09:50:02 +1300 A couple of ereports were making use of StringInfos as temporary storage
for the portions of the WARNING message. One was doing this to avoid
having 2 separate ereports. This was all fairly unnecessary and
resulted in more code rather than less code.
Refactor out the additional StringInfos and make
check_publications_origin_tables() use 2 ereports.
In passing, adjust pubnames to become a stack-allocated StringInfoData to
avoid having to palloc the temporary StringInfoData. This follows on
from the efforts made in 6d0eba662.
Author: Mats Kindahl <mats.kindahl@gmail.com>
Reviewed-by: David Rowley <dgrowleyml@gmail.com>
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>
Reviewed-by: Álvaro Herrera <alvherre@kurilemu.de>
Discussion: https://postgr.es/m/0b381b02-cab9-41f9-a900-ad6c8d26c1fc%40gmail.com M src/backend/commands/subscriptioncmds.c
Use XLogRecPtrIsValid() in various places
commit : a2b02293bc65dbb2401cb19c724f52c6ee0f2faf
author : Álvaro Herrera <alvherre@kurilemu.de>
date : Thu, 6 Nov 2025 20:33:57 +0100
committer: Álvaro Herrera <alvherre@kurilemu.de>
date : Thu, 6 Nov 2025 20:33:57 +0100 Now that commit 06edbed47862 has introduced XLogRecPtrIsValid(), we can
use that instead of:
- XLogRecPtrIsInvalid()
- direct comparisons with InvalidXLogRecPtr
- direct comparisons with literal 0
This makes the code more consistent.
Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Discussion: https://postgr.es/m/aQB7EvGqrbZXrMlg@ip-10-97-1-34.eu-west-3.compute.internal M contrib/pg_walinspect/pg_walinspect.c
M src/backend/access/gist/gist.c
M src/backend/access/gist/gistget.c
M src/backend/access/gist/gistutil.c
M src/backend/access/heap/rewriteheap.c
M src/backend/access/heap/vacuumlazy.c
M src/backend/access/heap/visibilitymap.c
M src/backend/access/transam/clog.c
M src/backend/access/transam/slru.c
M src/backend/access/transam/timeline.c
M src/backend/access/transam/twophase.c
M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogbackup.c
M src/backend/access/transam/xlogfuncs.c
M src/backend/access/transam/xloginsert.c
M src/backend/access/transam/xlogreader.c
M src/backend/access/transam/xlogrecovery.c
M src/backend/access/transam/xlogutils.c
M src/backend/access/transam/xlogwait.c
M src/backend/backup/backup_manifest.c
M src/backend/backup/basebackup_incremental.c
M src/backend/backup/walsummary.c
M src/backend/catalog/pg_subscription.c
M src/backend/commands/subscriptioncmds.c
M src/backend/postmaster/walsummarizer.c
M src/backend/replication/logical/applyparallelworker.c
M src/backend/replication/logical/launcher.c
M src/backend/replication/logical/logical.c
M src/backend/replication/logical/logicalfuncs.c
M src/backend/replication/logical/origin.c
M src/backend/replication/logical/proto.c
M src/backend/replication/logical/reorderbuffer.c
M src/backend/replication/logical/slotsync.c
M src/backend/replication/logical/snapbuild.c
M src/backend/replication/logical/worker.c
M src/backend/replication/slot.c
M src/backend/replication/slotfuncs.c
M src/backend/replication/syncrep.c
M src/backend/replication/walreceiver.c
M src/backend/replication/walreceiverfuncs.c
M src/backend/replication/walsender.c
M src/backend/storage/buffer/bufmgr.c
M src/bin/pg_basebackup/pg_receivewal.c
M src/bin/pg_basebackup/pg_recvlogical.c
M src/bin/pg_rewind/pg_rewind.c
M src/bin/pg_waldump/pg_waldump.c
Introduce XLogRecPtrIsValid()
commit : 06edbed478625829b19c35d0c17d805be588afa6
author : Álvaro Herrera <alvherre@kurilemu.de>
date : Thu, 6 Nov 2025 19:08:29 +0100
committer: Álvaro Herrera <alvherre@kurilemu.de>
date : Thu, 6 Nov 2025 19:08:29 +0100 XLogRecPtrIsInvalid() is inconsistent with the affirmative form of
macros used for other datatypes, and leads to awkward double negatives
in a few places. This commit introduces XLogRecPtrIsValid(), which
allows code to be written more naturally.
This patch only adds the new macro. XLogRecPtrIsInvalid() is left in
place, and all existing callers remain untouched. This means all
supported branches can accept hypothetical bug fixes that use the new
macro, and at the same time any code that compiled with the original
formulation will continue to silently compile just fine.
Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Backpatch-through: 13
Discussion: https://postgr.es/m/aQB7EvGqrbZXrMlg@ip-10-97-1-34.eu-west-3.compute.internal M src/include/access/xlogdefs.h
Refer readers of \? to "\? variables" for pset options
commit : 8fe7700b7eafe95d20244c5c85567f1573669e23
author : Álvaro Herrera <alvherre@kurilemu.de>
date : Thu, 6 Nov 2025 15:50:04 +0100
committer: Álvaro Herrera <alvherre@kurilemu.de>
date : Thu, 6 Nov 2025 15:50:04 +0100 ... and remove the list of \pset options from the general \? output.
That list was getting out of hand, both for developers to keep up to
date as well as for users to read.
Author: Álvaro Herrera <alvherre@kurilemu.de>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/202511041638.dm4qukcxfjto@alvherre.pgsql M src/bin/psql/help.c
Disallow generated columns in COPY WHERE clause
commit : aa606b9316a334cbc8c48560c72235f9e48e47bf
author : Peter Eisentraut <peter@eisentraut.org>
date : Thu, 6 Nov 2025 11:52:47 +0100
committer: Peter Eisentraut <peter@eisentraut.org>
date : Thu, 6 Nov 2025 11:52:47 +0100 Stored generated columns are not yet computed when the filtering
happens, so we need to prohibit them to avoid incorrect behavior.
Virtual generated columns currently error out ("unexpected virtual
generated column reference"). They could probably work if we expand
them in the right place, but for now let's keep them consistent with
the stored variant. This doesn't change the behavior, it only gives a
nicer error message.
Co-authored-by: jian he <jian.universality@gmail.com>
Reviewed-by: Kirill Reshke <reshkekirill@gmail.com>
Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/CACJufxHb8YPQ095R_pYDr77W9XKNaXg5Rzy-WP525mkq+hRM3g@mail.gmail.com M src/backend/commands/copy.c
M src/test/regress/expected/generated_stored.out
M src/test/regress/expected/generated_virtual.out
M src/test/regress/sql/generated_stored.sql
M src/test/regress/sql/generated_virtual.sql
Refactor shared memory allocation for semaphores
commit : aa9c5fd3e3d7f1e6154474e39ab71377136d463a
author : Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Thu, 6 Nov 2025 14:45:00 +0200
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Thu, 6 Nov 2025 14:45:00 +0200 Before commit e25626677f, spinlocks were implemented using semaphores
on some platforms (--disable-spinlocks). That made it necessary to
initialize semaphores early, before any spinlocks could be used. Now
that we don't support --disable-spinlocks anymore, we can allocate the
shared memory needed for semaphores the same way as other shared
memory structures. Since the semaphores are used only in the PGPROC
array, move the semaphore shmem size estimation and initialization
calls to ProcGlobalShmemSize() and InitProcGlobal().
Author: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>
Discussion: https://www.postgresql.org/message-id/CAExHW5seSZpPx-znjidVZNzdagGHOk06F+Ds88MpPUbxd1kTaA@mail.gmail.com M src/backend/port/posix_sema.c
M src/backend/port/sysv_sema.c
M src/backend/storage/ipc/ipci.c
M src/backend/storage/ipc/shmem.c
M src/backend/storage/lmgr/proc.c
M src/include/storage/ipc.h
M src/include/storage/shmem.h
Add comment to explain why PGReserveSemaphores() is called early
commit : daf3d99d2b8bebb3361163a11ef3d232002127c9
author : Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Thu, 6 Nov 2025 12:50:10 +0200
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Thu, 6 Nov 2025 12:50:10 +0200 Before commit e25626677f, PGReserveSemaphores() had to be called
before SpinlockSemaInit() because spinlocks were implemented using
semaphores on some platforms (--disable-spinlocks). Add a comment
explaining that.
Author: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>
Discussion: https://www.postgresql.org/message-id/CAExHW5seSZpPx-znjidVZNzdagGHOk06F+Ds88MpPUbxd1kTaA@mail.gmail.com
Backpatch-to: 18 M src/backend/storage/ipc/ipci.c
Fix redundancy in error message
commit : 150e24501bc218057a7b9a24b19a145fa8b5c678
author : Peter Eisentraut <peter@eisentraut.org>
date : Thu, 6 Nov 2025 10:22:29 +0100
committer: Peter Eisentraut <peter@eisentraut.org>
date : Thu, 6 Nov 2025 10:22:29 +0100 Discussion: https://www.postgresql.org/message-id/flat/E1vEsbx-004QDO-0o%40gemulon.postgresql.org M src/bin/pg_basebackup/pg_createsubscriber.c
Cosmetic fixes in GiST README
commit : 07b3df5d00cb01b024ee3c080cf15cee69ee3d95
author : John Naylor <john.naylor@postgresql.org>
date : Thu, 6 Nov 2025 16:35:40 +0700
committer: John Naylor <john.naylor@postgresql.org>
date : Thu, 6 Nov 2025 16:35:40 +0700 Fix a typo, add some missing conjunctions, and make a sentence flow
more smoothly.
Author: Paul A. Jungwirth <pj@illuminatedcomputing.com>
Discussion: https://postgr.es/m/CA%2BrenyXZgwzegmO5t%3DUSU%3D9Wo5bc-YqNf-6E7Nv7e577DCmYXA%40mail.gmail.com M src/backend/access/gist/README
Fix few issues in commit 5509055d69.
commit : 5a4eba558aa76c36ecf2aab7587b233c0e2003e2
author : Amit Kapila <akapila@postgresql.org>
date : Thu, 6 Nov 2025 08:52:31 +0000
committer: Amit Kapila <akapila@postgresql.org>
date : Thu, 6 Nov 2025 08:52:31 +0000 Test failure on buildfarm member prion:
The test failed due to an unexpected LOCATION: line appearing between the
WARNING and ERROR messages. This occurred because the prion machine uses
log_error_verbosity = verbose, which includes additional context in error
messages. The test was originally checking for both WARNING and ERROR
messages in sequence sync, but the extra LOCATION: line disrupted this
pattern. To make the test robust across different verbosity settings, it
now only checks for the presence of the WARNING message after the test,
which is sufficient to validate the intended behavior.
Failure to sync sequences with quoted names:
The previous implementation did not correctly quote sequence names when
querying remote information, leading to failures when quoted sequence
names were used. This fix ensures that sequence names are properly quoted
during remote queries, allowing sequences with quoted identifiers to be
synced correctly.
Author: Vignesh C <vignesh21@gmail.com>
Author: Shinya Kato <shinya11.kato@gmail.com>
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>
Discussion: https://postgr.es/m/CALDaNm0WcdSCoNPiE-5ek4J2dMJ5o111GPTzKCYj9G5i=ONYtQ@mail.gmail.com
Discussion: https://postgr.es/m/CAOzEurQOSN=Zcp9uVnatNbAy=2WgMTJn_DYszYjv0KUeQX_e_A@mail.gmail.com M src/backend/replication/logical/sequencesync.c
M src/test/subscription/t/036_sequences.pl
ci: Improve OpenBSD core dump backtrace handling.
commit : b498af4204bd832e11ffc87fe1999f113cc29a87
author : Thomas Munro <tmunro@postgresql.org>
date : Thu, 6 Nov 2025 17:25:04 +1300
committer: Thomas Munro <tmunro@postgresql.org>
date : Thu, 6 Nov 2025 17:25:04 +1300 Since OpenBSD core dumps do not embed executable paths, the script now
searches for the corresponding binary manually within the specified
directory before invoking LLDB. This is imperfect but should find the
right executable in practice, as needed for meaningful backtraces.
Author: Nazir Bilal Yavuz <byavuz81@gmail.com>
Discussion: https://postgr.es/m/CAN55FZ36R74TZ8RKsFueYwLxGKDAm3LU2FHM_ZUCSB6imd3vYA@mail.gmail.com
Backpatch-through: 18 M .cirrus.tasks.yml
M src/tools/ci/cores_backtrace.sh
Document some structures in attribute_stats.c
commit : d6c132d83bff76acd569175af7f53b7c1bf429f4
author : Michael Paquier <michael@paquier.xyz>
date : Thu, 6 Nov 2025 16:22:12 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Thu, 6 Nov 2025 16:22:12 +0900 Like relation_stats.c, these structures are used to track the argument
number, names and types of pg_restore_attribute_stats() and
pg_clear_attribute_stats().
Extracted from a larger patch by the same author, reworded by me for
consistency with relation_stats.c.
Author: Corey Huinker <corey.huinker@gmail.com>
Discussion: https://postgr.es/m/CADkLM=dpz3KFnqP-dgJ-zvRvtjsa8UZv8wDAQdqho=qN3kX0Zg@mail.gmail.com M src/backend/statistics/attribute_stats.c
Fix spurious output in configure
commit : 489ec6b2fcd09621a2ac146298193a8231810e60
author : Peter Eisentraut <peter@eisentraut.org>
date : Thu, 6 Nov 2025 08:00:35 +0100
committer: Peter Eisentraut <peter@eisentraut.org>
date : Thu, 6 Nov 2025 08:00:35 +0100 If sizeof off_t is 4, then configure will print a line saying just "0"
after the test. This is the output of the following "expr" command.
If we are using expr just for the exit code, the output should be sent
to /dev/null, as is done elsewhere. M configure
M configure.ac
MSVC: Improve warning options set
commit : 2307cfe31621d6077d9357aa7d6f4d8406c66b2d
author : Peter Eisentraut <peter@eisentraut.org>
date : Tue, 28 Oct 2025 22:11:26 +0100
committer: Peter Eisentraut <peter@eisentraut.org>
date : Tue, 28 Oct 2025 22:11:26 +0100 The previous code had a set of warnings to disable on MSVC. But some
of these weren't actually enabled by default anyway, only in higher
MSVC warning levels (/W, maps to meson warning_level). I rearranged
this so that it is clearer in what MSVC warning level a warning would
have been enabled. Furthermore, sort them numerically within the
levels.
Moreover, we can add a few warning types to the default set, to get a
similar set of warnings that we get by default with gcc or clang (the
equivalents of -Wswitch and -Wformat).
Reviewed-by: Bryan Green <dbryan.green@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/bf060644-47ff-441b-97cf-c685d0827757@eisentraut.org M meson.build
Re-run autoheader
commit : 01a985c3c4fb138ac2753e1210eed084e6bd181f
author : Peter Eisentraut <peter@eisentraut.org>
date : Thu, 6 Nov 2025 07:37:22 +0100
committer: Peter Eisentraut <peter@eisentraut.org>
date : Thu, 6 Nov 2025 07:37:22 +0100 Some of the changes in pg_config.h.in from commit 3853a6956c3 didn't
match the order that a fresh run would produce. M src/include/pg_config.h.in
Re-run autoconf
commit : 4b6fa00a3a91714ed19fed667abdcb5eeee69f77
author : Peter Eisentraut <peter@eisentraut.org>
date : Thu, 6 Nov 2025 07:36:06 +0100
committer: Peter Eisentraut <peter@eisentraut.org>
date : Thu, 6 Nov 2025 07:36:06 +0100 Some of the last-minute changes in commit f0f2c0c1aef were apparently
not captured. M configure
Update code comment
commit : 05b9edcb7140101e91f7cf17c0c7d463bb41c401
author : Peter Eisentraut <peter@eisentraut.org>
date : Wed, 5 Nov 2025 20:56:25 +0100
committer: Peter Eisentraut <peter@eisentraut.org>
date : Wed, 5 Nov 2025 20:56:25 +0100 Should have been part of commit a13833c35f9. M src/backend/utils/misc/guc_tables.c
Fix UNION planner estimate_num_groups with varno==0
commit : eaa159632d034a59ede1695f4b86098b1a372b48
author : David Rowley <drowley@postgresql.org>
date : Thu, 6 Nov 2025 16:34:55 +1300
committer: David Rowley <drowley@postgresql.org>
date : Thu, 6 Nov 2025 16:34:55 +1300 03d40e4b5 added code to provide better row estimates for when a UNION
query ended up only with a single child due to other children being
found to be dummy rels. In that case, ordinarily it would be ok to call
estimate_num_groups() on the targetlist of the only child path, however
that's not safe to do if the UNION child is the result of some other set
operation as we generate targetlists containing Vars with varno==0 for
those, which estimate_num_groups() can't handle. This could lead to:
ERROR: XX000: no relation entry for relid 0
Fix this by avoiding doing this when the only child is the result of
another set operation. In that case we'll fall back on the
assume-all-rows-are-unique method.
Reported-by: Alexander Lakhin <exclusion@gmail.com>
Author: David Rowley <dgrowleyml@gmail.com>
Discussion: https://postgr.es/m/cfbc99e5-9d44-4806-ba3c-f36b57a85e21@gmail.com M src/backend/optimizer/prep/prepunion.c
M src/test/regress/expected/union.out
M src/test/regress/sql/union.sql
Update obsolete comment in ExecScanReScan().
commit : a3ebec4e4cf6625a2bab4db2830d57d25a34ba1f
author : Etsuro Fujita <efujita@postgresql.org>
date : Thu, 6 Nov 2025 12:25:00 +0900
committer: Etsuro Fujita <efujita@postgresql.org>
date : Thu, 6 Nov 2025 12:25:00 +0900 Commit 27cc7cd2b removed the epqScanDone flag from the EState struct,
and instead added an equivalent flag named relsubs_done to the EPQState
struct; but it failed to update this comment.
Author: Etsuro Fujita <etsuro.fujita@gmail.com>
Discussion: https://postgr.es/m/CAPmGK152zJ3fU5avDT5udfL0namrDeVfMTL3dxdOXw28SOrycg%40mail.gmail.com
Backpatch-through: 13 M src/backend/executor/execScan.c
postgres_fdw: Add more test coverage for EvalPlanQual testing.
commit : c3eec94fc1a02a67ee51cdd781f24f6f28ad5b36
author : Etsuro Fujita <efujita@postgresql.org>
date : Thu, 6 Nov 2025 12:15:00 +0900
committer: Etsuro Fujita <efujita@postgresql.org>
date : Thu, 6 Nov 2025 12:15:00 +0900 postgres_fdw supports EvalPlanQual testing by using the infrastructure
provided by the core with the RecheckForeignScan callback routine (cf.
commits 5fc4c26db and 385f337c9), but there has been no test coverage
for that, except that recent commit 12609fbac, which fixed an issue in
commit 385f337c9, added a test case to exercise only a code path added
by that commit to the core infrastructure. So let's add test cases to
exercise other code paths as well at this time.
Like commit 12609fbac, back-patch to all supported branches.
Reported-by: Masahiko Sawada <sawada.mshk@gmail.com>
Author: Etsuro Fujita <etsuro.fujita@gmail.com>
Discussion: https://postgr.es/m/CAPmGK15%2B6H%3DkDA%3D-y3Y28OAPY7fbAdyMosVofZZ%2BNc769epVTQ%40mail.gmail.com
Backpatch-through: 13 M contrib/postgres_fdw/expected/eval_plan_qual.out
M contrib/postgres_fdw/specs/eval_plan_qual.spec
Doc: use uppercase keywords in SQLs
commit : 49d43faa835f3c6817be9fc0b98bec0d661c2587
author : David Rowley <drowley@postgresql.org>
date : Thu, 6 Nov 2025 16:03:02 +1300
committer: David Rowley <drowley@postgresql.org>
date : Thu, 6 Nov 2025 16:03:02 +1300 Use uppercase SQL keywords consistently throughout the documentation to
ease reading. Also add whitespace in a couple of places where it
improves readability.
Author: Erik Wienhold <ewie@ewie.name>
Reviewed-by: David Rowley <dgrowleyml@gmail.com>
Discussion: https://postgr.es/m/82eb512b-8ed2-46be-b311-54ffd26978c4%40ewie.name M doc/src/sgml/advanced.sgml
M doc/src/sgml/arch-dev.sgml
M doc/src/sgml/bloom.sgml
M doc/src/sgml/charset.sgml
M doc/src/sgml/config.sgml
M doc/src/sgml/cube.sgml
M doc/src/sgml/datatype.sgml
M doc/src/sgml/datetime.sgml
M doc/src/sgml/dblink.sgml
M doc/src/sgml/ddl.sgml
M doc/src/sgml/dict-int.sgml
M doc/src/sgml/dml.sgml
M doc/src/sgml/ecpg.sgml
M doc/src/sgml/event-trigger.sgml
M doc/src/sgml/func/func-array.sgml
M doc/src/sgml/func/func-binarystring.sgml
M doc/src/sgml/func/func-bitstring.sgml
M doc/src/sgml/func/func-datetime.sgml
M doc/src/sgml/func/func-formatting.sgml
M doc/src/sgml/func/func-info.sgml
M doc/src/sgml/func/func-json.sgml
M doc/src/sgml/func/func-matching.sgml
M doc/src/sgml/func/func-srf.sgml
M doc/src/sgml/func/func-string.sgml
M doc/src/sgml/func/func-textsearch.sgml
M doc/src/sgml/func/func-xml.sgml
M doc/src/sgml/hstore.sgml
M doc/src/sgml/indices.sgml
M doc/src/sgml/isn.sgml
M doc/src/sgml/libpq.sgml
M doc/src/sgml/logical-replication.sgml
M doc/src/sgml/logicaldecoding.sgml
M doc/src/sgml/ltree.sgml
M doc/src/sgml/maintenance.sgml
M doc/src/sgml/monitoring.sgml
M doc/src/sgml/pageinspect.sgml
M doc/src/sgml/pgcrypto.sgml
M doc/src/sgml/pgstattuple.sgml
M doc/src/sgml/pgsurgery.sgml
M doc/src/sgml/planstats.sgml
M doc/src/sgml/plperl.sgml
M doc/src/sgml/plpgsql.sgml
M doc/src/sgml/plpython.sgml
M doc/src/sgml/pltcl.sgml
M doc/src/sgml/queries.sgml
M doc/src/sgml/ref/alter_table.sgml
M doc/src/sgml/ref/create_function.sgml
M doc/src/sgml/ref/create_table.sgml
M doc/src/sgml/ref/pg_rewind.sgml
M doc/src/sgml/ref/psql-ref.sgml
M doc/src/sgml/ref/select.sgml
M doc/src/sgml/rules.sgml
M doc/src/sgml/seg.sgml
M doc/src/sgml/sepgsql.sgml
M doc/src/sgml/tablefunc.sgml
M doc/src/sgml/tcn.sgml
M doc/src/sgml/textsearch.sgml
M doc/src/sgml/typeconv.sgml
M doc/src/sgml/unaccent.sgml
M doc/src/sgml/xfunc.sgml
Use stack allocated StringInfoDatas, where possible
commit : 6d0eba66275b125bf634bbdffda90c70856e3f93
author : David Rowley <drowley@postgresql.org>
date : Thu, 6 Nov 2025 14:59:48 +1300
committer: David Rowley <drowley@postgresql.org>
date : Thu, 6 Nov 2025 14:59:48 +1300 Various places that were using StringInfo but didn't need that
StringInfo to exist beyond the scope of the function were using
makeStringInfo(), which allocates both a StringInfoData and the buffer it
uses as two separate allocations. It's more efficient for these cases to
use a StringInfoData on the stack and initialize it with initStringInfo(),
which only allocates the string buffer. This also simplifies the cleanup,
in a few cases.
Author: Mats Kindahl <mats.kindahl@gmail.com>
Reviewed-by: David Rowley <dgrowleyml@gmail.com>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://postgr.es/m/4379aac8-26f1-42f2-a356-ff0e886228d3@gmail.com M contrib/postgres_fdw/postgres_fdw.c
M contrib/tcn/tcn.c
M src/backend/access/transam/xlogbackup.c
M src/backend/backup/basebackup.c
M src/backend/commands/subscriptioncmds.c
M src/backend/utils/adt/json.c
M src/backend/utils/adt/jsonb.c
M src/backend/utils/adt/jsonfuncs.c
M src/backend/utils/adt/multirangetypes.c
M src/backend/utils/adt/rangetypes.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/adt/xml.c
ci: Add missing "set -e" to scripts run by su.
commit : cf638b46aff2ccb8d4811e3b5d8a2c2410638190
author : Thomas Munro <tmunro@postgresql.org>
date : Thu, 6 Nov 2025 13:24:30 +1300
committer: Thomas Munro <tmunro@postgresql.org>
date : Thu, 6 Nov 2025 13:24:30 +1300 If any shell command fails, the whole script should fail. To avoid
future omissions, add this even for single-command scripts that use su
with heredoc syntax, as they might be extended or copied-and-pasted.
Extracted from a larger patch that wanted to use #error during
compilation, leading to the diagnosis of this problem.
Reviewed-by: Tristan Partin <tristan@partin.io> (earlier version)
Discussion: https://postgr.es/m/DDZP25P4VZ48.3LWMZBGA1K9RH%40partin.io
Backpatch-through: 15 M .cirrus.tasks.yml
Avoid possible crash within libsanitizer.
commit : d4baa327a1c9c6a6e0b8f8d0ea410d19bf5dde33
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Wed, 5 Nov 2025 11:09:30 -0500
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Wed, 5 Nov 2025 11:09:30 -0500 We've successfully used libsanitizer for awhile with the undefined
and alignment sanitizers, but with some other sanitizers (at least
thread and hwaddress) it crashes due to internal recursion before
it's fully initialized itself. It turns out that that's due to the
"__ubsan_default_options" hack installed by commit f686ae82f, and we
can fix it by ensuring that __ubsan_default_options is built without
any sanitizer instrumentation hooks.
Reported-by: Emmanuel Sibi <emmanuelsibi.mec@gmail.com>
Reported-by: Alexander Lakhin <exclusion@gmail.com>
Diagnosed-by: Emmanuel Sibi <emmanuelsibi.mec@gmail.com>
Fix-suggested-by: Jacob Champion <jacob.champion@enterprisedb.com>
Author: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/F7543B04-E56C-4D68-A040-B14CCBAD38F1@gmail.com
Discussion: https://postgr.es/m/dbf77bf7-6e54-ed8a-c4ae-d196eeb664ce@gmail.com
Backpatch-through: 16 M src/backend/main/main.c
doc: Add section for temporal tables
commit : e4d8a2af07f56ec2537eb8f9a16599249db62c94
author : Peter Eisentraut <peter@eisentraut.org>
date : Wed, 5 Nov 2025 16:38:04 +0100
committer: Peter Eisentraut <peter@eisentraut.org>
date : Wed, 5 Nov 2025 16:38:04 +0100 This section introduces temporal tables, with a focus on Application
Time (which we support) and only a brief mention of System Time (which
we don't). It covers temporal primary keys, unique constraints, and
temporal foreign keys. We will document temporal update/delete and
periods as we add those features.
This commit also adds glossary entries for temporal table, application
time, and system time.
Author: Paul A. Jungwirth <pj@illuminatedcomputing.com>
Discussion: https://www.postgresql.org/message-id/flat/ec498c3d-5f2b-48ec-b989-5561c8aa2024@illuminatedcomputing.com M doc/src/sgml/ddl.sgml
M doc/src/sgml/glossary.sgml
M doc/src/sgml/images/Makefile
A doc/src/sgml/images/temporal-entities.svg
A doc/src/sgml/images/temporal-entities.txt
A doc/src/sgml/images/temporal-references.svg
A doc/src/sgml/images/temporal-references.txt
Implement WAIT FOR command
commit : 447aae13b0305780e87cac7b0dd669db6fab3d9d
author : Alexander Korotkov <akorotkov@postgresql.org>
date : Wed, 5 Nov 2025 11:43:55 +0200
committer: Alexander Korotkov <akorotkov@postgresql.org>
date : Wed, 5 Nov 2025 11:43:55 +0200 WAIT FOR is to be used on standby and specifies waiting for
the specific WAL location to be replayed. This option is useful when
the user makes some data changes on primary and needs a guarantee to see
these changes are on standby.
WAIT FOR needs to wait without any snapshot held. Otherwise, the snapshot
could prevent the replay of WAL records, implying a kind of self-deadlock.
This is why separate utility command seems appears to be the most robust
way to implement this functionality. It's not possible to implement this as
a function. Previous experience shows that stored procedures also have
limitation in this aspect.
Discussion: https://www.postgresql.org/message-id/flat/CAPpHfdsjtZLVzxjGT8rJHCYbM0D5dwkO+BBjcirozJ6nYbOW8Q@mail.gmail.com
Discussion: https://www.postgresql.org/message-id/flat/CABPTF7UNft368x-RgOXkfj475OwEbp%2BVVO-wEXz7StgjD_%3D6sw%40mail.gmail.com
Author: Kartyshov Ivan <i.kartyshov@postgrespro.ru>
Author: Alexander Korotkov <aekorotkov@gmail.com>
Author: Xuneng Zhou <xunengzhou@gmail.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Reviewed-by: Peter Eisentraut <peter.eisentraut@enterprisedb.com>
Reviewed-by: Dilip Kumar <dilipbalaut@gmail.com>
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>
Reviewed-by: Alexander Lakhin <exclusion@gmail.com>
Reviewed-by: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Reviewed-by: Euler Taveira <euler@eulerto.com>
Reviewed-by: Heikki Linnakangas <hlinnaka@iki.fi>
Reviewed-by: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Reviewed-by: jian he <jian.universality@gmail.com>
Reviewed-by: Álvaro Herrera <alvherre@kurilemu.de>
Reviewed-by: Xuneng Zhou <xunengzhou@gmail.com> M doc/src/sgml/high-availability.sgml
M doc/src/sgml/ref/allfiles.sgml
A doc/src/sgml/ref/wait_for.sgml
M doc/src/sgml/reference.sgml
M src/backend/access/transam/xact.c
M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogrecovery.c
M src/backend/commands/Makefile
M src/backend/commands/meson.build
A src/backend/commands/wait.c
M src/backend/parser/gram.y
M src/backend/storage/lmgr/proc.c
M src/backend/tcop/pquery.c
M src/backend/tcop/utility.c
A src/include/commands/wait.h
M src/include/nodes/parsenodes.h
M src/include/parser/kwlist.h
M src/include/tcop/cmdtaglist.h
M src/test/recovery/meson.build
A src/test/recovery/t/049_wait_for_lsn.pl
M src/tools/pgindent/typedefs.list
Add infrastructure for efficient LSN waiting
commit : 3b4e53a075ea5671b075f8fd873241179f8e64af
author : Alexander Korotkov <akorotkov@postgresql.org>
date : Mon, 3 Nov 2025 13:31:13 +0200
committer: Alexander Korotkov <akorotkov@postgresql.org>
date : Mon, 3 Nov 2025 13:31:13 +0200 Implement a new facility that allows processes to wait for WAL to reach
specific LSNs, both on primary (waiting for flush) and standby (waiting
for replay) servers.
The implementation uses shared memory with per-backend information
organized into pairing heaps, allowing O(1) access to the minimum
waited LSN. This enables fast-path checks: after replaying or flushing
WAL, the startup process or WAL writer can quickly determine if any
waiters need to be awakened.
Key components:
- New xlogwait.c/h module with WaitForLSNReplay() and WaitForLSNFlush()
- Separate pairing heaps for replay and flush waiters
- WaitLSN lightweight lock for coordinating shared state
- Wait events WAIT_FOR_WAL_REPLAY and WAIT_FOR_WAL_FLUSH for monitoring
This infrastructure can be used by features that need to wait for WAL
operations to complete.
Discussion: https://www.postgresql.org/message-id/flat/CAPpHfdsjtZLVzxjGT8rJHCYbM0D5dwkO+BBjcirozJ6nYbOW8Q@mail.gmail.com
Discussion: https://www.postgresql.org/message-id/flat/CABPTF7UNft368x-RgOXkfj475OwEbp%2BVVO-wEXz7StgjD_%3D6sw%40mail.gmail.com
Author: Kartyshov Ivan <i.kartyshov@postgrespro.ru>
Author: Alexander Korotkov <aekorotkov@gmail.com>
Author: Xuneng Zhou <xunengzhou@gmail.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Reviewed-by: Peter Eisentraut <peter.eisentraut@enterprisedb.com>
Reviewed-by: Dilip Kumar <dilipbalaut@gmail.com>
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>
Reviewed-by: Alexander Lakhin <exclusion@gmail.com>
Reviewed-by: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Reviewed-by: Euler Taveira <euler@eulerto.com>
Reviewed-by: Heikki Linnakangas <hlinnaka@iki.fi>
Reviewed-by: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Reviewed-by: Xuneng Zhou <xunengzhou@gmail.com> M src/backend/access/transam/Makefile
M src/backend/access/transam/meson.build
A src/backend/access/transam/xlogwait.c
M src/backend/storage/ipc/ipci.c
M src/backend/utils/activity/wait_event_names.txt
A src/include/access/xlogwait.h
M src/include/storage/lwlocklist.h
M src/tools/pgindent/typedefs.list
Add pairingheap_initialize() for shared memory usage
commit : 8af3ae0d4b36f4cbd6c72b12357ba928d02b3ebd
author : Alexander Korotkov <akorotkov@postgresql.org>
date : Wed, 5 Nov 2025 11:40:27 +0200
committer: Alexander Korotkov <akorotkov@postgresql.org>
date : Wed, 5 Nov 2025 11:40:27 +0200 The existing pairingheap_allocate() uses palloc(), which allocates
from process-local memory. For shared memory use cases, the pairingheap
structure must be allocated via ShmemAlloc() or embedded in a shared
memory struct. Add pairingheap_initialize() to initialize an already-
allocated pairingheap structure in-place, enabling shared memory usage.
Discussion: https://www.postgresql.org/message-id/flat/CAPpHfdsjtZLVzxjGT8rJHCYbM0D5dwkO+BBjcirozJ6nYbOW8Q@mail.gmail.com
Discussion: https://www.postgresql.org/message-id/flat/CABPTF7UNft368x-RgOXkfj475OwEbp%2BVVO-wEXz7StgjD_%3D6sw%40mail.gmail.com
Author: Kartyshov Ivan <i.kartyshov@postgrespro.ru>
Author: Alexander Korotkov <aekorotkov@gmail.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Reviewed-by: Peter Eisentraut <peter.eisentraut@enterprisedb.com>
Reviewed-by: Dilip Kumar <dilipbalaut@gmail.com>
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>
Reviewed-by: Alexander Lakhin <exclusion@gmail.com>
Reviewed-by: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Reviewed-by: Euler Taveira <euler@eulerto.com>
Reviewed-by: Heikki Linnakangas <hlinnaka@iki.fi>
Reviewed-by: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Reviewed-by: Xuneng Zhou <xunengzhou@gmail.com> M src/backend/lib/pairingheap.c
M src/include/lib/pairingheap.h
Avoid creating duplicate ordered append paths
commit : 0ea5eee37606386150aa8317184617e1d5d34565
author : Richard Guo <rguo@postgresql.org>
date : Wed, 5 Nov 2025 18:10:54 +0900
committer: Richard Guo <rguo@postgresql.org>
date : Wed, 5 Nov 2025 18:10:54 +0900 In generate_orderedappend_paths(), the function does not handle the
case where the paths in total_subpaths and fractional_subpaths are
identical. This situation is not uncommon, and as a result, it may
generate two exactly identical ordered append paths.
Fix by checking whether total_subpaths and fractional_subpaths contain
the same paths, and skipping creation of the ordered append path for
the fractional case when they are identical.
Given the lack of field complaints about this, I'm a bit hesitant to
back-patch, but let's clean it up in HEAD.
Author: Richard Guo <guofenglinux@gmail.com>
Reviewed-by: Andrei Lepikhov <lepihov@gmail.com>
Reviewed-by: Alexander Korotkov <aekorotkov@gmail.com>
Discussion: https://postgr.es/m/CAMbWs4-OYsgA75tGGiBARt87G0y_z_GBTSLrzudcJxAzndYkYw@mail.gmail.com M src/backend/optimizer/path/allpaths.c
Fix assertion failure in generate_orderedappend_paths()
commit : c1777f2d6d43adf9bc65da3e44a3a5ad2cbfa86d
author : Richard Guo <rguo@postgresql.org>
date : Wed, 5 Nov 2025 18:09:21 +0900
committer: Richard Guo <rguo@postgresql.org>
date : Wed, 5 Nov 2025 18:09:21 +0900 In generate_orderedappend_paths(), there is an assumption that a child
relation's row estimate is always greater than zero. There is an
Assert verifying this assumption, and the estimate is also used to
convert an absolute tuple count into a fraction.
However, this assumption is not always valid -- for example, upper
relations can have their row estimates unset, resulting in a value of
zero. This can cause an assertion failure in debug builds or lead to
the tuple fraction being computed as infinity in production builds.
To fix, use the row estimate from the cheapest_total path to compute
the tuple fraction. The row estimate in this path should already have
been forced to a valid value.
In passing, update the comment for generate_orderedappend_paths() to
note that the function also considers the cheapest-fractional case
when not all tuples need to be retrieved. That is, it collects all
the cheapest fractional paths and builds an ordered append path for
each interesting ordering.
Backpatch to v18, where this issue was introduced.
Bug: #19102
Reported-by: Kuntal Ghosh <kuntalghosh.2007@gmail.com>
Author: Richard Guo <guofenglinux@gmail.com>
Reviewed-by: Kuntal Ghosh <kuntalghosh.2007@gmail.com>
Reviewed-by: Andrei Lepikhov <lepihov@gmail.com>
Discussion: https://postgr.es/m/19102-93480667e1200169@postgresql.org
Backpatch-through: 18 M src/backend/optimizer/path/allpaths.c
M src/test/regress/expected/partition_aggregate.out
M src/test/regress/sql/partition_aggregate.sql
Fix timing-dependent failure in recovery test 004_timeline_switch
commit : a4fd971c6f534aff96a1b3aab61d8a498b6b4ac5
author : Michael Paquier <michael@paquier.xyz>
date : Wed, 5 Nov 2025 16:48:19 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Wed, 5 Nov 2025 16:48:19 +0900 The test introduced by 17b2d5ec759c verifies that a WAL receiver
survives across a timeline jump by searching the server logs for
termination messages. However, it called restart() before the timeline
switch, which kills the WAL receiver and may log the exact message being
checked, hence failing the test. As TAP tests reuse the same log file
across restarts, a rotate_logfile() is used before the restart so as the
log matching check is not impacted by log entries generated by a
previous shutdown.
Recent changes to file handle inheritance altered I/O timing enough to
make this fail consistently while testing another patch.
While on it, this adds an extra check based on a PID comparison. This
test may lead to false positives as it could be possible that the WAL
receiver has processed a timeline jump before the initial PID is
grabbed, but it should be good enough in most cases.
Like 17b2d5ec759c, backpatch down to v13.
Author: Bryan Green <dbryan.green@gmail.com>
Co-authored-by: Xuneng Zhou <xunengzhou@gmail.com>
Discussion: https://postgr.es/m/9d00b597-d64a-4f1e-802e-90f9dc394c70@gmail.com
Backpatch-through: 13 M src/test/recovery/t/004_timeline_switch.pl
Add sequence synchronization for logical replication.
commit : 5509055d6956745532e65ab218e15b99d87d66ce
author : Amit Kapila <akapila@postgresql.org>
date : Wed, 5 Nov 2025 05:54:25 +0000
committer: Amit Kapila <akapila@postgresql.org>
date : Wed, 5 Nov 2025 05:54:25 +0000 This patch introduces sequence synchronization. Sequences that are synced
will have 2 states:
- INIT (needs [re]synchronizing)
- READY (is already synchronized)
A new sequencesync worker is launched as needed to synchronize sequences.
A single sequencesync worker is responsible for synchronizing all
sequences. It begins by retrieving the list of sequences that are flagged
for synchronization, i.e., those in the INIT state. These sequences are
then processed in batches, allowing multiple entries to be synchronized
within a single transaction. The worker fetches the current sequence
values and page LSNs from the remote publisher, updates the corresponding
sequences on the local subscriber, and finally marks each sequence as
READY upon successful synchronization.
Sequence synchronization occurs in 3 places:
1) CREATE SUBSCRIPTION
- The command syntax remains unchanged.
- The subscriber retrieves sequences associated with publications.
- Published sequences are added to pg_subscription_rel with INIT
state.
- Initiate the sequencesync worker to synchronize all sequences.
2) ALTER SUBSCRIPTION ... REFRESH PUBLICATION
- The command syntax remains unchanged.
- Dropped published sequences are removed from pg_subscription_rel.
- Newly published sequences are added to pg_subscription_rel with INIT
state.
- Initiate the sequencesync worker to synchronize only newly added
sequences.
3) ALTER SUBSCRIPTION ... REFRESH SEQUENCES
- A new command introduced for PG19 by f0b3573c3a.
- All sequences in pg_subscription_rel are reset to INIT state.
- Initiate the sequencesync worker to synchronize all sequences.
- Unlike "ALTER SUBSCRIPTION ... REFRESH PUBLICATION" command,
addition and removal of missing sequences will not be done in this
case.
Author: Vignesh C <vignesh21@gmail.com>
Reviewed-by: shveta malik <shveta.malik@gmail.com>
Reviewed-by: Hou Zhijie <houzj.fnst@fujitsu.com>
Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com>
Reviewed-by: Hayato Kuroda <kuroda.hayato@fujitsu.com>
Reviewed-by: Dilip Kumar <dilipbalaut@gmail.com>
Reviewed-by: Peter Smith <smithpb2250@gmail.com>
Reviewed-by: Nisha Moond <nisha.moond412@gmail.com>
Reviewed-by: Shlok Kyal <shlok.kyal.oss@gmail.com>
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://postgr.es/m/CAA4eK1LC+KJiAkSrpE_NwvNdidw9F2os7GERUeSxSKv71gXysQ@mail.gmail.com M src/backend/catalog/pg_subscription.c
M src/backend/commands/sequence.c
M src/backend/postmaster/bgworker.c
M src/backend/replication/logical/Makefile
M src/backend/replication/logical/launcher.c
M src/backend/replication/logical/meson.build
A src/backend/replication/logical/sequencesync.c
M src/backend/replication/logical/syncutils.c
M src/backend/replication/logical/tablesync.c
M src/backend/replication/logical/worker.c
M src/backend/utils/misc/guc_parameters.dat
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/include/catalog/pg_subscription_rel.h
M src/include/commands/sequence.h
M src/include/replication/logicalworker.h
M src/include/replication/worker_internal.h
M src/test/subscription/t/036_sequences.pl
M src/tools/pgindent/typedefs.list
Drop unnamed portal immediately after execution to completion
commit : 1fd981f05369340a8afa4d013a350b0b2ac6e33e
author : Michael Paquier <michael@paquier.xyz>
date : Wed, 5 Nov 2025 14:35:16 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Wed, 5 Nov 2025 14:35:16 +0900 Previously, unnamed portals were kept until the next Bind message or the
end of the transaction. This could cause temporary files to persist
longer than expected and make logging not reflect the actual SQL
responsible for the temporary file.
This patch changes exec_execute_message() to drop unnamed portals
immediately after execution to completion at the end of an Execute
message, making their removal more aggressive. This forces temporary
file cleanups to happen at the same time as the completion of the portal
execution, with statement logging correctly reflecting to which
statements these temporary files were attached to (see the diffs in the
TAP test updated by this commit for an idea).
The documentation is updated to describe the lifetime of unnamed
portals, and test cases are updated to verify temporary file removal and
proper statement logging after unnamed portal execution. This changes
how unnamed portals are handled in the protocol, hence no backpatch is
done.
Author: Frédéric Yhuel <frederic.yhuel@dalibo.com>
Co-Authored-by: Sami Imseih <samimseih@gmail.com>
Co-Authored-by: Mircea Cadariu <cadariu.mircea@gmail.com>
Discussion: https://postgr.es/m/CAA5RZ0tTrTUoEr3kDXCuKsvqYGq8OOHiBwoD-dyJocq95uEOTQ%40mail.gmail.com M doc/src/sgml/protocol.sgml
M src/backend/tcop/postgres.c
M src/test/modules/test_misc/t/009_log_temp_files.pl
Fix comments for ChangeVarNodes() and related functions
commit : 59dec6c0b09f717e4ce78d54f578d56ef93bcc53
author : Richard Guo <rguo@postgresql.org>
date : Wed, 5 Nov 2025 12:29:31 +0900
committer: Richard Guo <rguo@postgresql.org>
date : Wed, 5 Nov 2025 12:29:31 +0900 The comment for ChangeVarNodes() refers to a parameter named
change_RangeTblRef, which does not exist in the code.
The comment for ChangeVarNodesExtended() contains an extra space,
while the comment for replace_relid_callback() has an awkward line
break and a typo.
This patch fixes these issues and revises some sentences for smoother
wording.
Oversights in commits ab42d643c and fc069a3a6.
Author: Richard Guo <guofenglinux@gmail.com>
Discussion: https://postgr.es/m/CAMbWs480j16HC1JtjKCgj5WshivT8ZJYkOfTyZAM0POjFomJkg@mail.gmail.com
Backpatch-through: 18 M src/backend/optimizer/plan/analyzejoins.c
M src/backend/rewrite/rewriteManip.c
Add assertions checking for the startup process in WAL replay routines
commit : 2fc31079624e16d6b1a8508958dbf81e8edce057
author : Michael Paquier <michael@paquier.xyz>
date : Wed, 5 Nov 2025 10:41:50 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Wed, 5 Nov 2025 10:41:50 +0900 These assertions may prove to become useful to make sure that no process
other than the startup process calls the routines where these checks are
added, as we expect that these do not interfere with a WAL receiver
switched to a "stopping" state by a startup process.
The assumption that only the startup process can use this code has
existed for many years, without a check enforcing it.
Reviewed-by: Xuneng Zhou <xunengzhou@gmail.com>
Discussion: https://postgr.es/m/aQmGeVLYl51y1m_0@paquier.xyz M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogrecovery.c
aio: Improve assertions related to io_method
commit : dae00f333bdd98d094275080dba248cc80d4ca04
author : Andres Freund <andres@anarazel.de>
date : Tue, 4 Nov 2025 19:23:13 -0500
committer: Andres Freund <andres@anarazel.de>
date : Tue, 4 Nov 2025 19:23:13 -0500 First, the assertions in assign_io_method() were the wrong way round. Second,
the lengthof() assertion checked the length of io_method_options, which is the
wrong array to check and is always longer than pgaio_method_ops_table.
While add it, add a static assert to ensure pgaio_method_ops_table and
io_method_options stay in sync.
Per coverity and Tom Lane.
Reported-by: Tom Lane <tgl@sss.pgh.pa.us>
Backpatch-through: 18 M src/backend/storage/aio/aio.c
jit: Fix accidentally-harmless type confusion
commit : 2d83d729d5a1a6cc5c62bf3a932fdb508ce3d1ac
author : Andres Freund <andres@anarazel.de>
date : Tue, 4 Nov 2025 18:36:18 -0500
committer: Andres Freund <andres@anarazel.de>
date : Tue, 4 Nov 2025 18:36:18 -0500 In 2a0faed9d702, which added JIT compilation support for expressions, I
accidentally used sizeof(LLVMBasicBlockRef *) instead of
sizeof(LLVMBasicBlockRef) as part of computing the size of an allocation. That
turns out to have no real negative consequences due to LLVMBasicBlockRef being
a pointer itself (and thus having the same size). It still is wrong and
confusing, so fix it.
Reported by coverity.
Backpatch-through: 13 M src/backend/jit/llvm/llvmjit_expr.c
Special case C_COLLATION_OID in pg_newlocale_from_collation().
commit : d115de9d89164e87269d73d4f0f1368f06ebdd5e
author : Jeff Davis <jdavis@postgresql.org>
date : Tue, 4 Nov 2025 16:28:07 -0800
committer: Jeff Davis <jdavis@postgresql.org>
date : Tue, 4 Nov 2025 16:28:07 -0800 Allow pg_newlocale_from_collation(C_COLLATION_OID) to work even if
there's no catalog access, which some extensions expect.
Not known to be a bug without extensions involved, but backport to 18.
Also corrects an issue in master with dummy_c_locale (introduced in
commit 5a38104b36) where deterministic was not set. That wasn't a bug,
but could have been if that structure was used more widely.
Reported-by: Alexander Kukushkin <cyberdemn@gmail.com>
Reviewed-by: Alexander Kukushkin <cyberdemn@gmail.com>
Discussion: https://postgr.es/m/CAFh8B=nj966ECv5vi_u3RYij12v0j-7NPZCXLYzNwOQp9AcPWQ@mail.gmail.com
Backpatch-through: 18 M src/backend/regex/regc_pg_locale.c
M src/backend/utils/adt/pg_locale.c
Add CHECK_FOR_INTERRUPTS in Evict{Rel,All}UnpinnedBuffers.
commit : 8ae0f6a0c3da4b1568b753906eb8ea34d41da251
author : Masahiko Sawada <msawada@postgresql.org>
date : Tue, 4 Nov 2025 15:47:25 -0800
committer: Masahiko Sawada <msawada@postgresql.org>
date : Tue, 4 Nov 2025 15:47:25 -0800 This commit adds CHECK_FOR_INTERRUPTS to the shared buffer iteration
loops in EvictRelUnpinnedBuffers and EvictAllUnpinnedBuffers. These
functions, used by pg_buffercache's pg_buffercache_evict_relation and
pg_buffercache_evict_all, can now be interrupted during long-running
operations.
Backpatch to version 18, where these functions and their corresponding
pg_buffercache functions were introduced.
Author: Yuhang Qiu <iamqyh@gmail.com>
Discussion: https://postgr.es/m/8DC280D4-94A2-4E7B-BAB9-C345891D0B78%40gmail.com
Backpatch-through: 18 M src/backend/storage/buffer/bufmgr.c
Fix possible usage of incorrect UPPERREL_SETOP RelOptInfo
commit : fdda78e361f136ec2b8de579b366c1e66bba1199
author : David Rowley <drowley@postgresql.org>
date : Wed, 5 Nov 2025 11:48:09 +1300
committer: David Rowley <drowley@postgresql.org>
date : Wed, 5 Nov 2025 11:48:09 +1300 03d40e4b5 allowed dummy UNION [ALL] children to be removed from the plan
by checking for is_dummy_rel(). That commit neglected to still account
for the relids from the dummy rel so that the correct UPPERREL_SETOP
RelOptInfo could be found and used for adding the Paths to.
Not doing this could result in processing of subsequent UNIONs using the
same RelOptInfo as a previously processed UNION, which could result in
add_path() freeing old Paths that are needed by the previous UNION.
The same fix was independently submitted (2 mins later) by Richard Guo.
Reported-by: Alexander Lakhin <exclusion@gmail.com>
Author: David Rowley <dgrowleyml@gmail.com>
Discussion: https://postgr.es/m/bee34aec-659c-46f1-9ab7-7bbae0b7616c@gmail.com M src/backend/optimizer/prep/prepunion.c
M src/test/regress/expected/union.out
Fix snapshot handling bug in recent BRIN fix
commit : 0a3d27bfe0fb229253aa95feccd0360530b7edd8
author : Álvaro Herrera <alvherre@kurilemu.de>
date : Tue, 4 Nov 2025 20:31:43 +0100
committer: Álvaro Herrera <alvherre@kurilemu.de>
date : Tue, 4 Nov 2025 20:31:43 +0100 Commit a95e3d84c0e0 added ActiveSnapshot push+pop when processing
work-items (BRIN autosummarization), but forgot to handle the case of
a transaction failing during the run, which drops the snapshot untimely.
Fix by making the pop conditional on an element being actually there.
Author: Álvaro Herrera <alvherre@kurilemu.de>
Backpatch-through: 13
Discussion: https://postgr.es/m/202511041648.nofajnuddmwk@alvherre.pgsql M src/backend/postmaster/autovacuum.c
Trim TIDs during parallel GIN builds more eagerly
commit : 1213cb475391640508d2495b2b560329897d152c
author : Tomas Vondra <tomas.vondra@postgresql.org>
date : Tue, 4 Nov 2025 19:30:17 +0100
committer: Tomas Vondra <tomas.vondra@postgresql.org>
date : Tue, 4 Nov 2025 19:30:17 +0100 The parallel GIN builds perform "freezing" of TID lists when merging
chunks built earlier. This means determining what part of the list can
no longer change, depending on the last received chunk. The frozen part
can be evicted from memory and written out.
The code attempted to freeze items right before merging the old and new
TID list, after already attempting to trim the current buffer. That
means part of the data may get frozen based on the new TID list, but
will be trimmed later (on next loop). This increases memory usage.
This inverts the order, so that we freeze data first (before trimming).
The benefits are likely relatively small, but it's also virtually free
with no other downsides.
Discussion: https://postgr.es/m/CAHLJuCWDwn-PE2BMZE4Kux7x5wWt_6RoWtA0mUQffEDLeZ6sfA@mail.gmail.com M src/backend/access/gin/gininsert.c
psql: Add tab completion for COPY ... PROGRAM.
commit : 6d2ff1de4d0b66eb0288e21021c3741b9df1df0d
author : Masahiko Sawada <msawada@postgresql.org>
date : Tue, 4 Nov 2025 10:51:39 -0800
committer: Masahiko Sawada <msawada@postgresql.org>
date : Tue, 4 Nov 2025 10:51:39 -0800 This commit adds tab completion support for COPY TO PROGRAM and COPY
FROM PROGRAM syntax in psql.
Author: Yugo Nagata <nagata@sraoss.co.jp>
Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com>
Discussion: https://postgr.es/m/20250605100835.b396f9d656df1018f65a4556@sraoss.co.jp M src/bin/psql/tab-complete.in.c
psql: Improve tab completion for COPY ... STDIN/STDOUT.
commit : 02fd47dbfade9b86ae4c34b5b01e10abb6dc45dc
author : Masahiko Sawada <msawada@postgresql.org>
date : Tue, 4 Nov 2025 10:40:58 -0800
committer: Masahiko Sawada <msawada@postgresql.org>
date : Tue, 4 Nov 2025 10:40:58 -0800 This commit enhances tab completion for both COPY FROM and COPY TO
commands to suggest STDIN and STDOUT, respectively.
To make suggesting both file names and keywords easier, it introduces
a new COMPLETE_WITH_FILES_PLUS() macro.
Author: Yugo Nagata <nagata@sraoss.co.jp>
Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com>
Discussion: https://postgr.es/m/20250605100835.b396f9d656df1018f65a4556@sraoss.co.jp M src/bin/psql/tab-complete.in.c
ci: debian: Switch to Debian Trixie release
commit : be9efd4929b0f4843cdde38866421c4d486b45e3
author : Andres Freund <andres@anarazel.de>
date : Tue, 4 Nov 2025 13:25:22 -0500
committer: Andres Freund <andres@anarazel.de>
date : Tue, 4 Nov 2025 13:25:22 -0500 Debian Trixie CI images are generated now [1], so use them with the
following changes:
- detect_stack_use_after_return=0 option is added to the ASAN_OPTIONS
because ASAN uses a "shadow stack" to track stack variable lifetimes
and this confuses Postgres' stack depth check [2].
- Perl is updated to the newer version (perl5.40-i386-linux-gnu).
- LLVM-14 is no longer default installation, no need to force using
LLVM-16.
- Switch MinGW CC/CXX to x86_64-w64-mingw32ucrt-* to fix build failure
from missing _iswctype_l in mingw-w64 v12 headers.
[1] https://github.com/anarazel/pg-vm-images/commit/35a144793f
[2] https://postgr.es/m/20240130212304.q66rquj5es4375ab%40awork3.anarazel.de
Author: Nazir Bilal Yavuz <byavuz81@gmail.com>
Discussion: https://postgr.es/m/CAN55FZ1_B1usTskAv+AYt1bA7abVd9YH6XrUUSbr-2Z0d5Wd8w@mail.gmail.com
Backpatch: 15-, where CI support was added M .cirrus.tasks.yml
Limit the size of TID lists during parallel GIN build
commit : c98dffcb7c7010d216dc16d22cb594ef7d65fde1
author : Tomas Vondra <tomas.vondra@postgresql.org>
date : Tue, 4 Nov 2025 18:46:37 +0100
committer: Tomas Vondra <tomas.vondra@postgresql.org>
date : Tue, 4 Nov 2025 18:46:37 +0100 When building intermediate TID lists during parallel GIN builds, split
the sorted lists into smaller chunks, to limit the amount of memory
needed when merging the chunks later.
The leader may need to keep in memory up to one chunk per worker, and
possibly one extra chunk (before evicting some of the data). The code
processing item pointers uses regular palloc/repalloc calls, which means
it's subject to the MaxAllocSize (1GB) limit.
We could fix this by allowing huge allocations, but that'd require
changes in many places without much benefit. Larger chunks do not
actually improve performance, so the memory usage would be wasted.
Fixed by limiting the chunk size to not hit MaxAllocSize. Each worker
gets a fair share.
This requires remembering the number of participating workers, in a
place that can be accessed from the callback. Luckily, the bs_worker_id
field in GinBuildState was unused, so repurpose that.
Report by Greg Smith, investigation and fix by me. Batchpatched to 18,
where parallel GIN builds were introduced.
Reported-by: Gregory Smith <gregsmithpgsql@gmail.com>
Discussion: https://postgr.es/m/CAHLJuCWDwn-PE2BMZE4Kux7x5wWt_6RoWtA0mUQffEDLeZ6sfA@mail.gmail.com
Backpatch-through: 18 M src/backend/access/gin/gininsert.c
Remove redundant memset() introduced by a0942f4.
commit : 4bfaea11d2d686a06487c2e33297bf17f12732d7
author : Jeff Davis <jdavis@postgresql.org>
date : Tue, 4 Nov 2025 09:46:00 -0800
committer: Jeff Davis <jdavis@postgresql.org>
date : Tue, 4 Nov 2025 09:46:00 -0800 Reported-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://postgr.es/m/CAEoWx2kAkNaDa01O0nKsQmkfEmxsDvm09SU=f1T0CV8ew3qJEA@mail.gmail.com M src/backend/access/common/heaptuple.c
Allow "SET list_guc TO NULL" to specify setting the GUC to empty.
commit : ff4597acd4c3d957373335034e1ac16b6584c3e6
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Tue, 4 Nov 2025 12:37:40 -0500
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Tue, 4 Nov 2025 12:37:40 -0500 We have never had a SET syntax that allows setting a GUC_LIST_INPUT
parameter to be an empty list. A locution such as
SET search_path = '';
doesn't mean that; it means setting the GUC to contain a single item
that is an empty string. (For search_path the net effect is much the
same, because search_path ignores invalid schema names and '' must be
invalid.) This is confusing, not least because configuration-file
entries and the set_config() function can easily produce empty-list
values.
We considered making the empty-string syntax do this, but that would
foreclose ever allowing empty-string items to be valid in list GUCs.
While there isn't any obvious use-case for that today, it feels like
the kind of restriction that might hurt someday. Instead, let's
accept the forbidden-up-to-now value NULL and treat that as meaning an
empty list. (An objection to this could be "what if we someday want
to allow NULL as a GUC value?". That seems unlikely though, and even
if we did allow it for scalar GUCs, we could continue to treat it as
meaning an empty list for list GUCs.)
Author: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Andrei Klychkov <andrew.a.klychkov@gmail.com>
Reviewed-by: Jim Jones <jim.jones@uni-muenster.de>
Discussion: https://postgr.es/m/CA+mfrmwsBmYsJayWjc8bJmicxc3phZcHHY=yW5aYe=P-1d_4bg@mail.gmail.com M doc/src/sgml/ref/alter_system.sgml
M doc/src/sgml/ref/set.sgml
M src/backend/parser/gram.y
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/adt/varlena.c
M src/backend/utils/misc/guc_funcs.c
M src/bin/pg_dump/dumputils.c
M src/bin/pg_dump/pg_dump.c
M src/test/regress/expected/guc.out
M src/test/regress/expected/rules.out
M src/test/regress/sql/guc.sql
M src/test/regress/sql/rules.sql
Have psql's "\? variables" show csv_fieldsep
commit : 93b7ab5b4beee2f0cdef9d57d934e3a57638f5ca
author : Álvaro Herrera <alvherre@kurilemu.de>
date : Tue, 4 Nov 2025 17:30:44 +0100
committer: Álvaro Herrera <alvherre@kurilemu.de>
date : Tue, 4 Nov 2025 17:30:44 +0100 Accidental omission in commit aa2ba50c2c13. There are too many lists of
these variables ...
Discussion: https://postgr.es/m/202511031738.eqaeaedpx5cr@alvherre.pgsql M src/bin/psql/help.c
Tighten check for generated column in partition key expression
commit : 040cc5f3c782839ed30816671c5b5f36df0d2398
author : Peter Eisentraut <peter@eisentraut.org>
date : Tue, 4 Nov 2025 14:31:57 +0100
committer: Peter Eisentraut <peter@eisentraut.org>
date : Tue, 4 Nov 2025 14:31:57 +0100 A generated column may end up being part of the partition key
expression, if it's specified as an expression e.g. "(<generated
column name>)" or if the partition key expression contains a whole-row
reference, even though we do not allow a generated column to be part
of partition key expression. Fix this hole.
Co-authored-by: jian he <jian.universality@gmail.com>
Co-authored-by: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>
Reviewed-by: Fujii Masao <masao.fujii@oss.nttdata.com>
Discussion: https://www.postgresql.org/message-id/flat/CACJufxF%3DWDGthXSAQr9thYUsfx_1_t9E6N8tE3B8EqXcVoVfQw%40mail.gmail.com M src/backend/commands/tablecmds.c
M src/test/regress/expected/generated_stored.out
M src/test/regress/expected/generated_virtual.out
M src/test/regress/sql/generated_stored.sql
M src/test/regress/sql/generated_virtual.sql
BRIN autosummarization may need a snapshot
commit : a95e3d84c0e0ffd1e27c185dd69d053e43f2f8b5
author : Álvaro Herrera <alvherre@kurilemu.de>
date : Tue, 4 Nov 2025 13:23:26 +0100
committer: Álvaro Herrera <alvherre@kurilemu.de>
date : Tue, 4 Nov 2025 13:23:26 +0100 It's possible to define BRIN indexes on functions that require a
snapshot to run, but the autosummarization feature introduced by commit
7526e10224f0 fails to provide one. This causes autovacuum to leave a
BRIN placeholder tuple behind after a failed work-item execution, making
such indexes less efficient. Repair by obtaining a snapshot prior to
running the task, and add a test to verify this behavior.
Author: Álvaro Herrera <alvherre@kurilemu.de>
Reported-by: Giovanni Fabris <giovanni.fabris@icon.it>
Reported-by: Arthur Nascimento <tureba@gmail.com>
Backpatch-through: 13
Discussion: https://postgr.es/m/202511031106.h4fwyuyui6fz@alvherre.pgsql M src/backend/postmaster/autovacuum.c
M src/test/modules/brin/t/01_workitems.pl
Error message stylistic correction
commit : c09a06918dff9a1651ed12a24eb03712331b234b
author : Peter Eisentraut <peter@eisentraut.org>
date : Tue, 4 Nov 2025 11:59:17 +0100
committer: Peter Eisentraut <peter@eisentraut.org>
date : Tue, 4 Nov 2025 11:59:17 +0100 Fixup for commit ef5e60a9d35: The inconsistent use of articles was a
bit awkward. M src/backend/parser/parse_expr.c
M src/test/regress/expected/collate.icu.utf8.out
libpq: Improve error handling in passwordFromFile()
commit : 861af9261035cec7408040d646cba92959ba6f13
author : Michael Paquier <michael@paquier.xyz>
date : Tue, 4 Nov 2025 20:12:48 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Tue, 4 Nov 2025 20:12:48 +0900 Previously, passwordFromFile() returned NULL for valid cases (like no
matching password found) and actual errors (two out-of-memory paths).
This made it impossible for its sole caller, pqConnectOptions2(), to
distinguish between these scenarios and fail the connection
appropriately should an out-of-memory error occur.
This patch extends passwordFromFile() to be able to detect both valid
and failure cases, with an error string given back to the caller of the
function.
Out-of-memory failures unlikely happen in the field, so no backpatch is
done.
Author: Joshua Shanks <jjshanks@gmail.com>
Discussion: https://postgr.es/m/CAOxqWDfihFRmhNVdfu8epYTXQRxkCHSOrg+=-ij2c_X3gW=o3g@mail.gmail.com M src/interfaces/libpq/fe-connect.c
Use USECS_PER_SEC from datatype/timestamp.h
commit : ad1581d7feaeb1d78a0858703dac1bcb52f600d8
author : Álvaro Herrera <alvherre@kurilemu.de>
date : Tue, 4 Nov 2025 10:07:54 +0100
committer: Álvaro Herrera <alvherre@kurilemu.de>
date : Tue, 4 Nov 2025 10:07:54 +0100 We had two places defining their own constants for this.
Author: Álvaro Herrera <alvherre@kurilemu.de>
Reviewed-by: Peter Smith <smithpb2250@gmail.com>
Discussion: https://postgr.es/m/202510311750.mxiykx3tp4mx@alvherre.pgsql M src/bin/pg_basebackup/pg_createsubscriber.c
M src/bin/pg_ctl/pg_ctl.c
Add assertion check for WAL receiver state during stream-archive transition
commit : 65f4976189b6cbe9aa93fc5f4b1eb7a2040b6301
author : Michael Paquier <michael@paquier.xyz>
date : Tue, 4 Nov 2025 13:14:46 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Tue, 4 Nov 2025 13:14:46 +0900 When the startup process switches from streaming to archive as WAL
source, we avoid calling ShutdownWalRcv() if the WAL receiver is not
streaming, based on WalRcvStreaming(). WALRCV_STOPPING is a state set
by ShutdownWalRcv(), called only by the startup process, meaning that it
should not be possible to reach this state while in
WaitForWALToBecomeAvailable().
This commit adds an assertion to make sure that a WAL receiver is never
in a WALRCV_STOPPING state should the startup process attempt to reset
InstallXLogFileSegmentActive.
Idea suggested by Noah Misch.
Author: Xuneng Zhou <xunengzhou@gmail.com>
Discussion: https://postgr.es/m/19093-c4fff49a608f82a0@postgresql.org M src/backend/access/transam/xlogrecovery.c
Add WalRcvGetState() to retrieve the state of a WAL receiver
commit : e0ca61e7c4d55c34d67a3cc6fa0bdea2f41d2cf2
author : Michael Paquier <michael@paquier.xyz>
date : Tue, 4 Nov 2025 12:57:36 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Tue, 4 Nov 2025 12:57:36 +0900 This has come up as useful as an alternative of WalRcvStreaming(), to be
able to do sanity checks based on the state of a WAL receiver. This
will be used in a follow-up commit.
Author: Xuneng Zhou <xunengzhou@gmail.com>
Discussion: https://postgr.es/m/19093-c4fff49a608f82a0@postgresql.org M src/backend/replication/walreceiverfuncs.c
M src/include/replication/walreceiver.h
Fix unconditional WAL receiver shutdown during stream-archive transition
commit : 17b2d5ec759c0d26b29def7e57f51d0515ddca1f
author : Michael Paquier <michael@paquier.xyz>
date : Tue, 4 Nov 2025 10:47:38 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Tue, 4 Nov 2025 10:47:38 +0900 Commit b4f584f9d2a1 (affecting v15~, later backpatched down to 13 as of
3635a0a35aaf) introduced an unconditional WAL receiver shutdown when
switching from streaming to archive WAL sources. This causes problems
during a timeline switch, when a WAL receiver enters WALRCV_WAITING
state but remains alive, waiting for instructions.
The unconditional shutdown can break some monitoring scenarios as the
WAL receiver gets repeatedly terminated and re-spawned, causing
pg_stat_wal_receiver.status to show a "streaming" instead of "waiting"
status, masking the fact that the WAL receiver is waiting for a new TLI
and a new LSN to be able to continue streaming.
This commit changes the WAL receiver behavior so as the shutdown becomes
conditional, with InstallXLogFileSegmentActive being always reset to
prevent the regression fixed by b4f584f9d2a1: only terminate the WAL
receiver when it is actively streaming (WALRCV_STREAMING,
WALRCV_STARTING, or WALRCV_RESTARTING). When in WALRCV_WAITING state,
just reset InstallXLogFileSegmentActive flag to allow archive
restoration without killing the process. WALRCV_STOPPED and
WALRCV_STOPPING are not reachable states in this code path. For the
latter, the startup process is the one in charge of setting
WALRCV_STOPPING via ShutdownWalRcv(), waiting for the WAL receiver to
reach a WALRCV_STOPPED state after switching walRcvState, so
WaitForWALToBecomeAvailable() cannot be reached while a WAL receiver is
in a WALRCV_STOPPING state.
A regression test is added to check that a WAL receiver is not stopped
on timeline jump, that fails when the fix of this commit is reverted.
Reported-by: Ryan Bird <ryanzxg@gmail.com>
Author: Xuneng Zhou <xunengzhou@gmail.com>
Reviewed-by: Noah Misch <noah@leadboat.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://postgr.es/m/19093-c4fff49a608f82a0@postgresql.org
Backpatch-through: 13 M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogrecovery.c
M src/include/access/xlog.h
M src/test/recovery/t/004_timeline_switch.pl
Doc: cover index CONCURRENTLY causing errors in INSERT ... ON CONFLICT.
commit : 8b18ed6dfbb8b3e4483801b513fea6b429140569
author : Noah Misch <noah@leadboat.com>
date : Mon, 3 Nov 2025 12:57:09 -0800
committer: Noah Misch <noah@leadboat.com>
date : Mon, 3 Nov 2025 12:57:09 -0800 Author: Mikhail Nikalayeu <mihailnikalayeu@gmail.com>
Reviewed-by: Noah Misch <noah@leadboat.com>
Discussion: https://postgr.es/m/CANtu0ojXmqjmEzp-=aJSxjsdE76iAsRgHBoK0QtYHimb_mEfsg@mail.gmail.com
Backpatch-through: 13 M doc/src/sgml/ref/insert.sgml
M src/backend/optimizer/util/plancat.c
Fix outdated comment of COPY in gram.y.
commit : e7ccb247b38fff342c13aa7bdf61ce5ab45b2a85
author : Masahiko Sawada <msawada@postgresql.org>
date : Mon, 3 Nov 2025 10:34:49 -0800
committer: Masahiko Sawada <msawada@postgresql.org>
date : Mon, 3 Nov 2025 10:34:49 -0800 Author: ChangAo Chen <cca5507@qq.com>
Discussion: https://postgr.es/m/tencent_392C0E92EC52432D0A336B9D52E66426F009@qq.com M src/backend/parser/gram.y
Add \pset options for boolean value display
commit : 645cb44c5490f70da4dca57b8ecca6562fb883a7
author : Álvaro Herrera <alvherre@kurilemu.de>
date : Mon, 3 Nov 2025 17:40:39 +0100
committer: Álvaro Herrera <alvherre@kurilemu.de>
date : Mon, 3 Nov 2025 17:40:39 +0100 New \pset variables display_true and display_false allow the user to
change how true and false values are displayed.
Author: David G. Johnston <David.G.Johnston@gmail.com>
Reviewed-by: Álvaro Herrera <alvherre@kurilemu.de>
Discussion: https://postgr.es/m/CAKFQuwYts3vnfQ5AoKhEaKMTNMfJ443MW2kFswKwzn7fiofkrw@mail.gmail.com
Discussion: https://postgr.es/m/56308F56.8060908@joh.to M doc/src/sgml/ref/psql-ref.sgml
M src/bin/psql/command.c
M src/bin/psql/help.c
M src/bin/psql/tab-complete.in.c
M src/fe_utils/print.c
M src/include/fe_utils/print.h
M src/test/regress/expected/psql.out
M src/test/regress/sql/psql.sql
Prevent setting a column as identity if its not-null constraint is invalid
commit : cf8be022538937fe9fe22de776fb8cfe6460a784
author : Álvaro Herrera <alvherre@kurilemu.de>
date : Mon, 3 Nov 2025 15:58:19 +0100
committer: Álvaro Herrera <alvherre@kurilemu.de>
date : Mon, 3 Nov 2025 15:58:19 +0100 We don't allow null values to appear in identity-generated columns in
other ways, so we shouldn't let unvalidated not-null constraints do it
either. Oversight in commit a379061a22a8.
Author: jian he <jian.universality@gmail.com>
Backpatch-through: 18
Discussion: https://postgr.es/m/CACJufxGQM_+vZoYJMaRoZfNyV=L2jxosjv_0TLAScbuLJXWRfQ@mail.gmail.com M src/backend/commands/tablecmds.c
M src/test/regress/expected/constraints.out
M src/test/regress/sql/constraints.sql
Remove WaitPMResult enum in pg_createsubscriber
commit : f242dbcede9cb1c2f60ca31e6ad1141e0713bc65
author : Álvaro Herrera <alvherre@kurilemu.de>
date : Mon, 3 Nov 2025 12:59:32 +0100
committer: Álvaro Herrera <alvherre@kurilemu.de>
date : Mon, 3 Nov 2025 12:59:32 +0100 A simple boolean suffices. This is cosmetic, so no backpatch.
Author: Álvaro Herrera <alvherre@kurilemu.de>
Discussion: https://postgr.es/m/202510311750.mxiykx3tp4mx@alvherre.pgsql M src/bin/pg_basebackup/pg_createsubscriber.c
Add wal_fpi_bytes to VACUUM and ANALYZE logs
commit : ad25744f436ed7809fc754e1a44630b087812fbc
author : Michael Paquier <michael@paquier.xyz>
date : Mon, 3 Nov 2025 19:42:03 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Mon, 3 Nov 2025 19:42:03 +0900 The new wal_fpi_bytes counter calculates the total amount of full page
images inserted in WAL records, in bytes. This commit adds this
information to VACUUM and ANALYZE logs alongside the existing counters,
building upon f9a09aa29520.
Author: Shinya Kato <shinya11.kato@gmail.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://postgr.es/m/aQMMSSlFXy4Evxn3@paquier.xyz M src/backend/access/heap/vacuumlazy.c
M src/backend/commands/analyze.c
Sort guc_parameters.dat alphabetically by name
commit : fce7c73fba4e5e3014c27b8980aa07511d6e0f85
author : Peter Eisentraut <peter@eisentraut.org>
date : Mon, 3 Nov 2025 09:37:20 +0100
committer: Peter Eisentraut <peter@eisentraut.org>
date : Mon, 3 Nov 2025 09:37:20 +0100 The order in this list was previously pretty random and had grown
organically over time. This made it unnecessarily cumbersome to
maintain these lists, as there was no clear guidelines about where to
put new entries. Also, after the merger of the type-specific GUC
structs, the list still reflected the previous type-specific
super-order.
By using alphabetical order, the place for new entries becomes clear,
and often related entries will be listed close together.
This patch reorders the existing entries in guc_parameters.dat, and it
also augments the generation script to error if an entry is found at
the wrong place.
Note: The order is actually checked after lower-casing, to handle the
likes of "DateStyle".
Reviewed-by: John Naylor <johncnaylorls@gmail.com>
Reviewed-by: Álvaro Herrera <alvherre@kurilemu.de>
Reviewed-by: Heikki Linnakangas <hlinnaka@iki.fi>
Discussion: https://www.postgresql.org/message-id/flat/8fdfb91e-60fb-44fa-8df6-f5dea47353c9@eisentraut.org M src/backend/utils/misc/gen_guc_tables.pl
M src/backend/utils/misc/guc_parameters.dat
Change "long" numGroups fields to be Cardinality (i.e., double).
commit : 8f29467c57f44cc2cdd9e4e53c6ab1b07375d5b4
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Sun, 2 Nov 2025 16:57:43 -0500
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Sun, 2 Nov 2025 16:57:43 -0500 We've been nibbling away at removing uses of "long" for a long time,
since its width is platform-dependent. Here's one more: change the
remaining "long" fields in Plan nodes to Cardinality, since the three
surviving examples all represent group-count estimates. The upstream
planner code was converted to Cardinality some time ago; for example
the corresponding fields in Path nodes are type Cardinality, as are
the arguments of the make_foo_path functions. Downstream in the
executor, it turns out that these all feed to the table-size argument
of BuildTupleHashTable. Change that to "double" as well, and fix it
so that it safely clamps out-of-range values to the uint32 limit of
simplehash.h, as was not being done before.
Essentially, this is removing all the artificial datatype-dependent
limitations on these values from upstream processing, and applying
just one clamp at the moment where we're forced to do so by the
datatype choices of simplehash.h.
Also, remove BuildTupleHashTable's misguided attempt to enforce
work_mem/hash_mem_limit. It doesn't have enough information
(particularly not the expected tuple width) to do that accurately,
and it has no real business second-guessing the caller's choice.
For all these plan types, it's really the planner's responsibility
to not choose a hashed implementation if the hashtable is expected
to exceed hash_mem_limit. The previous patch improved the
accuracy of those estimates, and even if BuildTupleHashTable had
more information it should arrive at the same conclusions.
Reported-by: Jeff Janes <jeff.janes@gmail.com>
Author: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: David Rowley <dgrowleyml@gmail.com>
Discussion: https://postgr.es/m/CAMkU=1zia0JfW_QR8L5xA2vpa0oqVuiapm78h=WpNsHH13_9uw@mail.gmail.com M src/backend/executor/execGrouping.c
M src/backend/executor/nodeAgg.c
M src/backend/executor/nodeRecursiveunion.c
M src/backend/executor/nodeSetOp.c
M src/backend/executor/nodeSubplan.c
M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/plan/createplan.c
M src/include/executor/executor.h
M src/include/nodes/plannodes.h
M src/include/optimizer/optimizer.h
M src/include/optimizer/planmain.h
Improve planner's estimates of tuple hash table sizes.
commit : 1ea5bdb00bfbc6f8034859cd19769346bf31dc53
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Sun, 2 Nov 2025 16:57:26 -0500
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Sun, 2 Nov 2025 16:57:26 -0500 For several types of plan nodes that use TupleHashTables, the
planner estimated the expected size of the table as basically
numEntries * (MAXALIGN(dataWidth) + MAXALIGN(SizeofHeapTupleHeader)).
This is pretty far off, especially for small data widths, because
it doesn't account for the overhead of the simplehash.h hash table
nor for any per-tuple "additional space" the plan node may request.
Jeff Janes noted a case where the estimate was off by about a factor
of three, even though the obvious hazards such as inaccurate estimates
of numEntries or dataWidth didn't apply.
To improve matters, create functions provided by the relevant executor
modules that can estimate the required sizes with reasonable accuracy.
(We're still not accounting for effects like allocator padding, but
this at least gets the first-order effects correct.)
I added functions that can estimate the tuple table sizes for
nodeSetOp and nodeSubplan; these rely on an estimator for
TupleHashTables in general, and that in turn relies on one for
simplehash.h hash tables. That feels like kind of a lot of mechanism,
but if we take any short-cuts we're violating modularity boundaries.
The other places that use TupleHashTables are nodeAgg, which took
pains to get its numbers right already, and nodeRecursiveunion.
I did not try to improve the situation for nodeRecursiveunion because
there's nothing to improve: we are not making an estimate of the hash
table size, and it wouldn't help us to do so because we have no
non-hashed alternative implementation. On top of that, our estimate
of the number of entries to be hashed in that module is so suspect
that we'd likely often choose the wrong implementation if we did have
two ways to do it.
Reported-by: Jeff Janes <jeff.janes@gmail.com>
Author: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: David Rowley <dgrowleyml@gmail.com>
Discussion: https://postgr.es/m/CAMkU=1zia0JfW_QR8L5xA2vpa0oqVuiapm78h=WpNsHH13_9uw@mail.gmail.com M src/backend/executor/execGrouping.c
M src/backend/executor/nodeSetOp.c
M src/backend/executor/nodeSubplan.c
M src/backend/optimizer/plan/subselect.c
M src/backend/optimizer/util/pathnode.c
M src/include/executor/executor.h
M src/include/executor/nodeSetOp.h
M src/include/executor/nodeSubplan.h
M src/include/lib/simplehash.h
Document nbtree row comparison design.
commit : b8f1c62807a58dc97e9262a17e7d0cadb305322b
author : Peter Geoghegan <pg@bowt.ie>
date : Sun, 2 Nov 2025 15:27:05 -0500
committer: Peter Geoghegan <pg@bowt.ie>
date : Sun, 2 Nov 2025 15:27:05 -0500 Add comments explaining when and where it is safe for nbtree to treat
row compare keys as if they were simple scalar inequality keys on the
row's most significant column. This is particularly important within
_bt_advance_array_keys, which deals with required inequality keys in a
general and uniform way, without any special handling for row compares.
Also spell out the implications of _bt_check_rowcompare's approach of
_conditionally_ evaluating lower-order row compare subkeys, particularly
when one of its lower-order subkeys might see NULL index tuple values
(these may or may not affect whether the qual as a whole is satisfied).
The behavior in this area isn't particularly intuitive, so these issues
seem worth going into.
In passing, add a few more defensive/documenting row comparison related
assertions to _bt_first and _bt_check_rowcompare.
Follow-up to commits bd3f59fd and ec986020.
Author: Peter Geoghegan <pg@bowt.ie>
Reviewed-By: Victor Yegorov <vyegorov@gmail.com>
Reviewed-By: Chao Li <li.evan.chao@gmail.com>
Discussion: https://postgr.es/m/CAH2-Wznwkak_K7pcAdv9uH8ZfNo8QO7+tHXOaCUddMeTfaCCFw@mail.gmail.com
Backpatch-through: 18 M src/backend/access/nbtree/nbtsearch.c
M src/backend/access/nbtree/nbtutils.c
Remove obsolete nbtree equality key comments.
commit : 4f08586c7ae5df69f768b3c4cf87f2e1a543a975
author : Peter Geoghegan <pg@bowt.ie>
date : Sun, 2 Nov 2025 13:34:18 -0500
committer: Peter Geoghegan <pg@bowt.ie>
date : Sun, 2 Nov 2025 13:34:18 -0500 _bt_first reliably uses the same equality key (on each index column) for
initial positioning purposes as the one that _bt_checkkeys can use to
end the scan following commit f09816a0. _bt_first no longer applies its
own independent rules to determine which initial positioning key to use
on each column (for equality and inequality keys alike). Preprocessing
is now fully in control of determining which keys start and end each
scan, ensuring that _bt_first and _bt_checkkeys have symmetric behavior.
Remove obsolete comments that described why _bt_first was expected to
use at least one of the available required equality keys for initial
positioning purposes. The rules in this area are now maximally strict
and uniform, so there's no reason to draw attention to equality keys.
Any column with a required equality key cannot have a redundant required
inequality key (nor can it have a redundant required equality key).
Oversight in commit f09816a0, which removed similar comments from
_bt_first, but missed these comments.
Author: Peter Geoghegan <pg@bowt.ie>
Backpatch-through: 18 M src/backend/access/nbtree/nbtsearch.c
M src/backend/access/nbtree/nbtutils.c
Avoid mixing void and integer in a conditional expression.
commit : 645c1e2752d98dba2684a2c0d72aa788badb4908
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Sun, 2 Nov 2025 12:30:44 -0500
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Sun, 2 Nov 2025 12:30:44 -0500 The C standard says that the second and third arguments of a
conditional operator shall be both void type or both not-void
type. The Windows version of INTERRUPTS_PENDING_CONDITION()
got this wrong. It's pretty harmless because the result of
the operator is ignored anyway, but apparently recent versions
of MSVC have started issuing a warning about it. Silence the
warning by casting the dummy zero to void.
Reported-by: Christian Ullrich <chris@chrullrich.net>
Author: Bryan Green <dbryan.green@gmail.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/cc4ef8db-f8dc-4347-8a22-e7ebf44c0308@chrullrich.net
Backpatch-through: 13 M src/include/miscadmin.h
Remove unused variable in recovery/t/006_logical_decoding.pl.
commit : b70cafd85fb5040d49a4e026fa9798d4ed5de17b
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Sat, 1 Nov 2025 14:01:52 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Sat, 1 Nov 2025 14:01:52 -0400 Author: Daniil Davydov <3danissimo@gmail.com>
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>
Discussion: https://postgr.es/m/CAJDiXggmZWew8+SY_9o0atpmaJmPTL25wdz07MrDoqCkp4D1ug@mail.gmail.com M src/test/recovery/t/006_logical_decoding.pl
Fix contrib/ltree's subpath() with negative offset.
commit : ff8aba65d463b144db7c081181b5ccf6eaaf1af4
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Sat, 1 Nov 2025 13:25:42 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Sat, 1 Nov 2025 13:25:42 -0400 subpath(ltree,offset,len) now correctly errors when given an offset
less than -n, where n is the number of labels in the given ltree.
There was a duplicate block of code that allowed an offset as low
as -2n. The documentation says no such thing, so this must have
been a copy-and-paste error in the original ltree patch.
While here, avoid redundant calculation of "end" and write
LTREE_MAX_LEVELS rather than its hard-coded value.
Author: Marcus Gartner <m.a.gartner@gmail.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/CAAUGV_SvBO9gWYbaejb9nhe-mS9FkNP4QADNTdM3wdRhvLobwA@mail.gmail.com M contrib/ltree/expected/ltree.out
M contrib/ltree/ltree_op.c
M contrib/ltree/sql/ltree.sql
pg_createsubscriber: reword dry-run log messages
commit : 2648eab3779b0204368f785f9df84de01270e537
author : Álvaro Herrera <alvherre@kurilemu.de>
date : Fri, 31 Oct 2025 18:49:50 +0100
committer: Álvaro Herrera <alvherre@kurilemu.de>
date : Fri, 31 Oct 2025 18:49:50 +0100 The original messages were confusing in dry-run mode in that they state
that something is being done, when in reality it isn't. Use alternative
wording in that case, to make the distinction clear.
Author: Peter Smith <smithpb2250@gmail.com>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Euler Taveira <euler@eulerto.com>
Backpatch-through: 18
Discussion: https://postgr.es/m/CAHut+PsvQJQnQO0KT0S2oegenkvJ8FUuY-QS5syyqmT24R2xFQ@mail.gmail.com M src/bin/pg_basebackup/pg_createsubscriber.c
M src/bin/pg_basebackup/t/040_pg_createsubscriber.pl
pg_createsubscriber: Fix error complaining about the wrong thing
commit : 11144915e101eff94556192f5f18f6ac133da43e
author : Álvaro Herrera <alvherre@kurilemu.de>
date : Fri, 31 Oct 2025 17:43:15 +0100
committer: Álvaro Herrera <alvherre@kurilemu.de>
date : Fri, 31 Oct 2025 17:43:15 +0100 The code updates the system identifier, then runs pg_walreset; if the
latter fails, it complains about the former, which makes no sense.
Change the error message to complain about the right thing.
Noticed while reviewing a patch touching nearby code.
Author: Álvaro Herrera <alvherre@kurilemu.de>
Backpatch-through: 17 M src/bin/pg_basebackup/pg_createsubscriber.c
Mark function arguments of type "Datum *" as "const Datum *" where possible
commit : 8a27d418f8fc08b62f371c1b167efbfbf0a2a24e
author : Peter Eisentraut <peter@eisentraut.org>
date : Fri, 31 Oct 2025 10:45:02 +0100
committer: Peter Eisentraut <peter@eisentraut.org>
date : Fri, 31 Oct 2025 10:45:02 +0100 Several functions in the codebase accept "Datum *" parameters but do
not modify the pointed-to data. These have been updated to take
"const Datum *" instead, improving type safety and making the
interfaces clearer about their intent. This change helps the compiler
catch accidental modifications and better documents immutability of
arguments.
Most of "Datum *" parameters have a pairing "bool *isnull" parameter,
they are constified as well.
No functional behavior is changed by this patch.
Author: Chao Li <lic@highgo.com>
Discussion: https://www.postgresql.org/message-id/flat/CAEoWx2msfT0knvzUa72ZBwu9LR_RLY4on85w2a9YpE-o2By5HQ@mail.gmail.com M doc/src/sgml/spi.sgml
M src/backend/access/brin/brin_minmax_multi.c
M src/backend/access/hash/hashutil.c
M src/backend/access/heap/heaptoast.c
M src/backend/access/nbtree/nbtpreprocesskeys.c
M src/backend/access/nbtree/nbtsort.c
M src/backend/access/spgist/spgdoinsert.c
M src/backend/access/spgist/spgtextproc.c
M src/backend/executor/execPartition.c
M src/backend/executor/nodeIndexscan.c
M src/backend/executor/spi.c
M src/backend/partitioning/partbounds.c
M src/backend/partitioning/partprune.c
M src/backend/statistics/attribute_stats.c
M src/backend/tsearch/ts_selfuncs.c
M src/backend/utils/adt/array_selfuncs.c
M src/backend/utils/adt/arrayfuncs.c
M src/backend/utils/adt/json.c
M src/backend/utils/adt/jsonfuncs.c
M src/backend/utils/adt/multirangetypes_selfuncs.c
M src/backend/utils/adt/network_selfuncs.c
M src/backend/utils/adt/orderedsetaggs.c
M src/backend/utils/adt/rangetypes_selfuncs.c
M src/backend/utils/adt/xml.c
M src/backend/utils/cache/catcache.c
M src/include/access/hash.h
M src/include/access/heaptoast.h
M src/include/access/spgist_private.h
M src/include/executor/spi.h
M src/include/partitioning/partbounds.h
M src/include/utils/array.h
M src/include/utils/jsonb.h
M src/include/utils/xml.h
M src/test/modules/spgist_name_ops/spgist_name_ops.c
formatting.c cleanup: Change fill_str() return type to void
commit : aa4535307e3d432f44b4c76b8ffebc5a0789250c
author : Peter Eisentraut <peter@eisentraut.org>
date : Fri, 31 Oct 2025 09:53:01 +0100
committer: Peter Eisentraut <peter@eisentraut.org>
date : Fri, 31 Oct 2025 09:53:01 +0100 The return value is not used anywhere.
In passing, add a comment explaining the function's arguments.
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/6dd9d208-a3ed-49b5-b03d-8617261da973%40eisentraut.org M src/backend/utils/adt/formatting.c
formatting.c cleanup: Rename DCH_S_* to DCH_SUFFIX_*
commit : da2052ab9a256277391a361715abb66c9b7956c4
author : Peter Eisentraut <peter@eisentraut.org>
date : Fri, 31 Oct 2025 08:05:33 +0100
committer: Peter Eisentraut <peter@eisentraut.org>
date : Fri, 31 Oct 2025 08:05:33 +0100 For clarity. Also rename several related macros and turn them into
inline functions.
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/6dd9d208-a3ed-49b5-b03d-8617261da973%40eisentraut.org M src/backend/utils/adt/formatting.c
formatting.c cleanup: Change several int fields to enums
commit : 378212c68ab0f84fce2379c6e9cee750fec3c45b
author : Peter Eisentraut <peter@eisentraut.org>
date : Fri, 31 Oct 2025 08:05:33 +0100
committer: Peter Eisentraut <peter@eisentraut.org>
date : Fri, 31 Oct 2025 08:05:33 +0100 This makes their purpose more self-documenting.
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/6dd9d208-a3ed-49b5-b03d-8617261da973%40eisentraut.org M src/backend/utils/adt/formatting.c
formatting.c cleanup: Change TmFromChar.clock field to bool
commit : ce5f6817e4d572300f303a797f4f42820ead0044
author : Peter Eisentraut <peter@eisentraut.org>
date : Fri, 31 Oct 2025 08:05:33 +0100
committer: Peter Eisentraut <peter@eisentraut.org>
date : Fri, 31 Oct 2025 08:05:33 +0100 This makes the purpose clearer and avoids having two extra symbols,
one of which (CLOCK_24_HOUR) was unused.
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/6dd9d208-a3ed-49b5-b03d-8617261da973%40eisentraut.org M src/backend/utils/adt/formatting.c
Add test tracking WAL receiver shutdown for primary_conninfo updates
commit : c9e38a569c5fe8006a08f63ba6b63d8021704c53
author : Michael Paquier <michael@paquier.xyz>
date : Fri, 31 Oct 2025 11:24:24 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Fri, 31 Oct 2025 11:24:24 +0900 The test introduced by this commit checks that a reload of
primary_conninfo leads to a WAL receiver restarted, by looking at the
request generated in the server logs. This is something for what there
was no coverage.
This has come up for a different patch, while discussing a regression
where a WAL receiver should not be stopped while waiting for a new
position to stream, like at the end of a timeline. In the case of the
other patch, we want to check that this log entry is not generated, but
if the error message is reworded the test would become silently broken.
The test of this commit ensures that we at least keep track the log
message format, for a supported scenario.
Extracted from a larger patch by the same author.
Author: Xuneng Zhou <xunengzhou@gmail.com>
Discussion: https://postgr.es/m/aQKlC1v2_MXGV6_9@paquier.xyz M src/test/recovery/t/040_standby_failover_slots_sync.pl
doc: rewrite random_page_cost description
commit : 3896e861b348f282813f165f60fb8ab3342114c6
author : Bruce Momjian <bruce@momjian.us>
date : Thu, 30 Oct 2025 19:11:53 -0400
committer: Bruce Momjian <bruce@momjian.us>
date : Thu, 30 Oct 2025 19:11:53 -0400 This removes some of the specifics of how the default was set, and adds
a mention of latency as a reason the value is lower than the storage
hardware might suggest. It still mentions caching.
Discussion: https://postgr.es/m/CAKAnmmK_nSPYr53LobUwQD59a-8U9GEC3XGJ43oaTYJq5nAOkw@mail.gmail.com
Backpatch-through: 13 M doc/src/sgml/config.sgml
ci: macos: Upgrade to Sequoia
commit : 9c398fdf48176cde67e64ce40828aaaf98cf3750
author : Andres Freund <andres@anarazel.de>
date : Thu, 30 Oct 2025 16:08:21 -0400
committer: Andres Freund <andres@anarazel.de>
date : Thu, 30 Oct 2025 16:08:21 -0400 Author: Nazir Bilal Yavuz <byavuz81@gmail.com>
Discussion: https://postgr.es/m/CAN55FZ3kO4vLq56PWrfJ7Fw6Wz8DhEN9j9GX3aScx%2BWOirtK-g%40mail.gmail.com
Backpatch: 15-, where CI support was added M .cirrus.tasks.yml
ci: Fix Windows and MinGW task names
commit : 0a8a4be8660dc507288961042d8994cac0045c80
author : Andres Freund <andres@anarazel.de>
date : Thu, 30 Oct 2025 13:06:42 -0400
committer: Andres Freund <andres@anarazel.de>
date : Thu, 30 Oct 2025 13:06:42 -0400 They use Windows Server 2022, not 2019.
Author: Nazir Bilal Yavuz <byavuz81@gmail.com>
Discussion: https://postgr.es/m/flat/CAN55FZ1OsaM+852BMQDJ+Kgfg+07knJ6dM3PjbGbtYaK4qwfqA@mail.gmail.com M .cirrus.tasks.yml
Use BumpContext contexts in TupleHashTables, and do some code cleanup.
commit : c106ef08071ad611fdf4febb3a8d2da441272a6d
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Thu, 30 Oct 2025 11:21:22 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Thu, 30 Oct 2025 11:21:22 -0400 For all extant uses of TupleHashTables, execGrouping.c itself does
nothing with the "tablecxt" except to allocate new hash entries in it,
and the callers do nothing with it except to reset the whole context.
So this is an ideal use-case for a BumpContext, and the hash tables
are frequently big enough for the savings to be significant.
(Commit cc721c459 already taught nodeAgg.c this idea, but neglected
the other callers of BuildTupleHashTable.)
While at it, let's clean up some ill-advised leftovers from rebasing
TupleHashTables on simplehash.h:
* Many comments and variable names were based on the idea that the
tablecxt holds the whole TupleHashTable, whereas now it only holds the
hashed tuples (plus any caller-defined "additional storage"). Rename
to names like tuplescxt and tuplesContext, and adjust the comments.
Also adjust the memory context names to be like "<Foo> hashed tuples".
* Make ResetTupleHashTable() reset the tuplescxt rather than relying
on the caller to do so; that was fairly bizarre and seems like a
recipe for leaks. This is less efficient in the case where nodeAgg.c
uses the same tuplescxt for several different hashtables, but only
microscopically so because mcxt.c will short-circuit the extra resets
via its isReset flag. I judge the extra safety and intellectual
cleanliness well worth those few cycles.
* Remove the long-obsolete "allow_jit" check added by ac88807f9;
instead, just Assert that metacxt and tuplescxt are different.
We need that anyway for this definition of ResetTupleHashTable() to
be safe.
There is a side issue of the extent to which this change invalidates
the planner's estimates of hashtable memory consumption. However,
those estimates are already pretty bad, so improving them seems like
it can be a separate project. This change is useful to do first to
establish consistent executor behavior that the planner can expect.
A loose end not addressed here is that the "entrysize" calculation
in BuildTupleHashTable seems wrong: "sizeof(TupleHashEntryData) +
additionalsize" corresponds neither to the size of the simplehash
entries nor to the total space needed per tuple. It's questionable
why BuildTupleHashTable is second-guessing its caller's nbuckets
choice at all, since the original source of the number should have had
more information. But that all seems wrapped up with the planner's
estimation logic, so let's leave it for the planned followup patch.
Reported-by: Jeff Janes <jeff.janes@gmail.com>
Reported-by: David Rowley <dgrowleyml@gmail.com>
Author: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: David Rowley <dgrowleyml@gmail.com>
Discussion: https://postgr.es/m/CAMkU=1zia0JfW_QR8L5xA2vpa0oqVuiapm78h=WpNsHH13_9uw@mail.gmail.com
Discussion: https://postgr.es/m/2268409.1761512111@sss.pgh.pa.us M src/backend/executor/execGrouping.c
M src/backend/executor/nodeAgg.c
M src/backend/executor/nodeRecursiveunion.c
M src/backend/executor/nodeSetOp.c
M src/backend/executor/nodeSubplan.c
M src/include/executor/executor.h
M src/include/nodes/execnodes.h
Mark ItemPointer arguments as const throughout
commit : e1ac846f3d2836dcfa0ad15310e28d0a0b495500
author : Peter Eisentraut <peter@eisentraut.org>
date : Thu, 30 Oct 2025 14:10:39 +0100
committer: Peter Eisentraut <peter@eisentraut.org>
date : Thu, 30 Oct 2025 14:10:39 +0100 This is a follow up 991295f. I searched over src/ and made all
ItemPointer arguments as const as much as possible.
Note: We cut out from the original patch the pieces that would have
created incompatibilities in the index or table AM APIs. Those could
be considered separately.
Author: Chao Li <li.evan.chao@gmail.com>
Discussion: https://www.postgresql.org/message-id/CAEoWx2nBaypg16Z5ciHuKw66pk850RFWw9ACS2DqqJ_AkKeRsw%40mail.gmail.com M src/backend/access/common/tidstore.c
M src/backend/access/hash/hashsort.c
M src/backend/access/heap/heapam.c
M src/backend/access/nbtree/nbtdedup.c
M src/backend/access/nbtree/nbtsearch.c
M src/backend/access/nbtree/nbtsort.c
M src/backend/access/nbtree/nbtsplitloc.c
M src/backend/access/spgist/spgdoinsert.c
M src/backend/access/spgist/spgutils.c
M src/backend/access/spgist/spgvacuum.c
M src/backend/catalog/indexing.c
M src/backend/executor/execIndexing.c
M src/backend/storage/lmgr/predicate.c
M src/backend/utils/adt/tid.c
M src/backend/utils/sort/tuplesortvariants.c
M src/include/access/hash.h
M src/include/access/heapam.h
M src/include/access/nbtree.h
M src/include/access/spgist_private.h
M src/include/access/tidstore.h
M src/include/catalog/index.h
M src/include/catalog/indexing.h
M src/include/executor/executor.h
M src/include/storage/predicate.h
M src/include/utils/tuplesort.h
Simplify coding in ProcessQuery
commit : a27c40bfe8ab1834c45d657844df3a84cbb292ac
author : Álvaro Herrera <alvherre@kurilemu.de>
date : Thu, 30 Oct 2025 11:26:06 +0100
committer: Álvaro Herrera <alvherre@kurilemu.de>
date : Thu, 30 Oct 2025 11:26:06 +0100 The original is pretty baroque for no apparent reason; arguably, commit
2f9661311b83 should have done this. Noted while reviewing related code
for bug #18984. This is cosmetic (though I'm surprised that my compiler
generates shorter assembly this way), so no backpatch.
Discussion: https://postgr.es/m/18984-0f4778a6599ac3ae@postgresql.org M src/backend/tcop/pquery.c
Fix some confusing uses of const
commit : 8ce795fcb70df7a8fdf3303eec0cfcd703b0d122
author : Peter Eisentraut <peter@eisentraut.org>
date : Thu, 30 Oct 2025 10:44:36 +0100
committer: Peter Eisentraut <peter@eisentraut.org>
date : Thu, 30 Oct 2025 10:44:36 +0100 There are a few places where we have
typedef struct FooData { ... } FooData;
typedef FooData *Foo;
and then function declarations with
bar(const Foo x)
which isn't incorrect but probably meant
bar(const FooData *x)
meaning that the thing x points to is immutable, not x itself.
This patch makes those changes where appropriate. In one
case (execGrouping.c), the thing being pointed to was not immutable,
so in that case remove the const altogether, to avoid further
confusion.
Co-authored-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://www.postgresql.org/message-id/CAEoWx2m2E0xE8Kvbkv31ULh_E%2B5zph-WA_bEdv3UR9CLhw%2B3vg%40mail.gmail.com
Discussion: https://www.postgresql.org/message-id/CAEoWx2kTDz%3Db6T2xHX78vy_B_osDeCC5dcTCi9eG0vXHp5QpdQ%40mail.gmail.com M contrib/pg_surgery/heap_surgery.c
M src/backend/access/gin/ginget.c
M src/backend/access/gin/ginpostinglist.c
M src/backend/executor/execGrouping.c
M src/backend/nodes/tidbitmap.c
M src/backend/utils/adt/tsvector_op.c
M src/include/access/gin_private.h
M src/include/nodes/tidbitmap.h
M src/tools/pgindent/typedefs.list
docs: Link to the correct protocol version inspection function
commit : 9fcd4874ed50ee6c60dadd0f1146d8fea9ff0055
author : Peter Eisentraut <peter@eisentraut.org>
date : Thu, 30 Oct 2025 10:59:56 +0100
committer: Peter Eisentraut <peter@eisentraut.org>
date : Thu, 30 Oct 2025 10:59:56 +0100 The docs for max_protocol_version suggested PQprotocolVersion()
instead of PQfullProtocolVersion() to find out the exact protocol
version. Since PQprotocolVersion() only returns the major protocol
version, that is bad advice.
Author: Jelte Fennema-Nio <postgres@jeltef.nl>
Reviewed-by: Shinya Kato <shinya11.kato@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/CAGECzQSKFxQsYAgr11PhdOr-RtPZEdAXZnHx6U3avLuk3xQaTQ%40mail.gmail.com M doc/src/sgml/libpq.sgml
const-qualify ItemPointer comparison functions
commit : 3479a0f823d5a6c3ec61dff6b11ea5250389e56a
author : Peter Eisentraut <peter@eisentraut.org>
date : Thu, 30 Oct 2025 09:38:52 +0100
committer: Peter Eisentraut <peter@eisentraut.org>
date : Thu, 30 Oct 2025 09:38:52 +0100 Add const qualifiers to ItemPointerEquals() and ItemPointerCompare().
This will allow further changes up the stack. It also complements
commit aeb767ca0b0, as we now have all of itemptr.h appropriately
const-qualified.
Author: Chao Li <li.evan.chao@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/CAEoWx2nBaypg16Z5ciHuKw66pk850RFWw9ACS2DqqJ_AkKeRsw@mail.gmail.com M src/backend/storage/page/itemptr.c
M src/include/storage/itemptr.h
formatting.c cleanup: Improve formatting of some struct declarations
commit : e2cf524e4ad8a8667033628ca106fb7c9ebcd207
author : Peter Eisentraut <peter@eisentraut.org>
date : Thu, 30 Oct 2025 08:18:34 +0100
committer: Peter Eisentraut <peter@eisentraut.org>
date : Thu, 30 Oct 2025 08:18:34 +0100 This makes future editing easier.
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/6dd9d208-a3ed-49b5-b03d-8617261da973%40eisentraut.org M src/backend/utils/adt/formatting.c
formatting.c cleanup: Remove unnecessary zeroize macros
commit : 9a1a5dfee8bbab0b258472800f7e0be5836ad4f6
author : Peter Eisentraut <peter@eisentraut.org>
date : Thu, 30 Oct 2025 08:18:34 +0100
committer: Peter Eisentraut <peter@eisentraut.org>
date : Thu, 30 Oct 2025 08:18:34 +0100 Replace with initializer or memset().
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/6dd9d208-a3ed-49b5-b03d-8617261da973%40eisentraut.org M src/backend/utils/adt/formatting.c
formatting.c cleanup: Remove unnecessary extra line breaks in error message literals
commit : 38506f55fd4ac5ee4fe6b21bc2a380a14e7b2089
author : Peter Eisentraut <peter@eisentraut.org>
date : Thu, 30 Oct 2025 08:18:34 +0100
committer: Peter Eisentraut <peter@eisentraut.org>
date : Thu, 30 Oct 2025 08:18:34 +0100 Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/6dd9d208-a3ed-49b5-b03d-8617261da973%40eisentraut.org M src/backend/utils/adt/formatting.c
Expose wal_fpi_bytes in EXPLAIN (WAL)
commit : 5ab0b6a248076bf373a80bc7e83a5dfa4edf13aa
author : Michael Paquier <michael@paquier.xyz>
date : Thu, 30 Oct 2025 15:34:01 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Thu, 30 Oct 2025 15:34:01 +0900 The new wal_fpi_bytes counter calculates the total amount of full page
images inserted in WAL records, in bytes. This commit exposes this
information in EXPLAIN (ANALYZE, WAL) alongside the existing counters,
for both the text and JSON/YAML outputs, building upon f9a09aa29520.
Author: Shinya Kato <shinya11.kato@gmail.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Discusssion: https://postgr.es/m/CAOzEurQtZEAfg6P0kU3Wa-f9BWQOi0RzJEMPN56wNTOmJLmfaQ@mail.gmail.com M doc/src/sgml/ref/explain.sgml
M src/backend/commands/explain.c
Fix regression with slot invalidation checks
commit : d432094689062b6a0b7b2504b289d34defca8888
author : Michael Paquier <michael@paquier.xyz>
date : Thu, 30 Oct 2025 13:13:28 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Thu, 30 Oct 2025 13:13:28 +0900 This commit reverts 818fefd8fd4, that has been introduced to address a
an instability in some of the TAP tests due to the presence of random
standby snapshot WAL records, when slots are invalidated by
InvalidatePossiblyObsoleteSlot().
Anyway, this commit had also the consequence of introducing a behavior
regression. After 818fefd8fd4, the code may determine that a slot needs
to be invalidated while it may not require one: the slot may have moved
from a conflicting state to a non-conflicting state between the moment
when the mutex is released and the moment when we recheck the slot, in
InvalidatePossiblyObsoleteSlot(). Hence, the invalidations may be more
aggressive than they actually have to.
105b2cb3361 has tackled the test instability in a way that should be
hopefully sufficient for the buildfarm, even for slow members:
- In v18, the test relies on an injection point that bypasses the
creation of the random records generated for standby snapshots,
eliminating the random factor that impacted the test. This option was
not available when 818fefd8fd4 was discussed.
- In v16 and v17, the problem was bypassed by disallowing a slot to
become active in some of the scenarios tested.
While on it, this commit adds a comment to document that it is fine for
a recheck to use xmin and LSN values stored in the slot, without storing
and reusing them across multiple checks.
Reported-by: "suyu.cmj" <mengjuan.cmj@alibaba-inc.com>
Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com>
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>
Discussion: https://postgr.es/m/f492465f-657e-49af-8317-987460cb68b0.mengjuan.cmj@alibaba-inc.com
Backpatch-through: 16 M src/backend/replication/slot.c
Disable parallel plans for RIGHT_SEMI joins
commit : 257ee78341f2657d5c19cdaf0888f843e9bb0c33
author : Richard Guo <rguo@postgresql.org>
date : Thu, 30 Oct 2025 11:58:45 +0900
committer: Richard Guo <rguo@postgresql.org>
date : Thu, 30 Oct 2025 11:58:45 +0900 RIGHT_SEMI joins rely on the HEAP_TUPLE_HAS_MATCH flag to guarantee
that only the first match for each inner tuple is considered.
However, in a parallel hash join, the inner relation is stored in a
shared global hash table that can be probed by multiple workers
concurrently. This allows different workers to inspect and set the
match flags of the same inner tuples at the same time.
If two workers probe the same inner tuple concurrently, both may see
the match flag as unset and emit the same tuple, leading to duplicate
output rows and violating RIGHT_SEMI join semantics.
For now, we disable parallel plans for RIGHT_SEMI joins. In the long
term, it may be possible to support parallel execution by performing
atomic operations on the match flag, for example using a CAS or
similar mechanism.
Backpatch to v18, where RIGHT_SEMI join was introduced.
Bug: #19094
Reported-by: Lori Corbani <Lori.Corbani@jax.org>
Diagnosed-by: Tom Lane <tgl@sss.pgh.pa.us>
Author: Richard Guo <guofenglinux@gmail.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/19094-6ed410eb5b256abd@postgresql.org
Backpatch-through: 18 M src/backend/optimizer/path/joinpath.c
M src/test/regress/expected/join.out
M src/test/regress/sql/join.sql
Fix bogus use of "long" in AllocSetCheck()
commit : 50eb4e11815664bfcee883e92f4bf238ac23ec12
author : David Rowley <drowley@postgresql.org>
date : Thu, 30 Oct 2025 14:48:10 +1300
committer: David Rowley <drowley@postgresql.org>
date : Thu, 30 Oct 2025 14:48:10 +1300 Because long is 32-bit on 64-bit Windows, it isn't a good datatype to
store the difference between 2 pointers. The under-sized type could
overflow and lead to scary warnings in MEMORY_CONTEXT_CHECKING builds,
such as:
WARNING: problem in alloc set ExecutorState: bad single-chunk %p in block %p
However, the problem lies only in the code running the check, not from
an actual memory accounting bug.
Fix by using "Size" instead of "long". This means using an unsigned
type rather than the previous signed type. If the block's freeptr was
corrupted, we'd still catch that if the unsigned type wrapped. Unsigned
allows us to avoid further needless complexities around comparing signed
and unsigned types.
Author: David Rowley <dgrowleyml@gmail.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Backpatch-through: 13
Discussion: https://postgr.es/m/CAApHDvo-RmiT4s33J=aC9C_-wPZjOXQ232V-EZFgKftSsNRi4w@mail.gmail.com M src/backend/utils/mmgr/aset.c
Use C11 char16_t and char32_t for Unicode code points.
commit : 3853a6956c3e3bc7a6fa9bcdb205a2997f46bac2
author : Jeff Davis <jdavis@postgresql.org>
date : Wed, 29 Oct 2025 14:17:13 -0700
committer: Jeff Davis <jdavis@postgresql.org>
date : Wed, 29 Oct 2025 14:17:13 -0700 Reviewed-by: Tatsuo Ishii <ishii@postgresql.org>
Reviewed-by: Thomas Munro <thomas.munro@gmail.com>
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Discussion: https://postgr.es/m/bedcc93d06203dfd89815b10f815ca2de8626e85.camel%40j-davis.com M configure
M configure.ac
M meson.build
M src/backend/parser/parser.c
M src/backend/parser/scan.l
M src/backend/utils/adt/jsonpath_scan.l
M src/backend/utils/adt/pg_locale_builtin.c
M src/backend/utils/adt/varlena.c
M src/backend/utils/mb/mbutils.c
M src/common/saslprep.c
M src/common/unicode/case_test.c
M src/common/unicode/category_test.c
M src/common/unicode/generate-norm_test_table.pl
M src/common/unicode/generate-unicode_case_table.pl
M src/common/unicode/generate-unicode_category_table.pl
M src/common/unicode/norm_test.c
M src/common/unicode_case.c
M src/common/unicode_category.c
M src/common/unicode_norm.c
M src/fe_utils/mbprint.c
M src/include/c.h
M src/include/common/unicode_case.h
M src/include/common/unicode_case_table.h
M src/include/common/unicode_category.h
M src/include/common/unicode_category_table.h
M src/include/common/unicode_norm.h
M src/include/mb/pg_wchar.h
M src/include/pg_config.h.in
M src/tools/pgindent/typedefs.list
pg_stat_statements: Fix handling of duplicate constant locations
commit : 16edc1b94fc2db6e6a376471e280b50a418907c2
author : Álvaro Herrera <alvherre@kurilemu.de>
date : Wed, 29 Oct 2025 12:35:02 +0100
committer: Álvaro Herrera <alvherre@kurilemu.de>
date : Wed, 29 Oct 2025 12:35:02 +0100 Two or more constants can have the same location. We handled this
correctly for non squashed constants, but failed to do it if squashed
(resulting in out-of-bounds memory access), because the code structure
became broken by commit 0f65f3eec478: we failed to update 'last_loc'
correctly when skipping these squashed constants.
The simplest fix seems to be to get rid of 'last_loc' altogether -- in
hindsight, it's quite pointless. Also, when ignoring a constant because
of this, make sure to fulfill fill_in_constant_lengths's duty of setting
its length to -1.
Lastly, we can use == instead of <= because the locations have been
sorted beforehand, so the < case cannot arise.
Co-authored-by: Sami Imseih <samimseih@gmail.com>
Co-authored-by: Dmitry Dolgov <9erthalion6@gmail.com>
Reported-by: Konstantin Knizhnik <knizhnik@garret.ru>
Backpatch-through: 18
Discussion: https://www.postgresql.org/message-id/2b91e358-0d99-43f7-be44-d2d4dbce37b3%40garret.ru M contrib/pg_stat_statements/expected/squashing.out
M contrib/pg_stat_statements/pg_stat_statements.c
M contrib/pg_stat_statements/sql/squashing.sql
CheckNNConstraintFetch: Fill all of ConstrCheck in a single pass
commit : 94f95d91b025cb6752b4118bb0b30851e3d64df9
author : Álvaro Herrera <alvherre@kurilemu.de>
date : Wed, 29 Oct 2025 11:41:39 +0100
committer: Álvaro Herrera <alvherre@kurilemu.de>
date : Wed, 29 Oct 2025 11:41:39 +0100 Previously, we'd fill all fields except ccbin, and only later obtain and
detoast ccbin, with hypothetical failures being possible. If ccbin is
null (rare catalog corruption I have never witnessed) or its a corrupted
toast entry, we leak a tiny bit of memory in CacheMemoryContext from
having strdup'd the constraint name. Repair these by only attempting to
fill the struct once ccbin has been detoasted.
Author: Ranier Vilela <ranier.vf@gmail.com>
Discussion: https://postgr.es/m/CAEudQAr=i3_Z4GvmediX900+sSySTeMkvuytYShhQqEwoGyvhA@mail.gmail.com M src/backend/utils/cache/relcache.c
Reorganize GUC structs
commit : a13833c35f9e07fe978bf6fad984d6f5f25f59cd
author : Peter Eisentraut <peter@eisentraut.org>
date : Fri, 3 Oct 2025 08:27:18 +0200
committer: Peter Eisentraut <peter@eisentraut.org>
date : Fri, 3 Oct 2025 08:27:18 +0200 Instead of having five separate GUC structs, one for each type, with
the generic part contained in each of them, flip it around and have
one common struct, with the type-specific part has a subfield.
The very original GUC design had type-specific structs and
type-specific lists, and the membership in one of the lists defined
the type. But now the structs themselves know the type (from the
.vartype field), and they are all loaded into a common hash table at
run time, and so this original separation no longer makes sense. It
creates a bunch of inconsistencies in the code about whether the
type-specific or the generic struct is the primary struct, and a lot
of casting in between, which makes certain assumptions about the
struct layouts.
After the change, all these casts are gone and all the data is
accessed via normal field references. Also, various code is
simplified because only one kind of struct needs to be processed.
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Heikki Linnakangas <hlinnaka@iki.fi>
Discussion: https://www.postgresql.org/message-id/flat/8fdfb91e-60fb-44fa-8df6-f5dea47353c9@eisentraut.org M src/backend/utils/misc/gen_guc_tables.pl
M src/backend/utils/misc/guc.c
M src/backend/utils/misc/guc_funcs.c
M src/backend/utils/misc/help_config.c
M src/include/utils/guc_tables.h
M src/tools/pgindent/typedefs.list
formatting.c cleanup: Remove unnecessary extra parentheses
commit : 2724830929ba29a5cf95fba6134ca4dcbfdb4109
author : Peter Eisentraut <peter@eisentraut.org>
date : Wed, 29 Oct 2025 09:27:59 +0100
committer: Peter Eisentraut <peter@eisentraut.org>
date : Wed, 29 Oct 2025 09:27:59 +0100 Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/6dd9d208-a3ed-49b5-b03d-8617261da973%40eisentraut.org M src/backend/utils/adt/formatting.c
formatting.c cleanup: Use array syntax instead of pointer arithmetic
commit : 6271d9922e040e457b58eedcfa60839146951243
author : Peter Eisentraut <peter@eisentraut.org>
date : Wed, 29 Oct 2025 09:27:59 +0100
committer: Peter Eisentraut <peter@eisentraut.org>
date : Wed, 29 Oct 2025 09:27:59 +0100 for easier readability
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/6dd9d208-a3ed-49b5-b03d-8617261da973%40eisentraut.org M src/backend/utils/adt/formatting.c
formatting.c cleanup: Add some const pointer qualifiers
commit : b9def57a3c95540737290ca88eadf33212785690
author : Peter Eisentraut <peter@eisentraut.org>
date : Wed, 29 Oct 2025 09:27:59 +0100
committer: Peter Eisentraut <peter@eisentraut.org>
date : Wed, 29 Oct 2025 09:27:59 +0100 Co-authored-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/6dd9d208-a3ed-49b5-b03d-8617261da973%40eisentraut.org M src/backend/utils/adt/formatting.c
formatting.c cleanup: Use size_t for string length variables and arguments
commit : d98b3cdbafb8db54d08a6f122d0c22950e66f970
author : Peter Eisentraut <peter@eisentraut.org>
date : Wed, 29 Oct 2025 09:27:59 +0100
committer: Peter Eisentraut <peter@eisentraut.org>
date : Wed, 29 Oct 2025 09:27:59 +0100 Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/6dd9d208-a3ed-49b5-b03d-8617261da973%40eisentraut.org M src/backend/utils/adt/formatting.c
Replace pg_restrict by standard restrict
commit : f0f2c0c1aef95757c4e7f144d5577e2b0d814279
author : Peter Eisentraut <peter@eisentraut.org>
date : Wed, 29 Oct 2025 07:36:46 +0100
committer: Peter Eisentraut <peter@eisentraut.org>
date : Wed, 29 Oct 2025 07:36:46 +0100 MSVC in C11 mode supports the standard restrict qualifier, so we don't
need the workaround naming pg_restrict anymore.
Even though restrict is in C99 and should be supported by all
supported compilers, we keep the configure test and the hardcoded
redirection to __restrict, because that will also work in C++ in all
supported compilers. (restrict is not part of the C++ standard.)
For backward compatibility for extensions, we keep a #define of
pg_restrict around, but our own code doesn't use it anymore.
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://www.postgresql.org/message-id/flat/0e3d8644-c01d-4374-86ea-9f0a987981f0%40eisentraut.org M configure
M configure.ac
M meson.build
M src/bin/pg_verifybackup/pg_verifybackup.c
M src/bin/pg_verifybackup/pg_verifybackup.h
M src/common/logging.c
M src/common/string.c
M src/include/c.h
M src/include/common/logging.h
M src/include/common/string.h
M src/include/libpq/pqformat.h
M src/include/pg_config.h.in
Remove obsolete comment
commit : c094be259b918fbcae5bed12d6c6b64bcb4c4846
author : Peter Eisentraut <peter@eisentraut.org>
date : Wed, 29 Oct 2025 07:32:21 +0100
committer: Peter Eisentraut <peter@eisentraut.org>
date : Wed, 29 Oct 2025 07:32:21 +0100 The comment "type prefixes (const, signed, volatile, inline) are
handled in pg_config.h." has been mostly not true for a long time. M src/include/c.h
Fix correctness issue with computation of FPI size in WAL stats
commit : d3111cb753e81a64c1a4417ed6de98a90a04432a
author : Michael Paquier <michael@paquier.xyz>
date : Wed, 29 Oct 2025 09:13:31 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Wed, 29 Oct 2025 09:13:31 +0900 XLogRecordAssemble() may be called multiple times before inserting a
record in XLogInsertRecord(), and the amount of FPIs generated inside
a record whose insertion is attempted multiple times may vary.
The logic added in f9a09aa29520 touched directly pgWalUsage in
XLogRecordAssemble(), meaning that it could be possible for pgWalUsage
to be incremented multiple times for a single record. This commit
changes the code to use the same logic as the number of FPIs added to a
record, where XLogRecordAssemble() returns this information and feeds it
to XLogInsertRecord(), updating pgWalUsage only when a record is
inserted.
Reported-by: Shinya Kato <shinya11.kato@gmail.com>
Discussion: https://postgr.es/m/CAOzEurSiSr+rusd0GzVy8Bt30QwLTK=ugVMnF6=5WhsSrukvvw@mail.gmail.com M src/backend/access/transam/xlog.c
M src/backend/access/transam/xloginsert.c
M src/include/access/xlog.h
Add psql PROMPT variable for search_path.
commit : b3ce55f413cdf70b1bc4724052fb4eacf9de239a
author : Nathan Bossart <nathan@postgresql.org>
date : Tue, 28 Oct 2025 14:08:38 -0500
committer: Nathan Bossart <nathan@postgresql.org>
date : Tue, 28 Oct 2025 14:08:38 -0500 The new %S substitution shows the current value of search_path.
Note that this only works when connected to Postgres v18 or newer,
since search_path was first marked as GUC_REPORT in commit
28a1121fd9. On older versions that don't report search_path, %S is
replaced with a question mark.
Suggested-by: Lauri Siltanen <lauri.siltanen@gmail.com>
Author: Florents Tselai <florents.tselai@gmail.com>
Reviewed-by: Jelte Fennema-Nio <postgres@jeltef.nl>
Reviewed-by: Jim Jones <jim.jones@uni-muenster.de>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://postgr.es/m/CANsM767JhTKCRagTaq5Lz52fVwLPVkhSpyD1C%2BOrridGv0SO0A%40mail.gmail.com M doc/src/sgml/ref/psql-ref.sgml
M src/bin/psql/prompt.c
formatting.c cleanup: Move loop variables definitions into for statement
commit : 03fbb0814c5015ab79e670ab97bb6a3349269e4b
author : Peter Eisentraut <peter@eisentraut.org>
date : Tue, 28 Oct 2025 19:20:17 +0100
committer: Peter Eisentraut <peter@eisentraut.org>
date : Tue, 28 Oct 2025 19:20:17 +0100 Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/6dd9d208-a3ed-49b5-b03d-8617261da973%40eisentraut.org M src/backend/utils/adt/formatting.c
formatting.c cleanup: Remove dashes in comments
commit : 95924672d534be7291fa6b717e146b6dcb7bc1c6
author : Peter Eisentraut <peter@eisentraut.org>
date : Tue, 28 Oct 2025 19:20:02 +0100
committer: Peter Eisentraut <peter@eisentraut.org>
date : Tue, 28 Oct 2025 19:20:02 +0100 This saves some vertical space and makes the comments style more
consistent with the rest of the code.
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/6dd9d208-a3ed-49b5-b03d-8617261da973%40eisentraut.org M src/backend/utils/adt/formatting.c
Don't error out when dropping constraint if relchecks is already zero
commit : d5845aa8adb25fda30cb2ad44aa2c5b0a59baa27
author : Álvaro Herrera <alvherre@kurilemu.de>
date : Tue, 28 Oct 2025 19:13:32 +0100
committer: Álvaro Herrera <alvherre@kurilemu.de>
date : Tue, 28 Oct 2025 19:13:32 +0100 I have never seen this be a problem in practice, but it came up when
purposely corrupting catalog contents to study the fix for a nearby bug:
we'd try to decrement relchecks, but since it's zero we error out and
fail to drop the constraint. The fix is to downgrade the error to
warning, skip decrementing the counter, and otherwise proceed normally.
Given lack of field complaints, no backpatch.
Author: Álvaro Herrera <alvherre@kurilemu.de>
Discussion: https://postgr.es/m/202508291058.q2zscdcs64fj@alvherre.pgsql M src/backend/catalog/pg_constraint.c
Move comment about casts from pg_wchar.
commit : 4da12e9e2e3c011a3fc8354ca451d6a82c017fa3
author : Jeff Davis <jdavis@postgresql.org>
date : Tue, 28 Oct 2025 10:49:20 -0700
committer: Jeff Davis <jdavis@postgresql.org>
date : Tue, 28 Oct 2025 10:49:20 -0700 Suggested-by: Thomas Munro <thomas.munro@gmail.com>
Discussion: https://postgr.es/m/CA+hUKGLXQUYK7Cq5KbLGgTWo7pORs7yhBWO1AEnZt7xTYbLRhg@mail.gmail.com M src/backend/utils/adt/pg_locale_icu.c
M src/backend/utils/adt/pg_locale_libc.c
Check that index can return in get_actual_variable_range()
commit : 35e53b68418a1d06f899d4bb41be88d18f9dcb7b
author : Peter Eisentraut <peter@eisentraut.org>
date : Tue, 28 Oct 2025 10:06:03 +0100
committer: Peter Eisentraut <peter@eisentraut.org>
date : Tue, 28 Oct 2025 10:06:03 +0100 Some recent changes were made to remove the explicit dependency on
btree indexes in some parts of the code. One of these changes was
made in commit 9ef1851685b, which allows non-btree indexes to be used
in get_actual_variable_range(). A follow-up commit ee1ae8b99f9 fixes
the cases where an index doesn’t have a sortopfamily as this is a
prerequisite to be used in get_actual_variable_range().
However, it was found that indexes that have amcanorder = true but do
not allow index-only-scans (amcanreturn returns false or is NULL) will
pass all of the conditions, while they should be rejected since
get_actual_variable_range() uses the index-only-scan machinery in
get_actual_variable_endpoint(). Such an index might cause errors like
ERROR: no data returned for index-only scan
during query planning.
The fix is to add a check in get_actual_variable_range() to reject
indexes that do not allow index-only scans.
Author: Maxime Schoemans <maxime.schoemans@enterprisedb.com>
Discussion: https://www.postgresql.org/message-id/flat/20ED852A-C2D9-41EB-8671-8C8B9D418BE9%40enterprisedb.com M src/backend/utils/adt/selfuncs.c
Add wal_fpi_bytes to pg_stat_wal and pg_stat_get_backend_wal()
commit : f9a09aa2952039a9956b44d929b9df74d62a4cd4
author : Michael Paquier <michael@paquier.xyz>
date : Tue, 28 Oct 2025 16:21:51 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Tue, 28 Oct 2025 16:21:51 +0900 This new counter, called "wal_fpi_bytes", tracks the total amount in
bytes of full page images (FPIs) generated in WAL. This data becomes
available globally via pg_stat_wal, and for backend statistics via
pg_stat_get_backend_wal().
Previously, this information could only be retrieved with pg_waldump or
pg_walinspect, which may not be available depending on the environment,
and are expensive to execute. It offers hints about how much FPIs
impact the WAL generated, which could be a large percentage for some
workloads, as well as the effects of wal_compression or page holes.
Bump catalog version.
Bump PGSTAT_FILE_FORMAT_ID, due to the addition of wal_fpi_bytes in
PgStat_WalCounters.
Author: Shinya Kato <shinya11.kato@gmail.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://postgr.es/m/CAOzEurQtZEAfg6P0kU3Wa-f9BWQOi0RzJEMPN56wNTOmJLmfaQ@mail.gmail.com M doc/src/sgml/monitoring.sgml
M src/backend/access/transam/xloginsert.c
M src/backend/catalog/system_views.sql
M src/backend/executor/instrument.c
M src/backend/utils/activity/pgstat_backend.c
M src/backend/utils/activity/pgstat_wal.c
M src/backend/utils/adt/pgstatfuncs.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/include/executor/instrument.h
M src/include/pgstat.h
M src/test/regress/expected/rules.out
Add worker type argument to logical replication worker functions.
commit : 3e8e05596a020f043f1efd6406e4511ea85170bd
author : Amit Kapila <akapila@postgresql.org>
date : Tue, 28 Oct 2025 05:47:50 +0000
committer: Amit Kapila <akapila@postgresql.org>
date : Tue, 28 Oct 2025 05:47:50 +0000 Extend logicalrep_worker_stop, logicalrep_worker_wakeup, and
logicalrep_worker_find to accept a worker type argument. This change
enables differentiation between logical replication worker types, such as
apply workers and table sync workers. While preserving existing behavior,
it lays the groundwork for upcoming patch to add sequence synchronization
workers.
Author: Vignesh C <vignesh21@gmail.com>
Reviewed-by: shveta malik <shveta.malik@gmail.com>
Reviewed-by: Peter Smith <smithpb2250@gmail.com>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Hayato Kuroda <kuroda.hayato@fujitsu.com>
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>
Discussion: https://postgr.es/m/CAA4eK1LC+KJiAkSrpE_NwvNdidw9F2os7GERUeSxSKv71gXysQ@mail.gmail.com M src/backend/commands/subscriptioncmds.c
M src/backend/replication/logical/launcher.c
M src/backend/replication/logical/syncutils.c
M src/backend/replication/logical/tablesync.c
M src/backend/replication/logical/worker.c
M src/include/replication/worker_internal.h
Simplify newline handling in two TAP tests
commit : 8767b449a3a1e75626dfb08f24da54933171d4c5
author : Michael Paquier <michael@paquier.xyz>
date : Tue, 28 Oct 2025 08:26:42 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Tue, 28 Oct 2025 08:26:42 +0900 Two tests are changed in this commit:
- libpq's 006_service
- ldap's 003_ldap_connection_param_lookup
CRLF translation is already handled by the text mode, so there should be
need for any specific logic. See also 1c6d4629394d, msys perl being one
case where the translation mattered.
Note: This is first applied on HEAD, and backpatch will follow once the
buildfarm has provided an opinion about this commit.
Author: Jacob Champion <jacob.champion@enterprisedb.com>
Co-authored-by: Michael Paquier <michael@paquier.xyz>
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>
Discussion: https://postgr.es/m/aPsh39bxwYKvUlAf@paquier.xyz
Backpatch-through: 13 M src/interfaces/libpq/t/006_service.pl
M src/test/ldap/t/003_ldap_connection_param_lookup.pl
Fix a couple of comments.
commit : 123661427b974777ed00abcfa10443d0ca525b3c
author : Nathan Bossart <nathan@postgresql.org>
date : Mon, 27 Oct 2025 10:30:05 -0500
committer: Nathan Bossart <nathan@postgresql.org>
date : Mon, 27 Oct 2025 10:30:05 -0500 These were discovered while reviewing Aleksander Alekseev's
proposed changes to pgindent.
Oversights in commits 393e0d2314 and 25a30bbd42.
Discussion: https://postgr.es/m/aP-H6kSsGOxaB21k%40nathan M src/backend/executor/nodeWindowAgg.c
M src/backend/storage/ipc/waiteventset.c
Add new RLS tests to test policies applied by command type.
commit : 2e84248d6497ce06e8c63e08d3cf3bee1e9ee105
author : Dean Rasheed <dean.a.rasheed@gmail.com>
date : Mon, 27 Oct 2025 10:21:16 +0000
committer: Dean Rasheed <dean.a.rasheed@gmail.com>
date : Mon, 27 Oct 2025 10:21:16 +0000 The existing RLS tests focus on the outcomes of various testing
scenarios, rather than the exact policies applied. This sometimes
makes it hard to see why a particular result occurred (e.g., which
policy failed), or to construct a test that fails a particular policy
check without an earlier check failing. These new tests issue NOTICE
messages to show the actual policies applied for each command type,
including the different paths through INSERT ... ON CONFLICT and
MERGE, making it easier to verify the expected behaviour.
Author: Dean Rasheed <dean.a.rasheed@gmail.com>
Reviewed-by: Viktor Holmberg <v@viktorh.net>
Reviewed-by: Jian He <jian.universality@gmail.com>
Discussion: https://postgr.es/m/CAEZATCWqnfeChjK=n1V_dYZT4rt4mnq+ybf9c0qXDYTVMsy8pg@mail.gmail.com M src/test/regress/expected/rowsecurity.out
M src/test/regress/sql/rowsecurity.sql
Add some const qualifications
commit : 10b5bb3bffaee8d136d970c5b2ec1f21592b581b
author : Peter Eisentraut <peter@eisentraut.org>
date : Mon, 27 Oct 2025 09:54:16 +0100
committer: Peter Eisentraut <peter@eisentraut.org>
date : Mon, 27 Oct 2025 09:54:16 +0100 Add some const qualifications afforded by the previous change that
added a const qualification to PageAddItemExtended().
Reviewed-by: Nathan Bossart <nathandbossart@gmail.com>
Reviewed-by: Peter Geoghegan <pg@bowt.ie>
Discussion: https://www.postgresql.org/message-id/flat/c75cccf5-5709-407b-a36a-2ae6570be766@eisentraut.org M src/backend/access/brin/brin_pageops.c
M src/backend/access/gin/ginfast.c
M src/backend/access/nbtree/nbtinsert.c
M src/backend/access/nbtree/nbtsort.c
M src/include/access/brin_pageops.h
Remove Item type
commit : 76acf4b722faa2a552f62034b793c2797909f91b
author : Peter Eisentraut <peter@eisentraut.org>
date : Mon, 27 Oct 2025 09:54:16 +0100
committer: Peter Eisentraut <peter@eisentraut.org>
date : Mon, 27 Oct 2025 09:54:16 +0100 This type is just char * underneath, it provides no real value, no
type safety, and just makes the code one level more mysterious. It is
more idiomatic to refer to blobs of memory by a combination of void *
and size_t, so change it to that.
Also, since this type hides the pointerness, we can't apply qualifiers
to what is pointed to, which requires some unconstify nonsense. This
change allows fixing that.
Extension code that uses the Item type can change its code to use
void * to be backward compatible.
Reviewed-by: Nathan Bossart <nathandbossart@gmail.com>
Reviewed-by: Peter Geoghegan <pg@bowt.ie>
Discussion: https://www.postgresql.org/message-id/flat/c75cccf5-5709-407b-a36a-2ae6570be766@eisentraut.org M src/backend/access/brin/brin_pageops.c
M src/backend/access/brin/brin_xlog.c
M src/backend/access/gin/ginentrypage.c
M src/backend/access/gin/ginfast.c
M src/backend/access/gin/ginvacuum.c
M src/backend/access/gin/ginxlog.c
M src/backend/access/gist/gist.c
M src/backend/access/gist/gistbuild.c
M src/backend/access/gist/gistutil.c
M src/backend/access/gist/gistxlog.c
M src/backend/access/hash/hash_xlog.c
M src/backend/access/hash/hashinsert.c
M src/backend/access/heap/heapam_xlog.c
M src/backend/access/heap/hio.c
M src/backend/access/heap/rewriteheap.c
M src/backend/access/nbtree/nbtdedup.c
M src/backend/access/nbtree/nbtinsert.c
M src/backend/access/nbtree/nbtpage.c
M src/backend/access/nbtree/nbtsort.c
M src/backend/access/nbtree/nbtxlog.c
M src/backend/access/spgist/spgdoinsert.c
M src/backend/access/spgist/spgutils.c
M src/backend/access/spgist/spgxlog.c
M src/backend/commands/sequence.c
M src/backend/storage/page/bufpage.c
M src/include/access/spgist_private.h
M src/include/storage/bufpage.h
D src/include/storage/item.h
M src/tools/pgindent/typedefs.list
Remove meaninglist restrict qualifiers
commit : 64d2b0968ea494cb11900ffb7681b5784e4112b9
author : Peter Eisentraut <peter@eisentraut.org>
date : Mon, 27 Oct 2025 08:52:39 +0100
committer: Peter Eisentraut <peter@eisentraut.org>
date : Mon, 27 Oct 2025 08:52:39 +0100 The use of the restrict qualifier in casts is meaningless, so remove
them.
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://www.postgresql.org/message-id/flat/0e3d8644-c01d-4374-86ea-9f0a987981f0%40eisentraut.org M src/include/libpq/pqformat.h
Fix GUC check_hook validation for synchronized_standby_slots.
commit : e0dc4bbfb88546cbbe53cfc7f8e9aca8e256adff
author : Amit Kapila <akapila@postgresql.org>
date : Mon, 27 Oct 2025 06:48:32 +0000
committer: Amit Kapila <akapila@postgresql.org>
date : Mon, 27 Oct 2025 06:48:32 +0000 Previously, the check_hook for synchronized_standby_slots attempted to
validate that each specified slot existed and was physical. However, these
checks were not performed during server startup. As a result, if users
configured non-existent slots before startup, the misconfiguration would
go undetected initially. This could later cause parallel query failures,
as newly launched workers would detect the issue and raise an ERROR.
This patch improves the check_hook by validating the syntax and format of
slot names. Validation of slot existence and type is deferred to the WAL
sender process, aligning with the behavior of the check_hook for
primary_slot_name.
Reported-by: Fabrice Chapuis <fabrice636861@gmail.com>
Author: Shlok Kyal <shlok.kyal.oss@gmail.com>
Reviewed-by: Hayato Kuroda <kuroda.hayato@fujitsu.com>
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>
Reviewed-by: Ashutosh Sharma <ashu.coek88@gmail.com>
Reviewed-by: Rahila Syed <rahilasyed90@gmail.com>
Backpatch-through: 17, where it was introduced
Discussion: https://postgr.es/m/CAA5-nLCeO4MQzWipCXH58qf0arruiw0OeUc1+Q=Z=4GM+=v1NQ@mail.gmail.com M src/backend/replication/slot.c
M src/test/modules/unsafe_tests/expected/guc_privs.out
M src/test/modules/unsafe_tests/sql/guc_privs.sql
Improve test in 009_matviews.pl.
commit : 549d9c91b1d2fa38e374c020eb584e3e6836e27c
author : Amit Kapila <akapila@postgresql.org>
date : Mon, 27 Oct 2025 03:52:39 +0000
committer: Amit Kapila <akapila@postgresql.org>
date : Mon, 27 Oct 2025 03:52:39 +0000 Ensure that the target table on the subscriber exists before executing any
DML intended for replication.
Currently, if the table is missing, the replication logic keeps retrying
until the table is eventually created by the test. Although this behaviour
does not cause test failures, since the table is created after the INSERT
is published and replication eventually succeeds, however, it introduces
unnecessary looping and delays.
Author: Grem Snoort <grem.snoort@gmail.com>
Discussion: https://postgr.es/m/CANV9Qw5HD7=Fp4nox2O7DoVctHoabRRVW9Soo4A=QipqW5B=Tg@mail.gmail.com M src/test/subscription/t/009_matviews.pl
Comment typo fixes: pg_wchar_t should be pg_wchar.
commit : 371a302eecdc82274b0ae2967d18fd726a0aa6a1
author : Jeff Davis <jdavis@postgresql.org>
date : Sun, 26 Oct 2025 12:31:50 -0700
committer: Jeff Davis <jdavis@postgresql.org>
date : Sun, 26 Oct 2025 12:31:50 -0700 Reported-by: Thomas Munro <thomas.munro@gmail.com>
Discussion: https://postgr.es/m/CA+hUKGJ5Xh0KxLYXDZuPvw1_fHX=yuzb4xxtam1Cr6TPZZ1o+w@mail.gmail.com M src/backend/utils/adt/pg_locale_libc.c
M src/include/utils/pg_locale.h
Fix incorrect logic for caching ResultRelInfos for triggers
commit : 39dcfda2d23ac39f14ecf4b83e01eae85d07d9e5
author : David Rowley <drowley@postgresql.org>
date : Sun, 26 Oct 2025 10:59:50 +1300
committer: David Rowley <drowley@postgresql.org>
date : Sun, 26 Oct 2025 10:59:50 +1300 When dealing with ResultRelInfos for partitions, there are cases where
there are mixed requirements for the ri_RootResultRelInfo. There are
cases when the partition itself requires a NULL ri_RootResultRelInfo and
in the same query, the same partition may require a ResultRelInfo with
its parent set in ri_RootResultRelInfo. This could cause the column
mapping between the partitioned table and the partition not to be done
which could result in crashes if the column attnums didn't match
exactly.
The fix is simple. We now check that the ri_RootResultRelInfo matches
what the caller passed to ExecGetTriggerResultRel() and only return a
cached ResultRelInfo when the ri_RootResultRelInfo matches what the
caller wants, otherwise we'll make a new one.
Author: David Rowley <dgrowleyml@gmail.com>
Author: Amit Langote <amitlangote09@gmail.com>
Reported-by: Dmitry Fomin <fomin.list@gmail.com>
Discussion: https://postgr.es/m/7DCE78D7-0520-4207-822B-92F60AEA14B4@gmail.com
Backpatch-through: 15 M src/backend/executor/execMain.c
M src/test/regress/expected/foreign_key.out
M src/test/regress/sql/foreign_key.sql
Guard against division by zero in test_int128 module.
commit : 7e2af1fb1118a547bd831fca3afbc3ff80ebf089
author : Dean Rasheed <dean.a.rasheed@gmail.com>
date : Sat, 25 Oct 2025 11:08:46 +0100
committer: Dean Rasheed <dean.a.rasheed@gmail.com>
date : Sat, 25 Oct 2025 11:08:46 +0100 When testing 128/32-bit division in the test_int128 test module, make
sure that we don't attempt to divide by zero.
While at it, use pg_prng_int64() and pg_prng_int32() to generate the
random numbers required for the tests, rather than pg_prng_uint64().
This eliminates the need for any implicit or explicit type casts.
Author: Dean Rasheed <dean.a.rasheed@gmail.com>
Reported-by: Andres Freund <andres@anarazel.de>
Discussion: https://postgr.es/m/da4wqngd6gwz5s4yf5y5f75xj7gpja62l4dbp6w4j3vs7fcjue@upvolcu4e6o2 M src/test/modules/test_int128/test_int128.c
pg_rewind: Skip copy of WAL segments generated before point of divergence
commit : 5173bfd0443e0c0f3fa37006727d516dc1ba4cee
author : Michael Paquier <michael@paquier.xyz>
date : Sat, 25 Oct 2025 09:07:31 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Sat, 25 Oct 2025 09:07:31 +0900 This commit makes the way WAL segments are handled from the source to
the target server slightly smarter: the copy of the WAL segments is now
skipped if these have been created before the point where source and
target have diverged (the WAL segment where the point of divergence
exists is still copied), because we know that such segments exist on
both the target and source. Note that the on-disk size of the WAL
segments on the source and target need to match. Hence, only the
segments generated after the point of divergence are now copied. A
segment existing on the source but not the target is copied.
Previously, all the WAL segments were just copied in full. This change
can make the rewind operation cheaper in some configurations, especially
for setups where some WAL retention causes many segments to remain on
the source server even after the promotion of a standby used as source
to rewind a previous primary.
A TAP test is added to track these new behaviors. The file map printed
with --debug now includes all the information related to WAL segments,
to be able to track if these are copied or skipped, and the test relies
on the debug output generated.
Author: John Hsu <johnhyvr@gmail.com>
Author: Justin Kwan <justinpkwan@outlook.com>
Reviewed-by: Robert Haas <robertmhaas@gmail.com>
Reviewed-by: Alexander Korotkov <aekorotkov@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Reviewed-by: Srinath Reddy Sadipiralla <srinath2133@gmail.com>
Discussion: https://postgr.es/m/181b4c6fa9c.b8b725681941212.7547232617810891479@viggy28.dev M doc/src/sgml/ref/pg_rewind.sgml
M src/bin/pg_rewind/filemap.c
M src/bin/pg_rewind/filemap.h
M src/bin/pg_rewind/meson.build
M src/bin/pg_rewind/pg_rewind.c
A src/bin/pg_rewind/t/011_wal_copy.pl
psql: Improve tab completion for large objects.
commit : 14ee8e6403001c3788f2622cdcf81a8451502dc2
author : Fujii Masao <fujii@postgresql.org>
date : Fri, 24 Oct 2025 14:30:05 +0900
committer: Fujii Masao <fujii@postgresql.org>
date : Fri, 24 Oct 2025 14:30:05 +0900 This commit enhances psql's tab completion support for large objects:
- Completes \lo_export <oid> with a file name
- Completes GRANT/REVOKE ... LARGE with OBJECT
- Completes ALTER DEFAULT PRIVILEGES GRANT/REVOKE ... LARGE with OBJECTS
Author: Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>
Co-authored-by: Fujii Masao <masao.fujii@gmail.com>
Reviewed-by: Chao Li <lic@highgo.com>
Discussion: https://postgr.es/m/87y0syikki.fsf@wibble.ilmari.org M src/bin/psql/tab-complete.in.c
Update expected output for contrib/sepgsql's regression tests.
commit : 0758111f5d35b64dd5ddbc716bd05806b52ea183
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Thu, 23 Oct 2025 17:46:57 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Thu, 23 Oct 2025 17:46:57 -0400 Commit 65281391a caused some additional error context lines to
appear in the output of one test case. That's fine, but we missed
updating the expected output. Do it now.
While here, add some missing test-output subdirectories to
contrib/sepgsql/.gitignore, so that we don't get git warnings
after running the tests.
Author: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/1613232.1761255361@sss.pgh.pa.us
Backpatch-through: 18 M contrib/sepgsql/.gitignore
M contrib/sepgsql/expected/ddl.out
doc: Remove mention of Git protocol support
commit : c0677d8b2e4a69fbe2174ac77aca82f45f236d71
author : Daniel Gustafsson <dgustafsson@postgresql.org>
date : Thu, 23 Oct 2025 21:26:15 +0200
committer: Daniel Gustafsson <dgustafsson@postgresql.org>
date : Thu, 23 Oct 2025 21:26:15 +0200 The project Git server hasn't supported cloning with the Git protocol
in a very long time, but the documentation never got the memo. Remove
the mention of using the Git protocol, and while there wrap a mention
of Git in <productname> tags.
Backpatch down to all supported versions.
Author: Daniel Gustafsson <daniel@yesql.se>
Reported-by: Gurjeet Singh <gurjeet@singh.im>
Reviewed-by: Nathan Bossart <nathandbossart@gmail.com>
Reviewed-by: Jacob Champion <jacob.champion@enterprisedb.com>
Reviewed-by: Gurjeet Singh <gurjeet@singh.im>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/CABwTF4WMiMb-KT2NRcib5W0C8TQF6URMb+HK9a_=rnZnY8Q42w@mail.gmail.com
Backpatch-through: 13 M doc/src/sgml/sourcerepo.sgml
Avoid memory leak in validation of a PL/Python trigger function.
commit : e557c82759a3362d8fb618c798ca99ee90be96c5
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Thu, 23 Oct 2025 14:23:26 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Thu, 23 Oct 2025 14:23:26 -0400 If we're trying to perform check_function_bodies validation
of a PL/Python trigger function, we create a new PLyProcedure,
but we don't put it into the PLy_procedure_cache hash table.
(Doing so would be useless, since we don't have the relation
OID that is part of the cache key for a trigger function, so
we could not make an entry that would be found by later uses.)
However, we didn't think through what to do instead, with the
result that the PLyProcedure was simply leaked.
It would take a pretty large number of CREATE FUNCTION operations
for this to amount to a serious problem, but it's easy to see the
memory bloat if you do CREATE OR REPLACE FUNCTION in a loop.
To fix, have PLy_procedure_get delete the new PLyProcedure
and return NULL if it's not going to cache the PLyProcedure.
I considered making plpython3_validator do the cleanup instead,
which would be more natural. But then plpython3_validator would
have to know the rules under which PLy_procedure_get returns a
non-cached PLyProcedure, else it risks deleting something that's
pointed to by a cache entry. On the whole it seems more robust
to deal with the case inside PLy_procedure_get.
Found by the new version of Coverity (nice catch!). In the end
I feel this fix is more about satisfying Coverity than about
fixing a real-world problem, so I'm not going to back-patch. M src/pl/plpython/plpy_main.c
M src/pl/plpython/plpy_procedure.c
Fix off-by-one Asserts in FreePageBtreeInsertInternal/Leaf.
commit : 9f9a04368f8055c1851f5071add393b380d1cc52
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Thu, 23 Oct 2025 12:32:06 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Thu, 23 Oct 2025 12:32:06 -0400 These two functions expect there to be room to insert another item
in the FreePageBtree's array, but their assertions were too weak
to guarantee that. This has little practical effect granting that
the callers are not buggy, but it seems to be misleading late-model
Coverity into complaining about possible array overrun.
Author: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/799984.1761150474@sss.pgh.pa.us
Backpatch-through: 13 M src/backend/utils/mmgr/freepage.c
Fix resource leaks in PL/Python error reporting, redux.
commit : 798b19d27b28e6dec3ae5134d396882d3197dfe8
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Thu, 23 Oct 2025 11:47:46 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Thu, 23 Oct 2025 11:47:46 -0400 Commit c6f7f11d8 intended to prevent leaking any PyObject reference
counts in edge cases (such as out-of-memory during string
construction), but actually it introduced a leak in the normal case.
Repeating an error-trapping operation often enough would lead to
session-lifespan memory bloat. The problem is that I failed to
think about the fact that PyObject_GetAttrString() increments the
refcount of the returned PyObject, so that simply walking down the
list of error frame objects causes all but the first one to have
their refcount incremented.
I experimented with several more-or-less-complex ways around that,
and eventually concluded that the right fix is simply to drop the
newly-obtained refcount as soon as we walk to the next frame
object in PLy_traceback. This sounds unsafe, but it's perfectly
okay because the caller holds a refcount on the first frame object
and each frame object holds a refcount on the next one; so the
current frame object can't disappear underneath us.
By the same token, we can simplify the caller's cleanup back to
simply dropping its refcount on the first object. Cleanup of
each frame object will lead in turn to the refcount of the next
one going to zero.
I also added a couple of comments explaining why PLy_elog_impl()
doesn't try to free the strings acquired from PLy_get_spi_error_data()
or PLy_get_error_data(). That's because I got here by looking at a
Coverity complaint about how those strings might get leaked. They
are not leaked, but in testing that I discovered this other leak.
Back-patch, as c6f7f11d8 was. It's a bit nervous-making to be
putting such a fix into v13, which is only a couple weeks from its
final release; but I can't see that leaving a recently-introduced
leak in place is a better idea.
Author: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/1203918.1761184159@sss.pgh.pa.us
Backpatch-through: 13 M src/pl/plpython/plpy_elog.c
Introduce "REFRESH SEQUENCES" for subscriptions.
commit : f0b3573c3aac6c0ea4cbc278f98178516579d370
author : Amit Kapila <akapila@postgresql.org>
date : Thu, 23 Oct 2025 08:30:27 +0000
committer: Amit Kapila <akapila@postgresql.org>
date : Thu, 23 Oct 2025 08:30:27 +0000 This patch adds support for a new SQL command:
ALTER SUBSCRIPTION ... REFRESH SEQUENCES
This command updates the sequence entries present in the
pg_subscription_rel catalog table with the INIT state to trigger
resynchronization.
In addition to the new command, the following subscription commands have
been enhanced to automatically refresh sequence mappings:
ALTER SUBSCRIPTION ... REFRESH PUBLICATION
ALTER SUBSCRIPTION ... ADD PUBLICATION
ALTER SUBSCRIPTION ... DROP PUBLICATION
ALTER SUBSCRIPTION ... SET PUBLICATION
These commands will perform the following actions:
Add newly published sequences that are not yet part of the subscription.
Remove sequences that are no longer included in the publication.
This ensures that sequence replication remains aligned with the current
state of the publication on the publisher side.
Note that the actual synchronization of sequence data/values will be
handled in a subsequent patch that introduces a dedicated sequence sync
worker.
Author: Vignesh C <vignesh21@gmail.com>
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>
Reviewed-by: shveta malik <shveta.malik@gmail.com>
Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com>
Reviewed-by: Hayato Kuroda <kuroda.hayato@fujitsu.com>
Reviewed-by: Dilip Kumar <dilipbalaut@gmail.com>
Reviewed-by: Peter Smith <smithpb2250@gmail.com>
Reviewed-by: Nisha Moond <nisha.moond412@gmail.com>
Reviewed-by: Shlok Kyal <shlok.kyal.oss@gmail.com>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Hou Zhijie <houzj.fnst@fujitsu.com>
Discussion: https://postgr.es/m/CAA4eK1LC+KJiAkSrpE_NwvNdidw9F2os7GERUeSxSKv71gXysQ@mail.gmail.com M doc/src/sgml/catalogs.sgml
M doc/src/sgml/ref/alter_subscription.sgml
M src/backend/catalog/pg_subscription.c
M src/backend/commands/subscriptioncmds.c
M src/backend/executor/execReplication.c
M src/backend/parser/gram.y
M src/backend/replication/logical/proto.c
M src/backend/replication/logical/relation.c
M src/backend/replication/logical/syncutils.c
M src/backend/replication/logical/tablesync.c
M src/backend/replication/logical/worker.c
M src/backend/replication/pgoutput/pgoutput.c
M src/bin/psql/tab-complete.in.c
M src/include/catalog/pg_subscription_rel.h
M src/include/executor/executor.h
M src/include/nodes/parsenodes.h
M src/test/subscription/meson.build
A src/test/subscription/t/036_sequences.pl
M src/tools/pgindent/typedefs.list
pg_rewind: Extend code detecting relation files to work with WAL files
commit : 6ae08d9583e9a5e951286948bdd9fcd58e67718a
author : Michael Paquier <michael@paquier.xyz>
date : Thu, 23 Oct 2025 15:57:46 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Thu, 23 Oct 2025 15:57:46 +0900 isRelDataFile() is renamed to getFileContentType(), extended so as it
becomes able to detect more file patterns than only relation files. The
new file name pattern that can be detected is WAL files.
This refactoring has been suggested by Robert Haas. This will be used
in a follow-up patch where we are looking at improving how WAL files are
processed by pg_rewind. As of this change, WAL files are still handled
the same way as previously, always copied from the source to the target
server.
Extracted from a larger patch by the same authors.
Author: John Hsu <johnhyvr@gmail.com>
Author: Justin Kwan <justinpkwan@outlook.com>
Reviewed-by: Japin Li <japinli@hotmail.com>
Reviewed-by: Srinath Reddy Sadipiralla <srinath2133@gmail.com>
Discussion: https://postgr.es/m/181b4c6fa9c.b8b725681941212.7547232617810891479@viggy28.dev M src/bin/pg_rewind/filemap.c
M src/bin/pg_rewind/filemap.h
M src/tools/pgindent/typedefs.list
Add comments explaining overflow entries in the replication lag tracker.
commit : abc2b71383b4c49c2fbda74c281d50f3936551b8
author : Fujii Masao <fujii@postgresql.org>
date : Thu, 23 Oct 2025 13:24:56 +0900
committer: Fujii Masao <fujii@postgresql.org>
date : Thu, 23 Oct 2025 13:24:56 +0900 Commit 883a95646a8 introduced overflow entries in the replication lag tracker
to fix an issue where lag columns in pg_stat_replication could stall when
the replay LSN stopped advancing.
This commit adds comments clarifying the purpose and behavior of overflow
entries to improve code readability and understanding.
Since commit 883a95646a8 was recently applied and backpatched to all
supported branches, this follow-up commit is also backpatched accordingly.
Author: Xuneng Zhou <xunengzhou@gmail.com>
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>
Discussion: https://postgr.es/m/CABPTF7VxqQA_DePxyZ7Y8V+ErYyXkmwJ1P6NC+YC+cvxMipWKw@mail.gmail.com
Backpatch-through: 13 M src/backend/replication/walsender.c
Fix coding style with "else".
commit : 20628b62e46e3a2e66c3bb9396720077c7c47018
author : Tatsuo Ishii <ishii@postgresql.org>
date : Thu, 23 Oct 2025 10:58:41 +0900
committer: Tatsuo Ishii <ishii@postgresql.org>
date : Thu, 23 Oct 2025 10:58:41 +0900 The "else" code block having single statement with comments on a
separate line should have been surrounded by braces.
Reported-by: Chao Li <lic@highgo.com>
Suggested-by: David Rowley <dgrowleyml@gmail.com>
Author: Tatsuo Ishii <ishii@postgresql.org>
Discussion: https://postgr.es/m/20251020.125847.997839131426057290.ishii%40postgresql.org M src/backend/executor/nodeWindowAgg.c
Fix some misplaced comments in parallel_schedule
commit : b30da2d233fed10c0f0e90d95171bc927404b2b1
author : David Rowley <drowley@postgresql.org>
date : Thu, 23 Oct 2025 13:38:39 +1300
committer: David Rowley <drowley@postgresql.org>
date : Thu, 23 Oct 2025 13:38:39 +1300 These are listing which other tests one of the tests in the subsequent
group depends on. A couple of comments were located with unrelated
tests.
In passing, fix a small grammatical issue.
Noticed in passing while working on something else.
Author: David Rowley <dgrowleyml@gmail.com> M src/test/regress/parallel_schedule
Add copyright notice to vacuum_horizon_floor.pl test.
commit : 487e2bc5341c19a906db0928d09f08e935a9d737
author : Masahiko Sawada <msawada@postgresql.org>
date : Wed, 22 Oct 2025 17:17:49 -0700
committer: Masahiko Sawada <msawada@postgresql.org>
date : Wed, 22 Oct 2025 17:17:49 -0700 Fix oversight in commit 303ba0573, which was backpatched through 14.
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://postgr.es/m/CAD21AoBeFdTJcwUfUYPcEgONab3TS6i1PB9S5cSXcBAmdAdQKw%40mail.gmail.com
Backpatch-through: 14 M src/test/recovery/t/048_vacuum_horizon_floor.pl
Fix incorrect zero extension of Datum in JIT tuple deform code
commit : 6911f80379d48744c70e7ea7731b783c8fec01d2
author : David Rowley <drowley@postgresql.org>
date : Thu, 23 Oct 2025 13:11:02 +1300
committer: David Rowley <drowley@postgresql.org>
date : Thu, 23 Oct 2025 13:11:02 +1300 When JIT deformed tuples (controlled via the jit_tuple_deforming GUC),
types narrower than sizeof(Datum) would be zero-extended up to Datum
width. This wasn't the same as what fetch_att() does in the standard
tuple deforming code. Logically the values are the same when fetching
via the DatumGet*() marcos, but negative numbers are not the same in
binary form.
In the report, the problem was manifesting itself with:
ERROR: could not find memoization table entry
in a query which had a "Cache Mode: binary" Memoize node. However, it's
currently unclear what else is affected. Anything that uses
datum_image_eq() or datum_image_hash() on a Datum from a tuple deformed by
JIT could be affected, but it may not be limited to that.
The fix for this is simple: use signed extension instead of zero
extension.
Many thanks to Emmanuel Touzery for reporting this issue and providing
steps and backup which allowed the problem to easily be recreated.
Reported-by: Emmanuel Touzery <emmanuel.touzery@plandela.si>
Author: David Rowley <dgrowleyml@gmail.com>
Discussion: https://postgr.es/m/DB8P194MB08532256D5BAF894F241C06393F3A@DB8P194MB0853.EURP194.PROD.OUTLOOK.COM
Backpatch-through: 13 M src/backend/jit/llvm/llvmjit_deform.c
Avoid assuming that time_t can fit in an int.
commit : fe9c051fd3ff5c453b46cf2c958782227e4b3c69
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Wed, 22 Oct 2025 17:50:05 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Wed, 22 Oct 2025 17:50:05 -0400 We had several places that used cast-to-unsigned-int as a substitute
for properly checking for overflow. Coverity has started objecting
to that practice as likely introducing Y2038 bugs. An extra
comparison is surely not much compared to the cost of time(NULL), nor
is this coding practice particularly readable. Let's do it honestly,
with explicit logic covering the cases of first-time-through and
clock-went-backwards.
I don't feel a need to back-patch though: our released versions
will be out of support long before 2038, and besides which I think
the code would accidentally work anyway for another 70 years or so. M src/backend/postmaster/pgarch.c
M src/backend/postmaster/postmaster.c
M src/backend/replication/logical/slotsync.c
Fix type of infomask parameter in htup_details.h functions.
commit : d10866f1fdf1fbf66605b47e8303848b6c7d950b
author : Nathan Bossart <nathan@postgresql.org>
date : Wed, 22 Oct 2025 16:47:38 -0500
committer: Nathan Bossart <nathan@postgresql.org>
date : Wed, 22 Oct 2025 16:47:38 -0500 Oversight in commit 34694ec888. Since there aren't any known live
bugs related to this, no back-patch.
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/aPk4u955ZPPZ_nYw%40nathan M src/include/access/htup_details.h
Remove useless pstrdup() calls.
commit : 716c451128a141acbae1ccab6946c716021a977f
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Wed, 22 Oct 2025 16:22:52 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Wed, 22 Oct 2025 16:22:52 -0400 The result of PLyUnicode_AsString is already palloc'd,
so pstrdup'ing it is just a waste of time and memory.
More importantly it might confuse people about whether
that's necessary. Doesn't seem important enough to
back-patch, but we should fix it. Spotted by Coverity. M src/pl/plpython/plpy_elog.c
M src/pl/plpython/plpy_plpymodule.c
Fix memory leaks in scripts/vacuuming.c.
commit : bc310c6ff3463c65ce532a437f1d27a4318c8b4a
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Wed, 22 Oct 2025 15:19:19 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Wed, 22 Oct 2025 15:19:19 -0400 Coverity complained that the list of table names returned by
retrieve_objects() was leaked, and it's right. Potentially this
is quite a lot of memory; however, it's not entirely clear how much
we gain by cleaning it up, since in many operating modes we're going
to need the list until the program is about to exit. Still, it will
win in some cases, so fix the leak.
vacuuming.c is new in v19, and this patch doesn't apply at all cleanly
to the predecessor code in v18. I'm not excited enough about the
issue to devise a back-patch. M src/bin/scripts/vacuuming.c
Fix memory leaks in pg_combinebackup/reconstruct.c.
commit : 9224c3025243a3daeb49fa58b948c6e1fdf99501
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Wed, 22 Oct 2025 13:38:37 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Wed, 22 Oct 2025 13:38:37 -0400 One code path forgot to free the separately-malloc'd filename
part of a struct rfile. Another place freed the filename but
forgot the struct rfile itself. These seem worth fixing because
with a large backup we could be dealing with many files.
Coverity found the bug in make_rfile(). I found the other one
by manual inspection. M src/bin/pg_combinebackup/reconstruct.c
Remove make_temptable_name_n().
commit : 4c5e1d0785ce150c3e6c65b009ea56815acbc8cd
author : Nathan Bossart <nathan@postgresql.org>
date : Wed, 22 Oct 2025 12:31:55 -0500
committer: Nathan Bossart <nathan@postgresql.org>
date : Wed, 22 Oct 2025 12:31:55 -0500 This small function is only used in one place, and it fails to
handle quoted table names (although the table name portion of the
input should never be quoted in current usage). In addition to
removing make_temptable_name_n() in favor of open-coding it where
needed, this commit ensures the "diff" table name is properly
quoted in order to future-proof this area a bit.
Author: Aleksander Alekseev <aleksander@tigerdata.com>
Reviewed-by: Álvaro Herrera <alvherre@kurilemu.de>
Reviewed-by: Shinya Kato <shinya11.kato@gmail.com>
Discussion: https://postgr.es/m/CAJ7c6TO3a5q2NKRsjdJ6sLf8isVe4aMaaX1-Hj2TdHdhFw8zRA%40mail.gmail.com M src/backend/commands/matview.c
Make invalid primary_slot_name follow standard GUC error reporting.
commit : f33e60a53a9ca89b5078df49416acae20affe1f5
author : Fujii Masao <fujii@postgresql.org>
date : Wed, 22 Oct 2025 20:09:43 +0900
committer: Fujii Masao <fujii@postgresql.org>
date : Wed, 22 Oct 2025 20:09:43 +0900 Previously, if primary_slot_name was set to an invalid slot name and
the configuration file was reloaded, both the postmaster and all other
backend processes reported a WARNING. With many processes running,
this could produce a flood of duplicate messages. The problem was that
the GUC check hook for primary_slot_name reported errors at WARNING
level via ereport().
This commit changes the check hook to use GUC_check_errdetail() and
GUC_check_errhint() for error reporting. As with other GUC parameters,
this causes non-postmaster processes to log the message at DEBUG3,
so by default, only the postmaster's message appears in the log file.
Backpatch to all supported versions.
Author: Fujii Masao <masao.fujii@gmail.com>
Reviewed-by: Chao Li <lic@highgo.com>
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>
Reviewed-by: Álvaro Herrera <alvherre@kurilemu.de>
Reviewed-by: Hayato Kuroda <kuroda.hayato@fujitsu.com>
Discussion: https://postgr.es/m/CAHGQGwFud-cvthCTfusBfKHBS6Jj6kdAPTdLWKvP2qjUX6L_wA@mail.gmail.com
Backpatch-through: 13 M src/backend/access/transam/xlogrecovery.c
M src/backend/replication/slot.c
M src/include/replication/slot.h
Fix multi WinGetFuncArgInFrame/Partition calls with IGNORE NULLS.
commit : 2d7b247cb414ccbc052c485fd82a841477a7e1ff
author : Tatsuo Ishii <ishii@postgresql.org>
date : Wed, 22 Oct 2025 12:06:33 +0900
committer: Tatsuo Ishii <ishii@postgresql.org>
date : Wed, 22 Oct 2025 12:06:33 +0900 Previously it was mistakenly assumed that there's only one window
function argument which needs to be processed by WinGetFuncArgInFrame
or WinGetFuncArgInPartition when IGNORE NULLS option is specified. To
eliminate the limitation, WindowObject->notnull_info is modified from
"uint8 *" to "uint8 **" so that WindowObject->notnull_info could store
pointers to "uint8 *" which holds NOT NULL info corresponding to each
window function argument. Moreover, WindowObject->num_notnull_info is
changed from "int" to "int64 *" so that WindowObject->num_notnull_info
could store the number of NOT NULL info corresponding to each function
argument. Memories for these data structures will be allocated when
WinGetFuncArgInFrame or WinGetFuncArgInPartition is called. Thus no
memory except the pointers is allocated for function arguments which
do not call these functions
Also fix the set mark position logic in WinGetFuncArgInPartition to
not raise a "cannot fetch row before WindowObject's mark position"
error in IGNORE NULLS case.
Reported-by: Tom Lane <tgl@sss.pgh.pa.us>
Author: Tatsuo Ishii <ishii@postgresql.org>
Discussion: https://postgr.es/m/2952409.1760023154%40sss.pgh.pa.us M src/backend/executor/nodeWindowAgg.c
Fix stalled lag columns in pg_stat_replication when replay LSN stops advancing.
commit : 883a95646a8e67a2d316f230712ed82b8ba58e28
author : Fujii Masao <fujii@postgresql.org>
date : Wed, 22 Oct 2025 11:27:15 +0900
committer: Fujii Masao <fujii@postgresql.org>
date : Wed, 22 Oct 2025 11:27:15 +0900 Previously, when the replay LSN reported in feedback messages from a standby
stopped advancing, for example, due to a recovery conflict, the write_lag and
flush_lag columns in pg_stat_replication would initially update but then stop
progressing. This prevented users from correctly monitoring replication lag.
The problem occurred because when any LSN stopped updating, the lag tracker's
cyclic buffer became full (the write head reached the slowest read head).
In that state, the lag tracker could no longer compute round-trip lag values
correctly.
This commit fixes the issue by handling the slowest read entry (the one
causing the buffer to fill) as a separate overflow entry and freeing space
so the write and other read heads can continue advancing in the buffer.
As a result, write_lag and flush_lag now continue updating even if the reported
replay LSN remains stalled.
Backpatch to all supported versions.
Author: Fujii Masao <masao.fujii@gmail.com>
Reviewed-by: Chao Li <lic@highgo.com>
Reviewed-by: Shinya Kato <shinya11.kato@gmail.com>
Reviewed-by: Xuneng Zhou <xunengzhou@gmail.com>
Discussion: https://postgr.es/m/CAHGQGwGdGQ=1-X-71Caee-LREBUXSzyohkoQJd4yZZCMt24C0g@mail.gmail.com
Backpatch-through: 13 M src/backend/replication/walsender.c
Bump catalog version for new function error_on_null()
commit : 2519fa836235d371a6d7f5c2eb3a8f379120a988
author : Michael Paquier <michael@paquier.xyz>
date : Wed, 22 Oct 2025 10:08:47 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Wed, 22 Oct 2025 10:08:47 +0900 Oversight in 2b75c38b707a. No comments.
Discussion: https://postgr.es/m/aPgu7kwiT4iGo6Ya@paquier.xyz M src/include/catalog/catversion.h
Add error_on_null(), checking if the input is the null value
commit : 2b75c38b707a070922231de667a0bd08ee71b268
author : Michael Paquier <michael@paquier.xyz>
date : Wed, 22 Oct 2025 09:55:17 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Wed, 22 Oct 2025 09:55:17 +0900 This polymorphic function produces an error if the input value is
detected as being the null value; otherwise it returns the input value
unchanged.
This function can for example become handy in SQL function bodies, to
enforce that exactly one row was returned.
Author: Joel Jacobson <joel@compiler.org>
Reviewed-by: Vik Fearing <vik@postgresfriends.org>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://postgr.es/m/ece8c6d1-2ab1-45d5-ba12-8dec96fc8886@app.fastmail.com
Discussion: https://postgr.es/m/de94808d-ed58-4536-9e28-e79b09a534c7@app.fastmail.com M doc/src/sgml/func/func-comparison.sgml
M src/backend/utils/adt/misc.c
M src/include/catalog/pg_proc.dat
M src/test/regress/expected/misc_functions.out
M src/test/regress/sql/misc_functions.sql
Use CompactAttribute more often, when possible
commit : 2470ca435c452fe4def9dcc4a831b5101691d541
author : David Rowley <drowley@postgresql.org>
date : Wed, 22 Oct 2025 11:36:26 +1300
committer: David Rowley <drowley@postgresql.org>
date : Wed, 22 Oct 2025 11:36:26 +1300 5983a4cff added CompactAttribute for storing commonly used fields from
FormData_pg_attribute. 5983a4cff didn't go to the trouble of adjusting
every location where we can use CompactAttribute rather than
FormData_pg_attribute, so here we change the remaining ones.
There are some locations where I've left the code using
FormData_pg_attribute. These are mostly in the ALTER TABLE code. Using
CompactAttribute here seems more risky as often the TupleDesc is being
changed and those changes may not have been flushed to the
CompactAttribute yet.
I've also left record_recv(), record_send(), record_cmp(), record_eq()
and record_image_eq() alone as it's not clear to me that accessing the
CompactAttribute is a win here due to the FormData_pg_attribute still
having to be accessed for most cases. Switching the relevant parts to
use CompactAttribute would result in having to access both for common
cases. Careful benchmarking may reveal that something can be done to
make this better, but in absence of that, the safer option is to leave
these alone.
In ReorderBufferToastReplace(), there was a check to skip attnums < 0
while looping over the TupleDesc. Doing this is redundant since
TupleDescs don't store < 0 attnums. Removing that code allows us to
move to using CompactAttribute.
The change in validateDomainCheckConstraint() just moves fetching the
FormData_pg_attribute into the ERROR path, which is cold due to calling
errstart_cold() and results in code being moved out of the common path.
Author: David Rowley <dgrowleyml@gmail.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://postgr.es/m/CAApHDvrMy90o1Lgkt31F82tcSuwRFHq3vyGewSRN=-QuSEEvyQ@mail.gmail.com M contrib/dblink/dblink.c
M contrib/file_fdw/file_fdw.c
M contrib/postgres_fdw/deparse.c
M src/backend/access/gin/gininsert.c
M src/backend/commands/typecmds.c
M src/backend/optimizer/util/plancat.c
M src/backend/parser/parse_relation.c
M src/backend/replication/logical/reorderbuffer.c
M src/backend/replication/logical/worker.c
M src/backend/replication/pgoutput/pgoutput.c
M src/backend/utils/adt/expandedrecord.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/cache/catcache.c
M src/pl/plpython/plpy_typeio.c
Avoid short seeks in pg_restore.
commit : fba60a1b107df425ec9676b8cf759830a70def03
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Tue, 21 Oct 2025 14:10:11 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Tue, 21 Oct 2025 14:10:11 -0400 If a data block to be skipped over is less than 4kB, just read the
data instead of using fseeko(). Experimentation shows that this
avoids useless kernel calls --- possibly quite a lot of them, at
least with current glibc --- while not incurring any extra I/O,
since libc will read 4kB at a time anyway. (There may be platforms
where the default buffer size is different from 4kB, but this
change seems unlikely to hurt in any case.)
We don't expect short data blocks to be common in the wake of
66ec01dc4 and related commits. But older pg_dump files may well
contain very short data blocks, and that will likely be a case
to be concerned with for a long time.
While here, do a little bit of other cleanup in _skipData.
Make "buflen" be size_t not int; it can't really exceed the
range of int, but comparing size_t and int variables is just
asking for trouble. Also, when we initially allocate a buffer
for reading skipped data into, make sure it's at least 4kB to
reduce the odds that we'll shortly have to realloc it bigger.
Author: Dimitrios Apostolou <jimis@gmx.net>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/2edb7a57-b225-3b23-a680-62ba90658fec@gmx.net M src/bin/pg_dump/pg_backup_custom.c
Add reminder to create .abi-compliance-history.
commit : b97d8d843a2d07547f037e624fec79fd610005bb
author : Nathan Bossart <nathan@postgresql.org>
date : Tue, 21 Oct 2025 12:23:23 -0500
committer: Nathan Bossart <nathan@postgresql.org>
date : Tue, 21 Oct 2025 12:23:23 -0500 This commit adds a note to RELEASE_CHANGES to remind us to create
an .abi-compliance-history file for new major versions.
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: David E. Wheeler <david@justatheory.com>
Discussion: https://postgr.es/m/aPJ03E2itovDBcKX%40nathan M src/tools/RELEASE_CHANGES
Make char2wchar() static.
commit : ff53907c35713a9c0c8cbdcc8d82c54954cf8234
author : Jeff Davis <jdavis@postgresql.org>
date : Tue, 21 Oct 2025 09:32:12 -0700
committer: Jeff Davis <jdavis@postgresql.org>
date : Tue, 21 Oct 2025 09:32:12 -0700 Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Discussion: https://postgr.es/m/0151ad01239e2cc7b3139644358cf8f7b9622ff7.camel@j-davis.com M src/backend/utils/adt/pg_locale_libc.c
M src/include/utils/pg_locale.h
Remove obsolete global database_ctype_is_c.
commit : 844385d12e7515f3461e53728f0a9358bc35b6a5
author : Jeff Davis <jdavis@postgresql.org>
date : Tue, 21 Oct 2025 09:32:04 -0700
committer: Jeff Davis <jdavis@postgresql.org>
date : Tue, 21 Oct 2025 09:32:04 -0700 Now that tsearch uses the database default locale, there's no need to
track the database CTYPE separately.
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Discussion: https://postgr.es/m/0151ad01239e2cc7b3139644358cf8f7b9622ff7.camel@j-davis.com M src/backend/utils/adt/pg_locale.c
M src/backend/utils/init/postinit.c
M src/include/utils/pg_locale.h
tsearch: use database default collation for parsing.
commit : e113f9c102b7e2462facf0ecffc97f8093efed54
author : Jeff Davis <jdavis@postgresql.org>
date : Tue, 21 Oct 2025 09:31:49 -0700
committer: Jeff Davis <jdavis@postgresql.org>
date : Tue, 21 Oct 2025 09:31:49 -0700 Previously, tsearch used the database's CTYPE setting, which only
matches the database default collation if the locale provider is libc.
Note that tsearch types (tsvector and tsquery) are not collatable
types. The locale affects parsing the original text, which is a lossy
process, so a COLLATE clause on the already-parsed value would not
make sense.
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Discussion: https://postgr.es/m/0151ad01239e2cc7b3139644358cf8f7b9622ff7.camel@j-davis.com M src/backend/tsearch/ts_locale.c
M src/backend/tsearch/wparser_def.c
Add previous commit to .git-blame-ignore-revs.
commit : 776c2c2ae2d3ba7d9b5d7d780df67af1924e7591
author : Nathan Bossart <nathan@postgresql.org>
date : Tue, 21 Oct 2025 10:02:19 -0500
committer: Nathan Bossart <nathan@postgresql.org>
date : Tue, 21 Oct 2025 10:02:19 -0500 Backpatch-through: 13 M .git-blame-ignore-revs
Re-pgindent brin.c.
commit : e94a7afe44bfa1bd8dc929204a2d4ac8b3fa9854
author : Nathan Bossart <nathan@postgresql.org>
date : Tue, 21 Oct 2025 09:56:26 -0500
committer: Nathan Bossart <nathan@postgresql.org>
date : Tue, 21 Oct 2025 09:56:26 -0500 Backpatch-through: 13 M src/backend/access/brin/brin.c
Make smgr access for a BufferManagerRelation safer in relcache inval
commit : b7cc6474e930d4429b15657d6910e1e32066de5e
author : Álvaro Herrera <alvherre@kurilemu.de>
date : Tue, 21 Oct 2025 10:51:55 +0300
committer: Álvaro Herrera <alvherre@kurilemu.de>
date : Tue, 21 Oct 2025 10:51:55 +0300 Currently there's no bug, because we have no code path where we
invalidate relcache entries where it'd cause a problem. But it's more
robust to do it this way in case we introduce such a path later, as some
Postgres forks reportedly already have.
Author: Daniil Davydov <3danissimo@gmail.com>
Reviewed-by: Stepan Neretin <slpmcf@gmail.com>
Discussion: https://postgr.es/m/CAJDiXgj3FNzAhV+jjPqxMs3jz=OgPohsoXFj_fh-L+nS+13CKQ@mail.gmail.com M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/buffer/localbuf.c
M src/include/storage/bufmgr.h
Fix BRIN 32-bit counter wrap issue with huge tables
commit : 9fd29d7ff476f3f1c1a22d6d6f730e813eddd960
author : David Rowley <drowley@postgresql.org>
date : Tue, 21 Oct 2025 20:46:14 +1300
committer: David Rowley <drowley@postgresql.org>
date : Tue, 21 Oct 2025 20:46:14 +1300 A BlockNumber (32-bit) might not be large enough to add bo_pagesPerRange
to when the table contains close to 2^32 pages. At worst, this could
result in a cancellable infinite loop during the BRIN index scan with
power-of-2 pagesPerRange, and slow (inefficient) BRIN index scans and
scanning of unneeded heap blocks for non power-of-2 pagesPerRange.
Backpatch to all supported versions.
Author: sunil s <sunilfeb26@gmail.com>
Reviewed-by: David Rowley <dgrowleyml@gmail.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://postgr.es/m/CAOG6S4-tGksTQhVzJM19NzLYAHusXsK2HmADPZzGQcfZABsvpA@mail.gmail.com
Backpatch-through: 13 M src/backend/access/brin/brin.c
Fix comment in pg_get_shmem_allocations_numa()
commit : e4e496e88c9a0940abe1ade44337577b26f032a0
author : Michael Paquier <michael@paquier.xyz>
date : Tue, 21 Oct 2025 16:12:30 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Tue, 21 Oct 2025 16:12:30 +0900 The comment fixed in this commit described the function as dealing with
database blocks, but in reality it processes shared memory allocations.
Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Discussion: https://postgr.es/m/aH4DDhdiG9Gi0rG7@ip-10-97-1-34.eu-west-3.compute.internal
Backpatch-through: 18 M src/backend/storage/ipc/shmem.c
Fix pushdown of degenerate HAVING clauses
commit : 18d2614093481cb7ae89e1f5b72f3ddf5fb49b4c
author : Richard Guo <rguo@postgresql.org>
date : Tue, 21 Oct 2025 12:35:36 +0900
committer: Richard Guo <rguo@postgresql.org>
date : Tue, 21 Oct 2025 12:35:36 +0900 67a54b9e8 taught the planner to push down HAVING clauses even when
grouping sets are present, as long as the clause does not reference
any columns that are nullable by the grouping sets. However, there
was an oversight: if any empty grouping sets are present, the
aggregation node can produce a row that did not come from the input,
and pushing down a HAVING clause in this case may cause us to fail to
filter out that row.
Currently, non-degenerate HAVING clauses are not pushed down when
empty grouping sets are present, since the empty grouping sets would
nullify the vars they reference. However, degenerate (variable-free)
HAVING clauses are not subject to this restriction and may be
incorrectly pushed down.
To fix, explicitly check for the presence of empty grouping sets and
retain degenerate clauses in HAVING when they are present. This
ensures that we don't emit a bogus aggregated row. A copy of each
such clause is also put in WHERE so that query_planner() can use it in
a gating Result node.
To facilitate this check, this patch expands the groupingSets tree of
the query to a flat list of grouping sets before applying the HAVING
pushdown optimization. This does not add any additional planning
overhead, since we need to do this expansion anyway.
In passing, make a small tweak to preprocess_grouping_sets() by
reordering its initial operations a bit.
Backpatch to v18, where this issue was introduced.
Reported-by: Yuhang Qiu <iamqyh@gmail.com>
Author: Richard Guo <guofenglinux@gmail.com>
Author: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/0879D9C9-7FE2-4A20-9593-B23F7A0B5290@gmail.com
Backpatch-through: 18 M src/backend/optimizer/plan/planner.c
M src/test/regress/expected/groupingsets.out
M src/test/regress/sql/groupingsets.sql
Fix POSIX compliance in pgwin32_unsetenv() for "name" argument
commit : 29b039e9166d5ad70b39375faceec2167343d355
author : Michael Paquier <michael@paquier.xyz>
date : Tue, 21 Oct 2025 08:05:28 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Tue, 21 Oct 2025 08:05:28 +0900 pgwin32_unsetenv() (compatibility routine of unsetenv() on Windows)
lacks the input validation that its sibling pgwin32_setenv() has.
Without these checks, calling unsetenv() with incorrect names crashes on
WIN32. However, invalid names should be handled, failing on EINVAL.
This commit adds the same checks as setenv() to fail with EINVAL for a
"name" set to NULL, an empty string, or if '=' is included in the value,
per POSIX requirements.
Like 7ca37fb0406b, backpatch down to v14. pgwin32_unsetenv() is defined
on REL_13_STABLE, but with the branch going EOL soon and the lack of
setenv() there for WIN32, nothing is done for v13.
Author: Bryan Green <dbryan.green@gmail.com>
Discussion: https://postgr.es/m/b6a1e52b-d808-4df7-87f7-2ff48d15003e@gmail.com
Backpatch-through: 14 M src/port/win32env.c
Support COPY TO for partitioned tables.
commit : 4bea91f21f61d01bd40a4191a4a8c82d0959fffe
author : Masahiko Sawada <msawada@postgresql.org>
date : Mon, 20 Oct 2025 10:38:52 -0700
committer: Masahiko Sawada <msawada@postgresql.org>
date : Mon, 20 Oct 2025 10:38:52 -0700 Previously, COPY TO command didn't support directly specifying
partitioned tables so users had to use COPY (SELECT ...) TO variant.
This commit adds direct COPY TO support for partitioned
tables, improving both usability and performance. Performance tests
show it's faster than the COPY (SELECT ...) TO variant as it avoids
the overheads of query processing and sending results to the COPY TO
command.
When used with partitioned tables, COPY TO copies the same rows as
SELECT * FROM table. Row-level security policies of the partitioned
table are applied in the same way as when executing COPY TO on a plain
table.
Author: jian he <jian.universality@gmail.com>
Reviewed-by: vignesh C <vignesh21@gmail.com>
Reviewed-by: David Rowley <dgrowleyml@gmail.com>
Reviewed-by: Melih Mutlu <m.melihmutlu@gmail.com>
Reviewed-by: Kirill Reshke <reshkekirill@gmail.com>
Reviewed-by: Atsushi Torikoshi <torikoshia@oss.nttdata.com>
Reviewed-by: Álvaro Herrera <alvherre@kurilemu.de>
Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://postgr.es/m/CACJufxEZt%2BG19Ors3bQUq-42-61__C%3Dy5k2wk%3DsHEFRusu7%3DiQ%40mail.gmail.com M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/sql/postgres_fdw.sql
M doc/src/sgml/ref/copy.sgml
M src/backend/commands/copy.c
M src/backend/commands/copyto.c
M src/test/regress/expected/copy.out
M src/test/regress/expected/rowsecurity.out
M src/test/regress/sql/copy.sql
M src/test/regress/sql/rowsecurity.sql
Fix thinko in commit 7d129ba54.
commit : d74cfe3263fa0a35cb962570697f422775cd12d6
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Mon, 20 Oct 2025 08:45:57 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Mon, 20 Oct 2025 08:45:57 -0400 The revised logic in 001_ssltests.pl would fail if openssl
doesn't work or if Perl is a 32-bit build, because it had
already overwritten $serialno with something inappropriate
to use in the eventual match. We could go back to the
previous code layout, but it seems best to introduce a
separate variable for the output of openssl.
Per failure on buildfarm member mamba, which has a 32-bit Perl. M src/test/ssl/t/001_ssltests.pl
pg_dump: Remove unnecessary code for security labels on extensions.
commit : 762faf702c6f7292bd02705553078700d92c15f1
author : Fujii Masao <fujii@postgresql.org>
date : Mon, 20 Oct 2025 11:44:11 +0900
committer: Fujii Masao <fujii@postgresql.org>
date : Mon, 20 Oct 2025 11:44:11 +0900 Commit d9572c4e3b4 added extension support and made pg_dump attempt to
dump security labels on extensions. However, security labels on extensions
are not actually supported, so this code was unnecessary.
This commit removes it.
Suggested-by: Jian He <jian.universality@gmail.com>
Author: Fujii Masao <masao.fujii@gmail.com>
Reviewed-by: Jian He <jian.universality@gmail.com>
Discussion: https://postgr.es/m/CACJufxF8=z0v=888NKKEoTHQ+Jc4EXutFi91BF0fFjgFsZT6JQ@mail.gmail.com M src/bin/pg_dump/pg_dump.c
pg_checksums: Use new routine to retrieve data of PG_VERSION
commit : a7c30422004ae757909ed831fd8eea453022f969
author : Michael Paquier <michael@paquier.xyz>
date : Mon, 20 Oct 2025 09:35:22 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Mon, 20 Oct 2025 09:35:22 +0900 Previously, attempting to use pg_checksums on a cluster with a control
file whose version does not match with what thetool is able to support
would lead to the following error:
pg_checksums: error: pg_control CRC value is incorrect
This is confusing, because it would look like the control file is
corrupted. However, the contents of the control file are correct,
pg_checksums not being able to understand how the past control file is
shaped.
This commit adds a check based on PG_VERSION, using the facility added
by cd0be131ba6f, using the same error message as some of the other
frontend tools. A note is added in the documentation about the major
version requirement.
Author: Michael Banck <mbanck@gmx.net>
Discussion: https://postgr.es/m/68f1ff21.170a0220.2c9b5f.4df5@mx.google.com M doc/src/sgml/ref/pg_checksums.sgml
M src/bin/pg_checksums/pg_checksums.c
Add static assertion that RELSEG_SIZE fits in an int.
commit : 92cf557ffae436235cfa3bbba1265b5807a68ef2
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Sun, 19 Oct 2025 18:28:46 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Sun, 19 Oct 2025 18:28:46 -0400 Our configure script intended to ensure this, but it supposed that
expr(1) would report an error for integer overflow. Maybe that
was true when the code was written (commit 3c6248a82 of 2008-05-02),
but all the modern expr's I tried will deliver bigger-than-int32
results without complaint. Moreover, if you use --with-segsize-blocks
then there's no check at all.
Ideally we'd add a test in configure itself to check that the value
fits in int, but to do that we'd need to suppose that test(1) handles
bigger-than-int32 numbers correctly. Probably modern ones do, but
that's an assumption I could do without; and I'm not too trusting
about meson either. Instead, let's install a static assertion, so
that even people who ignore all the compiler warnings you get from
such values will be forced to confront the fact that it won't work.
This has been hazardous for awhile, but given that we hadn't heard
a complaint about it till now, I don't feel a need to back-patch.
Reported-by: Casey Shobe <casey.allen.shobe@icloud.com>
Author: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/C5DC82D6-C76D-4E8F-BC2E-DF03EFC4FA24@icloud.com M src/backend/storage/smgr/md.c
Don't rely on zlib's gzgetc() macro.
commit : 277dec6514728e2d0d87c1279dd5e0afbf897428
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Sun, 19 Oct 2025 14:36:58 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Sun, 19 Oct 2025 14:36:58 -0400 It emerges that zlib's configuration logic is not robust enough
to guarantee that the macro will have the same ideas about struct
field layout as the library itself does, leading to corruption of
zlib's state struct followed by unintelligible failure messages.
This hazard has existed for a long time, but we'd not noticed
for several reasons:
(1) We only use gzgetc() when trying to read a manually-compressed
TOC file within a directory-format dump, which is a rarely-used
scenario that we weren't even testing before 20ec99589.
(2) No corruption actually occurs unless sizeof(long) is different
from sizeof(off_t) and the platform is big-endian.
(3) Some platforms have already fixed the configuration instability,
at least sufficiently for their environments.
Despite (3), it seems foolish to assume that the problem isn't
going to be present in some environments for a long time to come.
Hence, avoid relying on this macro. We can just #undef it and
fall back on the underlying function of the same name.
Author: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/2122679.1760846783@sss.pgh.pa.us
Backpatch-through: 13 M src/bin/pg_dump/compress_gzip.c
Fix Coverity issue reported in commit 2273fa32bce.
commit : dd766a441d69d16d1c8ab0d3a41a10649702d202
author : Tatsuo Ishii <ishii@postgresql.org>
date : Sun, 19 Oct 2025 09:29:26 +0900
committer: Tatsuo Ishii <ishii@postgresql.org>
date : Sun, 19 Oct 2025 09:29:26 +0900 Coverity complains that the return value from gettuple_eval_partition
(stored in variable "datum") in a do..while loop in
WinGetFuncArgInPartition is overwritten when exiting the while
loop. This commit tries to fix the issue by changing the
gettuple_eval_partition call to:
(void) gettuple_eval_partition()
explicitly stating that we discard the return value. We are just
interested in whether we are inside or outside of partition, NULL or
NOT NULL here.
Also enhance some comments for easier code reading.
Reported-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://postgr.es/m/aPCOabSE4VfJLaky%40paquier.xyz M src/backend/executor/nodeWindowAgg.c
Add pg_database_locale() to retrieve database default locale.
commit : e533524b23b8dd504d38c09c9f84b38289ca635d
author : Jeff Davis <jdavis@postgresql.org>
date : Sat, 18 Oct 2025 16:25:23 -0700
committer: Jeff Davis <jdavis@postgresql.org>
date : Sat, 18 Oct 2025 16:25:23 -0700 Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Discussion: https://postgr.es/m/0151ad01239e2cc7b3139644358cf8f7b9622ff7.camel@j-davis.com M src/backend/utils/adt/pg_locale.c
M src/include/utils/pg_locale.h
Add pg_iswxdigit(), useful for tsearch.
commit : 67a8b49e96caf0782b556521c8d6650e78f2d88e
author : Jeff Davis <jdavis@postgresql.org>
date : Sat, 18 Oct 2025 16:25:11 -0700
committer: Jeff Davis <jdavis@postgresql.org>
date : Sat, 18 Oct 2025 16:25:11 -0700 Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Discussion: https://postgr.es/m/0151ad01239e2cc7b3139644358cf8f7b9622ff7.camel@j-davis.com M src/backend/utils/adt/pg_locale.c
M src/backend/utils/adt/pg_locale_builtin.c
M src/backend/utils/adt/pg_locale_icu.c
M src/backend/utils/adt/pg_locale_libc.c
M src/include/utils/pg_locale.h
Allow role created by new test to log in on Windows.
commit : da44d71e799d5b3f03256169334044ad817c1dd7
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Sat, 18 Oct 2025 18:36:21 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Sat, 18 Oct 2025 18:36:21 -0400 We must tell init about each role name we plan to connect as,
else SSPI auth fails. Similar to previous patches such as
14793f471, 973542866.
Oversight in 208927e65, per buildfarm member drongo.
(Although that was back-patched to v13, the test script
only exists in v16 and up.) M contrib/pg_prewarm/t/001_basic.pl
Tidyup truncate_useless_pathkeys() function
commit : e3b9e44689051d5bee199e333c748aac83396378
author : David Rowley <drowley@postgresql.org>
date : Sun, 19 Oct 2025 10:13:13 +1300
committer: David Rowley <drowley@postgresql.org>
date : Sun, 19 Oct 2025 10:13:13 +1300 This removes a few static functions and replaces them with 2 functions
which aim to be more reusable. The upper planner's pathkey requirements
can be simplified down to operations which require pathkeys in the same
order as the pathkeys for the given operation, and operations which can
make use of a Path's pathkeys in any order.
Here we also add some short-circuiting to truncate_useless_pathkeys(). At
any point we discover that all pathkeys are useful to a single operation,
we can stop checking the remaining operations as we're not going to be
able to find any further useful pathkeys - they're all possibly useful
already. Adjusting this seems to warrant trying to put the checks
roughly in order of least-expensive-first so that the short-circuits
have the most chance of skipping the more expensive checks.
In passing clean up has_useful_pathkeys() as it seems to have grown a
redundant check for group_pathkeys. This isn't needed as
standard_qp_callback will set query_pathkeys if there's any requirement
to have group_pathkeys. All this code does is waste run-time effort and
take up needless space.
Author: David Rowley <dgrowleyml@gmail.com>
Reviewed-by: Richard Guo <guofenglinux@gmail.com>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://postgr.es/m/CAApHDvpbsEoTksvW5901MMoZo-hHf78E5up3uDOfkJnxDe_WAw@mail.gmail.com M src/backend/optimizer/path/pathkeys.c
Fix determination of not-null constraint "locality" for inherited columns
commit : 615ff828e1cb8eaa2a987d4390c5c9970fc1a3e6
author : Álvaro Herrera <alvherre@kurilemu.de>
date : Sat, 18 Oct 2025 18:18:19 +0200
committer: Álvaro Herrera <alvherre@kurilemu.de>
date : Sat, 18 Oct 2025 18:18:19 +0200 It is possible to have a non-inherited not-null constraint on an
inherited column, but we were failing to preserve such constraints
during pg_upgrade where the source is 17 or older, because of a bug in
the pg_dump query for it. Oversight in commit 14e87ffa5c54. Fix that
query. In passing, touch-up a bogus nearby comment introduced by the
same commit.
In version 17, make the regression tests leave a table in this
situation, so that this scenario is tested in the cross-version upgrade
tests of 18 and up.
Author: Dilip Kumar <dilipbalaut@gmail.com>
Reported-by: Andrew Bille <andrewbille@gmail.com>
Bug: #19074
Backpatch-through: 18
Discussion: https://postgr.es/m/19074-ae2548458cf0195c@postgresql.org M src/bin/pg_dump/pg_dump.c
M src/test/regress/expected/constraints.out
M src/test/regress/sql/constraints.sql
Fix pg_dump sorting of foreign key constraints
commit : 4921a5972a345fd3118f47a9e425ec862d8a8333
author : Álvaro Herrera <alvherre@kurilemu.de>
date : Sat, 18 Oct 2025 17:50:10 +0200
committer: Álvaro Herrera <alvherre@kurilemu.de>
date : Sat, 18 Oct 2025 17:50:10 +0200 Apparently, commit 04bc2c42f765 failed to notice that DO_FK_CONSTRAINT
objects require identical handling as DO_CONSTRAINT ones, which causes
some pg_upgrade tests in debug builds to fail spuriously. Add that.
Author: Álvaro Herrera <alvherre@kurilemu.de>
Backpatch-through: 13
Discussion: https://postgr.es/m/202510181201.k6y75v2tpf5r@alvherre.pgsql M src/bin/pg_dump/pg_dump_sort.c
Fix reset of incorrect hash iterator in GROUPING SETS queries
commit : 5c0a20003b4396930a354105ccf47402ca5047d2
author : David Rowley <drowley@postgresql.org>
date : Sat, 18 Oct 2025 16:07:04 +1300
committer: David Rowley <drowley@postgresql.org>
date : Sat, 18 Oct 2025 16:07:04 +1300 This fixes an unlikely issue when fetching GROUPING SET results from
their internally stored hash tables. It was possible in rare cases that
the hash iterator would be set up incorrectly which could result in a
crash.
This was introduced in 4d143509c, so backpatch to v18.
Many thanks to Yuri Zamyatin for reporting and helping to debug this
issue.
Bug: #19078
Reported-by: Yuri Zamyatin <yuri@yrz.am>
Author: David Rowley <dgrowleyml@gmail.com>
Reviewed-by: Jeff Davis <pgsql@j-davis.com>
Discussion: https://postgr.es/m/19078-dfd62f840a2c0766@postgresql.org
Backpatch-through: 18 M src/backend/executor/nodeAgg.c
M src/include/lib/simplehash.h
Englishify comment wording
commit : 86d118f9a60c6aafe1a6331fdf80455df24f32ae
author : David Rowley <drowley@postgresql.org>
date : Sat, 18 Oct 2025 12:50:14 +1300
committer: David Rowley <drowley@postgresql.org>
date : Sat, 18 Oct 2025 12:50:14 +1300 Switch to using the English word here rather than using a verbified
function name.
The full word still fits within a single comment line, so it's probably
better just to use that instead of trying to shorten it, which might
cause confusion.
Author: Rafia Sabih <rafia.pghackers@gmail.com>
Discussion: https://postgr.es/m/CA+FpmFe7LnRF2NA_QfARjkSWme4mNt+Udwbh2Yb=zZm35Ji31w@mail.gmail.com M src/include/nodes/memnodes.h
Fix hashjoin memory balancing logic
commit : b85c4700fc5124999e22ea7300ecc0a290c81cbc
author : Tomas Vondra <tomas.vondra@postgresql.org>
date : Fri, 17 Oct 2025 21:44:42 +0200
committer: Tomas Vondra <tomas.vondra@postgresql.org>
date : Fri, 17 Oct 2025 21:44:42 +0200 Commit a1b4f289beec improved the hashjoin sizing to also consider the
memory used by BufFiles for batches. The code however had multiple
issues, making it ineffective or not working as expected in some cases.
* The amount of memory needed by buffers was calculated using uint32,
so it would overflow for nbatch >= 262144. If this happened the loop
would exit prematurely and the memory usage would not be reduced.
The nbatch overflow is fixed by reworking the condition to not use a
multiplication at all, so there's no risk of overflow. An explicit
cast was added to a similar calculation in ExecHashIncreaseBatchSize.
* The loop adjusting the nbatch value used hash_table_bytes to calculate
the old/new size, but then updated only space_allowed. The consequence
is the total memory usage was not reduced, but all the memory saved by
reducing the number of batches was used for the internal hash table.
This was fixed by using only space_allowed. This is also more correct,
because hash_table_bytes does not account for skew buckets.
* The code was also doubling multiple parameters (e.g. the number of
buckets for hash table), but was missing overflow protections.
The loop now checks for overflow, and terminates if needed. It'd be
possible to cap the value and continue the loop, but it's not worth
the complexity. And the overflow implies the in-memory hash table is
already very large anyway.
While at it, rework the comment explaining how the memory balancing
works, to make it more concise and easier to understand.
The initial nbatch overflow issue was reported by Vaibhav Jain. The
other issues were noticed by me and Melanie Plageman. Fix by me, with a
lot of review and feedback by Melanie.
Backpatch to 18, where the hashjoin memory balancing was introduced.
Reported-by: Vaibhav Jain <jainva@google.com>
Reviewed-by: Melanie Plageman <melanieplageman@gmail.com>
Backpatch-through: 18
Discussion: https://postgr.es/m/CABa-Az174YvfFq7rLS+VNKaQyg7inA2exvPWmPWqnEn6Ditr_Q@mail.gmail.com M src/backend/executor/nodeHash.c
Remove unused data_bufsz from DecodedBkpBlock struct.
commit : fd530650137e41bd2c3ed2b62724d5b47721a922
author : Masahiko Sawada <msawada@postgresql.org>
date : Fri, 17 Oct 2025 11:28:54 -0700
committer: Masahiko Sawada <msawada@postgresql.org>
date : Fri, 17 Oct 2025 11:28:54 -0700 Author: Mikhail Gribkov <youzhick@gmail.com>
Reviewed-by: Nazir Bilal Yavuz <byavuz81@gmail.com>
Discussion: https://postgr.es/m/CAMEv5_sxuaiAfSy1ZyN%3D7UGbHg3C10cwHhEk8nXEjiCsBVs4vQ%40mail.gmail.com M src/include/access/xlogreader.h
Fix privilege checks for pg_prewarm() on indexes.
commit : 208927e656929df4ecc1efe8443dbcdbbcb23e38
author : Nathan Bossart <nathan@postgresql.org>
date : Fri, 17 Oct 2025 11:36:50 -0500
committer: Nathan Bossart <nathan@postgresql.org>
date : Fri, 17 Oct 2025 11:36:50 -0500 pg_prewarm() currently checks for SELECT privileges on the target
relation. However, indexes do not have access rights of their own,
so a role may be denied permission to prewarm an index despite
having the SELECT privilege on its parent table. This commit fixes
this by locking the parent table before the index (to avoid
deadlocks) and checking for SELECT on the parent table. Note that
the code is largely borrowed from
amcheck_lock_relation_and_check().
An obvious downside of this change is the extra AccessShareLock on
the parent table during prewarming, but that isn't expected to
cause too much trouble in practice.
Author: Ayush Vatsa <ayushvatsa1810@gmail.com>
Co-authored-by: Nathan Bossart <nathandbossart@gmail.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Jeff Davis <pgsql@j-davis.com>
Discussion: https://postgr.es/m/CACX%2BKaMz2ZoOojh0nQ6QNBYx8Ak1Dkoko%3DD4FSb80BYW%2Bo8CHQ%40mail.gmail.com
Backpatch-through: 13 M contrib/pg_prewarm/pg_prewarm.c
M contrib/pg_prewarm/t/001_basic.pl
Improve TAP tests by replacing ok() with better Test::More functions
commit : a6113dc1dae009a3d9a634d2fcc59d72d1dd7d7b
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Fri, 17 Oct 2025 11:25:53 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Fri, 17 Oct 2025 11:25:53 -0400 Transpose the changes made by commit fabb33b35 in 002_pg_dump.pl
into its recently-created clone 006_pg_dump_compress.pl. M src/bin/pg_dump/t/006_pg_dump_compress.pl
Avoid warnings in tests when openssl binary isn't available
commit : 7d129ba54e7425baf43aa518d417ba3e4e94a443
author : Daniel Gustafsson <dgustafsson@postgresql.org>
date : Fri, 17 Oct 2025 14:21:26 +0200
committer: Daniel Gustafsson <dgustafsson@postgresql.org>
date : Fri, 17 Oct 2025 14:21:26 +0200 The SSL tests for pg_stat_ssl tries to exactly match the serial
from the certificate by extracting it with the openssl binary.
If that fails due to the binary not being available, a fallback
match is used, but the attempt to execute a missing binary adds
a warning to the output which can confuse readers for a failure
in the test. Fix by only attempting if the openssl binary was
found by autoconf/meson.
Backpatch down to v16 where commit c8e4030d1bdd made the test
use the OPENSSL variable from autoconf/meson instead of a hard-
coded value.
Author: Daniel Gustafsson <daniel@yesql.se>
Reported-by: Christoph Berg <myon@debian.org>
Discussion: https://postgr.es/m/aNPSp1-RIAs3skZm@msg.df7cb.de
Backpatch-through: 16 M src/test/ssl/t/001_ssltests.pl
Change config_generic.vartype to be initialized at compile time
commit : e1a912c86d5205371b043772aa89908f2452cbf0
author : Peter Eisentraut <peter@eisentraut.org>
date : Fri, 17 Oct 2025 10:33:54 +0200
committer: Peter Eisentraut <peter@eisentraut.org>
date : Fri, 17 Oct 2025 10:33:54 +0200 Previously, this was initialized at run time so that it did not have
to be maintained by hand in guc_tables.c. But since that table is now
generated anyway, we might as well generate this bit as well.
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/8fdfb91e-60fb-44fa-8df6-f5dea47353c9@eisentraut.org M src/backend/utils/misc/gen_guc_tables.pl
M src/backend/utils/misc/guc.c
M src/include/utils/guc_tables.h
Use designated initializers for guc_tables
commit : 0a7bde46101697ece7549df29078ff9417347438
author : Peter Eisentraut <peter@eisentraut.org>
date : Fri, 17 Oct 2025 10:29:42 +0200
committer: Peter Eisentraut <peter@eisentraut.org>
date : Fri, 17 Oct 2025 10:29:42 +0200 This makes the generating script simpler and the output easier to
read. In the future, it will make it easier to reorder and rearrange
the underlying C structures.
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/8fdfb91e-60fb-44fa-8df6-f5dea47353c9@eisentraut.org M src/backend/utils/misc/gen_guc_tables.pl
ecpg: check return value of replace_variables()
commit : 0d82163958005b2ba56f8c58311888d142fa4509
author : Daniel Gustafsson <dgustafsson@postgresql.org>
date : Fri, 17 Oct 2025 10:03:15 +0200
committer: Daniel Gustafsson <dgustafsson@postgresql.org>
date : Fri, 17 Oct 2025 10:03:15 +0200 The function returns false if it fails to allocate memory, so
make sure to check the return value in callsites.
Author: Aleksander Alekseev <aleksander@tigerdata.com>
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>
Discussion: https://postgr.es/m/CAJ7c6TNPrU8ZxgdfN3PyGY1tzo0bgszx+KkqW0Z7zt3heyC1GQ@mail.gmail.com M src/interfaces/ecpg/ecpglib/prepare.c
Replace defunct URL with stable archive.org URL in rbtree.c
commit : 6aa184c80f0cb0e20572441e0189567ed5176e1d
author : Daniel Gustafsson <dgustafsson@postgresql.org>
date : Fri, 17 Oct 2025 09:38:49 +0200
committer: Daniel Gustafsson <dgustafsson@postgresql.org>
date : Fri, 17 Oct 2025 09:38:49 +0200 The URL for "Sorting and Searching Algorithms: A Cookbook"
by Thomas Niemann has started returning 404, and since we
refer to the page for license terms this replaces the now
defunct link with one to the copy on archive.org.
Author: Chao Li <lic@highgo.com>
Discussion: https://postgr.es/m/6DED3DEF-875E-4D1D-8F8F-7353D5AF7B79@gmail.com M src/backend/lib/rbtree.c
Improve TAP tests by replacing ok() with better Test::More functions
commit : fabb33b351c2504a1985f9a1cdf697924cd5f023
author : Michael Paquier <michael@paquier.xyz>
date : Fri, 17 Oct 2025 14:39:09 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Fri, 17 Oct 2025 14:39:09 +0900 The TAP tests whose ok() calls are changed in this commit were relying
on perl operators, rather than equivalents available in Test::More. For
example, rather than the following:
ok($data =~ qr/expr/m, "expr matching");
ok($data !~ qr/expr/m, "expr not matching");
The new test code uses this equivalent:
like($data, qr/expr/m, "expr matching");
unlike($data, qr/expr/m, "expr not matching");
A huge benefit of the new formulation is that it is possible to know
about the values we are checking if a failure happens, making debugging
easier, should the test runs happen in the buildfarm, in the CI or
locally.
This change leads to more test code overall as perltidy likes to make
the code pretty the way it is in this commit.
Author: Sadhuprasad Patro <b.sadhu@gmail.com>
Discussion: https://postgr.es/m/CAFF0-CHhwNx_Cv2uy7tKjODUbeOgPrJpW4Rpf1jqB16_1bU2sg@mail.gmail.com M contrib/amcheck/t/004_verify_nbtree_unique.pl
M contrib/pg_visibility/t/002_corrupt_vm.pl
M src/bin/initdb/t/001_initdb.pl
M src/bin/pg_basebackup/t/040_pg_createsubscriber.pl
M src/bin/pg_combinebackup/t/010_hardlink.pl
M src/bin/pg_dump/t/002_pg_dump.pl
M src/bin/pg_dump/t/005_pg_dump_filterfile.pl
M src/bin/pgbench/t/001_pgbench_with_server.pl
M src/bin/psql/t/001_basic.pl
M src/bin/scripts/t/020_createdb.pl
M src/interfaces/libpq/t/003_load_balance_host_list.pl
M src/interfaces/libpq/t/004_load_balance_dns.pl
M src/test/modules/test_aio/t/002_io_workers.pl
M src/test/modules/test_misc/t/001_constraint_validation.pl
M src/test/modules/test_misc/t/002_tablespace.pl
M src/test/modules/test_pg_dump/t/001_base.pl
M src/test/modules/xid_wraparound/t/002_limits.pl
M src/test/recovery/t/001_stream_rep.pl
M src/test/recovery/t/003_recovery_targets.pl
M src/test/recovery/t/005_replay_delay.pl
M src/test/recovery/t/006_logical_decoding.pl
M src/test/recovery/t/020_archive_status.pl
M src/test/recovery/t/024_archive_recovery.pl
M src/test/recovery/t/035_standby_logical_decoding.pl
M src/test/recovery/t/040_standby_failover_slots_sync.pl
M src/test/recovery/t/044_invalidate_inactive_slots.pl
M src/test/subscription/t/001_rep_changes.pl
M src/test/subscription/t/007_ddl.pl
M src/test/subscription/t/013_partition.pl
M src/test/subscription/t/027_nosuperuser.pl
M src/test/subscription/t/031_column_list.pl
M src/test/subscription/t/035_conflicts.pl
doc: Clarify when backend_xmin in pg_stat_replication can be NULL.
commit : e64aa1a39d4b8a9502be8ed8dfd67efd6f6acf28
author : Fujii Masao <fujii@postgresql.org>
date : Fri, 17 Oct 2025 14:03:42 +0900
committer: Fujii Masao <fujii@postgresql.org>
date : Fri, 17 Oct 2025 14:03:42 +0900 Improve the documentation of pg_stat_replication to explain when
the backend_xmin column becomes NULL. This happens when
a replication slot is used (the xmin is then shown in pg_replication_slots)
or when hot_standby_feedback is disabled.
Author: Renzo Dani <arons7@gmail.com>
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>
Discussion: https://postgr.es/m/CA+XOKQAMXzskpdUmj2sg03_5fmiXc2Gs0r3TX1_rmcFcqh+=xQ@mail.gmail.com M doc/src/sgml/monitoring.sgml
Fix matching check in recovery test 042_low_level_backup
commit : d1b80a31ed6dc185108af74f363bd6baad98104f
author : Michael Paquier <michael@paquier.xyz>
date : Fri, 17 Oct 2025 13:06:04 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Fri, 17 Oct 2025 13:06:04 +0900 042_low_level_backup compared the result of a query two times with a
comparison operator based on an integer, while the result should be
compared with a string.
The outcome of the tests is currently not impacted by this change.
However, it could be possible that the tests fail to detect future
issues if the query results become different, for some reason.
Oversight in 99b4a63bef94.
Author: Sadhuprasad Patro <b.sadhu@gmail.com>
Discussion: https://postgr.es/m/CAFF0-CHhwNx_Cv2uy7tKjODUbeOgPrJpW4Rpf1jqB16_1bU2sg@mail.gmail.com
Backpatch-through: 17 M src/test/recovery/t/042_low_level_backup.pl
pg_createsubscriber: Fix matching check in TAP test
commit : d372888ade9e7f4796882d3e15b0d78ae329d0cb
author : Michael Paquier <michael@paquier.xyz>
date : Fri, 17 Oct 2025 13:01:14 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Fri, 17 Oct 2025 13:01:14 +0900 040_pg_createsubscriber has been calling safe_psql(), that returns the
result of a SQL query, with ok() without checking the result generated
(in this case 't', for a number of publications).
The outcome of the tests is currently not impacted by this change.
However, it could be possible that the test fails to detect future
issues if the query results become different.
The test is rewritten so as the number of publications is checked. This
is not the fix suggested originally by the author, but this is more
reliable in the long run.
Oversight in e5aeed4b8020.
Author: Sadhuprasad Patro <b.sadhu@gmail.com>
Discussion: https://postgr.es/m/CAFF0-CHhwNx_Cv2uy7tKjODUbeOgPrJpW4Rpf1jqB16_1bU2sg@mail.gmail.com
Backpatch-through: 18 M src/bin/pg_basebackup/t/040_pg_createsubscriber.pl
Fix update-po for the PGXS case
commit : 6ad9378c9a7bf10840c884286009956f51e4924c
author : Álvaro Herrera <alvherre@kurilemu.de>
date : Thu, 16 Oct 2025 20:21:05 +0200
committer: Álvaro Herrera <alvherre@kurilemu.de>
date : Thu, 16 Oct 2025 20:21:05 +0200 The original formulation failed to take into account the fact that for
the PGXS case, the source dir is not $(top_srcdir), so it ended up not
doing anything. Handle it explicitly.
Author: Ryo Matsumura <matsumura.ryo@fujitsu.com>
Reviewed-by: Bryan Green <dbryan.green@gmail.com>
Backpatch-through: 13
Discussion: https://postgr.es/m/TYCPR01MB113164770FB0B0BE6ED21E68EE8DCA@TYCPR01MB11316.jpnprd01.prod.outlook.com M src/nls-global.mk
Add more TAP test coverage for pg_dump.
commit : 20ec9958921af9698e88d6f006c49a4d9d28f210
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Thu, 16 Oct 2025 12:52:10 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Thu, 16 Oct 2025 12:52:10 -0400 Add a test case to cover pg_dump with --compress=none. This
brings the coverage of compress_none.c up from about 64% to 90%,
in particular covering the new code added in a previous patch.
Include compression of toc.dat in manually-compressed test cases.
We would have found the bug fixed in commit a239c4a0c much sooner
if we'd done this. As far as I can tell, this doesn't reduce test
coverage at all, since there are other tests of directory format
that still use an uncompressed toc.dat.
Widen the wide row used to verify correct (de) compression.
Commit 1a05c1d25 advises us (not without reason) to ensure that
this test case fully fills DEFAULT_IO_BUFFER_SIZE, so that loops
within the compression logic will iterate completely. To follow
that advice with the proposed DEFAULT_IO_BUFFER_SIZE of 128K,
we need something close to this. This does indeed increase the
reported code coverage by a few lines.
While here, fix a glitch that I noticed in testing: the
$glob_patterns tests were incapable of failing, because glob()
will return 'foo' as 'foo' whether there is a matching file or
not. (Indeed, the stanza just above that one relies on that.)
In my testing, this patch adds approximately as much runtime
as was saved by the previous patch, so that it's about a wash
compared to the old code. However, we get better test coverage.
Author: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/3515357.1760128017@sss.pgh.pa.us M src/bin/pg_dump/t/002_pg_dump.pl
M src/bin/pg_dump/t/006_pg_dump_compress.pl
Split 002_pg_dump.pl into two test files.
commit : 9dcf7f1172cd464366ad488feae9c94a2c9ca417
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Thu, 16 Oct 2025 12:51:55 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Thu, 16 Oct 2025 12:51:55 -0400 Add a new test script 006_pg_dump_compress.pl, containing just
the pg_dump tests specifically concerned with compression, and
remove those tests from 002_pg_dump.pl. We can also drop some
infrastructure in 002_pg_dump.pl that was used only for these tests.
The point of this is to avoid the cost of running these test
cases over and over in all the scenarios (runs) that 002_pg_dump.pl
exercises. We don't learn anything more about the behavior of the
compression code that way, and we expend significant amounts of
time, since one of these test cases is quite large and due to get
larger.
The intent of this specific patch is to provide exactly the same
coverage as before, except that I went back to using --no-sync
in all the test runs moved over to 006_pg_dump_compress.pl.
I think that avoiding that had basically been cargo-culted into
these test cases as a result of modeling them on the
defaults_custom_format test case; again, doing that over and over
isn't going to teach us anything new.
Author: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/3515357.1760128017@sss.pgh.pa.us M src/bin/pg_dump/meson.build
M src/bin/pg_dump/t/002_pg_dump.pl
A src/bin/pg_dump/t/006_pg_dump_compress.pl
Align the data block sizes of pg_dump's various compression modes.
commit : 66ec01dc41243d756896777aa66df149ac8fa31d
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Thu, 16 Oct 2025 12:50:18 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Thu, 16 Oct 2025 12:50:18 -0400 After commit fe8192a95, compress_zstd.c tends to produce data block
sizes around 128K, and we don't really have any control over that
unless we want to overrule ZSTD_CStreamOutSize(). Which seems like
a bad idea. But let's try to align the other compression modes to
produce block sizes roughly comparable to that, so that pg_restore's
skip-data performance isn't enormously different for different modes.
gzip compression can be brought in line simply by setting
DEFAULT_IO_BUFFER_SIZE = 128K, which this patch does. That
increases some unrelated buffer sizes, but none of them seem
problematic for modern platforms.
lz4's idea of appropriate block size is highly nonlinear:
if we just increase DEFAULT_IO_BUFFER_SIZE then the output
blocks end up around 200K. I found that adjusting the slop
factor in LZ4State_compression_init was a not-too-ugly way
of bringing that number roughly into line.
With compress = none you get data blocks the same sizes as the
table rows, which seems potentially problematic for narrow tables.
Introduce a layer of buffering to make that case match the others.
Comments in compress_io.h and 002_pg_dump.pl suggest that if
we increase DEFAULT_IO_BUFFER_SIZE then we need to increase the
amount of data fed through the tests in order to improve coverage.
I've not done that here, leaving it for a separate patch.
Author: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/3515357.1760128017@sss.pgh.pa.us M src/bin/pg_dump/compress_io.h
M src/bin/pg_dump/compress_lz4.c
M src/bin/pg_dump/compress_none.c
M src/tools/pgindent/typedefs.list
Remove partColsUpdated.
commit : 812221b204276b884d2b14ef56aabd9e1946be81
author : Nathan Bossart <nathan@postgresql.org>
date : Thu, 16 Oct 2025 11:31:38 -0500
committer: Nathan Bossart <nathan@postgresql.org>
date : Thu, 16 Oct 2025 11:31:38 -0500 This information appears to have been unused since commit
c5b7ba4e67. We could not find any references in third-party code,
either.
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://postgr.es/m/aO_CyFRpbVMtgJWM%40nathan M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/util/inherit.c
M src/backend/optimizer/util/pathnode.c
M src/include/nodes/pathnodes.h
M src/include/nodes/plannodes.h
M src/include/optimizer/pathnode.h
Refactor logical worker synchronization code into a separate file.
commit : 41c674d2e31e8304a6edbcb5183d326798ba00f6
author : Amit Kapila <akapila@postgresql.org>
date : Thu, 16 Oct 2025 05:10:50 +0000
committer: Amit Kapila <akapila@postgresql.org>
date : Thu, 16 Oct 2025 05:10:50 +0000 To support the upcoming addition of a sequence synchronization worker,
this patch extracts common synchronization logic shared by table sync
workers and the new sequence sync worker into a dedicated file. This
modularization improves code reuse, maintainability, and clarity in the
logical workers framework.
Author: vignesh C <vignesh21@gmail.com>
Author: Hou Zhijie <houzj.fnst@fujitsu.com>
Reviewed-by: shveta malik <shveta.malik@gmail.com>
Reviewed-by: Dilip Kumar <dilipbalaut@gmail.com>
Reviewed-by: Peter Smith <smithpb2250@gmail.com>
Reviewed-by: Hayato Kuroda <kuroda.hayato@fujitsu.com>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>
Discussion: https://postgr.es/m/CAA4eK1LC+KJiAkSrpE_NwvNdidw9F2os7GERUeSxSKv71gXysQ@mail.gmail.com M src/backend/catalog/pg_subscription.c
M src/backend/replication/logical/Makefile
M src/backend/replication/logical/applyparallelworker.c
M src/backend/replication/logical/meson.build
A src/backend/replication/logical/syncutils.c
M src/backend/replication/logical/tablesync.c
M src/backend/replication/logical/worker.c
M src/bin/pg_dump/common.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dump.h
M src/include/catalog/pg_subscription_rel.h
M src/include/replication/worker_internal.h
M src/tools/pgindent/typedefs.list
Fix EPQ crash from missing partition directory in EState
commit : 905e932f0922a837bb3e4e482089c7c2e98bea67
author : Amit Langote <amitlan@postgresql.org>
date : Thu, 16 Oct 2025 14:01:44 +0900
committer: Amit Langote <amitlan@postgresql.org>
date : Thu, 16 Oct 2025 14:01:44 +0900 EvalPlanQualStart() failed to propagate es_partition_directory into
the child EState used for EPQ rechecks. When execution time partition
pruning ran during the EPQ scan, executor code dereferenced a NULL
partition directory and crashed.
Previously, propagating es_partition_directory into the EPQ EState was
unnecessary because CreatePartitionPruneState(), which sets it on
demand, also initialized the exec-pruning context. After commit
d47cbf474, CreatePartitionPruneState() now initializes only the init-
time pruning context, leaving exec-pruning context initialization to
ExecInitNode(). Since EvalPlanQualStart() runs only ExecInitNode() and
not CreatePartitionPruneState(), it can encounter a NULL
es_partition_directory. Other executor fields initialized during
CreatePartitionPruneState() are already copied into the child EState
thanks to commit 8741e48e5d, but es_partition_directory was missed.
Fix by borrowing the parent estate's es_partition_directory in
EvalPlanQualStart(), and by clearing that field in EvalPlanQualEnd()
so the parent remains responsible for freeing the directory.
Add an isolation test permutation that triggers EPQ with execution-
time partition pruning, the case that reproduces this crash.
Bug: #19078
Reported-by: Yuri Zamyatin <yuri@yrz.am>
Diagnosed-by: David Rowley <dgrowleyml@gmail.com>
Author: David Rowley <dgrowleyml@gmail.com>
Co-authored-by: Amit Langote <amitlangote09@gmail.com>
Discussion: https://postgr.es/m/19078-dfd62f840a2c0766@postgresql.org
Backpatch-through: 18 M src/backend/executor/execMain.c
M src/test/isolation/expected/eval-plan-qual.out
M src/test/isolation/specs/eval-plan-qual.spec
Override log_error_verbosity to "default" in test 009_log_temp_files
commit : 02c171f63fca870d55c4b184a4b7c0cebb06faa1
author : Michael Paquier <michael@paquier.xyz>
date : Thu, 16 Oct 2025 11:39:45 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Thu, 16 Oct 2025 11:39:45 +0900 Per report from buildfarm member prion. The CI does not use this
parameter, and this buildfarm member sets log_error_verbosity to
"verbose". This would generate extra LOCATION entries in the logs,
causing the regexps of the test to fail.
Trying to support log_error_verbosity=verbose in the test would mean to
tweak all the regexps used in the test to detect an optional set of
LOCATION lines, at least. This would not improve the coverage, and
forcing the GUC value is simpler.
Oversight in 76bba033128a.
Discussion: https://postgr.es/m/aPBaNNGiYT3xMBN1@paquier.xyz M src/test/modules/test_misc/t/009_log_temp_files.pl
Add tests for logging of temporary file removal and statement
commit : 76bba033128acd8bde70f532383f80b26cc9baae
author : Michael Paquier <michael@paquier.xyz>
date : Thu, 16 Oct 2025 09:02:51 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Thu, 16 Oct 2025 09:02:51 +0900 Temporary file usage is sometimes attributed to the wrong query in the logs
output. One identified reason is that unnamed portal cleanup (and
consequently temp file logging) happens during the next BIND message as
a, after debug_query_string has already been updated to the new query.
Dropping an unnamed portal in the next BIND message is a rather old
protocol behavior (fe19e56c572f, also mentioned in the docs).
log_temp_files is a bit newer than that, as of be8a4318815.
This commit adds tests to track which query is displayed next to the
temporary file(s) removed when a portal is dropped, and in some cases if
a query is displayed or not. We have not concluded how to improve the
situation yet; these tests will at least help in checking what changes
in the logs depending on the proposal discussed and how it affects the
scenarios tracked by this new test.
Author: Sami Imseih <samimseih@gmail.com>
Author: Frédéric Yhuel <frederic.yhuel@dalibo.com>
Reviewed-by: Mircea Cadariu <cadariu.mircea@gmail.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://postgr.es/m/3d07ee43-8855-42db-97e0-bad5db82d972@dalibo.com M src/test/modules/test_misc/meson.build
A src/test/modules/test_misc/t/009_log_temp_files.pl
Fix lookup code for REINDEX INDEX.
commit : 079480dc20223dfe03d60fcabda9c0a65e30d0d5
author : Nathan Bossart <nathan@postgresql.org>
date : Wed, 15 Oct 2025 16:32:40 -0500
committer: Nathan Bossart <nathan@postgresql.org>
date : Wed, 15 Oct 2025 16:32:40 -0500 This commit adjusts RangeVarCallbackForReindexIndex() to handle an
extremely unlikely race condition involving concurrent OID reuse.
In short, if REINDEX INDEX is executed at the same time that the
index is re-created with the same name and OID but a different
parent table OID, we might lock the wrong parent table. To fix,
simply detect when this happens and emit an ERROR. Unfortunately,
we can't gracefully handle this situation because we will have
already locked the index, and we must lock the parent table before
the index to avoid deadlocks.
While at it, I've replaced all but one early return in this
callback function with ERRORs that should be unreachable. While I
haven't verified the presence of a live bug, the checks in question
appear to be unnecessary, and the early returns seem prone to
breaking the parent table locking code in subtle ways. If nothing
else, this simplifies the code a bit.
This is a bug fix and could be back-patched, but given the presumed
rarity of the race condition and the lack of reports, I'm not going
to bother.
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Jeff Davis <pgsql@j-davis.com>
Discussion: https://postgr.es/m/Z8zwVmGzXyDdkAXj%40nathan M src/backend/commands/indexcmds.c
Add pg_iswalpha() and related functions.
commit : af164f31b9f5f00561d5831a72ab91cfe091f92e
author : Jeff Davis <jdavis@postgresql.org>
date : Wed, 15 Oct 2025 12:54:01 -0700
committer: Jeff Davis <jdavis@postgresql.org>
date : Wed, 15 Oct 2025 12:54:01 -0700 Per-character pg_locale_t APIs. Useful for tsearch parsing and
potentially other places.
Significant overlap with the regc_wc_isalpha() and related functions
in regc_pg_locale.c, but this change leaves those intact for
now.
Discussion: https://postgr.es/m/0151ad01239e2cc7b3139644358cf8f7b9622ff7.camel@j-davis.com M src/backend/regex/regc_pg_locale.c
M src/backend/utils/adt/pg_locale.c
M src/include/utils/pg_locale.h
A src/include/utils/pg_locale_c.h
Fix lookups in pg_{clear,restore}_{attribute,relation}_stats().
commit : 688dc6299a5bda3221db99fdd957ac9edf11c8a6
author : Nathan Bossart <nathan@postgresql.org>
date : Wed, 15 Oct 2025 12:47:33 -0500
committer: Nathan Bossart <nathan@postgresql.org>
date : Wed, 15 Oct 2025 12:47:33 -0500 Presently, these functions look up the relation's OID, lock it, and
then check privileges. Not only does this approach provide no
guarantee that the locked relation matches the arguments of the
lookup, but it also allows users to briefly lock relations for
which they do not have privileges, which might enable
denial-of-service attacks. This commit adjusts these functions to
use RangeVarGetRelidExtended(), which is purpose-built to avoid
both of these issues. The new RangeVarGetRelidCallback function is
somewhat complicated because it must handle both tables and
indexes, and for indexes, we must check privileges on the parent
table and lock it first. Also, it needs to handle a couple of
extremely unlikely race conditions involving concurrent OID reuse.
A downside of this change is that the coding doesn't allow for
locking indexes in AccessShare mode anymore; everything is locked
in ShareUpdateExclusive mode. Per discussion, the original choice
of lock levels was intended for a now defunct implementation that
used in-place updates, so we believe this change is okay.
Reviewed-by: Jeff Davis <pgsql@j-davis.com>
Discussion: https://postgr.es/m/Z8zwVmGzXyDdkAXj%40nathan
Backpatch-through: 18 M src/backend/statistics/attribute_stats.c
M src/backend/statistics/relation_stats.c
M src/backend/statistics/stat_utils.c
M src/include/statistics/stat_utils.h
M src/test/regress/expected/stats_import.out
Change reset_extra into a config_generic common field
commit : 5f4c3b33a97688174dfff44bdbc9ac228095714a
author : Peter Eisentraut <peter@eisentraut.org>
date : Wed, 15 Oct 2025 15:20:28 +0200
committer: Peter Eisentraut <peter@eisentraut.org>
date : Wed, 15 Oct 2025 15:20:28 +0200 This is not specific to the GUC parameter type, so it can be part of
the generic struct rather than the type-specific struct (like the
related "extra" field). This allows for some code simplifications.
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/8fdfb91e-60fb-44fa-8df6-f5dea47353c9@eisentraut.org M src/backend/utils/misc/guc.c
M src/include/utils/guc_tables.h
Add log_autoanalyze_min_duration
commit : dd3ae378301f7e84c18f7a90f183c3cd4165c0da
author : Peter Eisentraut <peter@eisentraut.org>
date : Wed, 15 Oct 2025 14:31:12 +0200
committer: Peter Eisentraut <peter@eisentraut.org>
date : Wed, 15 Oct 2025 14:31:12 +0200 The log output functionality of log_autovacuum_min_duration applies to
both VACUUM and ANALYZE, so it is not possible to separate the VACUUM
and ANALYZE log output thresholds. Logs are likely to be output only for
VACUUM and not for ANALYZE.
Therefore, we decided to separate the threshold for log output of VACUUM
by autovacuum (log_autovacuum_min_duration) and the threshold for log
output of ANALYZE by autovacuum (log_autoanalyze_min_duration).
Author: Shinya Kato <shinya11.kato@gmail.com>
Reviewed-by: Kasahara Tatsuhito <kasaharatt@oss.nttdata.com>
Discussion: https://www.postgresql.org/message-id/flat/CAOzEurQtfV4MxJiWT-XDnimEeZAY+rgzVSLe8YsyEKhZcajzSA@mail.gmail.com M doc/src/sgml/config.sgml
M doc/src/sgml/maintenance.sgml
M doc/src/sgml/ref/create_table.sgml
M src/backend/access/common/reloptions.c
M src/backend/access/heap/vacuumlazy.c
M src/backend/commands/analyze.c
M src/backend/commands/vacuum.c
M src/backend/postmaster/autovacuum.c
M src/backend/utils/misc/guc_parameters.dat
M src/backend/utils/misc/postgresql.conf.sample
M src/bin/psql/tab-complete.in.c
M src/include/commands/vacuum.h
M src/include/postmaster/autovacuum.h
M src/include/utils/rel.h
M src/test/regress/pg_regress.c
M src/tools/ci/pg_ci_base.conf
Fix EvalPlanQual handling of foreign/custom joins in ExecScanFetch.
commit : 12609fbacb007698ec91101b6464436506518346
author : Etsuro Fujita <efujita@postgresql.org>
date : Wed, 15 Oct 2025 17:15:00 +0900
committer: Etsuro Fujita <efujita@postgresql.org>
date : Wed, 15 Oct 2025 17:15:00 +0900 If inside an EPQ recheck, ExecScanFetch would run the recheck method
function for foreign/custom joins even if they aren't descendant nodes
in the EPQ recheck plan tree, which is problematic at least in the
foreign-join case, because such a foreign join isn't guaranteed to have
an alternative local-join plan required for running the recheck method
function; in the postgres_fdw case this could lead to a segmentation
fault or an assert failure in an assert-enabled build when running the
recheck method function.
Even if inside an EPQ recheck, any scan nodes that aren't descendant
ones in the EPQ recheck plan tree should be normally processed by using
the access method function; fix by modifying ExecScanFetch so that if
inside an EPQ recheck, it runs the recheck method function for
foreign/custom joins that are descendant nodes in the EPQ recheck plan
tree as before and runs the access method function for foreign/custom
joins that aren't.
This fix also adds to postgres_fdw an isolation test for an EPQ recheck
that caused issues stated above.
Oversight in commit 385f337c9.
Reported-by: Kristian Lejao <kristianlejao@gmail.com>
Author: Masahiko Sawada <sawada.mshk@gmail.com>
Co-authored-by: Etsuro Fujita <etsuro.fujita@gmail.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Reviewed-by: Etsuro Fujita <etsuro.fujita@gmail.com>
Discussion: https://postgr.es/m/CAD21AoBpo6Gx55FBOW+9s5X=nUw3Xpq64v35fpDEKsTERnc4TQ@mail.gmail.com
Backpatch-through: 13 M contrib/postgres_fdw/.gitignore
M contrib/postgres_fdw/Makefile
A contrib/postgres_fdw/expected/eval_plan_qual.out
M contrib/postgres_fdw/meson.build
A contrib/postgres_fdw/specs/eval_plan_qual.spec
M src/include/executor/execScan.h
Add some const qualifiers
commit : 29dc7a668753acee03a3140f541ae6de974244bc
author : Peter Eisentraut <peter@eisentraut.org>
date : Fri, 3 Oct 2025 08:27:18 +0200
committer: Peter Eisentraut <peter@eisentraut.org>
date : Fri, 3 Oct 2025 08:27:18 +0200 in guc-related source files, in anticipation of some further
restructuring.
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/8fdfb91e-60fb-44fa-8df6-f5dea47353c9@eisentraut.org M src/backend/utils/misc/guc.c
M src/backend/utils/misc/guc_funcs.c
M src/include/utils/guc_tables.h
Modernize some for loops
commit : 1a795188889cc630f4f9ce617bfc28fb2aa1432f
author : Peter Eisentraut <peter@eisentraut.org>
date : Fri, 3 Oct 2025 08:27:18 +0200
committer: Peter Eisentraut <peter@eisentraut.org>
date : Fri, 3 Oct 2025 08:27:18 +0200 in guc-related source files, in anticipation of some further
restructuring.
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/8fdfb91e-60fb-44fa-8df6-f5dea47353c9@eisentraut.org M src/backend/utils/misc/guc.c
M src/backend/utils/misc/guc_funcs.c
M src/backend/utils/misc/help_config.c
plpython: Remove support for major version conflict detection
commit : 594ba21bce05e8682eaf024f705fea8aeaba5ef3
author : Peter Eisentraut <peter@eisentraut.org>
date : Wed, 15 Oct 2025 08:13:07 +0200
committer: Peter Eisentraut <peter@eisentraut.org>
date : Wed, 15 Oct 2025 08:13:07 +0200 This essentially reverts commit 866566a690b, which installed
safeguards against loading plpython2 and plpython3 into the same
process. We don't support plpython2 anymore, so this is obsolete.
The Python and PL/Python initialization now happens again in
_PG_init() rather than the first time a PL/Python call handler is
invoked. (Often, these will be very close together.)
I kept the separate PLy_initialize() function introduced by
866566a690b to keep _PG_init() a bit modular.
Reviewed-by: Mario González Troncoso <gonzalemario@gmail.com>
Reviewed-by: Nathan Bossart <nathandbossart@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/9eb9feb6-1df3-4f0c-a0dc-9bcf35273111%40eisentraut.org M src/pl/plpython/plpy_main.c
Standardize use of REFRESH PUBLICATION in code and messages.
commit : 2436b8c047fff793c9d115dd0acb48c0b6e114d9
author : Amit Kapila <akapila@postgresql.org>
date : Wed, 15 Oct 2025 03:42:27 +0000
committer: Amit Kapila <akapila@postgresql.org>
date : Wed, 15 Oct 2025 03:42:27 +0000 This patch replaces ALTER SUBSCRIPTION REFRESH with
ALTER SUBSCRIPTION REFRESH PUBLICATION in comments and error messages to
improve clarity and support future extensibility. The change aligns with
upcoming addition REFRESH SEQUENCES for sequence synchronization.
Author: vignesh C <vignesh21@gmail.com>
Author: Hou Zhijie <houzj.fnst@fujitsu.com>
Reviewed-by: shveta malik <shveta.malik@gmail.com>
Reviewed-by: Dilip Kumar <dilipbalaut@gmail.com>
Reviewed-by: Peter Smith <smithpb2250@gmail.com>
Reviewed-by: Hayato Kuroda <kuroda.hayato@fujitsu.com>
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>
Discussion: https://postgr.es/m/CAA4eK1LC+KJiAkSrpE_NwvNdidw9F2os7GERUeSxSKv71gXysQ@mail.gmail.com M src/backend/commands/subscriptioncmds.c
M src/backend/parser/gram.y
M src/include/nodes/parsenodes.h
M src/test/regress/expected/object_address.out
M src/test/regress/expected/subscription.out
pg_createsubscriber: Use new routine to retrieve data of PG_VERSION
commit : fa55be2a506a77772cab1d62430cc2217413f9ec
author : Michael Paquier <michael@paquier.xyz>
date : Wed, 15 Oct 2025 11:11:30 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Wed, 15 Oct 2025 11:11:30 +0900 pg_createsubscriber is documented as requiring the same major version as
the target clusters. Attempting to use this tool on a cluster where the
control file version read does not match with the version compiled with
would lead to the following error message:
pg_createsubscriber: error: control file appears to be corrupt
This is confusing as the control file is correct: only the version
expected does not match. This commit integrates pg_createsubscriber
with the facility added by cd0be131ba6f, where the contents of
PG_VERSION are read and compared with the value of PG_MAJORVERSION_NUM
expected by the tool. This puts pg_createsubscriber in line with the
documentation, with a better error message when the version does not
match.
Author: Michael Paquier <michael@paquier.xyz>
Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com>
Discussion: https://postgr.es/m/aONDWig0bIGilixs@paquier.xyz M src/bin/pg_basebackup/pg_createsubscriber.c
pg_resetwal: Use new routine to retrieve data of PG_VERSION
commit : c6a6cd53d3ababa667aa224229550b96fb13cf26
author : Michael Paquier <michael@paquier.xyz>
date : Wed, 15 Oct 2025 10:09:48 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Wed, 15 Oct 2025 10:09:48 +0900 pg_resetwal's custom logic to retrieve the version number of a data
folder's PG_VERSION can be replaced by the facility introduced in
cd0be131ba6f. This removes some code.
One thing specific to pg_resetwal is that the first line of PG_VERSION
is read and reported in the error report generated when the major
version read does not match with the version pg_resetwal has been
compiled with. The new logic preserves this property, without changes
to neither the error message nor the data used in the error report.
Note that as a chdir() is done within the data folder before checking the
data of PG_VERSION, get_pg_version() needs to be tweaked to look for
PG_VERSION in the current folder.
Author: Michael Paquier <michael@paquier.xyz>
Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com>
Discussion: https://postgr.es/m/aOiirvWJzwdVCXph@paquier.xyz M src/bin/pg_resetwal/pg_resetwal.c
pg_combinebackup: Use new routine to retrieve data of PG_VERSION
commit : e4775e42cadeaa918bf5e10bf17056c51d5e16e2
author : Michael Paquier <michael@paquier.xyz>
date : Wed, 15 Oct 2025 09:54:56 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Wed, 15 Oct 2025 09:54:56 +0900 pg_combinebackup's custom logic to retrieve the version number of a data
folder's PG_VERSION can be replaced by the facility introduced in
cd0be131ba6f. This removes some code.
One thing specific to this tool is that backend versions older than v10
are not supported. The new code does the same checks as the previous
code.
Author: Michael Paquier <michael@paquier.xyz>
Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com>
Discussion: https://postgr.es/m/aOiirvWJzwdVCXph@paquier.xyz M src/bin/pg_combinebackup/pg_combinebackup.c
Revert "pg_createsubscriber: Add log message when no publications exist to drop."
commit : 45a7faf130176ae7c152413967c7c90068476a94
author : Masahiko Sawada <msawada@postgresql.org>
date : Tue, 14 Oct 2025 17:36:11 -0700
committer: Masahiko Sawada <msawada@postgresql.org>
date : Tue, 14 Oct 2025 17:36:11 -0700 This reverts commit 74ac377d75135e02064fc4427bec401277b4f60c.
The previous change contained a misconception about how publications
are cleaned up on the subscriber. The newly added log message could
confuse users, particularly when running pg_createsubscriber with
--dry-run - users would see a "dropping publication" message
immediately followed by a "no publications found" message.
Discussion: https://postgr.es/m/CAHut+Pu7xz1LqNvyQyvSHrV0Sw6D=e6T-Jm=gh1MRJrkuWGyBQ@mail.gmail.com M src/bin/pg_basebackup/pg_createsubscriber.c
Make heap_page_is_all_visible independent of LVRelState
commit : 3e4705484e0c64c7e90d5cc697a9aaf474287d0d
author : Melanie Plageman <melanieplageman@gmail.com>
date : Tue, 14 Oct 2025 17:43:41 -0400
committer: Melanie Plageman <melanieplageman@gmail.com>
date : Tue, 14 Oct 2025 17:43:41 -0400 This function only requires a few fields from LVRelState, so pass them
in individually.
This change allows calling heap_page_is_all_visible() from code such as
pruneheap.c, which does not have access to an LVRelState.
Author: Melanie Plageman <melanieplageman@gmail.com>
Reviewed-by: Kirill Reshke <reshkekirill@gmail.com>
Reviewed-by: Robert Haas <robertmhaas@gmail.com>
Reviewed-by: Andres Freund <andres@anarazel.de>
Discussion: https://postgr.es/m/2wk7jo4m4qwh5sn33pfgerdjfujebbccsmmlownybddbh6nawl%40mdyyqpqzxjek M src/backend/access/heap/vacuumlazy.c
Inline TransactionIdFollows/Precedes[OrEquals]()
commit : 43b05b38ea4d03a0ee9a09f08a9559bc0ca6d7ad
author : Melanie Plageman <melanieplageman@gmail.com>
date : Tue, 14 Oct 2025 17:03:48 -0400
committer: Melanie Plageman <melanieplageman@gmail.com>
date : Tue, 14 Oct 2025 17:03:48 -0400 These functions appeared prominently in a profile of a patch that sets
the visibility map on-access. Inline them to remove call overhead and
make them cheaper to use in hot paths.
Author: Melanie Plageman <melanieplageman@gmail.com>
Reviewed-by: Kirill Reshke <reshkekirill@gmail.com>
Reviewed-by: Andres Freund <andres@anarazel.de>
Discussion: https://postgr.es/m/2wk7jo4m4qwh5sn33pfgerdjfujebbccsmmlownybddbh6nawl%40mdyyqpqzxjek M src/backend/access/transam/transam.c
M src/include/access/transam.h
Add helper for freeze determination to heap_page_prune_and_freeze
commit : c8dd6542bae42744c676234dca45972e2cc3dfb2
author : Melanie Plageman <melanieplageman@gmail.com>
date : Tue, 14 Oct 2025 15:07:40 -0400
committer: Melanie Plageman <melanieplageman@gmail.com>
date : Tue, 14 Oct 2025 15:07:40 -0400 After scanning the line pointers on a heap page during the first phase
of vacuum, we use the information collected to decide whether to use
the assembled freeze plans.
Move this decision logic into a helper function to improve readability.
While here, rename a PruneState member and disambiguate some local
variables in heap_page_prune_and_freeze().
Author: Melanie Plageman <melanieplageman@gmail.com>
Reviewed-by: Andres Freund <andres@anarazel.de>
Discussion: https://postgr.es/m/2wk7jo4m4qwh5sn33pfgerdjfujebbccsmmlownybddbh6nawl%40mdyyqpqzxjek M src/backend/access/heap/pruneheap.c
pg_createsubscriber: Add log message when no publications exist to drop.
commit : 74ac377d75135e02064fc4427bec401277b4f60c
author : Masahiko Sawada <msawada@postgresql.org>
date : Tue, 14 Oct 2025 11:45:29 -0700
committer: Masahiko Sawada <msawada@postgresql.org>
date : Tue, 14 Oct 2025 11:45:29 -0700 When specifying --clean=publication to pg_createsubscriber, it drops
all existing publications with a log message "dropping all existing
publications in database "testdb"". Add a new log message "no
publications found" when there are no publications to drop, making the
progress more transparent to users.
Author: Peter Smith <smithpb2250@gmail.com>
Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com>
Discussion: https://postgr.es/m/CAHut+Ptm+WJwbbYXhC0s6FP_98KzZCR=5CPu8F8N5uV8P7BpqA@mail.gmail.com M src/bin/pg_basebackup/pg_createsubscriber.c
pg_regc_locale.c: rename some static functions.
commit : 8efe982fe2c5b900554d489c0409618638193aef
author : Jeff Davis <jdavis@postgresql.org>
date : Tue, 14 Oct 2025 11:04:04 -0700
committer: Jeff Davis <jdavis@postgresql.org>
date : Tue, 14 Oct 2025 11:04:04 -0700 Use the more specific prefix "regc_" rather than the generic prefix
"pg_".
A subsequent commit will create generic versions of some of these
functions that can be called from other modules.
Discussion: https://postgr.es/m/0151ad01239e2cc7b3139644358cf8f7b9622ff7.camel@j-davis.com M src/backend/regex/regc_locale.c
M src/backend/regex/regc_pg_locale.c
M src/backend/regex/regcomp.c
M src/include/regex/regcustom.h
dblink: Avoid locking relation before privilege check.
commit : c9b299f6df983ff3b196677a625393c31598d86f
author : Nathan Bossart <nathan@postgresql.org>
date : Tue, 14 Oct 2025 12:20:48 -0500
committer: Nathan Bossart <nathan@postgresql.org>
date : Tue, 14 Oct 2025 12:20:48 -0500 The present coding of dblink's get_rel_from_relname() predates the
introduction of RangeVarGetRelidExtended(), which provides a way to
check permissions before locking the relation. This commit adjusts
get_rel_from_relname() to use that function.
Reviewed-by: Jeff Davis <pgsql@j-davis.com>
Discussion: https://postgr.es/m/aOgmi6avE6qMw_6t%40nathan M contrib/dblink/dblink.c
Bump XLOG_PAGE_MAGIC after xl_heap_prune change
commit : 4a8fb58671d36b8f6cb4f5c582b8dc5fa4d26702
author : Melanie Plageman <melanieplageman@gmail.com>
date : Tue, 14 Oct 2025 10:13:10 -0400
committer: Melanie Plageman <melanieplageman@gmail.com>
date : Tue, 14 Oct 2025 10:13:10 -0400 add323da40a6 altered xl_heap_prune, changing the WAL format, but
neglected to bump XLOG_PAGE_MAGIC. Do so now.
Author: Melanie Plageman <melanieplageman@gmail.com>
Reported-by: Kirill Reshke <reshkekirill@gmail.com>
Reported-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://postgr.es/m/aO3Gw6hCAZFUd5ab%40paquier.xyz M src/include/access/xlog_internal.h
Use ereport rather than elog in WinCheckAndInitializeNullTreatment.
commit : 5f3808646f67260d5dc0d95f2602886da5cf5c52
author : Tatsuo Ishii <ishii@postgresql.org>
date : Tue, 14 Oct 2025 19:15:24 +0900
committer: Tatsuo Ishii <ishii@postgresql.org>
date : Tue, 14 Oct 2025 19:15:24 +0900 Previously WinCheckAndInitializeNullTreatment() used elog() to emit an
error message. ereport() should be used instead because it's a
user-facing error. Also use existing get_func_name() to get a
function's name, rather than own implementation.
Moreover add an assertion to validate winobj parameter, just like
other window function API.
Reported-by: Tom Lane <tgl@sss.pgh.pa.us>
Author: Tatsuo Ishii <ishii@postgresql.org>
Reviewed-by: Chao Li <lic@highgo.com>
Discussion: https://postgr.es/m/2952409.1760023154%40sss.pgh.pa.us M src/backend/executor/nodeWindowAgg.c
Rename apply_at to apply_agg_at for clarity
commit : 1206df04c2001868204f3f79c48173065f3b8231
author : Richard Guo <rguo@postgresql.org>
date : Tue, 14 Oct 2025 16:35:22 +0900
committer: Richard Guo <rguo@postgresql.org>
date : Tue, 14 Oct 2025 16:35:22 +0900 The field name "apply_at" in RelAggInfo was a bit ambiguous. Rename
it to "apply_agg_at" to improve clarity and make its purpose clearer.
Per complaint from David Rowley, Robert Haas.
Suggested-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/CA+TgmoZ0KR2_XCWHy17=HHcQ3p2Mamc9c6Dnnhf1J6wPYFD9ng@mail.gmail.com M src/backend/optimizer/path/allpaths.c
M src/backend/optimizer/path/joinrels.c
M src/backend/optimizer/util/relnode.c
M src/include/nodes/pathnodes.h
pg_upgrade: Use new routine to retrieve data of PG_VERSION
commit : a7d8052910d6254688ef66840554f1bba80a2238
author : Michael Paquier <michael@paquier.xyz>
date : Tue, 14 Oct 2025 16:27:13 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Tue, 14 Oct 2025 16:27:13 +0900 Unsurprisingly, this shaves code. get_major_server_version() can be
replaced by the new routine added by cd0be131ba6f, with the contents of
PG_VERSION stored in an allocated buffer instead of a fixed-sized one.
Author: Michael Paquier <michael@paquier.xyz>
Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com>
Discussion: https://postgr.es/m/aOiirvWJzwdVCXph@paquier.xyz M src/bin/pg_upgrade/exec.c
M src/bin/pg_upgrade/pg_upgrade.h
M src/bin/pg_upgrade/server.c
Introduce frontend API able to retrieve the contents of PG_VERSION
commit : cd0be131ba6f7e8b1323d188db20d15c2504b021
author : Michael Paquier <michael@paquier.xyz>
date : Tue, 14 Oct 2025 16:20:42 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Tue, 14 Oct 2025 16:20:42 +0900 get_pg_version() is able to return a version number, that can be used
for comparisons based on PG_VERSION_NUM. A macro is added to convert
the result to a major version number, to work with PG_MAJORVERSION_NUM.
It is possible to pass to the routine an optional argument, where the
contents retrieved from PG_VERSION are saved. This requirement matters
for some of the frontend code (one example: pg_upgrade wants that for
tablespace paths with a version number strictly older than v10).
This will be used by a set of follow-up patches, to be consumed in
various frontend tools that duplicate a logic similar to do what this
new routine does, like:
- pg_resetwal
- pg_combinebackup
- pg_createsubscriber
- pg_upgrade
This routine supports both the post-v10 version number and the older
flavor (aka 9.6), as required at least by pg_upgrade.
Author: Michael Paquier <michael@paquier.xyz>
Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com>
Discussion: https://postgr.es/m/aOiirvWJzwdVCXph@paquier.xyz M src/fe_utils/Makefile
M src/fe_utils/meson.build
A src/fe_utils/version.c
A src/include/fe_utils/version.h
Fix version number calculation for data folder flush in pg_combinebackup
commit : 1c05fe11abb6a1588b158e3f39b668053e24cdae
author : Michael Paquier <michael@paquier.xyz>
date : Tue, 14 Oct 2025 08:30:54 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Tue, 14 Oct 2025 08:30:54 +0900 The version number calculated by read_pg_version_file() is multiplied
once by 10000, to be able to do comparisons based on PG_VERSION_NUM or
equivalents with a minor version included. However, the version number
given sync_pgdata() was multiplied by 10000 a second time, leading to an
overestimated number.
This issue was harmless (still incorrect) as pg_combinebackup does not
support versions of Postgres older than v10, and sync_pgdata() only
includes a version check due to the rename of pg_xlog/ to pg_wal/. This
folder rename happened in the development cycle of v10. This would
become a problem if in the future sync_pgdata() is changed to have more
version-specific checks.
Oversight in dc212340058b, so backpatch down to v17.
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://postgr.es/m/aOil5d0y87ZM_wsZ@paquier.xyz
Backpatch-through: 17 M src/bin/pg_combinebackup/pg_combinebackup.c
Eliminate XLOG_HEAP2_VISIBLE from vacuum phase III
commit : add323da40a6bf9e01cdda510e32ea924c89cd1a
author : Melanie Plageman <melanieplageman@gmail.com>
date : Mon, 13 Oct 2025 18:01:06 -0400
committer: Melanie Plageman <melanieplageman@gmail.com>
date : Mon, 13 Oct 2025 18:01:06 -0400 Instead of emitting a separate XLOG_HEAP2_VISIBLE WAL record for each
page that becomes all-visible in vacuum's third phase, specify the VM
changes in the already emitted XLOG_HEAP2_PRUNE_VACUUM_CLEANUP record.
Visibility checks are now performed before marking dead items unused.
This is safe because the heap page is held under exclusive lock for the
entire operation.
This reduces the number of WAL records generated by VACUUM phase III by
up to 50%.
Author: Melanie Plageman <melanieplageman@gmail.com>
Reviewed-by: Andres Freund <andres@anarazel.de>
Reviewed-by: Robert Haas <robertmhaas@gmail.com>
Reviewed-by: Kirill Reshke <reshkekirill@gmail.com>
Discussion: https://postgr.es/m/flat/CAAKRu_ZMw6Npd_qm2KM%2BFwQ3cMOMx1Dh3VMhp8-V7SOLxdK9-g%40mail.gmail.com M src/backend/access/heap/heapam_xlog.c
M src/backend/access/heap/pruneheap.c
M src/backend/access/heap/vacuumlazy.c
M src/backend/access/rmgrdesc/heapdesc.c
M src/include/access/heapam.h
M src/include/access/heapam_xlog.h
Fix incorrect message-printing in win32security.c.
commit : 03bf7a12c5a44ced377352c8f9bf6e9f4b863885
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Mon, 13 Oct 2025 17:56:45 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Mon, 13 Oct 2025 17:56:45 -0400 log_error() would probably fail completely if used, and would
certainly print garbage for anything that needed to be interpolated
into the message, because it was failing to use the correct printing
subroutine for a va_list argument.
This bug likely went undetected because the error cases this code
is used for are rarely exercised - they only occur when Windows
security API calls fail catastrophically (out of memory, security
subsystem corruption, etc).
The FRONTEND variant can be fixed just by calling vfprintf()
instead of fprintf(). However, there was no va_list variant
of write_stderr(), so create one by refactoring that function.
Following the usual naming convention for such things, call
it vwrite_stderr().
Author: Bryan Green <dbryan.green@gmail.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/CAF+pBj8goe4fRmZ0V3Cs6eyWzYLvK+HvFLYEYWG=TzaM+tWPnw@mail.gmail.com
Backpatch-through: 13 M src/backend/utils/error/elog.c
M src/include/utils/elog.h
M src/port/win32security.c
Doc: clarify n_distinct_inherited setting
commit : 615a0fc2f1fd30df863b0dde2c045eaab8018ec6
author : David Rowley <drowley@postgresql.org>
date : Tue, 14 Oct 2025 09:25:02 +1300
committer: David Rowley <drowley@postgresql.org>
date : Tue, 14 Oct 2025 09:25:02 +1300 There was some confusion around how to adjust the n_distinct estimates
for partitioned tables. Here we try and clarify that
n_distinct_inherited needs to be adjusted rather than n_distinct.
Also fix some slightly misleading text which was talking about table
size rather than table rows, fix a grammatical error, and adjust some
text which indicated that ANALYZE was performing calculations based on
the n_distinct settings. Really it's the query planner that does this
and ANALYZE only stores the overridden n_distinct estimate value in
pg_statistic.
Author: David Rowley <dgrowleyml@gmail.com>
Reviewed-by: David G. Johnston <david.g.johnston@gmail.com>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Backpatch-through: 13
Discussion: https://postgr.es/m/CAApHDvrL7a-ZytM1SP8Uk9nEw9bR2CPzVb+uP+bcNj=_q-ZmVw@mail.gmail.com M doc/src/sgml/ref/alter_table.sgml
Fix serious performance problems in LZ4Stream_read_internal.
commit : 1f8062dd9668572d66549fc798a7d2057aa34ee1
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Mon, 13 Oct 2025 13:17:45 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Mon, 13 Oct 2025 13:17:45 -0400 I was distressed to find that reading an LZ4-compressed toc.dat
file was hundreds of times slower than it ought to be. On
investigation, the blame mostly affixes to LZ4Stream_read_overflow's
habit of memmove'ing all the remaining buffered data after each read
operation. Since reading a TOC file tends to involve a lot of small
(even one-byte) decompression calls, that amounts to an O(N^2) cost.
This could have been fixed with a minimal patch, but to my
eyes LZ4Stream_read_internal and LZ4Stream_read_overflow are
badly-written spaghetti code; in particular the eol_flag logic
is inefficient and duplicative. I chose to throw the code
away and rewrite from scratch. This version is about sixty
lines shorter as well as not having the performance issue.
Fortunately, AFAICT the only way to get to this problem is to
manually LZ4-compress the toc.dat and/or blobs.toc files within a
directory-style archive; in the main data files, we read blocks
that are large enough that the O(N^2) behavior doesn't manifest.
Few people do that, which likely explains the lack of field
complaints. Otherwise this performance bug might be considered
bad enough to warrant back-patching.
Author: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://postgr.es/m/3515357.1760128017@sss.pgh.pa.us M src/bin/pg_dump/compress_lz4.c
Fix poor buffering logic in pg_dump's lz4 and zstd compression code.
commit : fe8192a95e6c7159d639e341740e32966c9cf385
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Mon, 13 Oct 2025 13:01:45 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Mon, 13 Oct 2025 13:01:45 -0400 Both of these modules dumped each bit of output that they got from
the underlying compression library as a separate "data block" in
the emitted archive file. In the case of zstd this'd frequently
result in block sizes well under 100 bytes; lz4 is a little better
but still produces blocks around 300 bytes, at least in the test
case I tried. This bloats the archive file a little bit compared
to larger block sizes, but the real problem is that when pg_restore
has to skip each data block rather than seeking directly to some
target data, tiny block sizes are enormously inefficient.
Fix both modules so that they fill their allocated buffer reasonably
well before dumping a data block. In the case of lz4, also delete
some redundant logic that caused the lz4 frame header to be emitted
as a separate data block. (That saves little, but I see no reason
to expend extra code to get worse results.)
I fixed the "stream API" code too. In those cases, feeding small
amounts of data to fwrite() probably doesn't have any meaningful
performance consequences. But it seems like a bad idea to leave
the two sets of code doing the same thing in two different ways.
In passing, remove unnecessary "extra paranoia" check in
_ZstdWriteCommon. _CustomWriteFunc (the only possible referent
of cs->writeF) already protects itself against zero-length writes,
and it's really a modularity violation for _ZstdWriteCommon to know
that the custom format disallows empty data blocks. Also, fix
Zstd_read_internal to do less work when passed size == 0.
Reported-by: Dimitrios Apostolou <jimis@gmx.net>
Author: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://postgr.es/m/3515357.1760128017@sss.pgh.pa.us M src/bin/pg_dump/compress_lz4.c
M src/bin/pg_dump/compress_zstd.c
Fix issue with reading zero bytes in Gzip_read.
commit : a239c4a0c22627a45c0a91d2f4d9755bbc5be7be
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Mon, 13 Oct 2025 12:44:20 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Mon, 13 Oct 2025 12:44:20 -0400 pg_dump expects a read request of zero bytes to be a no-op; see for
example ReadStr(). Gzip_read got this wrong and falsely supposed
that the resulting gzret == 0 indicated an error. We could complicate
that error-checking logic some more, but it seems best to just fall
out immediately when passed size == 0.
This bug breaks the nominally-supported case of manually gzip'ing
the toc.dat file within a directory-style dump, so back-patch to v16
where this code came in. (Prior branches already have a short-circuit
for size == 0 before their only gzread call.)
Author: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://postgr.es/m/3515357.1760128017@sss.pgh.pa.us
Backpatch-through: 16 M src/bin/pg_dump/compress_gzip.c
docs: Fix protocol version 3.2 message format of CancelRequest
commit : d3ba50db48e66be8804b9edf093b0f921d625425
author : Magnus Hagander <magnus@hagander.net>
date : Mon, 13 Oct 2025 15:31:25 +0200
committer: Magnus Hagander <magnus@hagander.net>
date : Mon, 13 Oct 2025 15:31:25 +0200 Since protocol version 3.2 the CancelRequest does not have a fixed size
length anymore. The protocol docs still listed the length field to be a
constant number though. This fixes that.
Author: Jelte Fennema-Nio <postgres@jeltef.nl>
Reported-by: Dmitry Igrishin <dmitigr@gmail.com>
Backpatch-through: 18 M doc/src/sgml/protocol.sgml
Remove extra semicolon in example
commit : e062af861b453769ccf3940fe7920a87d7d31fe6
author : Magnus Hagander <magnus@hagander.net>
date : Mon, 13 Oct 2025 15:26:37 +0200
committer: Magnus Hagander <magnus@hagander.net>
date : Mon, 13 Oct 2025 15:26:37 +0200 Reported-By: Pavel Luzanov <p.luzanov@postgrespro.ru>
Discussion: https://postgr.es/m/175976566145.768.4645962241073007347@wrigleys.postgresql.org
Backpatch-through: 18 M doc/src/sgml/func/func-json.sgml
Remove unused nbtree array advancement variable.
commit : 7a662a46ebf74e9fa15cb62b592b4bf00c96fc94
author : Peter Geoghegan <pg@bowt.ie>
date : Sun, 12 Oct 2025 14:04:08 -0400
committer: Peter Geoghegan <pg@bowt.ie>
date : Sun, 12 Oct 2025 14:04:08 -0400 Remove a variable that is no longer in use following commit 9a2e2a28.
It's not immediately clear why there were no compiler warnings about
this oversight.
Author: Peter Geoghegan <pg@bowt.ie>
Backpatch-through: 18 M src/backend/access/nbtree/nbtutils.c
Restore test coverage of LZ4Stream_gets().
commit : 26d1cd375f156f68e12d51ba50e39ea46ea729ff
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Sat, 11 Oct 2025 16:33:55 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Sat, 11 Oct 2025 16:33:55 -0400 In commit a45c78e32 I removed the only regression test case that
reaches this function, because it turns out that we only use it
if reading an LZ4-compressed blobs.toc file in a directory dump,
and that is a state that has to be created manually. That seems
like a bad thing to not test, not so much for LZ4Stream_gets()
itself as because it means the squirrely eol_flag logic in
LZ4Stream_read_internal() is not tested.
The reason for the change was that I thought the lz4 program did not
have any way to perform compression without explicit specification
of the output file name. However, it turns out that the syntax
synopsis in its man page is a lie, and if you read enough of the
man page you find out that with "-m" it will do what's needful.
So restore the manual compression step in that test case.
Noted while testing some proposed changes in pg_dump's compression
logic.
Author: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/3515357.1760128017@sss.pgh.pa.us
Backpatch-through: 17 M src/bin/pg_dump/t/002_pg_dump.pl
Stop creating constraints during DETACH CONCURRENTLY
commit : 3231fd0455220194d6f75323c83819a38fc0a382
author : Álvaro Herrera <alvherre@kurilemu.de>
date : Sat, 11 Oct 2025 20:30:12 +0200
committer: Álvaro Herrera <alvherre@kurilemu.de>
date : Sat, 11 Oct 2025 20:30:12 +0200 Commit 71f4c8c6f74b (which implemented DETACH CONCURRENTLY) added code
to create a separate table constraint when a table is detached
concurrently, identical to the partition constraint, on the theory that
such a constraint was needed in case the optimizer had constructed any
query plans that depended on the constraint being there. However, that
theory was apparently bogus because any such plans would be invalidated.
For hash partitioning, those constraints are problematic, because their
expressions reference the OID of the parent partitioned table, to which
the detached table is no longer related; this causes all sorts of
problems (such as inability of restoring a pg_dump of that table, and
the table no longer working properly if the partitioned table is later
dropped).
We'd like to get rid of all those constraints. In fact, for branch
master, do that -- no longer create any substitute constraints.
However, out of fear that some users might somehow depend on these
constraints for other partitioning strategies, for stable branches
(back to 14, which added DETACH CONCURRENTLY), only do it for hash
partitioning.
(If you repeatedly DETACH CONCURRENTLY and then ATTACH a partition, then
with this constraint addition you don't need to scan the table in the
ATTACH step, which presumably is good. But if users really valued this
feature, they would have requested that it worked for non-concurrent
DETACH also.)
Author: Haiyang Li <mohen.lhy@alibaba-inc.com>
Reported-by: Fei Changhong <feichanghong@qq.com>
Reported-by: Haiyang Li <mohen.lhy@alibaba-inc.com>
Backpatch-through: 14
Discussion: https://postgr.es/m/18371-7fef49f63de13f02@postgresql.org
Discussion: https://postgr.es/m/19070-781326347ade7c57@postgresql.org M src/backend/commands/tablecmds.c
M src/test/regress/expected/alter_table.out
M src/test/regress/sql/alter_table.sql
dbase_redo: Fix Valgrind-reported memory leak
commit : ff47f9c16c2f626d828a473d63c90d03f18a34a3
author : Álvaro Herrera <alvherre@kurilemu.de>
date : Sat, 11 Oct 2025 16:39:22 +0200
committer: Álvaro Herrera <alvherre@kurilemu.de>
date : Sat, 11 Oct 2025 16:39:22 +0200 Introduced by my (Álvaro's) commit 9e4f914b5eba, which was itself
backpatched to pg10, though only pg15 and up contain the problem
because of commit 9c08aea6a309.
This isn't a particularly significant leak, but given the fix is
trivial, we might as well backpatch to all branches where it applies, so
do that.
Author: Nathan Bossart <nathandbossart@gmail.com>
Reported-by: Andres Freund <andres@anarazel.de>
Discussion: https://postgr.es/m/x4odfdlrwvsjawscnqsqjpofvauxslw7b4oyvxgt5owoyf4ysn@heafjusodrz7 M src/backend/commands/dbcommands.c
Remove overzealous _bt_killitems assertion.
commit : 843e50208a31b9e17e9ab530c93a158425cfb8ba
author : Peter Geoghegan <pg@bowt.ie>
date : Fri, 10 Oct 2025 14:52:25 -0400
committer: Peter Geoghegan <pg@bowt.ie>
date : Fri, 10 Oct 2025 14:52:25 -0400 An assertion in _bt_killitems expected the scan's currPos state to
contain a valid LSN, saved from when currPos's page was initially read.
The assertion failed to account for the fact that even logged relations
can have leaf pages with an invalid LSN when built with wal_level set to
"minimal". Remove the faulty assertion.
Oversight in commit e6eed40e (though note that the assertion was
backpatched to stable branches before 18 by commit 7c319f54).
Author: Peter Geoghegan <pg@bowt.ie>
Reported-By: Matthijs van der Vleuten <postgresql@zr40.nl>
Bug: #19082
Discussion: https://postgr.es/m/19082-628e62160dbbc1c1@postgresql.org
Backpatch-through: 13 M src/backend/access/nbtree/nbtutils.c
Fix two typos in xlogstats.h and xlogstats.c
commit : 3a36543d7d08eef6496fe3511f4cf04cba14f572
author : Michael Paquier <michael@paquier.xyz>
date : Fri, 10 Oct 2025 11:51:45 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Fri, 10 Oct 2025 11:51:45 +0900 Issue found while browsing this area of the code, introduced and
copy-pasted around by 2258e76f90bf.
Backpatch-through: 15 M src/backend/access/transam/xlogstats.c
M src/include/access/xlogstats.h
Remove state.tmp when failing to save a replication slot
commit : 912af1c7e9c9cc5e2cff4a506e829d6ea006ba9a
author : Michael Paquier <michael@paquier.xyz>
date : Fri, 10 Oct 2025 09:23:59 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Fri, 10 Oct 2025 09:23:59 +0900 An error happening while a slot data is saved on disk in
SaveSlotToPath() could cause a state.tmp file (temporary file holding
the slot state data, renamed to its permanent name at the end of the
function) to remain around after it has been created. This temporary
file is created with O_EXCL, meaning that if an existing state.tmp is
found, its creation would fail. This would prevent the slot data to be
saved, requiring a manual intervention to remove state.tmp before being
able to save again a slot. Possible scenarios where this temporary file
could remain on disk is for example a ENOSPC case (no disk space) while
writing, syncing or renaming it. The bug reports point to a write
failure as the principal cause of the problems.
Using O_TRUNC has been argued back in 2019 as a potential solution to
discard any temporary file that could exist. This solution was rejected
as O_EXCL can also act as a safety measure when saving the slot state,
crash recovery offering cleanup guarantees post-crash. This commit uses
the alternative approach that has been suggested by Andres Freund back
in 2019. When the temporary state file cannot be written, synced,
closed or renamed (note: not when created!), an unlink() is used to
remove the temporary state file while holding the in-progress I/O
LWLock, so as any follow-up attempts to save a slot's data would not
choke on an existing file that remained around because of a previous
failure.
This problem has been reported a few times across the years, going back
to 2019, but for some reason I have never come back to do something
about it and it has been forgotten. A recent report has reminded me
that this was still a problem.
Reported-by: Kevin K Biju <kevinkbiju@gmail.com>
Reported-by: Sergei Kornilov <sk@zsrv.org>
Reported-by: Grigory Smolkin <g.smolkin@postgrespro.ru>
Discussion: https://postgr.es/m/CAM45KeHa32soKL_G8Vk38CWvTBeOOXcsxAPAs7Jt7yPRf2mbVA@mail.gmail.com
Discussion: https://postgr.es/m/3559061693910326@qy4q4a6esb2lebnz.sas.yp-c.yandex.net
Discussion: https://postgr.es/m/08bbfab1-a61d-3750-fc18-4ab2c1aa7f09@postgrespro.ru
Backpatch-through: 13 M src/backend/replication/slot.c
bufmgr: Fix valgrind checking for buffers pinned in StrategyGetBuffer()
commit : c819d1017ddb349d92ab323d2631bc1f10bb4e86
author : Andres Freund <andres@anarazel.de>
date : Thu, 9 Oct 2025 16:27:08 -0400
committer: Andres Freund <andres@anarazel.de>
date : Thu, 9 Oct 2025 16:27:08 -0400 In 5e899859287 I made StrategyGetBuffer() pin buffers with a single CAS,
instead of using PinBuffer_Locked(). Unfortunately I missed that
PinBuffer_Locked() marked the page as defined for valgrind.
Fix this oversight by centralizing the valgrind initialization into
TrackNewBufferPin(), which also allows us to reduce the number of places doing
VALGRIND_MAKE_MEM_DEFINED.
Per buildfarm animal skink and Amit Langote.
Discussion: https://postgr.es/m/fvfmkr5kk4nyex56ejgxj3uzi63isfxovp2biecb4bspbjrze7@az2pljabhnff
Discussion: https://postgr.es/m/CA+HiwqGKJ6nEXEPQW7EpykVsEtzxp5-up_xhtcUAkWFtATVQvQ@mail.gmail.com M src/backend/storage/buffer/bufmgr.c
test_bitmapset: Improve random function
commit : 9d46b86529e8337e34fb5a65b1a7dca9dc53938f
author : Michael Paquier <michael@paquier.xyz>
date : Fri, 10 Oct 2025 07:20:03 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Fri, 10 Oct 2025 07:20:03 +0900 test_random_operations() did not check the result returned by
bms_is_member() in its last phase, when checking that the contents of
the bitmap match with what is expected. This was impacting the
reliability of the function and the coverage it could provide.
This commit improves the whole function, adding more checks based on
bms_is_member(), using a bitmap and a secondary array that tracks the
members added by random additions and deletions.
While on it, more comments are added to document the internals of the
function.
Reported-by: Ranier Vilela <ranier.vf@gmail.com>
Author: Greg Burd <greg@burd.me>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Reviewed-by: David Rowley <dgrowleyml@gmail.com>
Discussion: https://postgr.es/m/CAEudQAq_zOSA2NUQSWePTGV_=90Uw0WcXxGOWnN-vwF046OOqA@mail.gmail.com M src/test/modules/test_bitmapset/test_bitmapset.c
Eliminate COPY FREEZE use of XLOG_HEAP2_VISIBLE
commit : d96f87332b3786abd23cba47459546799c562b8c
author : Melanie Plageman <melanieplageman@gmail.com>
date : Thu, 9 Oct 2025 16:25:50 -0400
committer: Melanie Plageman <melanieplageman@gmail.com>
date : Thu, 9 Oct 2025 16:25:50 -0400 Instead of emitting a separate WAL XLOG_HEAP2_VISIBLE record for setting
bits in the VM, specify the VM block changes in the
XLOG_HEAP2_MULTI_INSERT record.
This halves the number of WAL records emitted by COPY FREEZE.
Author: Melanie Plageman <melanieplageman@gmail.com>
Reviewed-by: Andres Freund <andres@anarazel.de>
Reviewed-by: Robert Haas <robertmhaas@gmail.com>
Reviewed-by: Kirill Reshke <reshkekirill@gmail.com>
Discussion: https://postgr.es/m/flat/CAAKRu_ZMw6Npd_qm2KM%2BFwQ3cMOMx1Dh3VMhp8-V7SOLxdK9-g%40mail.gmail.com M src/backend/access/heap/heapam.c
M src/backend/access/heap/heapam_xlog.c
M src/backend/access/heap/visibilitymap.c
M src/backend/access/rmgrdesc/heapdesc.c
M src/include/access/visibilitymap.h
Cleanup VACUUM option processing error messages
commit : 1b073cba4993b31fbf820504f297efce5d951c00
author : David Rowley <drowley@postgresql.org>
date : Fri, 10 Oct 2025 09:25:23 +1300
committer: David Rowley <drowley@postgresql.org>
date : Fri, 10 Oct 2025 09:25:23 +1300 The processing of the PARALLEL option for VACUUM was not quite
following what the DefElem code had intended. defGetInt32() already has
code to handle missing parameters and returns a perfectly good error
message for when that happens.
Here we get rid of the ExecVacuum() error:
ERROR: parallel option requires a value between 0 and N
and leave defGetInt32() handle it, which will give:
ERROR: parallel requires an integer value
defGetInt32() was already handling the non-integer parameter case, so it
may as well handle the missing parameter case too.
Additionally, parameterize the option name to make translator work easier,
and also use errhint_internal() rather than errhint() for the
BUFFER_USAGE_LIMIT option since there isn't any work for a translator to
do for "%s".
Author: David Rowley <dgrowleyml@gmail.com>
Reviewed-by: Álvaro Herrera <alvherre@kurilemu.de>
Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com>
Discussion: https://postgr.es/m/CAApHDvovH14tNWB+WvP6TSbfi7-=TysQ9h5tQ5AgavwyWRWKHA@mail.gmail.com M src/backend/commands/vacuum.c
M src/test/regress/expected/vacuum.out
Clean up memory leakage that occurs in context callback functions.
commit : 89d57c1fb35522590ec1f70b123c853cf5a9acb2
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Thu, 9 Oct 2025 15:37:42 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Thu, 9 Oct 2025 15:37:42 -0400 An error context callback function might leak some memory into
ErrorContext, since those functions are run with ErrorContext as
current context. In the case where the elevel is ERROR, this is
no problem since the code level that catches the error should do
FlushErrorState to clean up, and that will reset ErrorContext.
However, if the elevel is less than ERROR then no such cleanup occurs.
In principle, repeated leaks while emitting log messages or client
notices could accumulate arbitrarily much leaked data, if no ERROR
occurs in the session.
To fix, let errfinish() perform an ErrorContext reset if it is
at the outermost error nesting level. (If it isn't, we'll delay
cleanup until the outermost nesting level is exited.)
The only actual leakage of this sort that I've been able to observe
within our regression tests was recently introduced by commit
f727b63e8. While it seems plausible that there are other such
leaks not reached in the regression tests, the lack of field
reports suggests that they're not a big problem. Accordingly,
I won't take the risk of back-patching this now. We can always
back-patch later if we get field reports of leaks.
Reported-by: Andres Freund <andres@anarazel.de>
Author: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/jngsjonyfscoont4tnwi2qoikatpd5hifsg373vmmjvugwiu6g@m6opxh7uisgd M src/backend/utils/error/elog.c
M src/backend/utils/misc/guc.c
Fix access-to-already-freed-memory issue in pgoutput.
commit : b46efe90482bc1105a17955fce02cb3708230f0e
author : Masahiko Sawada <msawada@postgresql.org>
date : Thu, 9 Oct 2025 10:59:27 -0700
committer: Masahiko Sawada <msawada@postgresql.org>
date : Thu, 9 Oct 2025 10:59:27 -0700 While pgoutput caches relation synchronization information in
RelationSyncCache that resides in CacheMemoryContext, each entry's
information (such as row filter expressions and column lists) is
stored in the entry's private memory context (entry_cxt in
RelationSyncEntry), which is a descendant memory context of the
decoding context. If a logical decoding invoked via SQL functions like
pg_logical_slot_get_binary_changes fails with an error, subsequent
logical decoding executions could access already-freed memory of the
entry's cache, resulting in a crash.
With this change, it's ensured that RelationSyncCache is cleaned up
even in error cases by using a memory context reset callback function.
Backpatch to 15, where entry_cxt was introduced for column filtering
and row filtering.
While the backbranches v13 and v14 have a similar issue where
RelationSyncCache persists even after an error when pgoutput is used
via SQL API, we decided not to backport this fix. This decision was
made because v13 is approaching its final minor release, and we won't
have an chance to fix any new issues that might arise. Additionally,
since using pgoutput via SQL API is not a common use case, the risk
outwights the benefit. If we receive bug reports, we can consider
backporting the fixes then.
Author: vignesh C <vignesh21@gmail.com>
Co-authored-by: Masahiko Sawada <sawada.mshk@gmail.com>
Reviewed-by: Zhijie Hou <houzj.fnst@fujitsu.com>
Reviewed-by: Euler Taveira <euler@eulerto.com>
Discussion: https://postgr.es/m/CALDaNm0x-aCehgt8Bevs2cm=uhmwS28MvbYq1=s2Ekf0aDPkOA@mail.gmail.com
Backpatch-through: 15 M src/backend/replication/pgoutput/pgoutput.c
Avoid uninitialized-variable warnings from older compilers.
commit : 71540dcdcb2239d9398c586615761d5ea424aaf0
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Thu, 9 Oct 2025 10:33:55 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Thu, 9 Oct 2025 10:33:55 -0400 Some of the buildfarm is still unhappy with WinGetFuncArgInPartition
even after 2273fa32b. While it seems to be just very old compilers,
we can suppress the warnings and arguably make the code more readable
by not initializing these variables till closer to where they are
used. While at it, make a couple of cosmetic comment improvements. M src/backend/executor/nodeWindowAgg.c
Fix comment in eager_aggregate.sql
commit : 36fd8bde1b77191eaf7d3499052c0636b6b93a87
author : Richard Guo <rguo@postgresql.org>
date : Thu, 9 Oct 2025 17:50:54 +0900
committer: Richard Guo <rguo@postgresql.org>
date : Thu, 9 Oct 2025 17:50:54 +0900 The comment stated that eager aggregation is disabled by default,
which is no longer true. This patch removes that comment as well as
the related GUC set statement.
Reported-by: David Rowley <dgrowleyml@gmail.com>
Discussion: https://postgr.es/m/CAApHDvr4YWpiMR3RsgYwJWv-u8xoRqTAKRiYy9zUszjZOqG4Ug@mail.gmail.com M src/test/regress/expected/eager_aggregate.out
M src/test/regress/sql/eager_aggregate.sql
Remove unnecessary include of "utils/fmgroids.h"
commit : f997d777adf725c674e1bfcff086487f2427759e
author : Richard Guo <rguo@postgresql.org>
date : Thu, 9 Oct 2025 17:49:20 +0900
committer: Richard Guo <rguo@postgresql.org>
date : Thu, 9 Oct 2025 17:49:20 +0900 In initsplan.c, no macros for built-in function OIDs are used, so this
include is unnecessary and can be removed. This was my oversight in
commit 8e1185910.
Discussion: https://postgr.es/m/CAMbWs4_-sag-cAKrLJ+X+5njL1=oudk=+KfLmsLZ5a2jckn=kg@mail.gmail.com M src/backend/optimizer/plan/initsplan.c
Remove duplicated log related to slot creation in pg_createsubscriber
commit : 8d02f49696d81b1641412c2f4545403de37faadc
author : Michael Paquier <michael@paquier.xyz>
date : Thu, 9 Oct 2025 14:02:24 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Thu, 9 Oct 2025 14:02:24 +0900 The creation of a replication slot done in a specific database on a
publisher was logged twice, with the second log not mentioning the
database where the slot creation happened. This commit removes the
information logged after a slot has been successfully created, moving
the information about the publisher from the second to the first log.
Note that failing a slot creation is also logged, so there is no loss of
information.
Author: Peter Smith <smithpb2250@gmail.com>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://postgr.es/m/CAHut+Pv7qDvLbDgc9PQGhULT3rPXTxdu_=w+iW-kMs+zPADR+w@mail.gmail.com M src/bin/pg_basebackup/pg_createsubscriber.c
Add "ALL SEQUENCES" support to publications.
commit : 96b37849734673e7c82fb86c4f0a46a28f500ac8
author : Amit Kapila <akapila@postgresql.org>
date : Thu, 9 Oct 2025 03:48:54 +0000
committer: Amit Kapila <akapila@postgresql.org>
date : Thu, 9 Oct 2025 03:48:54 +0000 This patch adds support for the ALL SEQUENCES clause in publications,
enabling synchronization/replication of all sequences that is useful for
upgrades.
Publications can now include all sequences via FOR ALL SEQUENCES.
psql enhancements:
\d shows publications for a given sequence.
\dRp indicates if a publication includes all sequences.
ALL SEQUENCES can be combined with ALL TABLES, but not with other options
like TABLE or TABLES IN SCHEMA. We can extend support for more granular
clauses in future.
The view pg_publication_sequences provides information about the mapping
between publications and sequences.
This patch enables publishing of sequences; subscriber-side support will
be added in upcoming patches.
Author: vignesh C <vignesh21@gmail.com>
Author: Tomas Vondra <tomas@vondra.me>
Reviewed-by: shveta malik <shveta.malik@gmail.com>
Reviewed-by: Dilip Kumar <dilipbalaut@gmail.com>
Reviewed-by: Peter Smith <smithpb2250@gmail.com>
Reviewed-by: Hayato Kuroda <kuroda.hayato@fujitsu.com>
Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com>
Reviewed-by: Nisha Moond <nisha.moond412@gmail.com>
Reviewed-by: Shlok Kyal <shlok.kyal.oss@gmail.com>
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>
Discussion: https://postgr.es/m/CAA4eK1LC+KJiAkSrpE_NwvNdidw9F2os7GERUeSxSKv71gXysQ@mail.gmail.com M doc/src/sgml/catalogs.sgml
M doc/src/sgml/logical-replication.sgml
M doc/src/sgml/ref/alter_publication.sgml
M doc/src/sgml/ref/create_publication.sgml
M doc/src/sgml/system-views.sgml
M src/backend/catalog/pg_publication.c
M src/backend/catalog/system_views.sql
M src/backend/commands/publicationcmds.c
M src/backend/parser/gram.y
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dump.h
M src/bin/pg_dump/t/002_pg_dump.pl
M src/bin/psql/describe.c
M src/bin/psql/tab-complete.in.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/include/catalog/pg_publication.h
M src/include/nodes/parsenodes.h
M src/test/regress/expected/psql.out
M src/test/regress/expected/publication.out
M src/test/regress/expected/rules.out
M src/test/regress/sql/publication.sql
M src/tools/pgindent/typedefs.list
Fix internal error from CollateExpr in SQL/JSON DEFAULT expressions
commit : ef5e60a9d352a97791af632e0d26a572bc88e921
author : Amit Langote <amitlan@postgresql.org>
date : Thu, 9 Oct 2025 01:07:59 -0400
committer: Amit Langote <amitlan@postgresql.org>
date : Thu, 9 Oct 2025 01:07:59 -0400 SQL/JSON functions such as JSON_VALUE could fail with "unrecognized
node type" errors when a DEFAULT clause contained an explicit COLLATE
expression. That happened because assign_collations_walker() could
invoke exprSetCollation() on a JsonBehavior expression whose DEFAULT
still contained a CollateExpr, which exprSetCollation() does not
handle.
For example:
SELECT JSON_VALUE('{"a":1}', '$.c' RETURNING text
DEFAULT 'A' COLLATE "C" ON EMPTY);
Fix by validating in transformJsonBehavior() that the DEFAULT
expression's collation matches the enclosing JSON expression’s
collation. In exprSetCollation(), replace the recursive call on the
JsonBehavior expression with an assertion that its collation already
matches the target, since the parser now enforces that condition.
Reported-by: Jian He <jian.universality@gmail.com>
Author: Jian He <jian.universality@gmail.com>
Reviewed-by: Amit Langote <amitlangote09@gmail.com>
Discussion: https://postgr.es/m/CACJufxHVwYYSyiVQ6o+PsRX6zQ7rAFinh_fv1kCfTsT1xG4Zeg@mail.gmail.com
Backpatch-through: 17 M src/backend/nodes/nodeFuncs.c
M src/backend/parser/parse_expr.c
M src/test/regress/expected/collate.icu.utf8.out
M src/test/regress/sql/collate.icu.utf8.sql
Make truncate_useless_pathkeys() consider WindowFuncs
commit : a5a68dd6d5159626360f75ffde96eca879e6cc30
author : David Rowley <drowley@postgresql.org>
date : Thu, 9 Oct 2025 12:38:33 +1300
committer: David Rowley <drowley@postgresql.org>
date : Thu, 9 Oct 2025 12:38:33 +1300 truncate_useless_pathkeys() seems to have neglected to account for
PathKeys that might be useful for WindowClause evaluation. Modify it so
that it properly accounts for that.
Making this work required adjusting two things:
1. Change from checking query_pathkeys to check sort_pathkeys instead.
2. Add explicit check for window_pathkeys
For #1, query_pathkeys gets set in standard_qp_callback() according to the
sort order requirements for the first operation to be applied after the
join planner is finished, so this changes depending on which upper
planner operations a particular query needs. If the query has window
functions and no GROUP BY, then query_pathkeys gets set to
window_pathkeys. Before this change, this meant PathKeys useful for the
ORDER BY were not accounted for in queries with window functions.
Because of #1, #2 is now required so that we explicitly check to ensure
we don't truncate away PathKeys useful for window functions.
Author: David Rowley <dgrowleyml@gmail.com>
Discussion: https://postgr.es/m/CAApHDvrj3HTKmXoLMbUjTO=_MNMxM=cnuCSyBKidAVibmYPnrg@mail.gmail.com M src/backend/optimizer/path/pathkeys.c
M src/test/regress/expected/window.out
M src/test/regress/sql/window.sql
bufmgr: Don't lock buffer header in StrategyGetBuffer()
commit : 5e89985928795f243dc287210c2aa016dfd00bfe
author : Andres Freund <andres@anarazel.de>
date : Wed, 8 Oct 2025 17:01:10 -0400
committer: Andres Freund <andres@anarazel.de>
date : Wed, 8 Oct 2025 17:01:10 -0400 Previously StrategyGetBuffer() acquired the buffer header spinlock for every
buffer, whether it was reusable or not. If reusable, it'd be returned, with
the lock held, to GetVictimBuffer(), which then would pin the buffer with
PinBuffer_Locked(). That's somewhat violating the spirit of the guidelines for
holding spinlocks (i.e. that they are only held for a few lines of consecutive
code) and necessitates using PinBuffer_Locked(), which scales worse than
PinBuffer() due to holding the spinlock. This alone makes it worth changing
the code.
However, the main reason to change this is that a future commit will make
PinBuffer_Locked() slower (due to making UnlockBufHdr() slower), to gain
scalability for the much more common case of pinning a pre-existing buffer. By
pinning the buffer with a single atomic operation, iff the buffer is reusable,
we avoid any potential regression for miss-heavy workloads. There strictly are
fewer atomic operations for each potential buffer after this change.
The price for this improvement is that freelist.c needs two CAS loops and
needs to be able to set up the resource accounting for pinned buffers. The
latter is achieved by exposing a new function for that purpose from bufmgr.c,
that seems better than exposing the entire private refcount infrastructure.
The improvement seems worth the complexity.
Reviewed-by: Robert Haas <robertmhaas@gmail.com>
Reviewed-by: Matthias van de Meent <boekewurm+postgres@gmail.com>
Discussion: https://postgr.es/m/fvfmkr5kk4nyex56ejgxj3uzi63isfxovp2biecb4bspbjrze7@az2pljabhnff M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/buffer/freelist.c
M src/include/storage/buf_internals.h
bufmgr: fewer calls to BufferDescriptorGetContentLock
commit : 3baae90013df58a8d124afa79df07075b8ebea09
author : Andres Freund <andres@anarazel.de>
date : Wed, 8 Oct 2025 16:06:19 -0400
committer: Andres Freund <andres@anarazel.de>
date : Wed, 8 Oct 2025 16:06:19 -0400 We're planning to merge buffer content locks into BufferDesc.state. To reduce
the size of that patch, centralize calls to BufferDescriptorGetContentLock().
The biggest part of the change is in assertions, by introducing
BufferIsLockedByMe[InMode]() (and removing BufferIsExclusiveLocked()). This
seems like an improvement even without aforementioned plans.
Additionally replace some direct calls to LWLockAcquire() with calls to
LockBuffer().
Reviewed-by: Matthias van de Meent <boekewurm+postgres@gmail.com>
Discussion: https://postgr.es/m/fvfmkr5kk4nyex56ejgxj3uzi63isfxovp2biecb4bspbjrze7@az2pljabhnff M src/backend/access/heap/visibilitymap.c
M src/backend/access/transam/xloginsert.c
M src/backend/storage/buffer/bufmgr.c
M src/include/storage/bufmgr.h
bufmgr: Fix signedness of mask variable in BufferSync()
commit : 2a2e1b470b9b4e9c7d76bc227db02a2efbb57473
author : Andres Freund <andres@anarazel.de>
date : Wed, 8 Oct 2025 14:34:30 -0400
committer: Andres Freund <andres@anarazel.de>
date : Wed, 8 Oct 2025 14:34:30 -0400 BM_PERMANENT is defined as 1U<<31, which is a negative number when interpreted
as a signed integer. Unfortunately the mask variable in BufferSync() was
signed. This has been wrong for a long time, but failed to fail, due to
integer conversion rules.
However, in an upcoming patch the width of the state variable will be
increased, with the wrong signedness leading to never flushing permanent
buffers - luckily caught in a test.
It seems better to fix this separately, instead of doing so as part of a
large, otherwise mechanical, patch.
Reviewed-by: Matthias van de Meent <boekewurm+postgres@gmail.com>
Discussion: https://postgr.es/m/fvfmkr5kk4nyex56ejgxj3uzi63isfxovp2biecb4bspbjrze7@az2pljabhnff M src/backend/storage/buffer/bufmgr.c
bufmgr: Introduce FlushUnlockedBuffer
commit : 3c2b97b29ee33d5619779fd10e06eee07d4700da
author : Andres Freund <andres@anarazel.de>
date : Wed, 8 Oct 2025 14:34:30 -0400
committer: Andres Freund <andres@anarazel.de>
date : Wed, 8 Oct 2025 14:34:30 -0400 There were several copies of code locking a buffer, flushing its contents, and
unlocking the buffer. It seems worth centralizing that into a helper function.
Reviewed-by: Matthias van de Meent <boekewurm+postgres@gmail.com>
Discussion: https://postgr.es/m/fvfmkr5kk4nyex56ejgxj3uzi63isfxovp2biecb4bspbjrze7@az2pljabhnff M src/backend/storage/buffer/bufmgr.c
Improve ReadRecentBuffer() scalability
commit : 819dc118c0f6cd1fc08f0e807702b4bc0b0d8733
author : Andres Freund <andres@anarazel.de>
date : Wed, 8 Oct 2025 12:57:52 -0400
committer: Andres Freund <andres@anarazel.de>
date : Wed, 8 Oct 2025 12:57:52 -0400 While testing a new potential use for ReadRecentBuffer(), Andres
reported that it scales badly when called concurrently for the same
buffer by many backends. Instead of a naive (but wrong) coding with
PinBuffer(), it used the spinlock, so that it could be careful to pin
only if the buffer was valid and holding the expected block, to avoid
breaking invariants in eg GetVictimBuffer(). Unfortunately that made it
less scalable than PinBuffer(), which uses compare-exchange instead.
We can fix that by giving PinBuffer() a new skip_if_not_valid mode that
doesn't pin invalid buffers. It might occasionally skip when it
shouldn't due to the unlocked read of the header flags, but that's
unlikely and perfectly acceptable for an opportunistic optimisation
routine, and it can only succeed when it really should due to the
compare-exchange loop.
Note that this fixes ReadRecentBuffer()'s failure to bump the usage
count. While this could be seen as a bug, there currently aren't cases
affected by this in core, so it doesn't seem worth backpatching that portion.
Author: Thomas Munro <thomas.munro@gmail.com>
Reported-by: Andres Freund <andres@anarazel.de>
Reviewed-by: Andres Freund <andres@anarazel.de>
Reviewed-by: Matthias van de Meent <boekewurm+postgres@gmail.com>
Discussion: https://postgr.es/m/20230627020546.t6z4tntmj7wmjrfh%40awork3.anarazel.de
Discussion: https://postgr.es/m/fvfmkr5kk4nyex56ejgxj3uzi63isfxovp2biecb4bspbjrze7@az2pljabhnff M src/backend/storage/buffer/bufmgr.c
Add mem_exceeded_count column to pg_stat_replication_slots.
commit : d3b6183dd988928dd369b4b7d641917e77f1ae4e
author : Masahiko Sawada <msawada@postgresql.org>
date : Wed, 8 Oct 2025 10:05:04 -0700
committer: Masahiko Sawada <msawada@postgresql.org>
date : Wed, 8 Oct 2025 10:05:04 -0700 This commit introduces a new column mem_exceeded_count to the
pg_stat_replication_slots view. This counter tracks how often the
memory used by logical decoding exceeds the logical_decoding_work_mem
limit. The new statistic helps users determine whether exceeding the
logical_decoding_work_mem limit is a rare occurrences or a frequent
issue, information that wasn't available through existing statistics.
Bumps catversion.
Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com>
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>
Reviewed-by: shveta malik <shveta.malik@gmail.com>
Reviewed-by: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://postgr.es/m/978D21E8-9D3B-40EA-A4B1-F87BABE7868C@yesql.se M contrib/test_decoding/expected/stats.out
M contrib/test_decoding/sql/stats.sql
M doc/src/sgml/monitoring.sgml
M src/backend/catalog/system_views.sql
M src/backend/replication/logical/logical.c
M src/backend/replication/logical/reorderbuffer.c
M src/backend/utils/activity/pgstat_replslot.c
M src/backend/utils/adt/pgstatfuncs.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/include/pgstat.h
M src/include/replication/reorderbuffer.h
M src/test/regress/expected/rules.out
Cleanup NAN code in float.h, too.
commit : 14ad0d7bf2b8d5f26061df7cbdf18cfffcdcb225
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Wed, 8 Oct 2025 12:19:53 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Wed, 8 Oct 2025 12:19:53 -0400 In the same spirit as 3bf905692, assume that all compilers we still
support provide the NAN macro, and get rid of workarounds for that.
The C standard allows implementations to omit NAN if the underlying
float arithmetic lacks quiet (non-signaling) NaNs. However, we've
required that feature for years: the workarounds only supported
lack of the macro, not lack of the functionality. I put in a
compile-time #error if there's no macro, just for clarity.
Also fix up the copies of these functions in ecpglib, and leave
a breadcrumb for the next hacker who touches them.
History of the hacks being removed here can be found in commits
1bc2d544b, 4d17a2146, cec8394b5.
Author: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/1952095.1759764279@sss.pgh.pa.us M src/include/utils/float.h
M src/interfaces/ecpg/ecpglib/data.c
Add extension_state member to PlannedStmt.
commit : 4685977cc51c91dda0f76b1ef71ba02823a57a1e
author : Robert Haas <rhaas@postgresql.org>
date : Wed, 8 Oct 2025 09:07:49 -0400
committer: Robert Haas <rhaas@postgresql.org>
date : Wed, 8 Oct 2025 09:07:49 -0400 Extensions can stash data computed at plan time into this list using
planner_shutdown_hook (or perhaps other mechanisms) and then access
it from any code that has access to the PlannedStmt (such as explain
hooks), allowing for extensible debugging and instrumentation of
plans.
Reviewed-by: Andrei Lepikhov <lepihov@gmail.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: http://postgr.es/m/CA+TgmoYWKHU2hKr62Toyzh-kTDEnMDeLw7gkOOnjL-TnOUq0kQ@mail.gmail.com M src/include/nodes/plannodes.h
Add planner_setup_hook and planner_shutdown_hook.
commit : 94f3ad3961a2cb32d30c79f01a70db4caff13318
author : Robert Haas <rhaas@postgresql.org>
date : Wed, 8 Oct 2025 09:05:38 -0400
committer: Robert Haas <rhaas@postgresql.org>
date : Wed, 8 Oct 2025 09:05:38 -0400 These hooks allow plugins to get control at the earliest point at
which the PlannerGlobal object is fully initialized, and then just
before it gets destroyed. This is useful in combination with the
extendable plan state facilities (see extendplan.h) and perhaps for
other purposes as well.
Reviewed-by: Andrei Lepikhov <lepihov@gmail.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: http://postgr.es/m/CA+TgmoYWKHU2hKr62Toyzh-kTDEnMDeLw7gkOOnjL-TnOUq0kQ@mail.gmail.com M src/backend/optimizer/plan/planner.c
M src/include/optimizer/planner.h
Add ExplainState argument to pg_plan_query() and planner().
commit : c83ac02ec7309edb7561eee93895c31a54b93d3d
author : Robert Haas <rhaas@postgresql.org>
date : Wed, 8 Oct 2025 08:33:29 -0400
committer: Robert Haas <rhaas@postgresql.org>
date : Wed, 8 Oct 2025 08:33:29 -0400 This allows extensions to have access to any data they've stored
in the ExplainState during planning. Unfortunately, it won't help
with EXPLAIN EXECUTE is used, but since that case is less common,
this still seems like an improvement.
Since planner() has quite a few arguments now, also add some
documentation of those arguments and the return value.
Author: Robert Haas <rhaas@postgresql.org>
Co-authored-by: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Andrei Lepikhov <lepihov@gmail.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: http://postgr.es/m/CA+TgmoYWKHU2hKr62Toyzh-kTDEnMDeLw7gkOOnjL-TnOUq0kQ@mail.gmail.com M contrib/pg_stat_statements/pg_stat_statements.c
M src/backend/commands/copyto.c
M src/backend/commands/createas.c
M src/backend/commands/explain.c
M src/backend/commands/matview.c
M src/backend/commands/portalcmds.c
M src/backend/optimizer/plan/planner.c
M src/backend/tcop/postgres.c
M src/include/optimizer/optimizer.h
M src/include/optimizer/planner.h
M src/include/tcop/tcopprot.h
M src/test/modules/delay_execution/delay_execution.c
Implement Eager Aggregation
commit : 8e11859102f947e6145acdd809e5cdcdfbe90fa5
author : Richard Guo <rguo@postgresql.org>
date : Wed, 8 Oct 2025 17:04:23 +0900
committer: Richard Guo <rguo@postgresql.org>
date : Wed, 8 Oct 2025 17:04:23 +0900 Eager aggregation is a query optimization technique that partially
pushes aggregation past a join, and finalizes it once all the
relations are joined. Eager aggregation may reduce the number of
input rows to the join and thus could result in a better overall plan.
In the current planner architecture, the separation between the
scan/join planning phase and the post-scan/join phase means that
aggregation steps are not visible when constructing the join tree,
limiting the planner's ability to exploit aggregation-aware
optimizations. To implement eager aggregation, we collect information
about aggregate functions in the targetlist and HAVING clause, along
with grouping expressions from the GROUP BY clause, and store it in
the PlannerInfo node. During the scan/join planning phase, this
information is used to evaluate each base or join relation to
determine whether eager aggregation can be applied. If applicable, we
create a separate RelOptInfo, referred to as a grouped relation, to
represent the partially-aggregated version of the relation and
generate grouped paths for it.
Grouped relation paths can be generated in two ways. The first method
involves adding sorted and hashed partial aggregation paths on top of
the non-grouped paths. To limit planning time, we only consider the
cheapest or suitably-sorted non-grouped paths in this step.
Alternatively, grouped paths can be generated by joining a grouped
relation with a non-grouped relation. Joining two grouped relations
is currently not supported.
To further limit planning time, we currently adopt a strategy where
partial aggregation is pushed only to the lowest feasible level in the
join tree where it provides a significant reduction in row count.
This strategy also helps ensure that all grouped paths for the same
grouped relation produce the same set of rows, which is important to
support a fundamental assumption of the planner.
For the partial aggregation that is pushed down to a non-aggregated
relation, we need to consider all expressions from this relation that
are involved in upper join clauses and include them in the grouping
keys, using compatible operators. This is essential to ensure that an
aggregated row from the partial aggregation matches the other side of
the join if and only if each row in the partial group does. This
ensures that all rows within the same partial group share the same
"destiny", which is crucial for maintaining correctness.
One restriction is that we cannot push partial aggregation down to a
relation that is in the nullable side of an outer join, because the
NULL-extended rows produced by the outer join would not be available
when we perform the partial aggregation, while with a
non-eager-aggregation plan these rows are available for the top-level
aggregation. Pushing partial aggregation in this case may result in
the rows being grouped differently than expected, or produce incorrect
values from the aggregate functions.
If we have generated a grouped relation for the topmost join relation,
we finalize its paths at the end. The final paths will compete in the
usual way with paths built from regular planning.
The patch was originally proposed by Antonin Houska in 2017. This
commit reworks various important aspects and rewrites most of the
current code. However, the original patch and reviews were very
useful.
Author: Richard Guo <guofenglinux@gmail.com>
Author: Antonin Houska <ah@cybertec.at> (in an older version)
Reviewed-by: Robert Haas <robertmhaas@gmail.com>
Reviewed-by: Jian He <jian.universality@gmail.com>
Reviewed-by: Tender Wang <tndrwang@gmail.com>
Reviewed-by: Matheus Alcantara <matheusssilv97@gmail.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: David Rowley <dgrowleyml@gmail.com>
Reviewed-by: Tomas Vondra <tomas@vondra.me> (in an older version)
Reviewed-by: Andy Fan <zhihuifan1213@163.com> (in an older version)
Reviewed-by: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com> (in an older version)
Discussion: https://postgr.es/m/CAMbWs48jzLrPt1J_00ZcPZXWUQKawQOFE8ROc-ADiYqsqrpBNw@mail.gmail.com M contrib/postgres_fdw/expected/postgres_fdw.out
M doc/src/sgml/config.sgml
M src/backend/optimizer/README
M src/backend/optimizer/geqo/geqo_eval.c
M src/backend/optimizer/path/allpaths.c
M src/backend/optimizer/path/joinrels.c
M src/backend/optimizer/plan/initsplan.c
M src/backend/optimizer/plan/planmain.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/util/appendinfo.c
M src/backend/optimizer/util/relnode.c
M src/backend/utils/misc/guc_parameters.dat
M src/backend/utils/misc/postgresql.conf.sample
M src/include/nodes/pathnodes.h
M src/include/optimizer/pathnode.h
M src/include/optimizer/paths.h
M src/include/optimizer/planmain.h
M src/test/regress/expected/collate.icu.utf8.out
A src/test/regress/expected/eager_aggregate.out
M src/test/regress/expected/join.out
M src/test/regress/expected/partition_aggregate.out
M src/test/regress/expected/sysviews.out
M src/test/regress/parallel_schedule
A src/test/regress/sql/eager_aggregate.sql
M src/test/regress/sql/partition_aggregate.sql
M src/tools/pgindent/typedefs.list
Allow negative aggtransspace to indicate unbounded state size
commit : 185e304263347d0979832f7a08a812872d136b18
author : Richard Guo <rguo@postgresql.org>
date : Wed, 8 Oct 2025 17:01:48 +0900
committer: Richard Guo <rguo@postgresql.org>
date : Wed, 8 Oct 2025 17:01:48 +0900 This patch reuses the existing aggtransspace in pg_aggregate to
signal that an aggregate's transition state can grow unboundedly. If
aggtransspace is set to a negative value, it now indicates that the
transition state may consume unpredictable or large amounts of memory,
such as in aggregates like array_agg or string_agg that accumulate
input rows.
This information can be used by the planner to avoid applying
memory-sensitive optimizations (e.g., eager aggregation) when there is
a risk of excessive memory usage during partial aggregation.
Bump catalog version.
Per idea from Robert Haas, though applied differently than originally
suggested.
Discussion: https://postgr.es/m/CA+TgmoYbkvYwLa+1vOP7RDY7kO2=A7rppoPusoRXe44VDOGBPg@mail.gmail.com M doc/src/sgml/catalogs.sgml
M doc/src/sgml/ref/create_aggregate.sgml
M src/include/catalog/catversion.h
M src/include/catalog/pg_aggregate.dat
M src/test/regress/expected/opr_sanity.out
M src/test/regress/sql/opr_sanity.sql
Improve description of some WAL records for GIN
commit : 138da727a174219da2d408382e50f8628f1fa38f
author : Michael Paquier <michael@paquier.xyz>
date : Wed, 8 Oct 2025 13:57:04 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Wed, 8 Oct 2025 13:57:04 +0900 The following information is added in the description of some GIN
records:
- In INSERT_LISTPAGE, the number of tuples and the right link block.
- In UPDATE_META_PAGE, the number of tuples, the previous tail block,
and the right link block.
- In SPLIT, the left and right children blocks.
Author: Kirill Reshke <reshkekirill@gmail.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Discussion: https://postgr.es/m/CALdSSPgnAt5L=D_xGXRXLYO5FK1H31_eYEESxdU1n-r4g+6GqA@mail.gmail.com M src/backend/access/rmgrdesc/gindesc.c
Add stats_reset to pg_stat_user_functions
commit : b71bae41a0cdda879db39d9946d2cc4af910bed1
author : Michael Paquier <michael@paquier.xyz>
date : Wed, 8 Oct 2025 12:43:40 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Wed, 8 Oct 2025 12:43:40 +0900 It is possible to call pg_stat_reset_single_function_counters() for a
single function, but the reset time was missing the system view showing
its statistics. Like all the fields of pg_stat_user_functions, the GUC
track_functions needs to be enabled to show the statistics about
function executions.
Bump catalog version.
Bump PGSTAT_FILE_FORMAT_ID, as a result of the new field added to
PgStat_StatFuncEntry.
Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Discussion: https://postgr.es/m/aONjnsaJSx-nEdfU@paquier.xyz M doc/src/sgml/monitoring.sgml
M src/backend/catalog/system_views.sql
M src/backend/utils/activity/pgstat.c
M src/backend/utils/activity/pgstat_function.c
M src/backend/utils/adt/pgstatfuncs.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/include/pgstat.h
M src/include/utils/pgstat_internal.h
M src/test/isolation/expected/stats.out
M src/test/isolation/expected/stats_1.out
M src/test/isolation/specs/stats.spec
M src/test/regress/expected/rules.out
Fix typo in function header comment.
commit : 035b09131daab84f2ed9a4a3f766bf4781fd5cbf
author : Amit Kapila <akapila@postgresql.org>
date : Wed, 8 Oct 2025 03:17:05 +0000
committer: Amit Kapila <akapila@postgresql.org>
date : Wed, 8 Oct 2025 03:17:05 +0000 Reported-by: Robert Haas <robertmhaas@gmail.com>
Discussion: https://postgr.es/m/CA+TgmoZYh_nw-2j_Fi9y6ZAvrpN+W1aSOFNM7Rus2Q-zTkCsQw@mail.gmail.com M src/backend/access/transam/twophase.c
Fix Coverity issues reported in commit 25a30bbd423.
commit : 2273fa32bce7c1fb856c726d01d8cdaaba36f849
author : Tatsuo Ishii <ishii@postgresql.org>
date : Wed, 8 Oct 2025 09:26:49 +0900
committer: Tatsuo Ishii <ishii@postgresql.org>
date : Wed, 8 Oct 2025 09:26:49 +0900 Fix several issues pointed out by Coverity (reported by Tome Lane).
- In row_is_in_frame(), return value of window_gettupleslot() was not
checked.
- WinGetFuncArgInPartition() tried to derefference "isout" pointer
even if it could be NULL in some places.
Besides the issues, I also fixed a compiler warning reported by Álvaro
Herrera.
Moreover, in WinGetFuncArgInPartition refactor the do...while loop so
that the codes inside the loop simpler. Also simplify the case when
abs_pos < 0.
Author: Tatsuo Ishii <ishii@postgresql.org>
Reviewed-by: Paul Ramsey <pramsey@cleverelephant.ca>
Reported-by: Tom Lane <tgl@sss.pgh.pa.us>
Reported-by: Álvaro Herrera <alvherre@kurilemu.de>
Discussion: https://postgr.es/m/1686755.1759679957%40sss.pgh.pa.us
Discussion: https://postgr.es/m/202510051612.gw67jlc2iqpw%40alvherre.pgsql M src/backend/executor/nodeWindowAgg.c
Cleanup INFINITY code in float.h
commit : 3bf905692c9db5309c5cd4c0dec7ec17ab8c7af1
author : David Rowley <drowley@postgresql.org>
date : Wed, 8 Oct 2025 12:07:17 +1300
committer: David Rowley <drowley@postgresql.org>
date : Wed, 8 Oct 2025 12:07:17 +1300 The INFINITY macro is always defined per C99 standard, so this should
mean we can now get rid of the workaround code for when that macro isn't
defined.
Also, delete the (now unneeded) #pragma code which was disabling a
compiler warning in MSVC. There was a comment explaining why the #pragma
was placed outside the function body to work around a MSVC compiler bug,
but the link explaining that was dead, as reported by jian he.
Author: David Rowley <dgrowleyml@gmail.com>
Reported-by: jian he <jian.universality@gmail.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/CACJufxGARYETnNwtCK7QC0zE_7gq-tfN0mME=gT5rTNtC=VSHQ@mail.gmail.com M src/include/utils/float.h
Remove PlannerInfo's join_search_private method.
commit : 64095d157482136ee609586266f8a37467c69bde
author : Robert Haas <rhaas@postgresql.org>
date : Wed, 20 Aug 2025 15:10:52 -0400
committer: Robert Haas <rhaas@postgresql.org>
date : Wed, 20 Aug 2025 15:10:52 -0400 Instead, use the new mechanism that allows planner extensions to store
private state inside a PlannerInfo, treating GEQO as an in-core planner
extension. This is a useful test of the new facility, and also buys
back a few bytes of storage.
To make this work, we must remove innerrel_is_unique_ext's hack of
testing whether join_search_private is set as a proxy for whether
the join search might be retried. Add a flag that extensions can
use to explicitly signal their intentions instead.
Reviewed-by: Andrei Lepikhov <lepihov@gmail.com>
Reviewed-by: Melanie Plageman <melanieplageman@gmail.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: http://postgr.es/m/CA+TgmoYWKHU2hKr62Toyzh-kTDEnMDeLw7gkOOnjL-TnOUq0kQ@mail.gmail.com M src/backend/optimizer/geqo/geqo_eval.c
M src/backend/optimizer/geqo/geqo_main.c
M src/backend/optimizer/geqo/geqo_random.c
M src/backend/optimizer/plan/analyzejoins.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/prep/prepjointree.c
M src/include/nodes/pathnodes.h
M src/include/optimizer/geqo.h
Allow private state in certain planner data structures.
commit : 0132dddab33a6eae2d3d63eda9f053e745fedb06
author : Robert Haas <rhaas@postgresql.org>
date : Tue, 7 Oct 2025 12:09:30 -0400
committer: Robert Haas <rhaas@postgresql.org>
date : Tue, 7 Oct 2025 12:09:30 -0400 Extension that make extensive use of planner hooks may want to
coordinate their efforts, for example to avoid duplicate computation,
but that's currently difficult because there's no really good way to
pass data between different hooks.
To make that easier, allow for storage of extension-managed private
state in PlannerGlobal, PlannerInfo, and RelOptInfo, along very
similar lines to what we have permitted for ExplainState since commit
c65bc2e1d14a2d4daed7c1921ac518f2c5ac3d17.
Reviewed-by: Andrei Lepikhov <lepihov@gmail.com>
Reviewed-by: Melanie Plageman <melanieplageman@gmail.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: http://postgr.es/m/CA+TgmoYWKHU2hKr62Toyzh-kTDEnMDeLw7gkOOnjL-TnOUq0kQ@mail.gmail.com M src/backend/optimizer/util/Makefile
A src/backend/optimizer/util/extendplan.c
M src/backend/optimizer/util/meson.build
M src/include/nodes/pathnodes.h
A src/include/optimizer/extendplan.h
Adjust new TAP test to work on macOS.
commit : afd532c3a80c12a9c0f836c5e4fc3cfe6503b91f
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Tue, 7 Oct 2025 11:47:27 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Tue, 7 Oct 2025 11:47:27 -0400 Seems Apple's version of "wc -l" puts spaces before the number.
(I wonder why the cfbot didn't find this.) While here, make
the failure case log what it got, to aid debugging future issues.
Per buildfarm. M src/bin/psql/t/030_pager.pl
Improve psql's ability to select pager mode accurately.
commit : 27da1a796ff9a367c34d431fd28be923cd8da507
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Tue, 7 Oct 2025 10:57:56 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Tue, 7 Oct 2025 10:57:56 -0400 We try to use the pager only when more than a screenful's worth of
data is to be printed. However, the code in print.c that's concerned
with counting the number of lines that will be needed missed a lot of
edge cases:
* While plain aligned mode accounted for embedded newlines in column
headers and table cells, unaligned and vertical output modes did not.
* In particular, since vertical mode repeats the headers for each
record, we need to account for embedded newlines in the headers for
each record.
* Multi-line table titles were not accounted for.
* tuples_only mode (where headers aren't printed) wasn't accounted
for.
* Footers were accounted for as one line per footer, again missing
the possibility of multi-line footers. (In some cases such as
"\d+" on a view, there can be many lines in a footer.) Also,
we failed to account for the default footer.
To fix, move the entire responsibility for counting lines into
IsPagerNeeded (or actually, into a new subroutine count_table_lines),
and then expand the logic as appropriate. Also restructure to make it
perhaps a bit easier to follow. It's still only completely accurate
for ALIGNED/WRAPPED/UNALIGNED formats, but the other formats are not
typically used with interactive output.
Arrange to not run count_table_lines at all unless we will use
its result, and teach it to quit early as soon as it's proven
that the output is long enough to require use of the pager.
When dealing with large tables this should save a noticeable
amount of time, since pg_wcssize() isn't exactly cheap.
In passing, move the "flog" output step to the bottom of printTable(),
rather than running it when we've already opened the pager in some
modes. In principle it shouldn't interfere with the pager because
flog should always point to a non-interactive file; but it seems silly
to risk any interference, especially when the existing positioning
seems to have been chosen with the aid of a dartboard.
Also add a TAP test to exercise pager mode. Up to now, we have had
zero test coverage of these code paths, because they aren't reached
unless isatty(stdout). We do have the test infrastructure to improve
that situation, though. Following the lead of 010_tab_completion.pl,
set up an interactive psql and feed it some test cases. To detect
whether it really did invoke the pager, point PSQL_PAGER to "wc -l".
The test is skipped if that utility isn't available.
Author: Erik Wienhold <ewie@ewie.name>
Test-authored-by: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/2dd2430f-dd20-4c89-97fd-242616a3d768@ewie.name M src/bin/psql/meson.build
A src/bin/psql/t/030_pager.pl
M src/fe_utils/print.c
Assign each subquery a unique name prior to planning it.
commit : 8c49a484e8ebb0199fba4bd68eaaedaf49b48ed0
author : Robert Haas <rhaas@postgresql.org>
date : Tue, 7 Oct 2025 09:18:54 -0400
committer: Robert Haas <rhaas@postgresql.org>
date : Tue, 7 Oct 2025 09:18:54 -0400 Previously, subqueries were given names only after they were planned,
which makes it difficult to use information from a previous execution of
the query to guide future planning. If, for example, you knew something
about how you want "InitPlan 2" to be planned, you won't know whether
the subquery you're currently planning will end up being "InitPlan 2"
until after you've finished planning it, by which point it's too late to
use the information that you had.
To fix this, assign each subplan a unique name before we begin planning
it. To improve consistency, use textual names for all subplans, rather
than, as we did previously, a mix of numbers (such as "InitPlan 1") and
names (such as "CTE foo"), and make sure that the same name is never
assigned more than once.
We adopt the somewhat arbitrary convention of using the type of sublink
to set the plan name; for example, a query that previously had two
expression sublinks shown as InitPlan 2 and InitPlan 1 will now end up
named expr_1 and expr_2. Because names are assigned before rather than
after planning, some of the regression test outputs show the numerical
part of the name switching positions: what was previously SubPlan 2 was
actually the first one encountered, but we finished planning it later.
We assign names even to subqueries that aren't shown as such within the
EXPLAIN output. These include subqueries that are a FROM clause item or
a branch of a set operation, rather than something that will be turned
into an InitPlan or SubPlan. The purpose of this is to make sure that,
below the topmost query level, there's always a name for each subquery
that is stable from one planning cycle to the next (assuming no changes
to the query or the database schema).
Author: Robert Haas <rhaas@postgresql.org>
Co-authored-by: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Alexandra Wang <alexandra.wang.oss@gmail.com>
Reviewed-by: Richard Guo <guofenglinux@gmail.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Junwang Zhao <zhjwpku@gmail.com>
Discussion: http://postgr.es/m/3641043.1758751399@sss.pgh.pa.us M contrib/postgres_fdw/expected/postgres_fdw.out
M src/backend/commands/explain.c
M src/backend/optimizer/path/allpaths.c
M src/backend/optimizer/plan/planagg.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/plan/subselect.c
M src/backend/optimizer/prep/prepjointree.c
M src/backend/optimizer/prep/prepunion.c
M src/backend/utils/adt/ruleutils.c
M src/include/nodes/pathnodes.h
M src/include/nodes/primnodes.h
M src/include/optimizer/planner.h
M src/test/regress/expected/aggregates.out
M src/test/regress/expected/create_index.out
M src/test/regress/expected/groupingsets.out
M src/test/regress/expected/incremental_sort.out
M src/test/regress/expected/inherit.out
M src/test/regress/expected/insert_conflict.out
M src/test/regress/expected/join.out
M src/test/regress/expected/join_hash.out
M src/test/regress/expected/memoize.out
M src/test/regress/expected/merge.out
M src/test/regress/expected/partition_prune.out
M src/test/regress/expected/portals.out
M src/test/regress/expected/predicate.out
M src/test/regress/expected/returning.out
M src/test/regress/expected/rowsecurity.out
M src/test/regress/expected/rowtypes.out
M src/test/regress/expected/select_parallel.out
M src/test/regress/expected/sqljson.out
M src/test/regress/expected/subselect.out
M src/test/regress/expected/updatable_views.out
M src/test/regress/expected/update.out
M src/test/regress/expected/window.out
M src/test/regress/expected/with.out
doc: Add missing parenthesis in pg_stat_progress_analyze docs
commit : 8c2d5d4f1195c6ea62557f5975d8794b52ab4e0f
author : Daniel Gustafsson <dgustafsson@postgresql.org>
date : Tue, 7 Oct 2025 15:02:20 +0200
committer: Daniel Gustafsson <dgustafsson@postgresql.org>
date : Tue, 7 Oct 2025 15:02:20 +0200 Author: Shinya Kato <shinya11.kato@gmail.com>
Discussion: https://postgr.es/m/CAOzEurRgpAh9dsbEM88FPOhNaV_PkdL6p_9MJatcrNf9wXw1nw@mail.gmail.com
Backpatch-through: 18 M doc/src/sgml/monitoring.sgml
Fix compile of src/tutorial/funcs.c
commit : c53775185dc4b17cd951f5fff74c020a2469da27
author : Álvaro Herrera <alvherre@kurilemu.de>
date : Tue, 7 Oct 2025 10:45:57 +0200
committer: Álvaro Herrera <alvherre@kurilemu.de>
date : Tue, 7 Oct 2025 10:45:57 +0200 I broke this with recent #include removals. Fix by adding an explicit
Reported-by: Devrim Gündüz <devrim@gunduz.org>
Discussion: https://postgr.es/m/5e2c2d7c44434f3f0af7523864b27fe4fb590902.camel@gunduz.org M src/tutorial/funcs.c
Teach planner to short-circuit EXCEPT/INTERSECT with dummy inputs
commit : 9c9d41af4db7e7f81d0f9abc7dc16402386091b0
author : David Rowley <drowley@postgresql.org>
date : Tue, 7 Oct 2025 17:17:52 +1300
committer: David Rowley <drowley@postgresql.org>
date : Tue, 7 Oct 2025 17:17:52 +1300 When either inputs of an INTERSECT [ALL] operator are proven not to return
any results (a dummy rel), then mark the entire INTERSECT operation as
dummy.
Likewise, if an EXCEPT [ALL] operation's left input is proven empty, then
mark the entire operation as dummy.
With EXCEPT ALL, we can easily handle the right input being dummy as
we can return the left input without any processing. That can lead to
significant performance gains during query execution. We can't easily
handle dummy right inputs for EXCEPT (without ALL), as that would require
deduplication of the left input. Wiring up those Paths is likely more
complex than it's worth as the gains during execution aren't that great,
so let's leave that one to be handled by the normal Path generation code.
Author: David Rowley <dgrowleyml@gmail.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/CAApHDvri53PPF76c3M94_QNWbJfXjyCnjXuj_2=LYM-0m8WZtw@mail.gmail.com M src/backend/optimizer/prep/prepunion.c
M src/test/regress/expected/union.out
M src/test/regress/sql/union.sql
Fix incorrect targetlist in dummy UNIONs
commit : 928df067d1e6ca5b747722d32c79bc3efa891a32
author : David Rowley <drowley@postgresql.org>
date : Tue, 7 Oct 2025 14:15:04 +1300
committer: David Rowley <drowley@postgresql.org>
date : Tue, 7 Oct 2025 14:15:04 +1300 The prior code, added in 03d40e4b5 attempted to use the targetlist of the
first UNION child when all UNION children were proven as dummy rels.
That's not going to work when some operation atop of the Result node must
find target entries within the Result's targetlist. This could have been
something as simple as trying to sort the results of the UNION operation,
which would lead to:
ERROR: could not find pathkey item to sort
Instead, use the top-level UNION's targetlist and fix the varnos in
setrefs.c. Because set operation targetlists always use varno==0, we
can rewrite those to become varno==1, i.e. use the Vars from the first
UNION child. This does result in showing Vars from relations that are
not present in the final plan, but that's no different to what we see
when normal base relations are proven dummy.
Without this fix it would be possible to see the following error in
EXPLAIN VERBOSE when all UNION inputs were proven empty.
ERROR: bogus varno: 0
Author: David Rowley <dgrowleyml@gmail.com>
Discussion: https://postgr.es/m/CAApHDvrUASy9sfULMEsM2udvZJP6AoBRCZvHYXYxZTy2tX9FYw@mail.gmail.com M src/backend/optimizer/plan/setrefs.c
M src/backend/optimizer/prep/prepunion.c
M src/test/regress/expected/union.out
M src/test/regress/sql/union.sql
Avoid unnecessary GinFormTuple() calls for incompressible posting lists.
commit : 771cfe22a0982f8716abfa253707e74fbbad873a
author : Masahiko Sawada <msawada@postgresql.org>
date : Mon, 6 Oct 2025 14:02:01 -0700
committer: Masahiko Sawada <msawada@postgresql.org>
date : Mon, 6 Oct 2025 14:02:01 -0700 Previously, we attempted to form a posting list tuple even when
ginCompressPostingList() failed to compress the posting list due to
its size. While there was no functional failure, it always wasted one
GinFormTuple() call when item pointers didn't fit in a posting list
tuple.
This commit ensures that a GIN index tuple is formed only when all
item pointers in the posting list are successfully compressed.
Author: Arseniy Mukhin <arseniy.mukhin.dev@gmail.com>
Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com>
Discussion: https://postgr.es/m/CAE7r3M+C=jcpTD93f_RBHrQp3C+=TAXFs+k4tTuZuuxboK8AvA@mail.gmail.com M src/backend/access/gin/gininsert.c
Optimize hex_encode() and hex_decode() using SIMD.
commit : ec8719ccbfcd78c6b40b5f2b94f60769f3bd08aa
author : Nathan Bossart <nathan@postgresql.org>
date : Mon, 6 Oct 2025 12:28:50 -0500
committer: Nathan Bossart <nathan@postgresql.org>
date : Mon, 6 Oct 2025 12:28:50 -0500 The hex_encode() and hex_decode() functions serve as the workhorses
for hexadecimal data for bytea's text format conversion functions,
and some workloads are sensitive to their performance. This commit
adds new implementations that use routines from port/simd.h, which
testing indicates are much faster for larger inputs. For small or
invalid inputs, we fall back on the existing scalar versions.
Since we are using port/simd.h, these optimizations apply to both
x86-64 and AArch64.
Author: Nathan Bossart <nathandbossart@gmail.com>
Co-authored-by: Chiranmoy Bhattacharya <chiranmoy.bhattacharya@fujitsu.com>
Co-authored-by: Susmitha Devanga <devanga.susmitha@fujitsu.com>
Reviewed-by: John Naylor <johncnaylorls@gmail.com>
Discussion: https://postgr.es/m/aLhVWTRy0QPbW2tl%40nathan M src/backend/utils/adt/encode.c
M src/include/port/simd.h
M src/test/regress/expected/strings.out
M src/test/regress/sql/strings.sql
Revert "Improve docs syntax checking"
commit : 5b5e8a29c13aa583f8a674cb65f92a204da24be8
author : Andrew Dunstan <andrew@dunslane.net>
date : Mon, 6 Oct 2025 07:53:31 -0400
committer: Andrew Dunstan <andrew@dunslane.net>
date : Mon, 6 Oct 2025 07:53:31 -0400 This reverts commit b292256272623d1a7532f3893a4565d1944742b4.
Further discussion is needed
Discussion: https://postgr.es/m/0198ec0f-0269-4cf4-b4a7-22c05b3047cb@eisentraut.org M .cirrus.tasks.yml
M doc/src/sgml/Makefile
M doc/src/sgml/meson.build
D doc/src/sgml/sgml_syntax_check.pl
Expose sequence page LSN via pg_get_sequence_data.
commit : b93172ca59f4ae317b2b9dfbf7f342b237101256
author : Amit Kapila <akapila@postgresql.org>
date : Mon, 6 Oct 2025 08:27:22 +0000
committer: Amit Kapila <akapila@postgresql.org>
date : Mon, 6 Oct 2025 08:27:22 +0000 This patch enhances the pg_get_sequence_data function to include the
page-level LSN (Log Sequence Number) of the sequence. This additional
metadata will be used by upcoming patches to support synchronization
of sequences during logical replication.
By exposing the LSN, we enable more accurate tracking of sequence
changes, which is essential for maintaining consistency across
replicated nodes.
Author: vignesh C <vignesh21@gmail.com>
Reviewed-by: shveta malik <shveta.malik@gmail.com>
Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com>
Reviewed-by: Hayato Kuroda <kuroda.hayato@fujitsu.com>
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>
Discussion: https://www.postgresql.org/message-id/CAA4eK1LC+KJiAkSrpE_NwvNdidw9F2os7GERUeSxSKv71gXysQ@mail.gmail.com M src/backend/commands/sequence.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/test/regress/expected/sequence.out
M src/test/regress/sql/sequence.sql
Add comment in ginxlog.h about block used with ginxlogInsertListPage
commit : 42c6b74d8928885135ba35ffdb7fb60602953e2d
author : Michael Paquier <michael@paquier.xyz>
date : Mon, 6 Oct 2025 16:23:51 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Mon, 6 Oct 2025 16:23:51 +0900 All the other structures describe the list of blocks used, and in the
case of a GIN_INSERT_LISTPAGE record block 0 refers to a list page with
the items added to it.
Author: Kirill Reshke <reshkekirill@gmail.com>
Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Discussion: https://postgr.es/m/CALdSSPgk=9WRoXhZy5fdk+T1hiau7qbL_vn94w_L1N=gtEdbsg@mail.gmail.com M src/include/access/ginxlog.h
Remove block information from description of some WAL records for GIN
commit : 7072a8855e84287f63ee4155124455145d70534c
author : Michael Paquier <michael@paquier.xyz>
date : Mon, 6 Oct 2025 16:14:59 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Mon, 6 Oct 2025 16:14:59 +0900 The WAL records XLOG_GIN_INSERT and XLOG_GIN_VACUUM_DATA_LEAF_PAGE
included some information about the blocks added to the record.
This information is already provided by XLogRecGetBlockRefInfo() with
much more details about the blocks included in each record, like the
compression information, for example. This commit removes the block
information that existed in the record descriptions specific to GIN.
Author: Kirill Reshke <reshkekirill@gmail.com>
Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Discussion: https://postgr.es/m/CALdSSPgk=9WRoXhZy5fdk+T1hiau7qbL_vn94w_L1N=gtEdbsg@mail.gmail.com M src/backend/access/rmgrdesc/gindesc.c
Add stats_reset to pg_stat_all_{tables,indexes} and related views
commit : a5b543258aa29e181abe59b3183b685650d24651
author : Michael Paquier <michael@paquier.xyz>
date : Mon, 6 Oct 2025 15:31:21 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Mon, 6 Oct 2025 15:31:21 +0900 It is possible to call pg_stat_reset_single_table_counters() on a
relation (index or table) but the reset time was missing from the system
views showing their statistics.
This commit adds the reset time as an attribute of pg_stat_all_tables,
pg_stat_all_indexes, and other relations related to them.
Bump catalog version.
Bump PGSTAT_FILE_FORMAT_ID, as a result of the new field added to
PgStat_StatTabEntry.
Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Reviewed-by: Sami Imseih <samimseih@gmail.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://postgr.es/m/aN8l182jKxEq1h9f@paquier.xyz M doc/src/sgml/monitoring.sgml
M src/backend/catalog/system_views.sql
M src/backend/utils/activity/pgstat.c
M src/backend/utils/activity/pgstat_relation.c
M src/backend/utils/adt/pgstatfuncs.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/include/pgstat.h
M src/include/utils/pgstat_internal.h
M src/test/regress/expected/rules.out
M src/test/regress/expected/stats.out
M src/test/regress/sql/stats.sql
Add test for pg_stat_reset_single_table_counters() on index
commit : c173aaff98f898564998c0f5e4df9b6fca8a0f9c
author : Michael Paquier <michael@paquier.xyz>
date : Mon, 6 Oct 2025 14:34:45 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Mon, 6 Oct 2025 14:34:45 +0900 stats.sql is already doing some tests coverage on index statistics, by
retrieving for example idx_scan and friends in pg_stat_all_tables.
pg_stat_reset_single_table_counters() is supported for an index for a
long time, but the case was never covered.
This commit closes the gap, by using this reset function on an index,
cross-checking the contents of pg_stat_all_indexes.
Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Discussion: https://postgr.es/m/aN8l182jKxEq1h9f@paquier.xyz M src/test/regress/expected/stats.out
M src/test/regress/sql/stats.sql
Fix two comments in numeric.c
commit : 0c7f103028202cec94e12cbe45cebdb5c8fbc392
author : Michael Paquier <michael@paquier.xyz>
date : Mon, 6 Oct 2025 11:18:30 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Mon, 6 Oct 2025 11:18:30 +0900 The comments at the top of numeric_int4_safe() and numeric_int8_safe()
mentioned respectively int4_numeric() and int8_numeric(). The intention
is to refer to numeric_int4() and numeric_int8().
Oversights in 4246a977bad6.
Reported-by: jian he <jian.universality@gmail.com>
Discussion: https://postgr.es/m/CACJufxFfVt7Jx9_j=juxXyP-6tznN8OcvS9E-QSgp0BrD8KUgA@mail.gmail.com M src/backend/utils/adt/numeric.c
Use SOCK_ERRNO[_SET] in fe-secure-gssapi.c.
commit : ea78bd6d5d0f18c09db1e3ec6fd19be38d706030
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Sun, 5 Oct 2025 16:27:47 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Sun, 5 Oct 2025 16:27:47 -0400 On Windows, this code did not handle error conditions correctly at
all, since it looked at "errno" which is not used for socket-related
errors on that platform. This resulted, for example, in failure
to connect to a PostgreSQL server with GSSAPI enabled.
We have a convention for dealing with this within libpq, which is to
use SOCK_ERRNO and SOCK_ERRNO_SET rather than touching errno directly;
but the GSSAPI code is a relative latecomer and did not get that memo.
(The equivalent backend code continues to use errno, because the
backend does this differently. Maybe libpq's approach should be
rethought someday.)
Apparently nobody tries to build libpq with GSSAPI support on Windows,
or we'd have heard about this before, because it's been broken all
along. Back-patch to all supported branches.
Author: Ning Wu <ning94803@gmail.com>
Co-authored-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/CAFGqpvg-pRw=cdsUpKYfwY6D3d-m9tw8WMcAEE7HHWfm-oYWvw@mail.gmail.com
Backpatch-through: 13 M src/interfaces/libpq/fe-secure-gssapi.c
Don't include access/htup_details.h in executor/tuptable.h
commit : 1a8b5b11e48a8fb086228542d1d4b379f23bdc1e
author : Álvaro Herrera <alvherre@kurilemu.de>
date : Sun, 5 Oct 2025 18:00:38 +0200
committer: Álvaro Herrera <alvherre@kurilemu.de>
date : Sun, 5 Oct 2025 18:00:38 +0200 This is not at all needed; I suspect it was a simple mistake in commit
5408e233f066. It causes htup_details.h to bleed into a huge number of
places via execnodes.h. Remove it and fix fallout.
Discussion: https://postgr.es/m/202510021240.ptc2zl5cvwen@alvherre.pgsql M contrib/pageinspect/btreefuncs.c
M contrib/pageinspect/gistfuncs.c
M contrib/pg_stat_statements/pg_stat_statements.c
M contrib/pg_walinspect/pg_walinspect.c
M contrib/postgres_fdw/connection.c
M contrib/xml2/xslt_proc.c
M src/backend/access/common/printsimple.c
M src/backend/access/common/printtup.c
M src/backend/access/common/tupconvert.c
M src/backend/backup/walsummaryfuncs.c
M src/backend/catalog/pg_attrdef.c
M src/backend/catalog/pg_largeobject.c
M src/backend/catalog/pg_parameter_acl.c
M src/backend/commands/explain_dr.c
M src/backend/commands/proclang.c
M src/backend/commands/statscmds.c
M src/backend/executor/nodeGatherMerge.c
M src/backend/executor/nodeMemoize.c
M src/backend/executor/tstoreReceiver.c
M src/backend/optimizer/path/indxpath.c
M src/backend/optimizer/util/pathnode.c
M src/backend/parser/parse_coerce.c
M src/backend/parser/parse_expr.c
M src/backend/utils/adt/arrayfuncs.c
M src/backend/utils/adt/hbafuncs.c
M src/backend/utils/adt/json.c
M src/backend/utils/adt/misc.c
M src/backend/utils/adt/rangetypes.c
M src/backend/utils/adt/xid8funcs.c
M src/backend/utils/fmgr/fmgr.c
M src/backend/utils/misc/guc.c
M src/include/executor/tuptable.h
M src/test/modules/injection_points/injection_stats_fixed.c
Don't include execnodes.h in brin.h or gin.h
commit : 1b6f61bd89889f704656005e7c1f1a40255230e5
author : Álvaro Herrera <alvherre@kurilemu.de>
date : Sun, 5 Oct 2025 17:35:25 +0200
committer: Álvaro Herrera <alvherre@kurilemu.de>
date : Sun, 5 Oct 2025 17:35:25 +0200 These headers don't need execnodes.h for anything. I think they never
have.
Discussion: https://postgr.es/m/202510021240.ptc2zl5cvwen@alvherre.pgsql M src/backend/access/brin/brin_bloom.c
M src/include/access/brin.h
M src/include/access/gin.h
M src/include/access/gin_private.h
Teach UNION planner to remove dummy inputs
commit : 03d40e4b523b2075c198aa89d9445ea8297f8eca
author : David Rowley <drowley@postgresql.org>
date : Sat, 4 Oct 2025 14:30:03 +1300
committer: David Rowley <drowley@postgresql.org>
date : Sat, 4 Oct 2025 14:30:03 +1300 This adjusts UNION planning so that the planner produces more optimal
plans when one or more of the UNION's subqueries have been proven to be
empty (a dummy rel).
If any of the inputs are empty, then that input can be removed from the
Append / MergeAppend. Previously, a const-false "Result" node would
appear to represent this. Removing empty inputs has a few extra
benefits when only 1 union child remains as it means the Append or
MergeAppend can be removed in setrefs.c, making the plan slightly faster
to execute. Also, we can provide better n_distinct estimates by looking
at the sole remaining input rel's statistics.
Author: David Rowley <dgrowleyml@gmail.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/CAApHDvri53PPF76c3M94_QNWbJfXjyCnjXuj_2=LYM-0m8WZtw@mail.gmail.com M src/backend/optimizer/prep/prepunion.c
M src/test/regress/expected/union.out
M src/test/regress/sql/union.sql
Use bms_add_members() instead of bms_union() when possible
commit : 5092aae431e3e1a20324ea3a42a181c63f703d0d
author : David Rowley <drowley@postgresql.org>
date : Sat, 4 Oct 2025 12:19:31 +1300
committer: David Rowley <drowley@postgresql.org>
date : Sat, 4 Oct 2025 12:19:31 +1300 bms_union() causes a new set to be allocated. What this caller needs is
members added to an existing set. bms_add_members() is the tool for
that job.
This is just a matter of fixing an inefficiency due to surplus memory
allocations. No bugs being fixed.
The only other place I found that might be valid to apply this change is
in markNullableIfNeeded(), but I opted not to do that due to the risk to
reward ratio not looking favorable. The risk being that there *could* be
another pointer pointing to the Bitmapset.
Author: David Rowley <dgrowleyml@gmail.com>
Reviewed-by: Greg Burd <greg@burd.me>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/CAApHDvoCcoS-p5tZNJLTxFOKTYNjqVh7Dwf+5ikDUBwnvWftRw@mail.gmail.com M src/backend/optimizer/prep/prepunion.c
Optimize vector8_has_le() on AArch64.
commit : f8f4afe751fc75e1d3093fa634934018f440c29c
author : Nathan Bossart <nathan@postgresql.org>
date : Fri, 3 Oct 2025 14:02:47 -0500
committer: Nathan Bossart <nathan@postgresql.org>
date : Fri, 3 Oct 2025 14:02:47 -0500 Presently, the SIMD implementation of this function uses unsigned
saturating subtraction to find bytes less than or equal to the
given value, which is a workaround for the lack of unsigned
comparison instructions on some architectures. However, Neon
offers vminvq_u8(), which returns the minimum (unsigned) value in
the vector. This commit adds a Neon-specific implementation that
uses vminvq_u8() to optimize vector8_has_le() on AArch64.
In passing, adjust the SSE2 implementation to use vector8_min() and
vector8_eq() to find values less than or equal to the given value.
This was the only use of vector8_ssub(), so it has been removed.
Reviewed-by: John Naylor <johncnaylorls@gmail.com>
Discussion: https://postgr.es/m/aNHDNDSHleq0ogC_%40nathan M src/include/port/simd.h
Make some use of anonymous unions [DSM registry].
commit : 74b41f5a77b8586356d02227c92e7e47380ac228
author : Nathan Bossart <nathan@postgresql.org>
date : Fri, 3 Oct 2025 10:14:33 -0500
committer: Nathan Bossart <nathan@postgresql.org>
date : Fri, 3 Oct 2025 10:14:33 -0500 Make some use of anonymous unions, which are allowed as of C11, as
examples and encouragement for future code, and to test compilers.
This commit changes the DSMRegistryEntry struct.
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Discussion: https://postgr.es/m/aNKsDg0fJwqhZdXX%40nathan M src/backend/storage/ipc/dsm_registry.c
Tidy-up unneeded NULL parameter checks from SQL function
commit : a69b55cd47274d897f4d92c466bfda461c9acfda
author : David Rowley <drowley@postgresql.org>
date : Fri, 3 Oct 2025 23:04:37 +1300
committer: David Rowley <drowley@postgresql.org>
date : Fri, 3 Oct 2025 23:04:37 +1300 This function is marked as strict, so we can safely remove the checks
checking for NULL input parameters.
Author: David Rowley <dgrowleyml@gmail.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>
Discussion: https://postgr.es/m/CAApHDvqiN0+mbooUOSCDALc=GoM8DmTbCdvwnCwak6Wb2O1ZJA@mail.gmail.com M src/test/modules/test_bitmapset/test_bitmapset.c
Fix reuse-after-free hazard in dead_items_reset
commit : 54ab74865147c0051357d23af63314ff5e7332f4
author : John Naylor <john.naylor@postgresql.org>
date : Fri, 3 Oct 2025 16:05:02 +0700
committer: John Naylor <john.naylor@postgresql.org>
date : Fri, 3 Oct 2025 16:05:02 +0700 In similar vein to commit ccc8194e427, a reset instance of a shared
memory TID store happened to occupy the same private memory as the old
one for the entry point, since the chunk freed after the last round
of index vacuuming was put on the context's freelist. The failure
to update the vacrel->dead_items pointer was evident by nudging the
system to allocate memory in a different area. This was not discovered
at the time of the earlier commit since our regression tests didn't
cover multiple index passes with parallel vacuum.
Backpatch to v17, when TidStore came in.
Author: Kevin Oommen Anish <kevin.o@zohocorp.com>
Reviewed-by: Richard Guo <guofenglinux@gmail.com>
Tested-by: Richard Guo <guofenglinux@gmail.com>
Discussion: https://postgr.es/m/199a07cbdfc.7a1c4aac25838.1675074408277594551%40zohocorp.com
Backpatch-through: 17 M src/backend/access/heap/vacuumlazy.c
Fix incorrect function reference in comment
commit : 605bfb7dbe5d952b91b92d8b7b98cef549dab36c
author : Richard Guo <rguo@postgresql.org>
date : Fri, 3 Oct 2025 16:34:42 +0900
committer: Richard Guo <rguo@postgresql.org>
date : Fri, 3 Oct 2025 16:34:42 +0900 The comment incorrectly references the defunct function
BufFileOpenShared(), which was replaced in commit dcac5e7ac.
This patch updates the comment to refer to the current function
BufFileOpenFileSet().
Author: Zhang Mingli <zmlpostgres@gmail.com>
Reviewed-by: wenhui qiu <qiuwenhuifx@gmail.com>
Reviewed-by: Richard Guo <guofenglinux@gmail.com>
Discussion: https://postgr.es/m/1cb48b4c-54ab-40cc-b355-0b3c2af6d3f7@Spark M src/backend/utils/sort/logtape.c
pgbench: Fail cleanly when finding a COPY result state
commit : 902c08887aa183100b161ef48f1a2434af079213
author : Michael Paquier <michael@paquier.xyz>
date : Fri, 3 Oct 2025 14:03:55 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Fri, 3 Oct 2025 14:03:55 +0900 Currently, pgbench aborts when a COPY response is received in
readCommandResponse(). However, as PQgetResult() returns an empty
result when there is no asynchronous result, through getCopyResult(),
the logic done at the end of readCommandResponse() for the error path
leads to an infinite loop.
This commit forcefully exits the COPY state with PQendcopy() before
moving to the error handler when fiding a COPY state, avoiding the
infinite loop. The COPY protocol is not supported by pgbench anyway, as
an error is assumed in this case, so giving up is better than having the
tool be stuck forever. pgbench was interruptible in this state.
A TAP test is added to check that an error happens if trying to use
COPY.
Author: Anthonin Bonnefoy <anthonin.bonnefoy@datadoghq.com>
Discussion: https://postgr.es/m/CAO6_XqpHyF2m73ifV5a=5jhXxH2chk=XrgefY+eWWPe2Eft3=A@mail.gmail.com
Backpatch-through: 13 M src/bin/pgbench/pgbench.c
M src/bin/pgbench/t/001_pgbench_with_server.pl
Add IGNORE NULLS/RESPECT NULLS option to Window functions.
commit : 25a30bbd4235a49c854036c84fe90f2bc5a87652
author : Tatsuo Ishii <ishii@postgresql.org>
date : Fri, 3 Oct 2025 09:47:36 +0900
committer: Tatsuo Ishii <ishii@postgresql.org>
date : Fri, 3 Oct 2025 09:47:36 +0900 Add IGNORE NULLS/RESPECT NULLS option (null treatment clause) to lead,
lag, first_value, last_value and nth_value window functions. If
unspecified, the default is RESPECT NULLS which includes NULL values
in any result calculation. IGNORE NULLS ignores NULL values.
Built-in window functions are modified to call new API
WinCheckAndInitializeNullTreatment() to indicate whether they accept
IGNORE NULLS/RESPECT NULLS option or not (the API can be called by
user defined window functions as well). If WinGetFuncArgInPartition's
allowNullTreatment argument is true and IGNORE NULLS option is given,
WinGetFuncArgInPartition() or WinGetFuncArgInFrame() will return
evaluated function's argument expression on specified non NULL row (if
it exists) in the partition or the frame.
When IGNORE NULLS option is given, window functions need to visit and
evaluate same rows over and over again to look for non null rows. To
mitigate the issue, 2-bit not null information array is created while
executing window functions to remember whether the row has been
already evaluated to NULL or NOT NULL. If already evaluated, we could
skip the evaluation work, thus we could get better performance.
Author: Oliver Ford <ojford@gmail.com>
Co-authored-by: Tatsuo Ishii <ishii@postgresql.org>
Reviewed-by: Krasiyan Andreev <krasiyan@gmail.com>
Reviewed-by: Andrew Gierth <andrew@tao11.riddles.org.uk>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: David Fetter <david@fetter.org>
Reviewed-by: Vik Fearing <vik@postgresfriends.org>
Reviewed-by: "David G. Johnston" <david.g.johnston@gmail.com>
Reviewed-by: Chao Li <lic@highgo.com>
Discussion: https://postgr.es/m/flat/CAGMVOdsbtRwE_4+v8zjH1d9xfovDeQAGLkP_B6k69_VoFEgX-A@mail.gmail.com M doc/src/sgml/func/func-window.sgml
M doc/src/sgml/syntax.sgml
M src/backend/catalog/sql_features.txt
M src/backend/executor/nodeWindowAgg.c
M src/backend/optimizer/util/clauses.c
M src/backend/parser/gram.y
M src/backend/parser/parse_func.c
M src/backend/utils/adt/ruleutils.c
M src/backend/utils/adt/windowfuncs.c
M src/include/nodes/parsenodes.h
M src/include/nodes/primnodes.h
M src/include/parser/kwlist.h
M src/include/windowapi.h
M src/test/regress/expected/window.out
M src/test/regress/sql/window.sql
Remove check for NULL in STRICT function
commit : 381f5cffae0040a402e082adc5d5e7636035d2a7
author : Daniel Gustafsson <dgustafsson@postgresql.org>
date : Thu, 2 Oct 2025 22:54:37 +0200
committer: Daniel Gustafsson <dgustafsson@postgresql.org>
date : Thu, 2 Oct 2025 22:54:37 +0200 test_bms_make_singleton is defined as STRICT and only takes a single
parameter, so there is no need to check that parameter for NULL as a
NULL input won't ever reach there.
Author: Daniel Gustafsson <daniel@yesql.se>
Discussion: https://postgr.es/m/BC483901-9587-4076-B20F-9A414C66AB78@yesql.se M src/test/modules/test_bitmapset/test_bitmapset.c
Fixes for comments in test_bitmapset
commit : a1b064e4b22686ecaecdf1cee0abfe53b81f6aaf
author : Daniel Gustafsson <dgustafsson@postgresql.org>
date : Thu, 2 Oct 2025 22:41:24 +0200
committer: Daniel Gustafsson <dgustafsson@postgresql.org>
date : Thu, 2 Oct 2025 22:41:24 +0200 This fixes a typo in the sql/expected test files and removes a
leftover comment from test_bitmapset.c from when the functions
invoked bms_free.
Author: Daniel Gustafsson <daniel@yesql.se>
Reported-by: David Rowley <dgrowleyml@gmail.com>
Discussion: https://postgr.es/m/978D21E8-9D3B-40EA-A4B1-F87BABE7868C@yesql.se M src/test/modules/test_bitmapset/expected/test_bitmapset.out
M src/test/modules/test_bitmapset/sql/test_bitmapset.sql
M src/test/modules/test_bitmapset/test_bitmapset.c
Improve docs syntax checking
commit : b292256272623d1a7532f3893a4565d1944742b4
author : Andrew Dunstan <andrew@dunslane.net>
date : Tue, 30 Sep 2025 15:39:15 -0400
committer: Andrew Dunstan <andrew@dunslane.net>
date : Tue, 30 Sep 2025 15:39:15 -0400 Move the checks out of the Makefile into a perl script that can be
called from both the Makefile and meson.build. The set of files checked
is simplified, so it is just all the sgml and xsl files found in
docs/src/sgml directory tree.
Along the way make some adjustments to .cirrus.tasks.yml to support this
better in CI.
Also ensure that the checks are part of the Makefile's html target.
Author: Nazir Bilal Yavuz <byavuz81@gmail.com>
Co-Author: Andrew Dunstan <andrew@dunslane.net>
Discussion: https://postgr.es/m/CAN55FZ3BnM+0twT-ZWL8As9oBEte_b+SBU==cz6Hk8JUCM_5Wg@mail.gmail.com M .cirrus.tasks.yml
M doc/src/sgml/Makefile
M doc/src/sgml/meson.build
A doc/src/sgml/sgml_syntax_check.pl
doc: Improve wording for base64url definition
commit : 482bc0705d807a8cf4d959e9a42f179ff4b9b121
author : Daniel Gustafsson <dgustafsson@postgresql.org>
date : Thu, 2 Oct 2025 11:47:46 +0200
committer: Daniel Gustafsson <dgustafsson@postgresql.org>
date : Thu, 2 Oct 2025 11:47:46 +0200 This sentence should be "the alphabet uses" due to it referring to
multiple cases of use.
Reported-by: Erik Rijkers <er@xs4all.nl>
Discussion: https://postgr.es/m/81d6ab37-92dc-75c9-a649-4e1286a343ea@xs4all.nl M doc/src/sgml/func/func-binarystring.sgml
Remove useless pointer update in ginxlog.c
commit : 3f431109dc634918f4a216963c789e842a70ea65
author : Michael Paquier <michael@paquier.xyz>
date : Thu, 2 Oct 2025 17:16:20 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Thu, 2 Oct 2025 17:16:20 +0900 Oversight in 2c03216d8311, when the redo code of GIN got refactored for
the new WAL format where block information has been standardized, as the
payload data got tracked for each block after the change, and not in the
whole record. This is just a cleanup.
Author: Kirill Reshke <reshkekirill@gmail.com>
Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Discussion: https://postgr.es/m/CALdSSPgnAt5L=D_xGXRXLYO5FK1H31_eYEESxdU1n-r4g+6GqA@mail.gmail.com M src/backend/access/gin/ginxlog.c
Generate EUC_CN mappings from gb18030-2022.ucm
commit : 48566180efff2f414ce806ca7705e811451b82ad
author : John Naylor <john.naylor@postgresql.org>
date : Thu, 2 Oct 2025 12:36:24 +0700
committer: John Naylor <john.naylor@postgresql.org>
date : Thu, 2 Oct 2025 12:36:24 +0700 In the wake of cfa6cd292, EUC_CN was the only encoding that used
gb-18030-2000.xml to generate the .map files. Since EUC_CN is a subset
of GB18030, we can easily use the same UCM file. This allows deleting
the XML file from our repository.
Author: Chao Li <lic@highgo.com>
Discussion: https://postgr.es/m/CANWCAZaNRXZ-5NuXmsaMA2mKvMZnCGHZqQusLkpE%2B8YX%2Bi5OYg%40mail.gmail.com M src/backend/utils/mb/Unicode/Makefile
M src/backend/utils/mb/Unicode/UCS_to_EUC_CN.pl
D src/backend/utils/mb/Unicode/gb-18030-2000.xml
pgstattuple: Improve reports generated for indexes (hash, gist, btree)
commit : 684a745f55057edd2365a7125ebcb7a54a4db8f8
author : Michael Paquier <michael@paquier.xyz>
date : Thu, 2 Oct 2025 11:07:30 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Thu, 2 Oct 2025 11:07:30 +0900 pgstattuple checks the state of the pages retrieved for gist and hash
using some check functions from each index AM, respectively
gistcheckpage() and _hash_checkpage(). When these are called, they
would fail when bumping on data that is found as incorrect (like opaque
area size not matching, or empty pages), contrary to btree that simply
discards these cases and continues to aggregate data.
Zero pages can happen after a crash, with these AMs being able to do an
internal cleanup when these are seen. Also, sporadic failures are
annoying when doing for example a large-scale diagnostic query based on
pgstattuple with a join of pg_class, as it forces one to use tricks like
quals to discard hash or gist indexes, or use a PL wrapper able to catch
errors.
This commit changes the reports generated for btree, gist and hash to
be more user-friendly;
- When seeing an empty page, report it as free space. This new rule
applies to gist and hash, and already applied to btree.
- For btree, a check based on the size of BTPageOpaqueData is added.
- For gist indexes, gistcheckpage() is not called anymore, replaced by a
check based on the size of GISTPageOpaqueData.
- For hash indexes, instead of _hash_getbuf_with_strategy(), use a
direct call to ReadBufferExtended(), coupled with a check based on
HashPageOpaqueData. The opaque area size check was already used.
- Pages that do not match these criterias are discarded from the stats
reports generated.
There have been a couple of bug reports over the years that complained
about the current behavior for hash and gist, as being not that useful,
with nothing being done about it. Hence this change is backpatched down
to v13.
Reported-by: Noah Misch <noah@leadboat.com>
Author: Nitin Motiani <nitinmotiani@google.com>
Reviewed-by: Dilip Kumar <dilipbalaut@gmail.com>
Discussion: https://postgr.es/m/CAH5HC95gT1J3dRYK4qEnaywG8RqjbwDdt04wuj8p39R=HukayA@mail.gmail.com
Backpatch-through: 13 M contrib/pgstattuple/pgstattuple.c
test_json_parser: Speed up 002_inline.pl
commit : fd726b8379a8191da9e74d28761c967eda13f5f2
author : Jacob Champion <jchampion@postgresql.org>
date : Wed, 1 Oct 2025 09:48:57 -0700
committer: Jacob Champion <jchampion@postgresql.org>
date : Wed, 1 Oct 2025 09:48:57 -0700 Some macOS machines are having trouble with 002_inline, which executes
the JSON parser test executables hundreds of times in a nested loop.
Both developer machines and buildfarm critters have shown excessive test
durations, upwards of 20 seconds.
Push the innermost loop of 002_inline, which iterates through differing
chunk sizes, down into the test executable. (I'd eventually like to push
all of the JSON unit tests down into C, but this is an easy win in the
short term.) Testers have reported a speedup between 4-9x.
Reported-by: Robert Haas <robertmhaas@gmail.com>
Suggested-by: Andres Freund <andres@anarazel.de>
Tested-by: Andrew Dunstan <andrew@dunslane.net>
Tested-by: Tom Lane <tgl@sss.pgh.pa.us>
Tested-by: Robert Haas <robertmhaas@gmail.com>
Discussion: https://postgr.es/m/CA%2BTgmobKoG%2BgKzH9qB7uE4MFo-z1hn7UngqAe9b0UqNbn3_XGQ%40mail.gmail.com
Backpatch-through: 17 M src/test/modules/test_json_parser/README
M src/test/modules/test_json_parser/t/002_inline.pl
M src/test/modules/test_json_parser/test_json_parser_incremental.c
Fix compiler warnings around _CRT_glob
commit : 3e908fb54ff8fa857180bc212ca79c7bd95dcc2c
author : Peter Eisentraut <peter@eisentraut.org>
date : Wed, 1 Oct 2025 17:13:52 +0200
committer: Peter Eisentraut <peter@eisentraut.org>
date : Wed, 1 Oct 2025 17:13:52 +0200 Newer compilers warned about
extern int _CRT_glob = 0;
which is indeed a mysterious C construction, as it combines "extern"
and an initialization. It turns out that according to the C standard,
the "extern" is ignored here, so we can remove it to resolve the
warnings. But then we also need to add a real extern
declaration (without initializer) to satisfy
-Wmissing-variable-declarations.
(Note that this code is only active on MinGW.)
Discussion: https://www.postgresql.org/message-id/1053279b-da01-4eb4-b7a3-da6b5d8f73d1%40eisentraut.org M src/common/exec.c
Minor fixups of test_bitmapset.c
commit : 3a661580685964dd2ca192306a202934f268fc5c
author : David Rowley <drowley@postgresql.org>
date : Wed, 1 Oct 2025 18:50:28 +1300
committer: David Rowley <drowley@postgresql.org>
date : Wed, 1 Oct 2025 18:50:28 +1300 The macro's comment had become outdated from a prior version and there's
now no longer a need for the do/while loop (or my misplaced semi-colon).
Author: David Rowley <dgrowleyml@gmail.com>
Discussion: https://postgr.es/m/CAApHDvr+P454SP_LDvB=bViPAbDQhV1Jmg5M55GEKz0d3z25NA@mail.gmail.com M src/test/modules/test_bitmapset/test_bitmapset.c
test_bitmapset: Simplify code of the module
commit : 9952f6c05a40976063c3e2a4482873ec710f01a2
author : Michael Paquier <michael@paquier.xyz>
date : Wed, 1 Oct 2025 14:17:54 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Wed, 1 Oct 2025 14:17:54 +0900 Two macros are added in this module, to cut duplicated patterns:
- PG_ARG_GETBITMAPSET(), for input argument handling, with knowledge
about NULL.
- PG_RETURN_BITMAPSET_AS_TEXT(), that generates a text result from a
Bitmapset.
These changes limit the code so as the SQL functions are now mostly
wrappers of the equivalent C function. Functions that use integer input
arguments still need some NULL handling, like bms_make_singleton().
A NULL input is translated to "<>", which is what nodeToString()
generates. Some of the tests are able to generate this result.
Per discussion, the calls of bms_free() are removed. These may be
justified if the functions are used in a rather long-lived memory
context, but let's keep the code minimal for now. These calls used NULL
checks, which were also not necessary as NULL is an input authorized by
bms_free().
Some of the tests existed to cover behaviors related to the SQL
functions for NULL inputs. Most of them are still relevant, as the
routines of bitmapset.c are able to handle such cases.
The coverage reports of bitmapset.c and test_bitmapset.c remain the
same after these changes, with 300 lines of C code removed.
Author: David Rowley <dgrowleyml@gmail.com>
Co-authored-by: Greg Burd <greg@burd.me>
Discussion: https://postgr.es/m/CAApHDvqghMnm_zgSNefto9oaEJ0S-3Cgb3gdsV7XvLC-hMS02Q@mail.gmail.com M src/test/modules/test_bitmapset/expected/test_bitmapset.out
M src/test/modules/test_bitmapset/sql/test_bitmapset.sql
M src/test/modules/test_bitmapset/test_bitmapset–1.0.sql
M src/test/modules/test_bitmapset/test_bitmapset.c
Rename pg_builtin_integer_constant_p to pg_integer_constant_p
commit : 8e2acda2b098bf53120721e16a7b1055c4e5b3a6
author : Peter Eisentraut <peter@eisentraut.org>
date : Tue, 30 Sep 2025 21:15:46 +0200
committer: Peter Eisentraut <peter@eisentraut.org>
date : Tue, 30 Sep 2025 21:15:46 +0200 Since it's not builtin. Also fix a related typo.
Reviewed-by: David Rowley <dgrowleyml@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/CAApHDvom02B_XNVSkvxznVUyZbjGAR%2B5myA89ZcbEd3%3DPA9UcA%40mail.gmail.com M src/include/c.h
M src/include/utils/elog.h
pgbench: Fix error reporting in readCommandResponse().
commit : 19d4f9ffc207c66b4755ffdf2dbd84b47e31460a
author : Fujii Masao <fujii@postgresql.org>
date : Tue, 30 Sep 2025 23:52:28 +0900
committer: Fujii Masao <fujii@postgresql.org>
date : Tue, 30 Sep 2025 23:52:28 +0900 pgbench uses readCommandResponse() to process server responses.
When readCommandResponse() encounters an error during a call to
PQgetResult() to fetch the current result, it attempts to report it
with an additional error message from PQerrorMessage(). However,
previously, this extra error message could be lost or become incorrect.
The cause was that after fetching the current result (and detecting
an error), readCommandResponse() called PQgetResult() again to
peek at the next result. This second call could overwrite the libpq
connection's error message before the original error was reported,
causing the error message retrieved from PQerrorMessage() to be
lost or overwritten.
This commit fixes the issue by updating readCommandResponse()
to use PQresultErrorMessage() instead of PQerrorMessage()
to retrieve the error message generated when the PQgetResult()
for the current result causes an error, ensuring the correct message
is reported.
Backpatch to all supported versions.
Author: Yugo Nagata <nagata@sraoss.co.jp>
Reviewed-by: Chao Li <lic@highgo.com>
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>
Discussion: https://postgr.es/m/20250925110940.ebacc31725758ec47d5432c6@sraoss.co.jp
Backpatch-through: 13 M src/bin/pgbench/pgbench.c
Fix typo in pgstat_relation.c header comment
commit : 91df0465a69ddd249a548a63ee9d4aef6f984bf0
author : David Rowley <drowley@postgresql.org>
date : Wed, 1 Oct 2025 00:23:38 +1300
committer: David Rowley <drowley@postgresql.org>
date : Wed, 1 Oct 2025 00:23:38 +1300 Looks like a copy and paste error from pgstat_function.c
Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Discussion: https://postgr.es/m/aNuaVMAdTGbgBgqh@ip-10-97-1-34.eu-west-3.compute.internal M src/backend/utils/activity/pgstat_relation.c
Revert "Make some use of anonymous unions [pgcrypto]"
commit : f5aabe6d58e08179cc656539c4bd0145525bf22f
author : Peter Eisentraut <peter@eisentraut.org>
date : Tue, 30 Sep 2025 13:12:16 +0200
committer: Peter Eisentraut <peter@eisentraut.org>
date : Tue, 30 Sep 2025 13:12:16 +0200 This reverts commit efcd5199d8cb8e5098f79b38d0c46004e69d1a46.
I rebased my patch series incorrectly. This patch contained unrelated
parts from another patch, which made the overall build fail. Revert
for now and reconsider. M contrib/pgcrypto/openssl.c
M contrib/pgcrypto/px.h
M src/common/cryptohash.c
Make some use of anonymous unions [plpython]
commit : 8b7f27fef3e225e0b34f0d9f1a9f20770b72d01c
author : Peter Eisentraut <peter@eisentraut.org>
date : Tue, 30 Sep 2025 12:24:57 +0200
committer: Peter Eisentraut <peter@eisentraut.org>
date : Tue, 30 Sep 2025 12:24:57 +0200 Make some use of anonymous unions, which are allowed as of C11, as
examples and encouragement for future code, and to test compilers.
This commit changes some structures in plpython.
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/f00a9968-388e-4f8c-b5ef-5102e962d997%40eisentraut.org M src/pl/plpython/plpy_exec.c
M src/pl/plpython/plpy_typeio.c
M src/pl/plpython/plpy_typeio.h
Make some use of anonymous unions [pgcrypto]
commit : efcd5199d8cb8e5098f79b38d0c46004e69d1a46
author : Peter Eisentraut <peter@eisentraut.org>
date : Tue, 30 Sep 2025 12:24:38 +0200
committer: Peter Eisentraut <peter@eisentraut.org>
date : Tue, 30 Sep 2025 12:24:38 +0200 Make some use of anonymous unions, which are allowed as of C11, as
examples and encouragement for future code, and to test compilers.
This commit changes some structures in pgcrypto.
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/f00a9968-388e-4f8c-b5ef-5102e962d997%40eisentraut.org M contrib/pgcrypto/openssl.c
M contrib/pgcrypto/px.h
M src/common/cryptohash.c
Make some use of anonymous unions [reorderbuffer xact_time]
commit : 57d46dff9b0ba8dc50fb37166373ea7638ecd2b9
author : Peter Eisentraut <peter@eisentraut.org>
date : Tue, 30 Sep 2025 12:24:15 +0200
committer: Peter Eisentraut <peter@eisentraut.org>
date : Tue, 30 Sep 2025 12:24:15 +0200 Make some use of anonymous unions, which are allowed as of C11, as
examples and encouragement for future code, and to test compilers.
This commit changes the ReorderBufferTXN struct.
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/f00a9968-388e-4f8c-b5ef-5102e962d997%40eisentraut.org M contrib/test_decoding/test_decoding.c
M src/backend/replication/logical/proto.c
M src/backend/replication/logical/reorderbuffer.c
M src/backend/replication/pgoutput/pgoutput.c
M src/include/replication/reorderbuffer.h
Make some use of anonymous unions [pg_locale_t]
commit : 4b7e6c73b0df3384345052616727a25505db5fcb
author : Peter Eisentraut <peter@eisentraut.org>
date : Tue, 30 Sep 2025 12:23:47 +0200
committer: Peter Eisentraut <peter@eisentraut.org>
date : Tue, 30 Sep 2025 12:23:47 +0200 Make some use of anonymous unions, which are allowed as of C11, as
examples and encouragement for future code, and to test compilers.
This commit changes the pg_locale_t type.
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/f00a9968-388e-4f8c-b5ef-5102e962d997%40eisentraut.org M src/backend/utils/adt/pg_locale_builtin.c
M src/backend/utils/adt/pg_locale_icu.c
M src/backend/utils/adt/pg_locale_libc.c
M src/include/utils/pg_locale.h
Do a tiny bit of header file maintenance
commit : 3bf31dd24314ceea078f1ae9549c1a60c8a186d8
author : Álvaro Herrera <alvherre@kurilemu.de>
date : Tue, 30 Sep 2025 12:28:29 +0200
committer: Álvaro Herrera <alvherre@kurilemu.de>
date : Tue, 30 Sep 2025 12:28:29 +0200 Stop including utils/relcache.h in access/genam.h, and stop including
htup_details.h in nodes/tidbitmap.h. Both these files (genam.h and
tidbitmap.h) are widely used in other header files, so it's in our best
interest that they remain as lean as reasonable.
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/202509291356.o5t6ny2hoa3q@alvherre.pgsql M contrib/btree_gist/btree_bit.c
M src/backend/nodes/tidbitmap.c
M src/backend/utils/adt/network_spgist.c
M src/include/access/amapi.h
M src/include/access/genam.h
M src/include/access/nbtree.h
M src/include/nodes/tidbitmap.h
Reorder XLogNeedsFlush() checks to be more consistent
commit : bb68cde4136b02a7e51e8876891cd0a61c5726ca
author : Michael Paquier <michael@paquier.xyz>
date : Tue, 30 Sep 2025 09:38:32 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Tue, 30 Sep 2025 09:38:32 +0900 During recovery, XLogNeedsFlush() checks the minimum recovery LSN point
instead of the flush LSN point. The same condition checks are used when
updating the minimum recovery point in UpdateMinRecoveryPoint(), but are
written in reverse order.
This commit makes the order of the checks consistent between
XLogNeedsFlush() and UpdateMinRecoveryPoint(), improving the code
clarity. Note that the second check (as ordered by this commit) relies
on InRecovery, which is true only in the startup process. So this makes
XLogNeedsFlush() cheaper in the startup process with the first check
acting as a shortcut while doing crash recovery, where
LocalMinRecoveryPoint is an invalid LSN.
Author: Melanie Plageman <melanieplageman@gmail.com>
Reviewed-by: Dilip Kumar <dilipbalaut@gmail.com>
Discussion: https://postgr.es/m/aMIHNRTP6Wj6vw1s%40paquier.xyz M src/backend/access/transam/xlog.c
injection_points: Add proper locking when reporting fixed-variable stats
commit : 3cc689f833b1c9c5b52f1fe07c0e0fd817e23c8b
author : Michael Paquier <michael@paquier.xyz>
date : Tue, 30 Sep 2025 09:02:09 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Tue, 30 Sep 2025 09:02:09 +0900 Contrary to its siblings for the archiver, the bgwriter and the
checkpointer stats, pgstat_report_inj_fixed() can be called
concurrently. This was causing an assertion failure, while messing up
with the stats.
This code is aimed at being a template for extension developers, so it
is not a critical issue, but let's be correct. This module has also
been useful for some benchmarking, at least for me, and that was how I
have discovered this issue.
Oversight in f68cd847fa40.
Author: Michael Paquier <michael@paquier.xyz>
Reviewed-by: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: wenhui qiu <qiuwenhuifx@gmail.com>
Discussion: https://postgr.es/m/aNnXbAXHPFUWPIz2@paquier.xyz
Backpatch-through: 18 M src/test/modules/injection_points/injection_stats_fixed.c
Add GROUP BY ALL.
commit : ef38a4d9756db9ae1d20f40aa39f3cf76059b81a
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Mon, 29 Sep 2025 16:55:17 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Mon, 29 Sep 2025 16:55:17 -0400 GROUP BY ALL is a form of GROUP BY that adds any TargetExpr that does
not contain an aggregate or window function into the groupClause of
the query, making it exactly equivalent to specifying those same
expressions in an explicit GROUP BY list.
This feature is useful for certain kinds of data exploration. It's
already present in some other DBMSes, and the SQL committee recently
accepted it into the standard, so we can be reasonably confident in
the syntax being stable. We do have to invent part of the semantics,
as the standard doesn't allow for expressions in GROUP BY, so they
haven't specified what to do with window functions. We assume that
those should be treated like aggregates, i.e., left out of the
constructed GROUP BY list.
In passing, wordsmith some existing documentation about GROUP BY,
and update some neglected synopsis entries in select_into.sgml.
Author: David Christensen <david@pgguru.net>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/CAHM0NXjz0kDwtzoe-fnHAqPB1qA8_VJN0XAmCgUZ+iPnvP5LbA@mail.gmail.com M doc/src/sgml/queries.sgml
M doc/src/sgml/ref/select.sgml
M doc/src/sgml/ref/select_into.sgml
M src/backend/parser/analyze.c
M src/backend/parser/gram.y
M src/backend/parser/parse_clause.c
M src/backend/utils/adt/ruleutils.c
M src/include/catalog/catversion.h
M src/include/nodes/parsenodes.h
M src/include/parser/parse_clause.h
M src/test/regress/expected/aggregates.out
M src/test/regress/sql/aggregates.sql
Remove unused parameter from find_window_run_conditions()
commit : b91067c8995235445d76353bcd218ef383fe970d
author : David Rowley <drowley@postgresql.org>
date : Tue, 30 Sep 2025 08:37:42 +1300
committer: David Rowley <drowley@postgresql.org>
date : Tue, 30 Sep 2025 08:37:42 +1300 ... and check_and_push_window_quals().
Similar to 4be9024d5, but it seems there was yet another unused
parameter.
Author: Matheus Alcantara <matheusssilv97@gmail.com>
Discussion: https://postgr.es/m/DD5BEKORUG34.2M8492NMB9DB8@gmail.com M src/backend/optimizer/path/allpaths.c
Fix StatisticsObjIsVisibleExt() for pg_temp.
commit : a95393ecdb23563bd47eeb2c943640c88592d82b
author : Noah Misch <noah@leadboat.com>
date : Mon, 29 Sep 2025 11:15:44 -0700
committer: Noah Misch <noah@leadboat.com>
date : Mon, 29 Sep 2025 11:15:44 -0700 Neighbor get_statistics_object_oid() ignores objects in pg_temp, as has
been the standard for non-relation, non-type namespace searches since
CVE-2007-2138. Hence, most operations that name a statistics object
correctly decline to map an unqualified name to a statistics object in
pg_temp. StatisticsObjIsVisibleExt() did not. Consequently,
pg_statistics_obj_is_visible() wrongly returned true for such objects,
psql \dX wrongly listed them, and getObjectDescription()-based ereport()
and pg_describe_object() wrongly omitted namespace qualification. Any
malfunction beyond that would depend on how a human or application acts
on those wrong indications. Commit
d99d58cdc8c0b5b50ee92995e8575c100b1a458a introduced this. Back-patch to
v13 (all supported versions).
Reviewed-by: Nathan Bossart <nathandbossart@gmail.com>
Discussion: https://postgr.es/m/20250920162116.2e.nmisch@google.com
Backpatch-through: 13 M src/backend/catalog/namespace.c
M src/test/regress/expected/stats_ext.out
M src/test/regress/sql/stats_ext.sql
test_bitmapset: Expand more the test coverage
commit : 5668fff3c512a61b7f8a2b9bf04270578cf5665a
author : Michael Paquier <michael@paquier.xyz>
date : Mon, 29 Sep 2025 15:17:27 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Mon, 29 Sep 2025 15:17:27 +0900 This commit expands the set of tests added by 00c3d87a5cab, to bring the
coverage of bitmapset.c close to 100% by addressing a lot of corner
cases (most of these relate to word counts and reallocations).
Some of the functions of this module also have their own idea of the
result to return depending on the input values given. These are
specific to the module, still let's add more coverage for all of them.
Some comments are made more consistent in the tests, while on it.
Author: Greg Burd <greg@burd.me>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://postgr.es/m/aNR-gsGmLnMaNT5i@paquier.xyz M src/test/modules/test_bitmapset/expected/test_bitmapset.out
M src/test/modules/test_bitmapset/sql/test_bitmapset.sql
M src/test/modules/test_bitmapset/test_bitmapset–1.0.sql
M src/test/modules/test_bitmapset/test_bitmapset.c
Improve planner's width estimates for set operations
commit : 2cb49c609bd9bf44d319591df7bef1eb107cb375
author : David Rowley <drowley@postgresql.org>
date : Mon, 29 Sep 2025 14:36:39 +1300
committer: David Rowley <drowley@postgresql.org>
date : Mon, 29 Sep 2025 14:36:39 +1300 For UNION, EXCEPT and INTERSECT, we were not very good at estimating the
PathTarget.width for the set operation. Since the targetlist of the set
operation is made up of Vars with varno==0, this would result in
get_expr_width() applying a default estimate based on the Var's type
rather than taking width estimates from any relation's statistics.
Here we attempt to improve the situation by looking at the width estimates
for the set operation child paths and calculating the average width of the
relevant child paths weighted over the estimated number of rows. For
UNION and INTERSECT, the relevant paths to look at are *all* child paths.
For EXCEPT, since we don't return rows from the right-hand child (only
possibly remove left-hand rows matching those), we use only the left-hand
child for width estimates.
This also adjusts the hashed-UNION Path's PathTarget to use the same
PathTarget as its Append subpath. Both PathTargets will be the same and
are void of any resjunk columns, per generate_append_tlist(). Making
the AggPath use the same PathTarget saves having to adjust the "width"
of the AggPath's PathTarget too.
This was reported as a bug by sunw.fnst, but it's not something we ever
claimed to do properly. Plus, if we were to adjust this in back
branches, plans could change as the estimated input sizes to Sorts and
Hash Aggregates could go up or down. Plan choices aren't something we
want to destabilize in stable versions.
Reported-by: sunw.fnst <936739278@qq.com>
Author: David Rowley <drowleyml@gmail.com>
Discussion: https://postgr.es/m/tencent_34CF8017AB81944A4C08DD089D410AB6C306@qq.com M src/backend/optimizer/prep/prepunion.c
injection_points: Enable entry count in its variable-sized stats
commit : acf0960c23090ea6690f2c5da3bc2625836516a9
author : Michael Paquier <michael@paquier.xyz>
date : Mon, 29 Sep 2025 09:06:32 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Mon, 29 Sep 2025 09:06:32 +0900 This serves as coverage for the tracking of entry count added by
7bd2975fa92b as built-in variable-sized stats kinds have no need for it,
at least not yet.
A new function, called injection_points_stats_count(), is added to the
module. It is able to return the number of entries. This has been
useful when doing some benchmarking to check the sanity of the counts.
Author: Michael Paquier <michael@paquier.xyz>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://postgr.es/m/aMPKWR81KT5UXvEr@paquier.xyz M src/test/modules/injection_points/injection_points–1.0.sql
M src/test/modules/injection_points/injection_stats.c
M src/test/modules/injection_points/t/001_stats.pl
Add support for tracking of entry count in pgstats
commit : 7bd2975fa92bd6b5ade5e34f75d474ac838ec0c6
author : Michael Paquier <michael@paquier.xyz>
date : Mon, 29 Sep 2025 08:57:57 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Mon, 29 Sep 2025 08:57:57 +0900 Stats kinds can set a new option called "track_entry_count" (disabled by
default, available for variable-numbered stats) that will make pgstats
track the number of entries that exist in its shared hashtable.
As there is only one code path where a new entry is added, and one code
path where entries are freed, the count tracking is straight-forward in
its implementation. Reads of these counters are optimistic, and may
change across two calls. The counter is incremented when an entry is
created (not when reused), and is decremented when an entry is freed
from the hashtable (marked for drop with its refcount reaching 0), which
is something that pgstats decides internally.
A first use case of this facility would be pg_stat_statements, where we
need to be able to cap the number of entries that would be stored in the
shared hashtable, based on its "max" GUC. The module currently relies
on hash_get_num_entries(), which offers a cheap way to count how many
entries are in its hash table, but we cannot do that in pgstats for
variable-sized stats kinds as a single hashtable is used for all the
stats kinds. Independently of PGSS, this is useful for other custom
stats kinds that want to cap, control, or track the number of entries
they have, without depending on a potentially expensive sequential scan
to know the number of entries while holding an extra exclusive lock.
Author: Michael Paquier <michael@paquier.xyz>
Reviewed-by: Sami Imseih <samimseih@gmail.com>
Reviewed-by: Keisuke Kuroda <keisuke.kuroda.3862@gmail.com>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://postgr.es/m/aMPKWR81KT5UXvEr@paquier.xyz M src/backend/utils/activity/pgstat.c
M src/backend/utils/activity/pgstat_shmem.c
M src/include/utils/pgstat_internal.h
Refactor to avoid code duplication in transformPLAssignStmt.
commit : b0fb2c6aa5a485e28210e13ae5536c1231b1261f
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Sat, 27 Sep 2025 17:17:51 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Sat, 27 Sep 2025 17:17:51 -0400 transformPLAssignStmt contained many lines cribbed directly from
transformSelectStmt. I had supposed that we could manage to keep
the two copies in sync, but the bug just fixed in 7504d2be9 shows
that that hope was foolish. Let's refactor so there's just one copy.
The main stumbling block to doing this is that transformPLAssignStmt
has a chunk of custom code that has to run after transformTargetList
but before we potentially modify the tlist further during analysis
of ORDER BY and GROUP BY. Rather than make transformSelectStmt fully
aware of PLAssignStmt processing, I put that code into a callback
function. It still feels a little bit ugly, but it's not too awful,
and surely it's better than a hundred lines of duplicated code.
The steps involved in processing a PLAssignStmt remain exactly
the same as before, just in different places.
Author: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/31027.1758919078@sss.pgh.pa.us M src/backend/parser/analyze.c
M src/tools/pgindent/typedefs.list
Fix missed copying of groupDistinct in transformPLAssignStmt.
commit : 7504d2be9eb45207b48476919e4539d93c389d86
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Sat, 27 Sep 2025 14:29:41 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Sat, 27 Sep 2025 14:29:41 -0400 Because we failed to do this, DISTINCT in GROUP BY DISTINCT would be
ignored in PL/pgSQL assignment statements. It's not surprising that
no one noticed, since such statements will throw an error if the query
produces more than one row. That eliminates most scenarios where
advanced forms of GROUP BY could be useful, and indeed makes it hard
even to find a simple test case. Nonetheless it's wrong.
This is directly the fault of be45be9c3 which added the groupDistinct
field, but I think much of the blame has to fall on c9d529848, in
which I incautiously supposed that we'd manage to keep two copies of
a big chunk of parse-analysis logic in sync. As a follow-up, I plan
to refactor so that there's only one copy. But that seems useful
only in master, so let's use this one-line fix for the back branches.
Author: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/31027.1758919078@sss.pgh.pa.us
Backpatch-through: 14 M src/backend/parser/analyze.c
Teach MSVC that elog/ereport ERROR doesn't return
commit : 59c2f03d1ece7b9b215751a508b3a84728419246
author : David Rowley <drowley@postgresql.org>
date : Sat, 27 Sep 2025 22:41:04 +1200
committer: David Rowley <drowley@postgresql.org>
date : Sat, 27 Sep 2025 22:41:04 +1200 It had always been intended that this already works correctly as
pg_unreachable() uses __assume(0) on MSVC, and that directs the compiler
in a way so it knows that a given function won't return. However, with
ereport_domain(), it didn't work...
It's now understood that the failure to determine that elog(ERROR) does not
return comes from the inability of the MSVC compiler to detect the "const
int elevel_" is the same as the "elevel" macro parameter. MSVC seems to be
unable to make the "if (elevel_ >= ERROR) branch constantly-true when the
macro is used with any elevel >= ERROR, therefore the pg_unreachable() is
seen to only be present in a *conditional* branch rather than present
*unconditionally*.
While there seems to be no way to force the compiler into knowing that
elevel_ is equal to elevel within the ereport_domain() macro, there is a
way in C11 to determine if the elevel parameter is a compile-time
constant or not. This is done via some hackery using the _Generic()
intrinsic function, which gives us functionality similar to GCC's
__builtin_constant_p(), albeit only for integers.
Here we define pg_builtin_integer_constant_p() for this purpose.
Callers can check for availability via HAVE_PG_BUILTIN_INTEGER_CONSTANT_P.
ereport_domain() has been adjusted to use
pg_builtin_integer_constant_p() instead of __builtin_constant_p().
It's not quite clear at this stage if this now allows us to forego doing
the likes of "return NULL; /* keep compiler quiet */" as there may be other
compilers in use that have similar struggles. It's just a matter of time
before someone commits a function that does not "return" a value after
an elog(ERROR). Let's make time and lack of complaints about said commit
be the judge of if we need to continue the "/* keep compiler quiet */"
palaver.
Author: David Rowley <drowleyml@gmail.com>
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Discussion: https://postgr.es/m/CAApHDvom02B_XNVSkvxznVUyZbjGAR+5myA89ZcbEd3=PA9UcA@mail.gmail.com M src/include/c.h
M src/include/utils/elog.h
Remove unused for_all_tables field from AlterPublicationStmt.
commit : 66cdef4425f3295a2cfbce3031b3c0f0b5dffc04
author : Masahiko Sawada <msawada@postgresql.org>
date : Fri, 26 Sep 2025 09:23:00 -0700
committer: Masahiko Sawada <msawada@postgresql.org>
date : Fri, 26 Sep 2025 09:23:00 -0700 No backpatch as AlterPublicationStmt struct is exposed.
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Reviewed-by: Álvaro Herrera <alvherre@kurilemu.de>
Discussion: https://postgr.es/m/CAD21AoC6B6AuxWOST-TkxUbDgp8FwX=BLEJZmKLG_VrH-hfxpA@mail.gmail.com M src/backend/commands/publicationcmds.c
M src/include/nodes/parsenodes.h
Split vacuumdb to create vacuuming.c/h
commit : c4067383cb2c155c4cfea2351036709e2ebb3535
author : Álvaro Herrera <alvherre@kurilemu.de>
date : Fri, 26 Sep 2025 16:21:28 +0200
committer: Álvaro Herrera <alvherre@kurilemu.de>
date : Fri, 26 Sep 2025 16:21:28 +0200 This allows these routines to be reused by a future utility heavily
based on vacuumdb.
I made a few relatively minor changes from the original, most notably:
- objfilter was declared as an enum but the values are bit-or'ed, and
individual bits are tested throughout the code. We've discussed this
coding pattern in other contexts and stayed away from it, on the
grounds that the values so generated aren't really true values of the
enum. This commit changes it to be a bits32 with a few #defines for
the flag definitions, the way we do elsewhere. Also, instead of being
a global variable, it's now in the vacuumingOptions struct.
- Two booleans, analyze_only (in vacuumingOptions) and analyze_in_stages
(passed around as a separate boolean argument), are really determining
what "mode" the program runs in -- it's either vacuum, or one of those
two modes. I have three adjectives for them: inconsistent,
unergonomic, unorthodox. Removing these and replacing them with a
mode enum to be kept in vacuumingOptions makes the code structure easier
to understand in a couple of places, and it'll be useful for the new
mode we add next, so do that.
Reviewed-by: Antonin Houska <ah@cybertec.at>
Discussion: https://postgr.es/m/202508301750.cbohxyy2pcce@alvherre.pgsql M src/bin/scripts/Makefile
M src/bin/scripts/meson.build
M src/bin/scripts/nls.mk
M src/bin/scripts/vacuumdb.c
A src/bin/scripts/vacuuming.c
A src/bin/scripts/vacuuming.h
M src/tools/pgindent/typedefs.list
Create a separate file listing backend types
commit : dbf8cfb4f02eb9ec5525de1761675f9babfd30e3
author : Álvaro Herrera <alvherre@kurilemu.de>
date : Fri, 26 Sep 2025 15:21:49 +0200
committer: Álvaro Herrera <alvherre@kurilemu.de>
date : Fri, 26 Sep 2025 15:21:49 +0200 Use our established coding pattern to reduce maintenance pain when
adding other per-process-type characteristics.
Like PG_KEYWORD, PG_CMDTAG, PG_RMGR.
To keep the strings translatable, the relevant makefile now also scans
src/include for this specific file. I didn't want to have it scan all
.h files, as then gettext would have to scan all header files. I didn't
find any way to affect the meson behavior in this respect though.
Author: Álvaro Herrera <alvherre@kurilemu.de>
Co-authored-by: Jonathan Gonzalez V. <jonathan.abdiel@gmail.com>
Discussion: https://postgr.es/m/202507151830.dwgz5nmmqtdy@alvherre.pgsql M src/backend/nls.mk
M src/backend/postmaster/launch_backend.c
M src/backend/utils/init/miscinit.c
A src/include/postmaster/proctypelist.h
M src/tools/pginclude/headerscheck
pgbench: Fix assertion failure with retriable errors in pipeline mode.
commit : 8bb174295e8920fe202e2fb4c8d271e4546b9e98
author : Fujii Masao <fujii@postgresql.org>
date : Fri, 26 Sep 2025 21:23:43 +0900
committer: Fujii Masao <fujii@postgresql.org>
date : Fri, 26 Sep 2025 21:23:43 +0900 When running pgbench with --verbose-errors option and a custom script that
triggered retriable errors (e.g., serialization errors) in pipeline mode,
an assertion failure could occur:
Assertion failed: (sql_script[st->use_file].commands[st->command]->type == 1), function commandError, file pgbench.c, line 3062.
The failure happened because pgbench assumed these errors would only occur
during SQL commands, but in pipeline mode they can also happen during
\endpipeline meta command.
This commit fixes the assertion failure by adjusting the assertion check to
allow such errors during either SQL commands or \endpipeline.
Backpatch to v15, where the assertion check was introduced.
Author: Yugo Nagata <nagata@sraoss.co.jp>
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>
Discussion: https://postgr.es/m/CAHGQGwGWQMOzNkQs-LmpDHdNC0h8dmAuUMRvZrEntQi5a-b=Kg@mail.gmail.com M src/bin/pgbench/pgbench.c
Improve stability of btree page split on ERRORs
commit : 85e0ff62b68224b3354e47fb71b78d309063d06c
author : Michael Paquier <michael@paquier.xyz>
date : Fri, 26 Sep 2025 08:41:06 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Fri, 26 Sep 2025 08:41:06 +0900 This improves the stability of VACUUM when processing btree indexes,
which was previously able to trigger an assertion failure in
_bt_lock_subtree_parent() when an error was previously thrown outside
the scope of _bt_split() when splitting a btree page. VACUUM would
consider the index as in a corrupted state as the right page would not
be zeroed for the error thrown (allocation failure is one pattern).
In a non-assert build, VACUUM is able to succeed, reporting what it sees
as a corruption while attempting to fix the index. This would manifest
as a LOG message, as of:
LOG: failed to re-find parent key in index "idx" for deletion target
page N
CONTEXT: while vacuuming index "idx" of relation "public.tab"
This commit improves the code to rely on two PGAlignedBlocks that are
used as a temporary space for the left and right pages. The main change
concerns the right page, whose contents are now copied into the
"temporary" PGAlignedBlock page while its original space is zeroed. Its
contents are moved from the PGAlignedBlock page back to the page once we
enter in the critical section used for the split. This simplifies the
split logic, as it is not necessary to zero the right page before
throwing an error anymore. Hence errors can now be thrown outside the
split code. For the left page, this shaves one allocation, with
PageGetTempPage() being previously used.
The previous logic originates from commit 8fa30f906b, at a point where
PGAlignedBlock did not exist yet. This could be argued as something
that should be backpatched, but the lack of complaints indicates that it
may not be necessary.
Author: Konstantin Knizhnik <knizhnik@garret.ru>
Discussion: https://postgr.es/m/566dacaf-5751-47e4-abc6-73de17a5d42a@garret.ru M src/backend/access/nbtree/nbtinsert.c
Fix misleading comment in pg_get_statisticsobjdef_string()
commit : 3760d278dc4165d5eef7435fc62d8ebe13b8e793
author : David Rowley <drowley@postgresql.org>
date : Fri, 26 Sep 2025 11:04:15 +1200
committer: David Rowley <drowley@postgresql.org>
date : Fri, 26 Sep 2025 11:04:15 +1200 The comment claimed that a TABLESPACE reference was added to the
resulting string, but that's not true. Looks like the comment was
copied from pg_get_indexdef_string() without being adjusted correctly.
Reported-by: jian he <jian.universality@gmail.com>
Discussion: https://postgr.es/m/CACJufxHwVPgeu8o9D8oUeDQYEHTAZGt-J5uaJNgYMzkAW7MiCA@mail.gmail.com M src/backend/utils/adt/ruleutils.c
Remove unused parameter from check_and_push_window_quals
commit : 4be9024d57330b10d90e723787a83a6de8827b84
author : David Rowley <drowley@postgresql.org>
date : Fri, 26 Sep 2025 10:21:30 +1200
committer: David Rowley <drowley@postgresql.org>
date : Fri, 26 Sep 2025 10:21:30 +1200 ... and find_window_run_conditions.
This seems to have been around and unused ever since the Run Condition
feature was added in 9d9c02ccd. Let's remove it to clean things up a
bit.
Author: Matheus Alcantara <matheusssilv97@gmail.com>
Discussion: https://postgr.es/m/DD26NJ0Y34ZS.2ZOJPHSY12PFI@gmail.com M src/backend/optimizer/path/allpaths.c
psql: Add COMPLETE_WITH_FILES and COMPLETE_WITH_GENERATOR macros.
commit : 76418a0b676234d2b570a1138c1a43a2018c416f
author : Masahiko Sawada <msawada@postgresql.org>
date : Thu, 25 Sep 2025 14:28:01 -0700
committer: Masahiko Sawada <msawada@postgresql.org>
date : Thu, 25 Sep 2025 14:28:01 -0700 While most tab completions in match_previous_words() use
COMPLETE_WITH* macros to wrap rl_completion_matches(), some direct
calls to rl_completion_matches() still remained.
This commit introduces COMPLETE_WITH_FILES and COMPLETE_WITH_GENERATOR
macros to replace these direct calls, enhancing both code consistency
and readability.
Author: Yugo Nagata <nagata@sraoss.co.jp>
Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com>
Discussion: https://postgr.es/m/20250605100835.b396f9d656df1018f65a4556@sraoss.co.jp M src/bin/psql/tab-complete.in.c
Try to avoid floating-point roundoff error in pg_sleep().
commit : 02c4bc88302a750a2aed20e6f17885bda872d228
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Thu, 25 Sep 2025 17:02:15 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Thu, 25 Sep 2025 17:02:15 -0400 I noticed the surprising behavior that pg_sleep(0.001) will sleep
for 2ms not the expected 1ms. Apparently the float8 calculation of
time-to-sleep is managing to produce something a hair over 1, which
ceil() rounds up to 2, and then WaitLatch() faithfully waits 2ms.
It could be that this works as-expected for some ranges of current
timestamp but not others, which would account for not having seen
it before. In any case, let's try to avoid it by removing the
float arithmetic in the delay calculation. We're stuck with the
declared input type being float8, but we can convert that to integer
microseconds right away, and then work strictly with integral values.
There might still be roundoff surprises for certain input values,
but at least the behavior won't be time-varying.
Author: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Robert Haas <robertmhaas@gmail.com>
Reviewed-by: Nathan Bossart <nathandbossart@gmail.com>
Discussion: https://postgr.es/m/3879137.1758825752@sss.pgh.pa.us M src/backend/utils/adt/misc.c
Add minimal sleep to stats isolation test functions.
commit : e849bd551c323a384f2b14d20a1b7bfaa6127ed7
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Thu, 25 Sep 2025 13:29:02 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Thu, 25 Sep 2025 13:29:02 -0400 The functions test_stat_func() and test_stat_func2() had empty
function bodies, so that they took very little time to run. This made
it possible that on machines with relatively low timer resolution the
functions could return before the clock advanced, making the test fail
(as seen on buildfarm members fruitcrow and hamerkop).
To avoid that, pg_sleep for 10us during the functions. As far as we
can tell, all current hardware has clock resolution much less than
that. (The current implementation of pg_sleep will round it up to
1ms anyway, but someday that might get improved.)
Author: Michael Banck <mbanck@gmx.net>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/68d413a3.a70a0220.24c74c.8be9@mx.google.com
Backpatch-through: 15 M src/test/isolation/specs/stats.spec
Fix array allocation bugs in SetExplainExtensionState.
commit : 803ef0ed49eec57990053da1091f9e3b5a7fb839
author : Robert Haas <rhaas@postgresql.org>
date : Thu, 25 Sep 2025 11:43:52 -0400
committer: Robert Haas <rhaas@postgresql.org>
date : Thu, 25 Sep 2025 11:43:52 -0400 If we already have an extension_state array but see a new extension_id
much larger than the highest the extension_id we've previously seen,
the old code might have failed to expand the array to a large enough
size, leading to disaster. Also, if we don't have an extension array
at all and need to create one, we should make sure that it's big enough
that we don't have to resize it instantly.
Reported-by: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: http://postgr.es/m/2949591.1758570711@sss.pgh.pa.us
Backpatch-through: 18 M src/backend/commands/explain_state.c
Doc: clean up documentation for new UUID functions.
commit : 507aa16125c50809dfc926e7ee72938053c01a39
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Thu, 25 Sep 2025 11:23:27 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Thu, 25 Sep 2025 11:23:27 -0400 Fix assorted failures to conform to our normal style for function
documentation, such as lack of parentheses and incorrect markup.
Author: Marcos Pegoraro <marcos@f10.com.br>
Co-authored-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/CAB-JLwbocrFjKfGHoKY43pHTf49Ca2O0j3WVebC8z-eQBMPJyw@mail.gmail.com
Backpatch-through: 18 M doc/src/sgml/func/func-uuid.sgml
Teach doc/src/sgml/Makefile about the new func/*.sgml files.
commit : 170a8a3f4605b2c37c36d9928ec6cd2404c615f8
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Thu, 25 Sep 2025 11:09:26 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Thu, 25 Sep 2025 11:09:26 -0400 These were omitted from build dependencies and also tab/nbsp
checks, with the result that "make" did nothing after modifying
a func/*.sgml file.
Oversight in 4e23c9ef6. AFAICT we don't need any comparable
changes in meson.build, or at least I don't see it doing anything
special for the pre-existing ref/*.sgml files. M doc/src/sgml/Makefile
Remove preprocessor guards from injection points
commit : 0b3ce7878af757b8c91721ccecbbb75c10a22ef4
author : Daniel Gustafsson <dgustafsson@postgresql.org>
date : Thu, 25 Sep 2025 15:27:33 +0200
committer: Daniel Gustafsson <dgustafsson@postgresql.org>
date : Thu, 25 Sep 2025 15:27:33 +0200 When defining an injection point there is no need to wrap the definition
with USE_INJECTION_POINT guards, the INJECTION_POINT macro is available
in all builds. Remove to make the code consistent.
Author: Hayato Kuroda <kuroda.hayato@fujitsu.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>
Discussion: https://postgr.es/m/OSCPR01MB14966C8015DEB05ABEF2CE077F51FA@OSCPR01MB14966.jpnprd01.prod.outlook.com
Backpatch-through: 17 M src/backend/access/transam/xlog.c
Fix comments in recovery tests
commit : d8f07dbb81a169ff8d54c6684c0ca385b83de757
author : Daniel Gustafsson <dgustafsson@postgresql.org>
date : Thu, 25 Sep 2025 15:24:41 +0200
committer: Daniel Gustafsson <dgustafsson@postgresql.org>
date : Thu, 25 Sep 2025 15:24:41 +0200 Commit 4464fddf removed the large insertions but missed to remove
all the comments referring to them. Also remove a superfluous ')'
in another comment.
Author: Hayato Kuroda <kuroda.hayato@fujitsu.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>
Discussion: https://postgr.es/m/OSCPR01MB149663A99DAF2826BE691C23DF51FA@OSCPR01MB14966.jpnprd01.prod.outlook.com M src/test/recovery/t/046_checkpoint_logical_slot.pl
M src/test/recovery/t/047_checkpoint_physical_slot.pl
Don't include execnodes.h in replication/conflict.h
commit : 7e638d7f5093fd24837ebe709135fa16ef8e3e7b
author : Álvaro Herrera <alvherre@kurilemu.de>
date : Thu, 25 Sep 2025 14:45:08 +0200
committer: Álvaro Herrera <alvherre@kurilemu.de>
date : Thu, 25 Sep 2025 14:45:08 +0200 ... which silently propagates a lot of headers into many places
via pgstat.h, as evidenced by the variety of headers that this patch
needs to add to seemingly random places. Add a minimum of typedefs to
conflict.h to be able to remove execnodes.h, and fix the fallout.
Backpatch to 18, where conflict.h first appeared.
Discussion: https://postgr.es/m/202509191927.uj2ijwmho7nv@alvherre.pgsql M src/backend/access/transam/multixact.c
M src/backend/access/transam/xlogrecovery.c
M src/backend/storage/ipc/waiteventset.c
M src/backend/utils/activity/pgstat_backend.c
M src/include/pgstat.h
M src/include/replication/conflict.h
Update some more forward declarations to use typedef
commit : 81fc3e28e383d9a21843a5ab845a1bd1a1042e12
author : Álvaro Herrera <alvherre@kurilemu.de>
date : Thu, 25 Sep 2025 14:33:19 +0200
committer: Álvaro Herrera <alvherre@kurilemu.de>
date : Thu, 25 Sep 2025 14:33:19 +0200 As commit d4d1fc527bdb.
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Discussion: https://postgr.es/m/202509191025.22agk3fvpilc@alvherre.pgsql M src/backend/access/table/tableam.c
M src/include/access/amapi.h
M src/include/access/brin_internal.h
M src/include/access/genam.h
M src/include/access/heapam.h
M src/include/access/tableam.h
M src/include/nodes/execnodes.h
pgbench: Fix typo in documentation.
commit : 668de0430942829cc6085ab6ee99fd8080d21f0a
author : Fujii Masao <fujii@postgresql.org>
date : Thu, 25 Sep 2025 14:06:12 +0900
committer: Fujii Masao <fujii@postgresql.org>
date : Thu, 25 Sep 2025 14:06:12 +0900 This commit fixes a typo introduced in commit b6290ea48e1.
Reported off-list by Erik Rijkers <er@xs4all.nl> M doc/src/sgml/ref/pgbench.sgml
pgbench: Clarify documentation for \gset and \aset.
commit : b6290ea48e1b8e868516d95cb86a0d3565d63847
author : Fujii Masao <fujii@postgresql.org>
date : Thu, 25 Sep 2025 12:09:32 +0900
committer: Fujii Masao <fujii@postgresql.org>
date : Thu, 25 Sep 2025 12:09:32 +0900 This commit updates the pgbench documentation to list \gset and \aset
as separate terms for easier reading. It also clarifies that \gset raises
an error if the query returns zero or multiple rows, and explains how to
detect cases where the query with \aset returned no rows.
Author: Yugo Nagata <nagata@sraoss.co.jp>
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>
Discussion: https://postgr.es/m/20250626180125.5b896902a3d0bcd93f86c240@sraoss.co.jp M doc/src/sgml/ref/pgbench.sgml
vacuumdb: Do not run VACUUM (ONLY_DATABASE_STATS) when --analyze-only.
commit : 879c492480d0e9ad8155c4269f95c5e8add41901
author : Fujii Masao <fujii@postgresql.org>
date : Thu, 25 Sep 2025 01:38:54 +0900
committer: Fujii Masao <fujii@postgresql.org>
date : Thu, 25 Sep 2025 01:38:54 +0900 Previously, vacuumdb --analyze-only issued VACUUM (ONLY_DATABASE_STATS)
at the end. Since --analyze-only is meant to update optimizer statistics only,
this extra VACUUM command is unnecessary.
This commit prevents vacuumdb --analyze-only from running that redundant
VACUUM command.
Author: Fujii Masao <masao.fujii@gmail.com>
Reviewed-by: Mircea Cadariu <cadariu.mircea@gmail.com>
Discussion: https://postgr.es/m/CAHGQGwEqHGa-k=wbRMucUVihHVXk4NQkK94GNN=ym9cQ5HBSHg@mail.gmail.com M src/bin/scripts/t/100_vacuumdb.pl
M src/bin/scripts/vacuumdb.c
Correct prune WAL record opcode name in comment
commit : ae8ea7278c16a23aa7dfb56c531706c18628ba55
author : Melanie Plageman <melanieplageman@gmail.com>
date : Wed, 24 Sep 2025 12:29:13 -0400
committer: Melanie Plageman <melanieplageman@gmail.com>
date : Wed, 24 Sep 2025 12:29:13 -0400 f83d709760d8 incorrectly refers to a XLOG_HEAP2_PRUNE_FREEZE WAL record
opcode. No such code exists. The relevant opcodes are
XLOG_HEAP2_PRUNE_ON_ACCESS, XLOG_HEAP2_PRUNE_VACUUM_SCAN, and
XLOG_HEAP2_PRUNE_VACUUM_CLEANUP. Correct it.
Author: Melanie Plageman <melanieplageman@gmail.com>
Reviewed-by: Andres Freund <andres@anarazel.de>
Discussion: https://postgr.es/m/yn4zp35kkdsjx6wf47zcfmxgexxt4h2og47pvnw2x5ifyrs3qc%407uw6jyyxuyf7 M src/backend/access/heap/pruneheap.c
Ensure guc_tables.o's dependency on guc_tables.inc.c is known.
commit : aadbcc40bc24362070b5d88769b62f2d62fdedfb
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Wed, 24 Sep 2025 12:28:20 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Wed, 24 Sep 2025 12:28:20 -0400 Without this, rebuilds can malfunction unless --enable-depend is used.
Historically we've expected that you can get away without
--enable-depend as long as you manually clean after changing *.h
files; the makefiles are supposed to handle other sorts of
dependencies. So add this one.
Follow-on to 635998965, so no need for back-patch.
Discussion: https://postgr.es/m/3121329.1758650878@sss.pgh.pa.us M src/backend/utils/misc/Makefile
Include pg_test_timing's full output in the TAP test log.
commit : 7ccbf6d8b5e5a4f45cb77e25f16afcf13cf1dfd3
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Wed, 24 Sep 2025 12:08:55 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Wed, 24 Sep 2025 12:08:55 -0400 We were already doing a short (1-second) pg_test_timing run during
check-world and buildfarm runs. But we weren't doing anything
with the result except for a basic regex-based sanity check.
Collecting that output from buildfarm runs is seeming very
attractive though, because it would help us determine what sort
of timing resolution is available on supported platforms.
It's not very long, so let's just note it verbatim in the TAP log.
Discussion: https://postgr.es/m/3321785.1758728271@sss.pgh.pa.us M src/bin/pg_test_timing/t/001_basic.pl
Fix incorrect and inconsistent comments in tableam.h and heapam.c.
commit : 7fcb32ad023a434e07b7214c1c762ecd410b6969
author : Fujii Masao <fujii@postgresql.org>
date : Thu, 25 Sep 2025 00:51:59 +0900
committer: Fujii Masao <fujii@postgresql.org>
date : Thu, 25 Sep 2025 00:51:59 +0900 This commit corrects several issues in function comments:
* The parameter "rel" was incorrectly referred to as "relation" in the comments
for table_tuple_delete(), table_tuple_update(), and table_tuple_lock().
* In table_tuple_delete(), "changingPart" was listed as an output parameter
in the comments but is actually input.
* In table_tuple_update(), "slot" was listed as an input parameter
in the comments but is actually output.
* The comment for "update_indexes" in table_tuple_update() was mis-indented.
* The comments for heap_lock_tuple() incorrectly referenced a non-existent
"tid" parameter.
Author: Chao Li <lic@highgo.com>
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>
Discussion: https://postgr.es/m/CAEoWx2nB6Ay8g=KEn7L3qbYX_4+sLk9XOMkV0XZqHR4cTY8ZvQ@mail.gmail.com M src/backend/access/heap/heapam.c
M src/include/access/tableam.h
Remove PointerIsValid()
commit : a5b35fcedb542587e7d8b8fcd21a2e0995b82d2f
author : Peter Eisentraut <peter@eisentraut.org>
date : Wed, 24 Sep 2025 15:14:06 +0200
committer: Peter Eisentraut <peter@eisentraut.org>
date : Wed, 24 Sep 2025 15:14:06 +0200 This doesn't provide any value over the standard style of checking the
pointer directly or comparing against NULL.
Also remove related:
- AllocPointerIsValid() [unused]
- IndexScanIsValid() [had one user]
- HeapScanIsValid() [unused]
- InvalidRelation [unused]
Leaving HeapTupleIsValid(), ItemIdIsValid(), PortalIsValid(),
RelationIsValid for now, to reduce code churn.
Reviewed-by: Jacob Champion <jacob.champion@enterprisedb.com>
Discussion: https://www.postgresql.org/message-id/flat/ad50ab6b-6f74-4603-b099-1cd6382fb13d%40eisentraut.org
Discussion: https://www.postgresql.org/message-id/CA+hUKG+NFKnr=K4oybwDvT35dW=VAjAAfiuLxp+5JeZSOV3nBg@mail.gmail.com
Discussion: https://www.postgresql.org/message-id/bccf2803-5252-47c2-9ff0-340502d5bd1c@iki.fi M src/backend/access/common/reloptions.c
M src/backend/access/common/tupdesc.c
M src/backend/access/index/indexam.c
M src/backend/access/transam/xact.c
M src/backend/catalog/index.c
M src/backend/catalog/objectaddress.c
M src/backend/catalog/pg_proc.c
M src/backend/catalog/pg_type.c
M src/backend/commands/foreigncmds.c
M src/backend/commands/tablecmds.c
M src/backend/nodes/outfuncs.c
M src/backend/postmaster/autovacuum.c
M src/backend/storage/ipc/sinvaladt.c
M src/backend/storage/large_object/inv_api.c
M src/backend/utils/adt/acl.c
M src/backend/utils/adt/arrayfuncs.c
M src/backend/utils/adt/datum.c
M src/backend/utils/adt/xml.c
M src/backend/utils/cache/catcache.c
M src/backend/utils/cache/relcache.c
M src/backend/utils/cache/syscache.c
M src/backend/utils/error/assert.c
M src/backend/utils/mmgr/aset.c
M src/backend/utils/mmgr/bump.c
M src/backend/utils/mmgr/generation.c
M src/backend/utils/mmgr/portalmem.c
M src/backend/utils/mmgr/slab.c
M src/include/access/genam.h
M src/include/access/heapam.h
M src/include/access/htup.h
M src/include/access/itup.h
M src/include/c.h
M src/include/lib/radixtree.h
M src/include/storage/itemid.h
M src/include/storage/itemptr.h
M src/include/utils/portal.h
M src/include/utils/rel.h
Fix incorrect option name in usage screen
commit : 0fba25eb720a6a20b8f3c9597dd0417a0d20fc94
author : Daniel Gustafsson <dgustafsson@postgresql.org>
date : Wed, 24 Sep 2025 14:58:18 +0200
committer: Daniel Gustafsson <dgustafsson@postgresql.org>
date : Wed, 24 Sep 2025 14:58:18 +0200 The usage screen incorrectly refered to the --docs option as --sgml.
Backpatch down to v17 where this script was introduced.
Author: Daniel Gustafsson <daniel@yesql.se>
Discussion: https://postgr.es/m/20250729.135638.1148639539103758555.horikyota.ntt@gmail.com
Backpatch-through: 17 M src/backend/utils/activity/generate-wait_event_types.pl
Consistently handle tab delimiters for wait event names
commit : 711ccce38f222e9988882493d95f244e2b02744f
author : Daniel Gustafsson <dgustafsson@postgresql.org>
date : Wed, 24 Sep 2025 14:57:26 +0200
committer: Daniel Gustafsson <dgustafsson@postgresql.org>
date : Wed, 24 Sep 2025 14:57:26 +0200 Format validation and element extraction for intermediate line
strings were inconsistent in their handling of tab delimiters,
which resulted in an unclear error when multiple tab characters
were used as a delimiter. This fixes it by using captures from
the validation regex instead of a separate split() to avoid the
inconsistency. Also, it ensures that \t+ is used consistently
when inspecting the strings.
Author: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>
Discussion: https://postgr.es/m/20250729.135638.1148639539103758555.horikyota.ntt@gmail.com M src/backend/utils/activity/generate-wait_event_types.pl
Update GB18030 encoding from version 2000 to 2022
commit : 5334620eef8f7b429594e6cf9dc97331eda2a8bd
author : John Naylor <john.naylor@postgresql.org>
date : Wed, 24 Sep 2025 13:26:05 +0700
committer: John Naylor <john.naylor@postgresql.org>
date : Wed, 24 Sep 2025 13:26:05 +0700 Mappings for 18 characters have changed, affecting 36 code points. This
is a break in compatibility, but these characters are rarely used.
U+E5E5 (Private Use Area) was previously mapped to \xA3A0. This code
point now maps to \x65356535. Attempting to convert \xA3A0 will now
raise an error.
Separate from the 2022 update, the following mappings were previously
swapped, and subsequently corrected in 2000 and later versions:
* U+E7C7 (Private Use Area) now maps to \x8135F437
* U+1E3F (Latin Small Letter M with Acute) now maps to \xA8BC
The 2022 standard mentions the following policy changes, but they
have no effect in our implementation:
66 new ideographs are now required, but these are mapped
algorithmically so were already handled by utf8_and_gb18030.c.
Nine CJK compatibility ideographs are no longer required, but
implementations may retain them, as does the source we use from
the Unicode Consortium.
Release notes: Compatibility section
For further details, see:
https://www.unicode.org/L2/L2022/22274-disruptive-changes.pdf
https://ken-lunde.medium.com/the-gb-18030-2022-standard-3d0ebaeb4132
Author: Chao Li <lic@highgo.com>
Author: Zheng Tao <taoz@highgo.com>
Discussion: https://postgr.es/m/966d9fc.169.198741fe60b.Coremail.jiaoshuntian%40highgo.com M doc/src/sgml/charset.sgml
M src/backend/utils/mb/Unicode/Makefile
M src/backend/utils/mb/Unicode/UCS_to_GB18030.pl
M src/backend/utils/mb/Unicode/gb18030_to_utf8.map
M src/backend/utils/mb/Unicode/utf8_to_gb18030.map
M src/test/regress/expected/conversion.out
M src/test/regress/sql/conversion.sql
Fix LOCK_TIMEOUT handling during parallel apply.
commit : e41d954da6aa04f0a4453e566d3bcc064512d457
author : Amit Kapila <akapila@postgresql.org>
date : Wed, 24 Sep 2025 04:11:53 +0000
committer: Amit Kapila <akapila@postgresql.org>
date : Wed, 24 Sep 2025 04:11:53 +0000 Previously, the parallel apply worker used SIGINT to receive a graceful
shutdown signal from the leader apply worker. However, SIGINT is also used
by the LOCK_TIMEOUT handler to trigger a query-cancel interrupt. This
overlap caused the parallel apply worker to miss LOCK_TIMEOUT signals,
leading to incorrect behavior during lock wait/contention.
This patch resolves the conflict by switching the graceful shutdown signal
from SIGINT to SIGUSR2.
Reported-by: Zane Duffield <duffieldzane@gmail.com>
Diagnosed-by: Zhijie Hou <houzj.fnst@fujitsu.com>
Author: Hayato Kuroda <kuroda.hayato@fujitsu.com>
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>
Backpatch-through: 16, where it was introduced
Discussion: https://postgr.es/m/CACMiCkXyC4au74kvE2g6Y=mCEF8X6r-Ne_ty4r7qWkUjRE4+oQ@mail.gmail.com M src/backend/postmaster/interrupt.c
M src/backend/replication/logical/applyparallelworker.c
M src/backend/replication/logical/launcher.c
Fix compiler warnings in test_bitmapset
commit : f83fe65f3fc1cae177f6c75f7b38eb951dd217b5
author : Michael Paquier <michael@paquier.xyz>
date : Wed, 24 Sep 2025 08:20:23 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Wed, 24 Sep 2025 08:20:23 +0900 The macros doing conversions of/from "text" from/to Bitmapset were using
arbitrary casts with Datum, something that is not fine since
2a600a93c7be.
These macros do not actually need casts with Datum, as they are given
already "text" and Bitmapset data in input. They are updated to use
cstring_to_text() and text_to_cstring(), fixing the compiler warnings
reported by the buildfarm. Note that appending a -m32 to gcc to trigger
32-bit builds was enough to reproduce the warnings here.
While on it, outer parenthesis are added to TEXT_TO_BITMAPSET(), and
inner parenthesis are removed from BITMAPSET_TO_TEXT(), to make these
macros more consistent with the style used in the tree, based on
suggestions by Tom Lane.
Oversights in commit 00c3d87a5cab.
Reported-by: Tom Lane <tgl@sss.pgh.pa.us>
Author: Greg Burd <greg@burd.me>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://postgr.es/m/3027069.1758606227@sss.pgh.pa.us M src/test/modules/test_bitmapset/test_bitmapset.c
Keep track of what RTIs a Result node is scanning.
commit : f2bae51dfd5b2edc460c86071c577a45a1acbfd7
author : Robert Haas <rhaas@postgresql.org>
date : Tue, 23 Sep 2025 09:07:55 -0400
committer: Robert Haas <rhaas@postgresql.org>
date : Tue, 23 Sep 2025 09:07:55 -0400 Result nodes now include an RTI set, which is only non-NULL when they
have no subplan, and is taken from the relid set of the RelOptInfo that
the Result is generating. ExplainPreScanNode now takes notice of these
RTIs, which means that a few things get schema-qualified in the
regression tests that previously did not. This makes the output more
consistent between cases where some part of the plan tree is replaced by
a Result node and those where this does not happen.
Likewise, pg_overexplain's EXPLAIN (RANGE_TABLE) now displays the RTIs
stored in a Result node just as it already does for other RTI-bearing
node types.
Result nodes also now include a result_reason, which tells us something
about why the Result node was inserted. Using that information, EXPLAIN
now emits, where relevant, a "Replaces" line describing the origin of
a Result node.
The purpose of these changes is to allow code that inspects a Plan
tree to understand the origin of Result nodes that appear therein.
Discussion: http://postgr.es/m/CA+TgmoYeUZePZWLsSO+1FAN7UPePT_RMEZBKkqYBJVCF1s60=w@mail.gmail.com
Reviewed-by: Alexandra Wang <alexandra.wang.oss@gmail.com>
Reviewed-by: Richard Guo <guofenglinux@gmail.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Junwang Zhao <zhjwpku@gmail.com> M contrib/file_fdw/expected/file_fdw.out
M contrib/pg_overexplain/expected/pg_overexplain.out
M contrib/pg_overexplain/pg_overexplain.c
M contrib/postgres_fdw/expected/postgres_fdw.out
M src/backend/commands/explain.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/plan/setrefs.c
M src/include/nodes/plannodes.h
M src/test/regress/expected/aggregates.out
M src/test/regress/expected/case.out
M src/test/regress/expected/explain.out
M src/test/regress/expected/generated_virtual.out
M src/test/regress/expected/groupingsets.out
M src/test/regress/expected/inherit.out
M src/test/regress/expected/join.out
M src/test/regress/expected/merge.out
M src/test/regress/expected/partition_aggregate.out
M src/test/regress/expected/partition_join.out
M src/test/regress/expected/partition_prune.out
M src/test/regress/expected/predicate.out
M src/test/regress/expected/rowsecurity.out
M src/test/regress/expected/rowtypes.out
M src/test/regress/expected/select.out
M src/test/regress/expected/subselect.out
M src/test/regress/expected/tsrf.out
M src/test/regress/sql/explain.sql
M src/tools/pgindent/typedefs.list
doc: Remove trailing whitespace in xref
commit : a48d1ef58652229521ba4b5070e19f857608b22e
author : Daniel Gustafsson <dgustafsson@postgresql.org>
date : Mon, 22 Sep 2025 10:12:31 +0200
committer: Daniel Gustafsson <dgustafsson@postgresql.org>
date : Mon, 22 Sep 2025 10:12:31 +0200 Remove stray whitespace in xref tag.
This was found due to a regression in xmllint 2.15.0 which flagged
this as an error, and at the time of this commit no fix for xmllint
has shipped.
Author: Erik Wienhold <ewie@ewie.name>
Discussion: https://postgr.es/m/f4c4661b-4e60-4c10-9336-768b7b55c084@ewie.name
Backpatch-through: 17 M doc/src/sgml/ref/pg_combinebackup.sgml
Add a test module for Bitmapset
commit : 00c3d87a5cab6e1b816658f15573ea4730c2f17b
author : Michael Paquier <michael@paquier.xyz>
date : Mon, 22 Sep 2025 16:53:00 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Mon, 22 Sep 2025 16:53:00 +0900 Bitmapset has a complex set of APIs, defined in bitmapset.h, and it can
be hard to test edge cases with the backend core code only.
This test module is aimed at closing the gap, and implements a set of
SQL functions that act as wrappers of the low-level C functions of the
same names. These functions rely on text as data type for the input and
the output as Bitmapset as a node has support for these. An extra
function, named test_random_operations(), can be used to stress bitmaps
with random member values and a defined number of operations potentially
useful for other purposes than only tests.
The coverage increases from 85.2% to 93.4%. It should be possible to
cover more code paths, but at least it's a beginning.
Author: Greg Burd <greg@burd.me>
Reviewed-by: Nathan Bossart <nathandbossart@gmail.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://postgr.es/m/7BD1ABDB-B03A-464A-9BA9-A73B55AD8A1F@getmailspring.com M src/test/modules/Makefile
M src/test/modules/meson.build
A src/test/modules/test_bitmapset/.gitignore
A src/test/modules/test_bitmapset/Makefile
A src/test/modules/test_bitmapset/expected/test_bitmapset.out
A src/test/modules/test_bitmapset/meson.build
A src/test/modules/test_bitmapset/sql/test_bitmapset.sql
A src/test/modules/test_bitmapset/test_bitmapset–1.0.sql
A src/test/modules/test_bitmapset/test_bitmapset.c
A src/test/modules/test_bitmapset/test_bitmapset.control
Fix various incorrect filename references
commit : 9fc7f6ab7226d7c9dbe4ff333130c82f92749f69
author : David Rowley <drowley@postgresql.org>
date : Mon, 22 Sep 2025 13:32:36 +1200
committer: David Rowley <drowley@postgresql.org>
date : Mon, 22 Sep 2025 13:32:36 +1200 Author: Chao Li <li.evan.chao@gmail.com>
Author: David Rowley <dgrowleyml@gmail.com>
Discussion: https://postgr.es/m/CAEoWx2=hOBCPm-Z=F15twr_23XjHeoXSbifP5GdEdtWona97wQ@mail.gmail.com M contrib/amcheck/verify_common.h
M contrib/isn/UPC.h
M src/backend/commands/explain_dr.c
M src/bin/pg_combinebackup/copy_file.c
M src/include/access/gin_tuple.h
M src/include/storage/io_worker.h
Fix misleading comment in RangeTblEntry
commit : e3a0304eba2813821f3db8ab9d45fc584c23575b
author : Richard Guo <rguo@postgresql.org>
date : Mon, 22 Sep 2025 10:04:39 +0900
committer: Richard Guo <rguo@postgresql.org>
date : Mon, 22 Sep 2025 10:04:39 +0900 The comment describing join_using_alias incorrectly referred to the
alias field as being defined "below", when it actually appears earlier
in the RangeTblEntry struct. This patch fixes that.
Author: Steve Lau <stevelauc@outlook.com>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://postgr.es/m/TYWPR01MB10612B020C33FD08F729415CEB613A@TYWPR01MB10612.jpnprd01.prod.outlook.com M src/include/nodes/parsenodes.h
Fix meson build with -Duuid=ossp when using version older than 0.60
commit : 293a3286d764df15d834fe5ac3bac4dc513817e7
author : Michael Paquier <michael@paquier.xyz>
date : Mon, 22 Sep 2025 08:03:23 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Mon, 22 Sep 2025 08:03:23 +0900 The package for the UUID library may be named "uuid" or "ossp-uuid", and
meson.build has been using a single call of dependency() with multiple
names, something only supported since meson 0.60.0.
The minimum version of meson supported by Postgres is 0.57.2 on HEAD,
since f039c2244110, and 0.54 on stable branches down to 16.
Author: Oreo Yang <oreo.yang@hotmail.com>
Reviewed-by: Nazir Bilal Yavuz <byavuz81@gmail.com>
Discussion: https://postgr.es/m/OS3P301MB01656E6F91539770682B1E77E711A@OS3P301MB0165.JPNP301.PROD.OUTLOOK.COM
Backpatch-through: 16 M meson.build
Add support for base64url encoding and decoding
commit : e1d917182c1953b16b32a39ed2fe38e3d0823047
author : Daniel Gustafsson <dgustafsson@postgresql.org>
date : Sat, 20 Sep 2025 23:19:32 +0200
committer: Daniel Gustafsson <dgustafsson@postgresql.org>
date : Sat, 20 Sep 2025 23:19:32 +0200 This adds support for base64url encoding and decoding, a base64
variant which is safe to use in filenames and URLs. base64url
replaces '+' in the base64 alphabet with '-' and '/' with '_',
thus making it safe for URL addresses and file systems.
Support for base64url was originally suggested by Przemysław Sztoch.
Author: Florents Tselai <florents.tselai@gmail.com>
Reviewed-by: Aleksander Alekseev <aleksander@timescale.com>
Reviewed-by: David E. Wheeler <david@justatheory.com>
Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com>
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>
Reviewed-by: Chao Li (Evan) <li.evan.chao@gmail.com>
Discussion: https://postgr.es/m/70f2b6a8-486a-4fdb-a951-84cef35e22ab@sztoch.pl M doc/src/sgml/func/func-binarystring.sgml
M src/backend/utils/adt/encode.c
M src/test/regress/expected/strings.out
M src/test/regress/sql/strings.sql
Track the maximum possible frequency of non-MCE array elements.
commit : 261f89a976bf3dbf25e43bab9983fdd28f20b49b
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Sat, 20 Sep 2025 14:48:16 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Sat, 20 Sep 2025 14:48:16 -0400 The lossy-counting algorithm that ANALYZE uses to identify most-common
array elements has a notion of cutoff frequency: elements with
frequency greater than that are guaranteed to be collected, elements
with smaller frequencies are not. In cases where we find fewer MCEs
than the stats target would permit us to store, the cutoff frequency
provides valuable additional information, to wit that there are no
non-MCEs with frequency greater than that. What the selectivity
estimation functions actually use the "minfreq" entry for is as a
ceiling on the possible frequency of non-MCEs, so using the cutoff
rather than the lowest stored MCE frequency provides a tighter bound
and more accurate estimates.
Therefore, instead of redundantly storing the minimum observed MCE
frequency, store the cutoff frequency when there are fewer tracked
values than we want. (When there are more, then of course we cannot
assert that no non-stored elements are above the cutoff frequency,
since we're throwing away some that are; so we still use the
minimum stored frequency in that case.)
Notably, this works even when none of the values are common enough
to be called MCEs. In such cases we previously stored nothing in
the STATISTIC_KIND_MCELEM pg_statistic slot, which resulted in the
selectivity functions falling back to default estimates. So in that
case we want to construct a STATISTIC_KIND_MCELEM entry that contains
no "values" but does have "numbers", to wit the three extra numbers
that the MCELEM entry type defines. A small obstacle is that
update_attstats() has traditionally stored a null, not an empty array,
when passed zero "values" for a slot. That gives rise to an MCELEM
entry that get_attstatsslot() will spit up on. The least risky
solution seems to be to adjust update_attstats() so that it will emit
a non-null (but possibly empty) array when the passed stavalues array
pointer isn't NULL, rather than conditioning that on numvalues > 0.
In other existing cases I don't believe that that changes anything.
For consistency, handle the stanumbers array the same way.
In passing, improve the comments in routines that use
STATISTIC_KIND_MCELEM data. Particularly, explain why we use
minfreq / 2 not minfreq as the estimate for non-MCE values.
Thanks to Matt Long for the suggestion that we could apply this
idea even when there are more than zero MCEs.
Reported-by: Mark Frost <FROSTMAR@uk.ibm.com>
Reported-by: Matt Long <matt@mattlong.org>
Author: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/PH3PPF1C905D6E6F24A5C1A1A1D8345B593E16FA@PH3PPF1C905D6E6.namprd15.prod.outlook.com M contrib/intarray/_int_selfuncs.c
M src/backend/commands/analyze.c
M src/backend/tsearch/ts_selfuncs.c
M src/backend/tsearch/ts_typanalyze.c
M src/backend/utils/adt/array_selfuncs.c
M src/backend/utils/adt/array_typanalyze.c
M src/include/catalog/pg_statistic.h
Re-allow using statistics for bool-valued functions in WHERE.
commit : 1eccb93150707acfcc8f24556a15742a6313c8ac
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Sat, 20 Sep 2025 12:44:52 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Sat, 20 Sep 2025 12:44:52 -0400 Commit a391ff3c3, which added the ability for a function's support
function to provide a custom selectivity estimate for "WHERE f(...)",
unintentionally removed the possibility of applying expression
statistics after finding there's no applicable support function.
That happened because we no longer fell through to boolvarsel()
as before. Refactor to do so again, putting the 0.3333333 default
back into boolvarsel() where it had been (cf. commit 39df0f150).
I surely wouldn't have made this error if 39df0f150 had included
a test case, so add one now. At the time we did not have the
"extended statistics" infrastructure, but we do now, and it is
also unable to work in this scenario because of this error.
So make use of that for the test case.
This is very clearly a bug fix, but I'm afraid to put it into
released branches because of the likelihood of altering plan
choices, which we avoid doing in minor releases. So, master only.
Reported-by: Frédéric Yhuel <frederic.yhuel@dalibo.com>
Author: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/a8b99dce-1bfb-4d97-af73-54a32b85c916@dalibo.com M src/backend/optimizer/path/clausesel.c
M src/backend/optimizer/util/plancat.c
M src/backend/utils/adt/selfuncs.c
M src/test/regress/expected/stats_ext.out
M src/test/regress/sql/stats_ext.sql
Fix obsolete references to postgres.h in comments.
commit : 18cdf5932a279a2c035d44460e1e0cbb659471f2
author : Nathan Bossart <nathan@postgresql.org>
date : Fri, 19 Sep 2025 09:19:03 -0500
committer: Nathan Bossart <nathan@postgresql.org>
date : Fri, 19 Sep 2025 09:19:03 -0500 Oversights in commits d08741eab5 and d952373a98.
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://postgr.es/m/aMxbfSJ2wLWd32x-%40nathan M src/include/access/htup_details.h
M src/include/c.h
M src/include/utils/expandeddatum.h
M src/include/utils/memutils.h
M src/include/utils/varbit.h
Improve wording in a few comments
commit : ac7c8e412cc5606ab43f641285400209a686bac8
author : David Rowley <drowley@postgresql.org>
date : Fri, 19 Sep 2025 23:35:23 +1200
committer: David Rowley <drowley@postgresql.org>
date : Fri, 19 Sep 2025 23:35:23 +1200 Initially this was to fix the "catched" typo, but I (David) wasn't quite
clear on what the previous comment meant about being "effective". I
expect this means efficiency, so I've reworded the comment to indicate
that.
While this is only a comment fixup, for the sake of possibly minimizing
possible future backpatching pain, I've opted to backpatch to 18 since
this code is new to that version and the release isn't out the door yet.
Author: Tender Wang <tndrwang@gmail.com>
Discussion: https://postgr.es/m/CAHewXNmSYWPud1sfBvpKbCJeRkWeZYuqatxtV9U9LvAFXBEiBw@mail.gmail.com
Backpatch-through: 18 M src/backend/optimizer/path/indxpath.c
Add optional pid parameter to pg_replication_origin_session_setup().
commit : 5b148706c5c8ffffe5662fe569a0f0bcef2351d9
author : Amit Kapila <akapila@postgresql.org>
date : Fri, 19 Sep 2025 05:38:40 +0000
committer: Amit Kapila <akapila@postgresql.org>
date : Fri, 19 Sep 2025 05:38:40 +0000 Commit 216a784829c introduced parallel apply workers, allowing multiple
processes to share a replication origin. To support this,
replorigin_session_setup() was extended to accept a pid argument
identifying the process using the origin.
This commit exposes that capability through the SQL interface function
pg_replication_origin_session_setup() by adding an optional pid parameter.
This enables multiple processes to coordinate replication using the same
origin when using SQL-level replication functions.
This change allows the non-builtin logical replication solutions to
implement parallel apply for large transactions.
Additionally, an existing internal error was made user-facing, as it can
now be triggered via the exposed SQL API.
Author: Doruk Yilmaz <doruk@mixrank.com>
Author: Hayato Kuroda <kuroda.hayato@fujitsu.com>
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>
Reviewed-by: Euler Taveira <euler@eulerto.com>
Discussion: https://postgr.es/m/CAMPB6wfe4zLjJL8jiZV5kjjpwBM2=rTRme0UCL7Ra4L8MTVdOg@mail.gmail.com
Discussion: https://postgr.es/m/CAE2gYzyTSNvHY1+iWUwykaLETSuAZsCWyryokjP6rG46ZvRgQA@mail.gmail.com M contrib/test_decoding/Makefile
A contrib/test_decoding/expected/parallel_session_origin.out
M contrib/test_decoding/expected/replorigin.out
M contrib/test_decoding/meson.build
A contrib/test_decoding/specs/parallel_session_origin.spec
M contrib/test_decoding/sql/replorigin.sql
M doc/src/sgml/func/func-admin.sgml
M src/backend/catalog/system_functions.sql
M src/backend/replication/logical/origin.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
Improve few errdetail messages introduced in commit 0d48d393d46.
commit : 8aac5923a3611aa89998368a09c54892b93ebdd9
author : Amit Kapila <akapila@postgresql.org>
date : Fri, 19 Sep 2025 04:52:59 +0000
committer: Amit Kapila <akapila@postgresql.org>
date : Fri, 19 Sep 2025 04:52:59 +0000 Based on suggestions by Tom Lane
Reported-by: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Author: Zhijie Hou <houzj.fnst@fujitsu.com>
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>
Discussion: https://postgr.es/m/20250916.114644.275726106301941878.horikyota.ntt@gmail.com M src/backend/replication/logical/worker.c
M src/test/subscription/t/035_conflicts.pl
Make XLogFlush() and XLogNeedsFlush() decision-making more consistent
commit : deb208df4559c922df217354f2c0cb689016a2ed
author : Michael Paquier <michael@paquier.xyz>
date : Fri, 19 Sep 2025 13:47:28 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Fri, 19 Sep 2025 13:47:28 +0900 When deciding which code path to use depending on the state of recovery,
XLogFlush() and XLogNeedsFlush() have been relying on different
criterias:
- XLogFlush() relied on XLogInsertAllowed().
- XLogNeedsFlush() relied on RecoveryInProgress().
Currently, the checkpointer is allowed to insert WAL records while
RecoveryInProgress() returns true for an end-of-recovery checkpoint,
where XLogInsertAllowed() matters. Using RecoveryInProgress() in
XLogNeedsFlush() did not really matter for its existing callers, as the
checkpointer only called XLogFlush(). However, a feature under
discussion, by Melanie Plageman, needs XLogNeedsFlush() to be able to
work in more contexts, the end-of-recovery checkpoint being one.
This commit changes XLogNeedsFlush() to use XLogInsertAllowed() instead
of RecoveryInProgress(), making the checks in both routines more
consistent. While on it, an assertion based on XLogNeedsFlush() is
added at the end of XLogFlush(), triggered when flushing a physical
position (not for the normal recovery patch that checks for updates of
the minimum recovery point). This assertion would fail for example in
the recovery test 015_promotion_pages if XLogNeedsFlush() is changed to
use RecoveryInProgress(). This should be hopefully enough to ensure
that the checks done in both routines remain consistent.
Author: Melanie Plageman <melanieplageman@gmail.com>
Co-authored-by: Dilip Kumar <dilipbalaut@gmail.com>
Reviewed-by: Jeff Davis <pgsql@j-davis.com>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://postgr.es/m/CAAKRu_a1vZRZRWO3_jv_X13RYoqLRVipGO0237g5PKzPa2YX6g@mail.gmail.com M src/backend/access/transam/xlog.c
Fix EPQ crash from missing partition pruning state in EState
commit : 8741e48e5ddaab1148419ad8a4cd00098de57efc
author : Amit Langote <amitlan@postgresql.org>
date : Fri, 19 Sep 2025 11:38:29 +0900
committer: Amit Langote <amitlan@postgresql.org>
date : Fri, 19 Sep 2025 11:38:29 +0900 Commit bb3ec16e14 moved partition pruning metadata into PlannedStmt.
At executor startup this metadata is used to initialize the EState
fields es_part_prune_infos, es_part_prune_states, and
es_part_prune_results. EvalPlanQualStart() failed to copy those
fields into the child EState, causing NULL dereference when Append
ran partition pruning during a recheck. This can occur with DELETE
or UPDATE on partitioned tables that use runtime pruning, e.g. with
generic plans.
Fix by copying all partition pruning state into the EPQ estate.
Add an isolation test that reproduces the crash with concurrent
UPDATE and DELETE on a partitioned table, where the DELETE session
hits the crash during its EPQ recheck after the UPDATE commits.
Bug: #19056
Reported-by: Fei Changhong <feichanghong@qq.com>
Diagnozed-by: Fei Changhong <feichanghong@qq.com>
Author: David Rowley <dgrowleyml@gmail.com>
Co-authored-by: Amit Langote <amitlangote09@gmail.com>
Discussion: https://postgr.es/m/19056-a677cef9b54d76a0%40postgresql.org M src/backend/executor/execMain.c
M src/test/isolation/expected/eval-plan-qual.out
M src/test/isolation/specs/eval-plan-qual.spec
Document and check that PgStat_HashKey has no padding
commit : 3cd3a039da7f36b827455a8b9a7068c16b85e15d
author : Michael Paquier <michael@paquier.xyz>
date : Fri, 19 Sep 2025 09:54:05 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Fri, 19 Sep 2025 09:54:05 +0900 This change is a tighter rework of 7d85d87f4d5c, which tried to improve
the code so as it would work should PgStat_HashKey gain new fields that
create padding bytes. However, the previous change is proving to not be
enough as some code paths of pgstats do not pass PgStat_HashKey by
reference (valgrind would warn when padding is added to the structure,
through a new field).
Per discussion, let's document and check that PgStat_HashKey has no
padding rather than try to complicate the code of pgstats so as it is
able to work around that.
This removes a couple of memset(0) calls that should not be required.
While on it, this commit adds a static assertion checking that no
padding is introduced in the structure, by checking that the size of
PgStat_HashKey matches with the sum of the size of all its fields.
The object ID part of the hash key is already 8 bytes, which should be
plenty enough already. A comment is added to discourage the addition of
new fields.
Author: Michael Paquier <michael@paquier.xyz>
Reviewed-by: Sami Imseih <samimseih@gmail.com>
Discussion: https://postgr.es/m/CAA5RZ0t9omat+HVSakJXwTMWvhpYFcAZb41RPWKwrKFUgmAFBQ@mail.gmail.com M src/backend/utils/activity/pgstat.c
M src/backend/utils/activity/pgstat_shmem.c
M src/include/utils/pgstat_internal.h
Add a test harness for the LWLock tranche code.
commit : 16607718c0107e971bf155c6357c193cc3f8f66a
author : Nathan Bossart <nathan@postgresql.org>
date : Thu, 18 Sep 2025 15:23:11 -0500
committer: Nathan Bossart <nathan@postgresql.org>
date : Thu, 18 Sep 2025 15:23:11 -0500 This code is heavily used and already has decent test coverage, but
it lacks a dedicated test suite. This commit changes that.
Author: Sami Imseih <samimseih@gmail.com>
Co-authored-by: Nathan Bossart <nathandbossart@gmail.com>
Reviewed-by: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Discussion: https://postgr.es/m/CAA5RZ0tQ%2BEYSTOd2hQ8RXdsNfGBLAtOe-YmnsTE6ZVg0E-4qew%40mail.gmail.com
Discussion: https://postgr.es/m/CAA5RZ0vpr0P2rbA%3D_K0_SCHM7bmfVX4wEO9FAyopN1eWCYORhA%40mail.gmail.com M src/test/modules/Makefile
M src/test/modules/meson.build
A src/test/modules/test_lwlock_tranches/.gitignore
A src/test/modules/test_lwlock_tranches/Makefile
A src/test/modules/test_lwlock_tranches/expected/test_lwlock_tranches.out
A src/test/modules/test_lwlock_tranches/meson.build
A src/test/modules/test_lwlock_tranches/sql/test_lwlock_tranches.sql
A src/test/modules/test_lwlock_tranches/test_lwlock_tranches–1.0.sql
A src/test/modules/test_lwlock_tranches/test_lwlock_tranches.c
A src/test/modules/test_lwlock_tranches/test_lwlock_tranches.conf
A src/test/modules/test_lwlock_tranches/test_lwlock_tranches.control
Fix re-initialization of LWLock-related shared memory.
commit : c3cc2ab87d72a1ce17a7f574756158479ef32f20
author : Nathan Bossart <nathan@postgresql.org>
date : Thu, 18 Sep 2025 09:55:39 -0500
committer: Nathan Bossart <nathan@postgresql.org>
date : Thu, 18 Sep 2025 09:55:39 -0500 When shared memory is re-initialized after a crash, the named
LWLock tranche request array that was copied to shared memory will
no longer be accessible. To fix, save the pointer to the original
array in postmaster's local memory, and switch to it when
re-initializing the LWLock-related shared memory.
Oversight in commit ed1aad15e0. Per buildfarm member batta.
Reported-by: Michael Paquier <michael@paquier.xyz>
Reported-by: Alexander Lakhin <exclusion@gmail.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://postgr.es/m/aMoejB3iTWy1SxfF%40paquier.xyz
Discussion: https://postgr.es/m/f8ca018f-3479-49f6-a92c-e31db9f849d7%40gmail.com M src/backend/storage/lmgr/lwlock.c
pgbench: Remove unused argument from create_sql_command().
commit : 2e66cae935c2e0f7ce9bab6b65ddeb7806f4de7c
author : Fujii Masao <fujii@postgresql.org>
date : Thu, 18 Sep 2025 11:22:21 +0900
committer: Fujii Masao <fujii@postgresql.org>
date : Thu, 18 Sep 2025 11:22:21 +0900 Author: Yugo Nagata <nagata@sraoss.co.jp>
Reviewed-by: Steven Niu <niushiji@gmail.com>
Discussion: https://postgr.es/m/20250917112814.096f660ea4c3c64630475e62@sraoss.co.jp M src/bin/pgbench/pgbench.c
pg_restore: Fix security label handling with --no-publications/subscriptions.
commit : 45f50c995fb658bee11bf26b8c6f4983eaa223c0
author : Fujii Masao <fujii@postgresql.org>
date : Thu, 18 Sep 2025 11:09:15 +0900
committer: Fujii Masao <fujii@postgresql.org>
date : Thu, 18 Sep 2025 11:09:15 +0900 Previously, pg_restore did not skip security labels on publications or
subscriptions even when --no-publications or --no-subscriptions was specified.
As a result, it could issue SECURITY LABEL commands for objects that were
never created, causing those commands to fail.
This commit fixes the issue by ensuring that security labels on publications
and subscriptions are also skipped when the corresponding options are used.
Backpatch to all supported versions.
Author: Jian He <jian.universality@gmail.com>
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>
Discussion: https://postgr.es/m/CACJufxHCt00pR9h51AVu6+yPD5J7JQn=7dQXxqacj0XyDhc-fA@mail.gmail.com
Backpatch-through: 13 M src/bin/pg_dump/pg_backup_archiver.c
Mark shared buffer lookup table HASH_FIXED_SIZE
commit : 0110e2ec5c0f230beb439885bd1f8505e783e742
author : Andres Freund <andres@anarazel.de>
date : Wed, 17 Sep 2025 20:28:43 -0400
committer: Andres Freund <andres@anarazel.de>
date : Wed, 17 Sep 2025 20:28:43 -0400 StrategyInitialize() calls InitBufTable() with maximum number of entries that
the buffer lookup table can ever have. Thus there should not be any need to
allocate more element after initialization. Hence mark the hash table as fixed
sized.
Author: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>
Discussion: https://postgr.es/m/CAExHW5v0jh3F_wj86yC=qBfWk0uiT94qy=Z41uzAHLHh0SerRA@mail.gmail.com M src/backend/storage/buffer/buf_table.c
Calculate agglevelsup correctly when Aggref contains a CTE.
commit : b0cc0a71e0a0a760f54c72edb8cd000e4555442b
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Wed, 17 Sep 2025 16:32:57 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Wed, 17 Sep 2025 16:32:57 -0400 If an aggregate function call contains a sub-select that has
an RTE referencing a CTE outside the aggregate, we must treat
that reference like a Var referencing the CTE's query level
for purposes of determining the aggregate's level. Otherwise
we might reach the nonsensical conclusion that the aggregate
should be evaluated at some query level higher than the CTE,
ending in a planner error or a broken plan tree that causes
executor failures.
Bug: #19055
Reported-by: BugForge <dllggyx@outlook.com>
Author: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/19055-6970cfa8556a394d@postgresql.org
Backpatch-through: 13 M src/backend/parser/parse_agg.c
M src/test/regress/expected/with.out
M src/test/regress/sql/with.sql
jit: Fix type used for Datum values in LLVM IR.
commit : 0951942bba25f85ad29a4f096ed51a356652b5a2
author : Thomas Munro <tmunro@postgresql.org>
date : Wed, 17 Sep 2025 12:00:16 +1200
committer: Thomas Munro <tmunro@postgresql.org>
date : Wed, 17 Sep 2025 12:00:16 +1200 Commit 2a600a93 made Datum 8 bytes wide everywhere. It was no longer
appropriate to use TypeSizeT on 32 bit systems, and JIT compilation
would fail with various type check errors. Introduce a separate
LLVMTypeRef with the name TypeDatum. TypeSizeT is still used in some
places for actual size_t values.
Reported-by: Dmitry Mityugov <d.mityugov@postgrespro.ru>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Tested-by: Dmitry Mityugov <d.mityugov@postgrespro.ru>
Discussion: https://postgr.es/m/0a9f0be59171c2e8f1b3bc10f4fcf267%40postgrespro.ru M src/backend/jit/llvm/llvmjit.c
M src/backend/jit/llvm/llvmjit_deform.c
M src/backend/jit/llvm/llvmjit_expr.c
M src/backend/jit/llvm/llvmjit_types.c
M src/include/jit/llvmjit.h
M src/include/jit/llvmjit_emit.h
injection_points: Fix incrementation of variable-numbered stats
commit : 39f67d9b554fcd6dfb6c4f02a4af757eecd1fecf
author : Michael Paquier <michael@paquier.xyz>
date : Wed, 17 Sep 2025 10:15:13 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Wed, 17 Sep 2025 10:15:13 +0900 The pending entry was not used when incrementing its data, directly
manipulating the shared memory pointer, without even locking it. This
could mean losing statistics under concurrent activity. The flush
callback was a no-op.
This code serves as a base template for extensions for the custom
cumulative statistics, so let's be clean and use a pending entry for the
incrementations, whose data is then flushed to the corresponding entry
in the shared hashtable when all the stats are reported, in its own
flush callback.
Author: Sami Imseih <samimseih@gmail.com>
Discussion: https://postgr.es/m/CAA5RZ0v0U0yhPbY+bqChomkPbyUrRQ3rQXnZf_SB-svDiQOpgQ@mail.gmail.com
Backpatch-through: 18 M src/test/modules/injection_points/injection_stats.c
Fix shared memory calculation size of PgAioCtl
commit : 158c48303e8ae0248d7d95b60b56dd67e7033c48
author : Michael Paquier <michael@paquier.xyz>
date : Wed, 17 Sep 2025 09:33:32 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Wed, 17 Sep 2025 09:33:32 +0900 The shared memory size was calculated based on an offset of io_handles,
which is itself a pointer included in the structure. We tend to
overestimate the shared memory size overall, so this was unlikely an
issue in practice, but let's be correct and use the full size of the
structure in the calculation, so as the pointer for io_handles is
included.
Oversight in da7226993fd4.
Author: Madhukar Prasad <madhukarprasad@google.com>
Reviewed-by: Andres Freund <andres@anarazel.de>
Reviewed-by: Matthias van de Meent <boekewurm+postgres@gmail.com>
Discussion: https://postgr.es/m/CAKi+wrbC2dTzh_vKJoAZXV5wqTbhY0n4wRNpCjJ=e36aoo0kFw@mail.gmail.com
Backpatch-through: 18 M src/backend/storage/aio/aio_init.c
Add missing EPQ recheck for TID Range Scan
commit : ac06ea8f7b6c6aeedef9bff5fb30f606f6054a55
author : David Rowley <drowley@postgresql.org>
date : Wed, 17 Sep 2025 12:19:15 +1200
committer: David Rowley <drowley@postgresql.org>
date : Wed, 17 Sep 2025 12:19:15 +1200 The EvalPlanQual recheck for TID Range Scan wasn't rechecking the TID qual
still passed after following update chains. This could result in tuples
being updated or deleted by plans using TID Range Scans where the ctid of
the new (updated) tuple no longer matches the clause of the scan. This
isn't desired behavior, and isn't consistent with what would happen if the
chosen plan had used an Index or Seq Scan, and that could lead to hard to
predict behavior for scans that contain TID quals and other quals as the
planner has freedom to choose TID Range or some other non-TID scan method
for such queries, and the chosen plan could change at any moment.
Here we fix this by properly implementing the recheck function for TID
Range Scans.
Backpatch to 14, where TID Range Scans were added
Reported-by: Sophie Alpert <pg@sophiebits.com>
Author: Sophie Alpert <pg@sophiebits.com>
Author: David Rowley <dgrowleyml@gmail.com>
Reviewed-by: David Rowley <dgrowleyml@gmail.com>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://postgr.es/m/4a6268ff-3340-453a-9bf5-c98d51a6f729@app.fastmail.com
Backpatch-through: 14 M src/backend/executor/nodeTidrangescan.c
M src/test/isolation/expected/eval-plan-qual.out
M src/test/isolation/specs/eval-plan-qual.spec
Add missing EPQ recheck for TID Scan
commit : dee21ea6d6178f1acd5044fd94e3dc4542e2656b
author : David Rowley <drowley@postgresql.org>
date : Wed, 17 Sep 2025 11:48:55 +1200
committer: David Rowley <drowley@postgresql.org>
date : Wed, 17 Sep 2025 11:48:55 +1200 The EvalPlanQual recheck for TID Scan wasn't rechecking the TID qual
still passed after following update chains. This could result in tuples
being updated or deleted by plans using TID Scans where the ctid of the
new (updated) tuple no longer matches the clause of the scan. This isn't
desired behavior, and isn't consistent with what would happen if the
chosen plan had used an Index or Seq Scan, and that could lead to hard to
predict behavior for scans that contain TID quals and other quals as the
planner has freedom to choose TID or some other scan method for such
queries, and the chosen plan could change at any moment.
Here we fix this by properly implementing the recheck function for TID
Scans.
Backpatch to 13, oldest supported version
Reported-by: Sophie Alpert <pg@sophiebits.com>
Author: Sophie Alpert <pg@sophiebits.com>
Author: David Rowley <dgrowleyml@gmail.com>
Reviewed-by: David Rowley <dgrowleyml@gmail.com>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://postgr.es/m/4a6268ff-3340-453a-9bf5-c98d51a6f729@app.fastmail.com
Backpatch-through: 13 M src/backend/executor/nodeTidscan.c
M src/test/isolation/expected/eval-plan-qual.out
M src/test/isolation/specs/eval-plan-qual.spec
Add regression expected-files for older OpenSSL in FIPS mode.
commit : e633fa6351bd7e7bc10a5e74168eed4c15992851
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Tue, 16 Sep 2025 14:36:51 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Tue, 16 Sep 2025 14:36:51 -0400 Cover contrib/pgcrypto, per buildfarm.
Author: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/443709.1757876535@sss.pgh.pa.us
Backpatch-through: 17 A contrib/pgcrypto/expected/hmac-md5_2.out
A contrib/pgcrypto/expected/md5_2.out
Revert "Avoid race condition between "GRANT role" and "DROP ROLE"".
commit : 8abbbbae610cd62faad4f9ec18e7cfa908593796
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Tue, 16 Sep 2025 13:05:53 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Tue, 16 Sep 2025 13:05:53 -0400 This reverts commit 98fc31d6499163a0a781aa6f13582a07f09cd7c6.
That change allowed DROP OWNED BY to drop grants of the target
role to other roles, arguing that nobody would need those
privileges anymore. But that's not so: if you're not superuser,
you still need admin privilege on the target role so you can
drop it.
It's not clear whether or how the dependency-based approach
to solving the original problem can be adapted to keep these
grants. Since v18 release is fast approaching, the sanest
thing to do seems to be to revert this patch for now. The
race-condition problem is low severity and not worth taking
risks for.
I didn't force a catversion bump in 98fc31d64, so I won't do
so here either.
Reported-by: Dipesh Dhameliya <dipeshdhameliya125@gmail.com>
Author: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/CABgZEgczOFicCJoqtrH9gbYMe_BV3Hq8zzCBRcMgmU6LRsihUA@mail.gmail.com
Backpatch-through: 18 M doc/src/sgml/ref/drop_owned.sgml
M src/backend/commands/user.c
M src/test/regress/expected/privileges.out
M src/test/regress/sql/privileges.sql
Fix pg_dump COMMENT dependency for separate domain constraints.
commit : c044b50d199cf592eba2ac84f48cf0fcb5fb65f8
author : Noah Misch <noah@leadboat.com>
date : Tue, 16 Sep 2025 09:40:44 -0700
committer: Noah Misch <noah@leadboat.com>
date : Tue, 16 Sep 2025 09:40:44 -0700 The COMMENT should depend on the separately-dumped constraint, not the
domain. Sufficient restore parallelism might fail the COMMENT command
by issuing it before the constraint exists. Back-patch to v13, like
commit 0858f0f96ebb891c8960994f023ed5a17b758a38.
Reviewed-by: Álvaro Herrera <alvherre@kurilemu.de>
Discussion: https://postgr.es/m/20250913020233.fa.nmisch@google.com
Backpatch-through: 13 M src/bin/pg_dump/pg_dump.c
Provide more-specific error details/hints for function lookup failures.
commit : 83a56419457ec0eff2eddfed8eb3aba86bede9cc
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Tue, 16 Sep 2025 12:17:02 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Tue, 16 Sep 2025 12:17:02 -0400 Up to now we've contented ourselves with a one-size-fits-all error
hint when we fail to find any match to a function or procedure call.
That was mostly okay in the beginning, but it was never great, and
since the introduction of named arguments it's really not adequate.
We at least ought to distinguish "function name doesn't exist" from
"function name exists, but not with those argument names". And the
rules for named-argument matching are arcane enough that some more
detail seems warranted if we match the argument names but the call
still doesn't work.
This patch creates a framework for dealing with these problems:
FuncnameGetCandidates and related code will now pass back a bitmask of
flags showing how far the match succeeded. This allows a considerable
amount of granularity in the reports. The set-bits-in-a-bitmask
approach means that when there are multiple candidate functions, the
report will reflect the match(es) that got the furthest, which seems
correct. Also, we can avoid mentioning "maybe add casts" unless
failure to match argument types is actually the issue.
Extend the same return-a-bitmask approach to OpernameGetCandidates.
The issues around argument names don't apply to operator syntax,
but it still seems worth distinguishing between "there is no
operator of that name" and "we couldn't match the argument types".
While at it, adjust these messages and related ones to more strictly
separate "detail" from "hint", following our message style guidelines'
distinction between those.
Reported-by: Dominique Devienne <ddevienne@gmail.com>
Author: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Robert Haas <robertmhaas@gmail.com>
Discussion: https://postgr.es/m/1756041.1754616558@sss.pgh.pa.us M contrib/postgres_fdw/expected/postgres_fdw.out
M doc/src/sgml/sources.sgml
M doc/src/sgml/typeconv.sgml
M src/backend/catalog/namespace.c
M src/backend/catalog/pg_aggregate.c
M src/backend/parser/parse_func.c
M src/backend/parser/parse_oper.c
M src/backend/utils/adt/regproc.c
M src/backend/utils/adt/ruleutils.c
M src/include/catalog/namespace.h
M src/include/parser/parse_func.h
M src/pl/plperl/expected/plperl_elog.out
M src/pl/plperl/expected/plperl_elog_1.out
M src/pl/plpgsql/src/expected/plpgsql_call.out
M src/pl/plpgsql/src/expected/plpgsql_record.out
M src/pl/plpython/expected/plpython_error.out
M src/test/modules/libpq_pipeline/traces/pipeline_abort.trace
M src/test/modules/test_extensions/expected/test_extensions.out
M src/test/regress/expected/alter_table.out
M src/test/regress/expected/arrays.out
M src/test/regress/expected/create_cast.out
M src/test/regress/expected/create_function_sql.out
M src/test/regress/expected/create_operator.out
M src/test/regress/expected/create_procedure.out
M src/test/regress/expected/create_view.out
M src/test/regress/expected/domain.out
M src/test/regress/expected/expressions.out
M src/test/regress/expected/geometry.out
M src/test/regress/expected/horology.out
M src/test/regress/expected/misc_functions.out
M src/test/regress/expected/multirangetypes.out
M src/test/regress/expected/plpgsql.out
M src/test/regress/expected/polymorphism.out
M src/test/regress/expected/rangetypes.out
M src/test/regress/expected/rowtypes.out
M src/test/regress/expected/subselect.out
M src/test/regress/expected/temp.out
M src/test/regress/expected/text.out
M src/test/regress/expected/time.out
M src/test/regress/expected/timetz.out
M src/test/regress/expected/with.out
M src/test/regress/expected/xid.out
M src/test/regress/sql/create_operator.sql
M src/test/regress/sql/polymorphism.sql
Add regression expected-files for older OpenSSL in FIPS mode.
commit : c7b0cb367d3c6b007122457ad5deb659fe8cc266
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Tue, 16 Sep 2025 10:09:49 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Tue, 16 Sep 2025 10:09:49 -0400 In our previous discussions around making our regression tests
pass in FIPS mode, we concluded that we didn't need to support
the different error message wording observed with pre-3.0 OpenSSL.
However there are still a few LTS distributions soldiering along
with such versions, and now we have some in the buildfarm.
So let's add the variant expected-files needed to make them happy.
This commit only covers the core regression tests. Previous
discussion suggested that we might need some adjustments in
contrib as well, but it's not totally clear to me what those
would be. Rather than work it out from first principles,
I'll wait to see what the buildfarm shows.
Back-patch to v17 which is the oldest branch that claims
to support this case.
Author: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/443709.1757876535@sss.pgh.pa.us
Backpatch-through: 17 A src/test/regress/expected/md5_2.out
A src/test/regress/expected/password_2.out
Treat JsonConstructorExpr as non-strict
commit : b63a822452152a7bd613fd4b28e0967e626e274e
author : Richard Guo <rguo@postgresql.org>
date : Tue, 16 Sep 2025 18:42:20 +0900
committer: Richard Guo <rguo@postgresql.org>
date : Tue, 16 Sep 2025 18:42:20 +0900 JsonConstructorExpr can produce non-NULL output with a NULL input, so
it should be treated as a non-strict construct. Failing to do so can
lead to incorrect query behavior.
For example, in the reported case, when pulling up a subquery that is
under an outer join, if the subquery's target list contains a
JsonConstructorExpr that uses subquery variables and it is mistakenly
treated as strict, it will be pulled up without being wrapped in a
PlaceHolderVar. As a result, the expression will be evaluated at the
wrong place and will not be forced to null when the outer join should
do so.
Back-patch to v16 where JsonConstructorExpr was introduced.
Bug: #19046
Reported-by: Runyuan He <runyuan@berkeley.edu>
Author: Tender Wang <tndrwang@gmail.com>
Co-authored-by: Richard Guo <guofenglinux@gmail.com>
Discussion: https://postgr.es/m/19046-765b6602b0a8cfdf@postgresql.org
Backpatch-through: 16 M src/backend/optimizer/util/clauses.c
M src/test/regress/expected/subselect.out
M src/test/regress/sql/subselect.sql
Generate GB18030 mappings from the Unicode Consortium's UCM file
commit : cfa6cd29271e67c43c1040e3420c1145fdcdceb7
author : John Naylor <john.naylor@postgresql.org>
date : Tue, 16 Sep 2025 16:29:08 +0700
committer: John Naylor <john.naylor@postgresql.org>
date : Tue, 16 Sep 2025 16:29:08 +0700 Previously we built the .map files for GB18030 (version 2000) from an
XML file. The 2022 version for this encoding is only available as a
Unicode Character Mapping (UCM) file, so as preparatory refactoring
switch to this format as the source for building version 2000.
As we do with most input files for the conversion mappings, download
the file on demand. In order to generate the same mappings we have
now, we must download from a previous upstream commit, rather than
the head since the latter contains a correction not present in our
current .map files.
The XML file is still used by EUC_CN, so we cannot delete it from our
repository. GB18030 is a superset of EUC_CN, so it may be possible to
build EUC_CN from the same UCM file, but that is left for future work.
Author: Chao Li <lic@highgo.com>
Discussion: https://postgr.es/m/966d9fc.169.198741fe60b.Coremail.jiaoshuntian%40highgo.com M src/backend/utils/mb/Unicode/Makefile
M src/backend/utils/mb/Unicode/UCS_to_GB18030.pl
M src/backend/utils/mb/conversion_procs/utf8_and_gb18030/utf8_and_gb18030.c
Move pg_int64 back to postgres_ext.h
commit : e56a601e067894002c8bbc19cef5c4ef584ba8ad
author : Peter Eisentraut <peter@eisentraut.org>
date : Tue, 16 Sep 2025 08:59:12 +0200
committer: Peter Eisentraut <peter@eisentraut.org>
date : Tue, 16 Sep 2025 08:59:12 +0200 Fix for commit 3c86223c998. That commit moved the typedef of pg_int64
from postgres_ext.h to libpq-fe.h, because the only remaining place
where it might be used is libpq users, and since the type is obsolete,
the intent was to limit its scope.
The problem is that if someone builds an extension against an
older (pre-PG18) server version and a new (PG18) libpq, they might get
two typedefs, depending on include file order. This is not allowed
under C99, so they might get warnings or errors, depending on the
compiler and options. The underlying types might also be
different (e.g., long int vs. long long int), which would also lead to
errors. This scenario is plausible when using the standard Debian
packaging, which provides only the newest libpq but per-major-version
server packages.
The fix is to undo that part of commit 3c86223c998. That way, the
typedef is in the same header file across versions. At least, this is
the safest fix doable before PostgreSQL 18 releases.
Reviewed-by: Thomas Munro <thomas.munro@gmail.com>
Discussion: https://www.postgresql.org/message-id/25144219-5142-4589-89f8-4e76948b32db%40eisentraut.org M src/include/postgres_ext.h
M src/interfaces/libpq/libpq-fe.h
pg_dump: Fix dumping of security labels on subscriptions and event triggers.
commit : 8e5b92928d2847f556f9fd75edf619935dc87010
author : Fujii Masao <fujii@postgresql.org>
date : Tue, 16 Sep 2025 16:44:58 +0900
committer: Fujii Masao <fujii@postgresql.org>
date : Tue, 16 Sep 2025 16:44:58 +0900 Previously, pg_dump incorrectly queried pg_seclabel to retrieve security labels
for subscriptions, which are stored in pg_shseclabel as they are global objects.
This could result in security labels for subscriptions not being dumped.
This commit fixes the issue by updating pg_dump to query the pg_seclabels view,
which aggregates entries from both pg_seclabel and pg_shseclabel.
While querying pg_shseclabel directly for subscriptions was an alternative,
using pg_seclabels is simpler and sufficient.
In addition, pg_dump is updated to dump security labels on event triggers,
which were previously omitted.
Backpatch to all supported versions.
Author: Jian He <jian.universality@gmail.com>
Co-authored-by: Fujii Masao <masao.fujii@gmail.com>
Discussion: https://postgr.es/m/CACJufxHCt00pR9h51AVu6+yPD5J7JQn=7dQXxqacj0XyDhc-fA@mail.gmail.com
Backpatch-through: 13 M src/bin/pg_dump/pg_backup_archiver.c
M src/bin/pg_dump/pg_dump.c
Fix intermittent BF failures in 035_conflicts.
commit : 0f42206531b3646f5bcda2bd35bb53fb0488eb00
author : Amit Kapila <akapila@postgresql.org>
date : Tue, 16 Sep 2025 06:16:23 +0000
committer: Amit Kapila <akapila@postgresql.org>
date : Tue, 16 Sep 2025 06:16:23 +0000 This commit addresses two sources of instability in the 035_conflicts
test:
Unstable VACUUM usage:
The test previously relied on VACUUM to remove a deleted column, which can
be unreliable due to concurrent background writer or checkpoint activity
that may lock the page containing the deleted tuple. Since the test
already verifies that replication_slot.xmin has advanced sufficiently to
confirm the feature's correctness, so, the VACUUM step is removed to
improve test stability.
Timing-sensitive retention resumption check:
The test includes a check to confirm that retention of conflict-relevant
information resumes after setting max_retention_duration to 0. However, in
some cases, the apply worker resumes retention immediately after the
inactive slot is removed from synchronized_standby_slots, even before
max_retention_duration is updated. This can happen if remote changes are
applied in under 1ms, causing the test to timeout while waiting for a
later log position. To ensure consistent behavior, this commit delays the
removal of synchronized_standby_slots until after max_retention_duration
is set to 0.
Author: Zhijie Hou <houzj.fnst@fujitsu.com>
Reviewed-by: shveta malik <shveta.malik@gmail.com>
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>
Discussion: https://postgr.es/m/TY4PR01MB16907805DE4816E53C54708159414A@TY4PR01MB16907.jpnprd01.prod.outlook.com M src/test/subscription/t/035_conflicts.pl
Fix incorrect const qualifier
commit : bce18ef3c67be63ad2dd8d585260dcb813f5a525
author : Peter Eisentraut <peter@eisentraut.org>
date : Tue, 16 Sep 2025 07:23:50 +0200
committer: Peter Eisentraut <peter@eisentraut.org>
date : Tue, 16 Sep 2025 07:23:50 +0200 Commit 7202d72787d added in passing some const qualifiers, but the one
on the postmaster_child_launch() startup_data argument was incorrect,
because the function itself modifies the pointed-to data. This is
hidden from the compiler because of casts. The qualifiers on the
functions called by postmaster_child_launch() are still correct. M src/backend/postmaster/launch_backend.c
M src/include/postmaster/postmaster.h
pg_restore: Fix comment handling with --no-policies.
commit : 66dabc06b1b0aaadfd5be640a2e3efbeea0fcaf5
author : Fujii Masao <fujii@postgresql.org>
date : Tue, 16 Sep 2025 11:54:23 +0900
committer: Fujii Masao <fujii@postgresql.org>
date : Tue, 16 Sep 2025 11:54:23 +0900 Previously, pg_restore did not skip comments on policies even when
--no-policies was specified. As a result, it could issue COMMENT commands
for policies that were never created, causing those commands to fail.
This commit fixes the issue by ensuring that comments on policies
are also skipped when --no-policies is used.
Backpatch to v18, where --no-policies was added in pg_restore.
Author: Jian He <jian.universality@gmail.com>
Co-authored-by: Fujii Masao <masao.fujii@gmail.com>
Discussion: https://postgr.es/m/CACJufxHCt00pR9h51AVu6+yPD5J7JQn=7dQXxqacj0XyDhc-fA@mail.gmail.com
Backpatch-through: 18 M src/bin/pg_dump/pg_backup_archiver.c
M src/bin/pg_dump/t/002_pg_dump.pl
pg_restore: Fix comment handling with --no-publications / --no-subscriptions.
commit : b54e8dbfe3b17648770a60c1a1bf99479bb766ce
author : Fujii Masao <fujii@postgresql.org>
date : Tue, 16 Sep 2025 10:35:12 +0900
committer: Fujii Masao <fujii@postgresql.org>
date : Tue, 16 Sep 2025 10:35:12 +0900 Previously, pg_restore did not skip comments on publications or subscriptions
even when --no-publications or --no-subscriptions was specified. As a result,
it could issue COMMENT commands for objects that were never created,
causing those commands to fail.
This commit fixes the issue by ensuring that comments on publications and
subscriptions are also skipped when the corresponding options are used.
Backpatch to all supported versions.
Author: Jian He <jian.universality@gmail.com>
Co-authored-by: Fujii Masao <masao.fujii@gmail.com>
Discussion: https://postgr.es/m/CACJufxHCt00pR9h51AVu6+yPD5J7JQn=7dQXxqacj0XyDhc-fA@mail.gmail.com
Backpatch-through: 13 M src/bin/pg_dump/pg_backup_archiver.c
M src/bin/pg_dump/t/002_pg_dump.pl
Teach nbtree to avoid evaluating row compare keys.
commit : 7d9cd2df5ffc2939ac84581c9463b8afc4ca4c41
author : Peter Geoghegan <pg@bowt.ie>
date : Mon, 15 Sep 2025 16:56:49 -0400
committer: Peter Geoghegan <pg@bowt.ie>
date : Mon, 15 Sep 2025 16:56:49 -0400 Add logic to _bt_set_startikey that determines whether row compare keys
are guaranteed to be satisfied by every tuple on a page that is about to
be read by _bt_readpage. This works in essentially the same way as the
existing scalar inequality logic. Testing has shown that the new logic
improves performance to about the same degree as the existing scalar
inequality logic (compared to the unoptimized case). In other words,
the new logic makes many row compare scans significantly faster.
Note that the new row compare inequality logic is only effective when
the same individual row member is the deciding subkey for all tuples on
the page (obviously, all tuples have to satisfy the row compare, too).
This is what makes the new row compare logic very similar to the
existing logic for scalar inequalities. Note, in particular, that this
makes it safe to ignore whether all row compare members are against
either ASC or DESC index attributes (i.e. it doesn't matter if
individual subkeys don't all use the same inequality strategy).
Also stop refusing to set pstate.startikey to an offset beyond any
nonrequired key (don't add logic that'll do that for an individual row
compare subkey, either). We can fully rely on our firstchangingattnum
tests instead. This will do the right thing when a page has a group of
tuples with NULLs in a lower-order attribute that makes the tuples fail
to satisfy a row compare key -- we won't incorrectly conclude that all
tuples must satisfy the row compare, just because firsttup and lasttup
happen to. Our firstchangingattnum test prevents that from happening.
(Note that the original "avoid evaluating nbtree scan keys" mechanism
added by commit e0b1ee17 couldn't support row compares due to issues
with tuples that contain NULLs in a lower-order subkey's attribute.
That original mechanism relied on requiredness markings, which the
replacement _bt_set_startikey mechanism never really needed.)
Follow up to commit 8a510275, which added the _bt_set_startikey
optimization. _bt_set_startikey is now feature complete; there's no
remaining kind of nbtree scan key that it still doesn't support.
Author: Peter Geoghegan <pg@bowt.ie>
Reviewed-By: Chao Li <li.evan.chao@gmail.com>
Discussion: https://postgr.es/m/CAH2-WznL6Z3H_GTQze9d8T_Ls=cYbnd-_9f-Jo7aYgTGRUD58g@mail.gmail.com M src/backend/access/nbtree/nbtutils.c
Expand virtual generated columns in constraint expressions
commit : ce71993ae46930ddb1ff790807114384898b86a7
author : Peter Eisentraut <peter@eisentraut.org>
date : Mon, 15 Sep 2025 16:27:50 +0200
committer: Peter Eisentraut <peter@eisentraut.org>
date : Mon, 15 Sep 2025 16:27:50 +0200 Virtual generated columns in constraint expressions need to be
expanded because the optimizer matches these expressions to qual
clauses. Failing to do so can cause us to miss opportunities for
constraint exclusion.
Author: Richard Guo <guofenglinux@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/204804c0-798f-4c72-bd1f-36116024fda3%40eisentraut.org M src/backend/optimizer/util/plancat.c
M src/test/regress/expected/generated_virtual.out
M src/test/regress/sql/generated_virtual.sql
CREATE STATISTICS: improve misleading error message
commit : 9ec0b29976b6d73cc08880842caa0db286e46bd4
author : Peter Eisentraut <peter@eisentraut.org>
date : Mon, 15 Sep 2025 11:38:58 +0200
committer: Peter Eisentraut <peter@eisentraut.org>
date : Mon, 15 Sep 2025 11:38:58 +0200 The previous change (commit f225473cbae) was still not on target,
because it talked about relation kinds, which are not what is being
checked here. Provide a more accurate message.
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/CACJufxEZ48toGH0Em_6vdsT57Y3L8pLF=DZCQ_gCii6=C3MeXw@mail.gmail.com M src/backend/tcop/utility.c
M src/test/regress/expected/stats_ext.out
Change fmgr.h typedefs to use original names
commit : 4bd91912987d794c48dd4ba4c337906bd23759be
author : Peter Eisentraut <peter@eisentraut.org>
date : Mon, 15 Sep 2025 10:48:30 +0200
committer: Peter Eisentraut <peter@eisentraut.org>
date : Mon, 15 Sep 2025 10:48:30 +0200 fmgr.h defined some types such as fmNodePtr which is just Node *, but
it made its own types to avoid having to include various header files.
With C11, we can now instead typedef the original names without fear
of conflicts.
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/10d32190-f31b-40a5-b177-11db55597355@eisentraut.org M src/backend/utils/fmgr/fmgr.c
M src/include/fmgr.h
M src/include/utils/builtins.h
M src/tools/pgindent/typedefs.list
Remove hbaPort type
commit : dc41d7415fc6eea3b5c5528a39d07016983ea75e
author : Peter Eisentraut <peter@eisentraut.org>
date : Mon, 15 Sep 2025 10:48:30 +0200
committer: Peter Eisentraut <peter@eisentraut.org>
date : Mon, 15 Sep 2025 10:48:30 +0200 This was just a workaround to avoid including the header file that
defines the Port type. With C11, we can now just re-define the Port
type without the possibility of a conflict.
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/10d32190-f31b-40a5-b177-11db55597355@eisentraut.org M src/backend/libpq/auth.c
M src/backend/libpq/hba.c
M src/include/libpq/hba.h
M src/tools/pgindent/typedefs.list
Update various forward declarations to use typedef
commit : d4d1fc527bdb333d818038081c17ed7d9b1697c1
author : Peter Eisentraut <peter@eisentraut.org>
date : Mon, 15 Sep 2025 10:48:30 +0200
committer: Peter Eisentraut <peter@eisentraut.org>
date : Mon, 15 Sep 2025 10:48:30 +0200 There are a number of forward declarations that use struct but not the
customary typedef, because that could have led to repeat typedefs,
which was not allowed. This is now allowed in C11, so we can update
these to provide the typedefs as well, so that the later uses of the
types look more consistent.
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/10d32190-f31b-40a5-b177-11db55597355@eisentraut.org M src/include/commands/tablecmds.h
M src/include/common/string.h
M src/include/executor/executor.h
M src/include/executor/tablefunc.h
M src/include/nodes/execnodes.h
M src/include/nodes/nodeFuncs.h
M src/include/nodes/params.h
M src/include/nodes/subscripting.h
M src/include/nodes/supportnodes.h
M src/include/optimizer/optimizer.h
M src/include/parser/parse_utilcmd.h
M src/include/partitioning/partbounds.h
M src/include/partitioning/partprune.h
M src/include/rewrite/rewriteManip.h
M src/include/storage/bufmgr.h
M src/include/storage/bulk_write.h
M src/include/storage/dsm.h
M src/include/storage/shmem.h
M src/include/tcop/pquery.h
M src/include/utils/array.h
M src/include/utils/lsyscache.h
M src/include/utils/plancache.h
M src/include/utils/ruleutils.h
Improve ExplainState type handling in header files
commit : 70407d39b7ea8fd41496489b5f6a30c285e7d7d0
author : Peter Eisentraut <peter@eisentraut.org>
date : Mon, 15 Sep 2025 10:48:30 +0200
committer: Peter Eisentraut <peter@eisentraut.org>
date : Mon, 15 Sep 2025 10:48:30 +0200 Now that we can have repeat typedefs with C11, we don't need to use
"struct ExplainState" anymore but can instead make a typedef where
necessary. This doesn't change anything but makes it look nicer.
(There are more opportunities for similar changes, but this is broken
out because there was a separate discussion about it, and it's
somewhat bulky on its own.)
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/f36c0a45-98cd-40b2-a7cc-f2bf02b12890%40eisentraut.org#a12fb1a2c1089d6d03010f6268871b00
Discussion: https://www.postgresql.org/message-id/flat/10d32190-f31b-40a5-b177-11db55597355@eisentraut.org M doc/src/sgml/fdwhandler.sgml
M src/include/commands/explain.h
M src/include/commands/explain_dr.h
M src/include/commands/explain_format.h
M src/include/commands/explain_state.h
M src/include/foreign/fdwapi.h
Remove workarounds against repeat typedefs
commit : 1e3b5edb8eb236f16529ca8dae917996ad1f433e
author : Peter Eisentraut <peter@eisentraut.org>
date : Mon, 15 Sep 2025 10:53:14 +0200
committer: Peter Eisentraut <peter@eisentraut.org>
date : Mon, 15 Sep 2025 10:53:14 +0200 This is allowed in C11, so we don't need the workarounds anymore.
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/10d32190-f31b-40a5-b177-11db55597355@eisentraut.org M src/include/nodes/pathnodes.h
M src/include/optimizer/optimizer.h
Resume conflict-relevant data retention automatically.
commit : 0d48d393d465b6f1abe18b86bd5ac2de0636a40e
author : Amit Kapila <akapila@postgresql.org>
date : Mon, 15 Sep 2025 08:44:54 +0000
committer: Amit Kapila <akapila@postgresql.org>
date : Mon, 15 Sep 2025 08:44:54 +0000 This commit resumes automatic retention of conflict-relevant data for a
subscription. Previously, retention would stop if the apply process failed
to advance its xmin (oldest_nonremovable_xid) within the configured
max_retention_duration and user needs to manually re-enable
retain_dead_tuples option. With this change, retention will resume
automatically once the apply worker catches up and begins advancing its
xmin (oldest_nonremovable_xid) within the configured threshold.
Author: Zhijie Hou <houzj.fnst@fujitsu.com>
Reviewed-by: shveta malik <shveta.malik@gmail.com>
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>
Reviewed-by: Dilip Kumar <dilipbalaut@gmail.com>
Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com>
Discussion: https://postgr.es/m/OS0PR01MB5716BE80DAEB0EE2A6A5D1F5949D2@OS0PR01MB5716.jpnprd01.prod.outlook.com M doc/src/sgml/ref/create_subscription.sgml
M src/backend/replication/logical/launcher.c
M src/backend/replication/logical/worker.c
M src/test/subscription/t/035_conflicts.pl
jit: fix build with LLVM-21
commit : 282d0bdee6192f1a859ee34672ae73abf49794dc
author : Peter Eisentraut <peter@eisentraut.org>
date : Mon, 15 Sep 2025 08:13:21 +0200
committer: Peter Eisentraut <peter@eisentraut.org>
date : Mon, 15 Sep 2025 08:13:21 +0200 LLVM-21 renamed llvm::GlobalValue::getGUID() to
getGUIDAssumingExternalLinkage(), so add a version guard.
Author: Holger Hoffstätte <holger@applied-asynchrony.com>
Discussion: https://www.postgresql.org/message-id/flat/d25e6e4a-d1b4-84d3-2f8a-6c45b975f53d%40applied-asynchrony.com M src/backend/jit/llvm/llvmjit_inline.cpp
Some stylistic improvements in toast_save_datum()
commit : 748caa9dcb686a84f239ee2cc08030d7c1efddd4
author : Peter Eisentraut <peter@eisentraut.org>
date : Mon, 15 Sep 2025 07:27:31 +0200
committer: Peter Eisentraut <peter@eisentraut.org>
date : Mon, 15 Sep 2025 07:27:31 +0200 Move some variables to a smaller scope. Initialize chunk_data before
storing a pointer to it; this avoids compiler warnings on clang-21, or
respectively us having to work around it by initializing it to zero
before the variable is used (as was done in commit e92677e8633).
Discussion: https://www.postgresql.org/message-id/flat/6604ad6e-5934-43ac-8590-15113d6ae4b1%40eisentraut.org M src/backend/access/common/toast_internals.c
Hide duplicate names from extension views
commit : bf5da5d6cae959d8119b4b137ddd9912292b8014
author : Peter Eisentraut <peter@eisentraut.org>
date : Mon, 15 Sep 2025 07:25:22 +0200
committer: Peter Eisentraut <peter@eisentraut.org>
date : Mon, 15 Sep 2025 07:25:22 +0200 If extensions of equal names were installed in different directories
in the path, the views pg_available_extensions and
pg_available_extension_versions would show all of them, even though
only the first one was actually reachable by CREATE EXTENSION. To
fix, have those views skip extensions found later in the path if they
have names already found earlier.
Also add a bit of documentation that only the first extension in the
path can be used.
Reported-by: Pierrick <pierrick.chovelon@dalibo.com>
Discussion: https://www.postgresql.org/message-id/flat/8f5a0517-1cb8-4085-ae89-77e7454e27ba%40dalibo.com M doc/src/sgml/config.sgml
M src/backend/commands/extension.c
M src/test/modules/test_extensions/t/001_extension_control_path.pl
nbtree: Always set skipScan flag on rescan.
commit : 454c046094ab3431c2ce0c540c46e623bc05bd1a
author : Peter Geoghegan <pg@bowt.ie>
date : Sat, 13 Sep 2025 21:01:33 -0400
committer: Peter Geoghegan <pg@bowt.ie>
date : Sat, 13 Sep 2025 21:01:33 -0400 The TimescaleDB extension expects to be able to change an nbtree scan's
keys across rescans. The issue arises in the extension's implementation
of loose index scan. This is arguably a misuse of the index AM API,
though apparently it worked until recently. It stopped working when the
skipScan flag was added to BTScanOpaqueData by commit 8a510275, though.
The flag wouldn't reliably track whether the scan (actually, the current
rescan) has any skip arrays, leading to confusion in _bt_set_startikey.
nbtree preprocessing will now defensively initialize the scan's skipScan
flag in all cases, including the case where _bt_preprocess_array_keys
returns early due to the (re)scan not using arrays. While nbtree isn't
obligated to support this use case (at least not according to my reading
of the index AM API), it still seems like a good idea to be consistent
here, on general robustness grounds.
Author: Peter Geoghegan <pg@bowt.ie>
Reported-By: Natalya Aksman <natalya@timescale.com>
Discussion: https://postgr.es/m/CAJumhcirfMojbk20+W0YimbNDkwdECvJprQGQ-XqK--ph09nQw@mail.gmail.com
Backpatch-through: 18 M src/backend/access/nbtree/nbtpreprocesskeys.c
Amend recent fix for SIMILAR TO regex conversion.
commit : cdf7feb96562071f15ceb070272d7e84246d943d
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Sat, 13 Sep 2025 16:55:51 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Sat, 13 Sep 2025 16:55:51 -0400 Commit e3ffc3e91 fixed the translation of character classes in
SIMILAR TO regular expressions. Unfortunately the fix broke a corner
case: if there is an escape character right after the opening bracket
(for example in "[\q]"), a closing bracket right after the escape
sequence would not be seen as closing the character class.
There were two more oversights: a backslash or a nested opening bracket
right at the beginning of a character class should remove the special
meaning from any following caret or closing bracket.
This bug suggests that this code needs to be more readable, so also
rename the variables "charclass_depth" and "charclass_start" to
something more meaningful, rewrite an "if" cascade to be more
consistent, and improve the commentary.
Reported-by: Dominique Devienne <ddevienne@gmail.com>
Reported-by: Stephan Springl <springl-psql@bfw-online.de>
Author: Laurenz Albe <laurenz.albe@cybertec.at>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/CAFCRh-8NwJd0jq6P=R3qhHyqU7hw0BTor3W0SvUcii24et+zAw@mail.gmail.com
Backpatch-through: 13 M src/backend/utils/adt/regexp.c
M src/test/regress/expected/strings.out
M src/test/regress/sql/strings.sql
Add commit 7e9c216b52 to .git-blame-ignore-revs.
commit : 95bdc672282722fb52656a81fefe18296015708e
author : Nathan Bossart <nathan@postgresql.org>
date : Sat, 13 Sep 2025 14:55:38 -0500
committer: Nathan Bossart <nathan@postgresql.org>
date : Sat, 13 Sep 2025 14:55:38 -0500 M .git-blame-ignore-revs
Re-pgindent nbtpreprocesskeys.c after commit 796962922e.
commit : 7e9c216b5236cc61f677787b35e8c8f28f5f6959
author : Nathan Bossart <nathan@postgresql.org>
date : Sat, 13 Sep 2025 14:50:02 -0500
committer: Nathan Bossart <nathan@postgresql.org>
date : Sat, 13 Sep 2025 14:50:02 -0500 Backpatch-through: 18 M src/backend/access/nbtree/nbtpreprocesskeys.c
Specify locale provider for pg_regress --no-locale
commit : f6edf403a99923b98f8b8b3398c7ef32e1ae9a3e
author : Alexander Korotkov <akorotkov@postgresql.org>
date : Sat, 13 Sep 2025 20:38:52 +0300
committer: Alexander Korotkov <akorotkov@postgresql.org>
date : Sat, 13 Sep 2025 20:38:52 +0300 pg_regress has a --no-locale option that forces the temporary database to
have C locale. However, currently, locale C only exists in the 'builtin'
locale provider. This makes 'pg_regress --no-locale' fail when the default
locale provider is not 'builtin'. This commit makes 'pg_regress --no-locale'
specify both LOCALE='C' and LOCALE_PROVIDER='builtin'.
Discussion: https://postgr.es/m/b54921f95e23b4391b1613e9053a3d58%40postgrespro.ru
Author: Oleg Tselebrovskiy <o.tselebrovskiy@postgrespro.ru>
Reviewed-by: Alexander Korotkov <aekorotkov@gmail.com> M src/test/regress/pg_regress.c
Avoid context dependency in test case added by 9a71989a8.
commit : 88824e68611a88a4ef7218c093810a94f86e12e0
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Fri, 12 Sep 2025 18:45:06 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Fri, 12 Sep 2025 18:45:06 -0400 It's not quite clear to me why this didn't show up in my local
check-world testing, but some of the buildfarm evidently runs
this test with a different database name. Adjust the test
so that that doesn't affect the reported error messages. M src/test/modules/unsafe_tests/expected/setconfig.out
M src/test/modules/unsafe_tests/sql/setconfig.sql
Reject "ALTER DATABASE/USER ... RESET foo" with invalid GUC name.
commit : 9a71989a8f61d7ee003c443a979a1bd43a08ff63
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Fri, 12 Sep 2025 18:10:11 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Fri, 12 Sep 2025 18:10:11 -0400 If the database or user had no entry in pg_db_role_setting,
RESET silently did nothing --- including not checking the
validity of the given GUC name. This is quite inconsistent
and surprising, because you *would* get such an error if there
were any pg_db_role_setting entry, even though it contains
values for unrelated GUCs.
While this is clearly a bug, changing it in stable branches seems
unwise. The effect will be that some ALTER commands that formerly
were no-ops will now be errors, and people don't like that sort of
thing in minor releases.
Author: Vitaly Davydov <v.davydov@postgrespro.ru>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/30783e-68c28a00-9-41004480@130449754 M src/backend/catalog/pg_db_role_setting.c
M src/test/modules/unsafe_tests/expected/setconfig.out
M src/test/modules/unsafe_tests/sql/setconfig.sql
Fix oversights in pg_event_trigger_dropped_objects() fixes.
commit : f14ea34d6e563374cd71b4e7b91cf8d2f60aabb3
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Fri, 12 Sep 2025 17:43:15 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Fri, 12 Sep 2025 17:43:15 -0400 Commit a0b99fc12 caused pg_event_trigger_dropped_objects()
to not fill the object_name field for schemas, which it
should have; and caused it to fill the object_name field
for default values, which it should not have.
In addition, triggers and RLS policies really should behave
the same way as we're making column defaults do; that is,
they should have is_temporary = true if they belong to a
temporary table.
Fix those things, and upgrade event_trigger.sql's woefully
inadequate test coverage of these secondary output columns.
As before, back-patch only to v15.
Reported-by: Sergey Shinderuk <s.shinderuk@postgrespro.ru>
Author: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/bd7b4651-1c26-4d30-832b-f942fabcb145@postgrespro.ru
Backpatch-through: 15 M src/backend/commands/event_trigger.c
M src/test/regress/expected/event_trigger.out
M src/test/regress/sql/event_trigger.sql
Replace tests of ALTER DATABASE RESET TABLESPACE.
commit : 4adb0380b9bff5ec6424a9e87f76f8974b025367
author : Noah Misch <noah@leadboat.com>
date : Fri, 12 Sep 2025 12:44:14 -0700
committer: Noah Misch <noah@leadboat.com>
date : Fri, 12 Sep 2025 12:44:14 -0700 This unblocks rejection of that syntax. One copy was a misspelling of
"SET TABLESPACE pg_default" that instead made no persistent changes.
The other copy just needed to populate a DATABASEOID syscache entry.
This slightly raises database.sql test coverage of catcache.c, while
dbcommands.c coverage remains the same.
Reported-by: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/1802710.1757608564@sss.pgh.pa.us M src/test/regress/expected/database.out
M src/test/regress/sql/database.sql
Always commute strategy when preprocessing DESC keys.
commit : 796962922e6938fdad4dbf810fb2a5dfcfc5f45a
author : Peter Geoghegan <pg@bowt.ie>
date : Fri, 12 Sep 2025 13:23:00 -0400
committer: Peter Geoghegan <pg@bowt.ie>
date : Fri, 12 Sep 2025 13:23:00 -0400 A recently added nbtree preprocessing step failed to account for the
fact that DESC columns already had their B-Tree strategy number commuted
at this point in preprocessing. As a result, preprocessing could output
a set of scan keys where one or more keys had the correct strategy
number, but used the wrong comparison routine.
To fix, make the faulty code path that looks up a more restrictive
replacement operator/comparison routine commute its requested inequality
strategy (while outputting the transformed strategy number as before).
This makes the final transformed scan key comport with the approach
preprocessing has always used to deal with DESC columns (which is
described by comments above _bt_fix_scankey_strategy).
Oversight in commit commit b3f1a13f, which made nbtree preprocessing
perform transformations on skip array inequalities that can reduce the
total number of index searches.
Author: Peter Geoghegan <pg@bowt.ie>
Reported-By: Natalya Aksman <natalya@timescale.com>
Discussion: https://postgr.es/m/19049-b7df801e71de41b2@postgresql.org
Backpatch-through: 18 M src/backend/access/nbtree/nbtpreprocesskeys.c
Avoid unexpected changes of CurrentResourceOwner and CurrentMemoryContext
commit : 7dcea51c2a4dcf7c512bbd4f618d1d3620f9d3d7
author : Álvaro Herrera <alvherre@kurilemu.de>
date : Fri, 12 Sep 2025 18:47:25 +0200
committer: Álvaro Herrera <alvherre@kurilemu.de>
date : Fri, 12 Sep 2025 18:47:25 +0200 Users of logical decoding can encounter an unexpected change of
CurrentResourceOwner and CurrentMemoryContext. The problem is that,
unlike other call sites of RollbackAndReleaseCurrentSubTransaction(), in
reorderbuffer.c we fail to restore the original values of these global
variables after being clobbered by subtransaction abort. This patch
saves the values prior to the call and restores them eventually.
In addition, logical.c and logicalfuncs.c had a hack to restore resource
owner, presumably because of lack of this restore. Remove that.
Instead, because the test coverage here is not very consistent, add an
Assert() to ensure that the resowner is kept identical; this would make
it easy to detect other cases of bugs were we fail to restore resowner
properly. This could be removed later.
This is arguably an old bug, but there appears to be no reason to
backpatch it and it's risky to do so, so refrain for now.
Author: Antonin Houska <ah@cybertec.at>
Reported-by: Mihail Nikalayeu <mihailnikalayeu@gmail.com>
Reviewed-by: Euler Taveira <euler@eulerto.com>
Discussion: https://postgr.es/m/119497.1756892972@localhost M src/backend/replication/logical/logical.c
M src/backend/replication/logical/logicalfuncs.c
M src/backend/replication/logical/reorderbuffer.c
ci: openbsd: Increase RAM disk's size
commit : 20d541a200e9dfed8affef9e798ff35ca0f30b8e
author : Andres Freund <andres@anarazel.de>
date : Fri, 12 Sep 2025 10:18:31 -0400
committer: Andres Freund <andres@anarazel.de>
date : Fri, 12 Sep 2025 10:18:31 -0400 Its size was ~3.8GB before, which sometimes was not enough. OpenBSD CI task
often were failing due to no space left on device. Increase the RAM disk size
to ~4.6 GB.
Author: Nazir Bilal Yavuz <byavuz81@gmail.com>
Discussion: https://postgr.es/m/CAN55FZ2XVVPJRJmGB2DsL3gOrOinWh=HWvj6GO1cHzJ=6LwTag@mail.gmail.com
Backpatch-through: 18, where openbsd was added to CI M src/tools/ci/gcp_ram_disk.sh
Allow redeclaration of typedef yyscan_t
commit : ae0e1be9f2a20f6b64072dcee5b8dd7b9027a8fa
author : Peter Eisentraut <peter@eisentraut.org>
date : Fri, 12 Sep 2025 08:13:05 +0200
committer: Peter Eisentraut <peter@eisentraut.org>
date : Fri, 12 Sep 2025 08:13:05 +0200 This is allowed in C11, so we don't need the workaround guards against
it anymore. This effectively reverts commit 382092a0cd2 that put
these guards in place.
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/10d32190-f31b-40a5-b177-11db55597355@eisentraut.org M contrib/cube/cubedata.h
M contrib/seg/segdata.h
M src/backend/utils/adt/jsonpath_internal.h
M src/bin/pgbench/pgbench.h
M src/include/bootstrap/bootstrap.h
M src/include/fe_utils/psqlscan_int.h
M src/include/replication/syncrep.h
M src/include/replication/walsender_private.h
M src/pl/plpgsql/src/plpgsql.h
Improve pgbench definition of yyscan_t
commit : 675ddc4d704f4cde0bc72244263a9efbb0d32cb8
author : Peter Eisentraut <peter@eisentraut.org>
date : Fri, 12 Sep 2025 08:13:05 +0200
committer: Peter Eisentraut <peter@eisentraut.org>
date : Fri, 12 Sep 2025 08:13:05 +0200 It was defining yyscan_t as a macro while the rest of the code uses a
typedef with #ifdef guards around it. The latter is also what the
flex generated code uses. So it seems best to make it look like those
other places for consistency.
The old way also had a potential for conflict if some code included
multiple headers providing yyscan_t. exprscan.l includes
#include "fe_utils/psqlscan_int.h"
#include "pgbench.h"
and fe_utils/psqlscan_int.h contains
#ifndef YY_TYPEDEF_YY_SCANNER_T
#define YY_TYPEDEF_YY_SCANNER_T
typedef void *yyscan_t;
#endif
which was then followed by pgbench.h
#define yyscan_t void *
and then the generated code in exprscan.c
#ifndef YY_TYPEDEF_YY_SCANNER_T
#define YY_TYPEDEF_YY_SCANNER_T
typedef void* yyscan_t;
#endif
This works, but if the #ifdef guard in psqlscan_int.h is removed, this
fails.
We want to move toward allowing repeat typedefs, per C11, but for that
we need to make sure they are all the same.
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/10d32190-f31b-40a5-b177-11db55597355@eisentraut.org M src/bin/pgbench/pgbench.h
Default to log_lock_waits=on
commit : 2aac62be8cbb870ccf8c5b3fbb8a4e4aa8a14a73
author : Peter Eisentraut <peter@eisentraut.org>
date : Fri, 12 Sep 2025 07:57:06 +0200
committer: Peter Eisentraut <peter@eisentraut.org>
date : Fri, 12 Sep 2025 07:57:06 +0200 If someone is stuck behind a lock for more than a second, that is
almost always a problem that is worth a log entry.
Author: Laurenz Albe <laurenz.albe@cybertec.at>
Reviewed-By: Michael Banck <mbanck@gmx.net>
Reviewed-By: Robert Haas <robertmhaas@gmail.com>
Reviewed-By: Christoph Berg <myon@debian.org>
Reviewed-By: Stephen Frost <sfrost@snowman.net>
Discussion: https://postgr.es/m/b8b8502915e50f44deb111bc0b43a99e2733e117.camel%40cybertec.at M doc/src/sgml/config.sgml
M src/backend/storage/lmgr/proc.c
M src/backend/utils/misc/guc_parameters.dat
M src/backend/utils/misc/postgresql.conf.sample
Remove traces of support for Sun Studio compiler
commit : 25f36066dd2abde74faa12f08e5e498a95128cd0
author : Peter Eisentraut <peter@eisentraut.org>
date : Thu, 11 Sep 2025 11:55:29 +0200
committer: Peter Eisentraut <peter@eisentraut.org>
date : Thu, 11 Sep 2025 11:55:29 +0200 Per discussion, this compiler suite is no longer maintained, and
it has not been able to compile PostgreSQL since at least PostgreSQL
17.
This removes all the remaining support code for this compiler.
Note that the Solaris operating system continues to be supported, but
using GCC as the compiler.
Reviewed-by: Andres Freund <andres@anarazel.de>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://www.postgresql.org/message-id/flat/a0f817ee-fb86-483a-8a14-b6f7f5991b6e%40eisentraut.org M config/c-compiler.m4
M configure
M configure.ac
M doc/src/sgml/dfunc.sgml
M doc/src/sgml/installation.sgml
M meson.build
M src/Makefile.global.in
M src/backend/port/Makefile
D src/backend/port/tas/sunstudio_sparc.s
D src/backend/port/tas/sunstudio_x86.s
M src/backend/storage/lmgr/Makefile
M src/include/c.h
M src/include/port/atomics.h
M src/include/port/atomics/arch-x86.h
D src/include/port/atomics/generic-sunpro.h
M src/include/port/solaris.h
M src/include/storage/s_lock.h
M src/makefiles/meson.build
M src/template/linux
M src/template/solaris
M src/tools/pginclude/headerscheck
Silence compiler warnings on clang 21
commit : e92677e86333562b8dd4972083c8a1abf985d90d
author : Peter Eisentraut <peter@eisentraut.org>
date : Fri, 12 Sep 2025 07:27:48 +0200
committer: Peter Eisentraut <peter@eisentraut.org>
date : Fri, 12 Sep 2025 07:27:48 +0200 Clang 21 shows some new compiler warnings, for example:
warning: variable 'dstsize' is uninitialized when passed as a const pointer argument here [-Wuninitialized-const-pointer]
The fix is to initialize the variables when they are defined. This is
similar to, for example, the existing situation in gistKeyIsEQ().
Discussion: https://www.postgresql.org/message-id/flat/6604ad6e-5934-43ac-8590-15113d6ae4b1%40eisentraut.org M src/backend/access/common/toast_internals.c
M src/backend/access/gist/gistutil.c
Fix misuse of Relids for storing attribute numbers
commit : 2d756ebbe857e3d395d18350bf232300ebd23981
author : Richard Guo <rguo@postgresql.org>
date : Fri, 12 Sep 2025 11:12:19 +0900
committer: Richard Guo <rguo@postgresql.org>
date : Fri, 12 Sep 2025 11:12:19 +0900 The typedef Relids (Bitmapset *) is intended to represent set of
relation identifiers, but was incorrectly used in several places to
store sets of attribute numbers. This is my oversight in e2debb643.
Fix that by replacing such usages with Bitmapset * to reflect the
correct semantics.
Author: Junwang Zhao <zhjwpku@gmail.com>
Reviewed-by: Tender Wang <tndrwang@gmail.com>
Reviewed-by: Richard Guo <guofenglinux@gmail.com>
Discussion: https://postgr.es/m/CAEG8a3LJhp_xriXf39iCz0TsK+M-2biuhDhpLC6Baxw8+ZYT3A@mail.gmail.com M src/backend/optimizer/util/clauses.c
M src/backend/optimizer/util/plancat.c
M src/include/optimizer/plancat.h
Add more information for WAL records of hash index AMs
commit : 528dadf691df3023fbb0bd71da5c6087c2d49d6a
author : Michael Paquier <michael@paquier.xyz>
date : Fri, 12 Sep 2025 10:29:02 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Fri, 12 Sep 2025 10:29:02 +0900 hashdesc.c was missing a couple of fields in its record descriptions, as
of:
- is_prev_bucket_same_wrt for SQUEEZE_PAGE.
- procid for INIT_META_PAGE.
- old_bucket_flag and new_bucket_flag for SPLIT_ALLOCATE_PAGE.
The author has noted the first hole, and I have spotted the others while
double-checking this area of the code. Note that the only data missing
now are the offsets stored in VACUUM_ONE_PAGE. We could perhaps add
them, if somebody sees value in this data, even if it makes the output
larger. These are discarded here.
Author: Kirill Reshke <reshkekirill@gmail.com>
Discussion: https://postgr.es/m/CALdSSPjc-OVwtZH0Xrkvg7n=2ZwdbMJzqrm_ed_CfjiAzuKVGg@mail.gmail.com M src/backend/access/rmgrdesc/hashdesc.c
Remove whitespace in comment of pg_stat_statements.c
commit : 306dd13079ed616c414c9411c5deadffea273266
author : Michael Paquier <michael@paquier.xyz>
date : Fri, 12 Sep 2025 09:55:16 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Fri, 12 Sep 2025 09:55:16 +0900 Introduced by 6b4d23feef6e, spotted while reading this area of the code. M contrib/pg_stat_statements/pg_stat_statements.c
Move named LWLock tranche requests to shared memory.
commit : ed1aad15e09d7d523f4ef413e3c4d410497c8065
author : Nathan Bossart <nathan@postgresql.org>
date : Thu, 11 Sep 2025 16:13:55 -0500
committer: Nathan Bossart <nathan@postgresql.org>
date : Thu, 11 Sep 2025 16:13:55 -0500 In EXEC_BACKEND builds, GetNamedLWLockTranche() can segfault when
called outside of the postmaster process, as it might access
NamedLWLockTrancheRequestArray, which won't be initialized. Given
the lack of reports, this is apparently unusual, presumably because
it is usually called from a shmem_startup_hook like this:
mystruct = ShmemInitStruct(..., &found);
if (!found)
{
mystruct->locks = GetNamedLWLockTranche(...);
...
}
This genre of shmem_startup_hook evades the aforementioned
segfaults because the struct is initialized in the postmaster, so
all other callers skip the !found path.
We considered modifying the documentation or requiring
GetNamedLWLockTranche() to be called from the postmaster, but
ultimately we decided to simply move the request array to shared
memory (and add it to the BackendParameters struct), thereby
allowing calls outside postmaster on all platforms. Since the main
shared memory segment is initialized after accepting LWLock tranche
requests, postmaster builds the request array in local memory first
and then copies it to shared memory later.
Given the lack of reports, back-patching seems unnecessary.
Reported-by: Sami Imseih <samimseih@gmail.com>
Reviewed-by: Sami Imseih <samimseih@gmail.com>
Discussion: https://postgr.es/m/CAA5RZ0v1_15QPg5Sqd2Qz5rh_qcsyCeHHmRDY89xVHcy2yt5BQ%40mail.gmail.com M src/backend/postmaster/launch_backend.c
M src/backend/storage/lmgr/lwlock.c
M src/include/storage/lwlock.h
Report the correct is_temporary flag for column defaults.
commit : a0b99fc12203fa179d5b4218a21de30e0e91a7b8
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Thu, 11 Sep 2025 17:11:54 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Thu, 11 Sep 2025 17:11:54 -0400 pg_event_trigger_dropped_objects() would report a column default
object with is_temporary = false, even if it belongs to a
temporary table. This seems clearly wrong, so adjust it to
report the table's temp-ness.
While here, refactor EventTriggerSQLDropAddObject to make its
handling of namespace objects less messy and avoid duplication
of the schema-lookup code. And add some explicit test coverage
of dropped-object reports for dependencies of temp tables.
Back-patch to v15. The bug exists further back, but the
GetAttrDefaultColumnAddress function this patch depends on does not,
and it doesn't seem worth adjusting it to cope with the older code.
Author: Antoine Violin <violin.antuan@gmail.com>
Co-authored-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/CAFjUV9x3-hv0gihf+CtUc-1it0hh7Skp9iYFhMS7FJjtAeAptA@mail.gmail.com
Backpatch-through: 15 M src/backend/commands/event_trigger.c
M src/test/regress/expected/event_trigger.out
M src/test/regress/sql/event_trigger.sql
Improve comment about snapshot macros
commit : 1d5800019f68d81139021b8bab159b8578fcaa2b
author : Álvaro Herrera <alvherre@kurilemu.de>
date : Thu, 11 Sep 2025 19:49:57 +0200
committer: Álvaro Herrera <alvherre@kurilemu.de>
date : Thu, 11 Sep 2025 19:49:57 +0200 The comment mistakenly had "the others" for "the other", but this
commit also reorders the comment so it matches the macros below. Now we
describe the levels in increasing strictness. In addition, it seems
easier to follow if we introduce one level at a time, rather than
describing two, followed by "the other" (and then jumping back to one of
the first two). Finally, reword the sentence about the purpose of the
macros, which was slightly off-point.
Author: Paul Jungwirth <pj@illuminatedcomputing.com>
Reviewed-by: Rustam ALLAKOV <rustamallakov@gmail.com>
Reviewed-by: Dean Rasheed <dean.a.rasheed@gmail.com>
Reviewed-by: Robert Haas <robertmhaas@gmail.com>
Discussion: https://postgr.es/m/CA+renyUp=xja80rBaB6NpY3RRdi750y046x28bo_xg29zKY72Q@mail.gmail.com M src/include/access/xact.h
Add test for temporal referential integrity
commit : e8cec3d1791c140398454aa561cf51659dd8243d
author : Álvaro Herrera <alvherre@kurilemu.de>
date : Thu, 11 Sep 2025 18:13:09 +0200
committer: Álvaro Herrera <alvherre@kurilemu.de>
date : Thu, 11 Sep 2025 18:13:09 +0200 This commit adds an isolation test showing that temporal foreign keys do
not permit referential integrity violations under concurrency, like
fk-snapshot-2. You can show that the test fails by passing false for
detectNewRows to ri_PerformCheck in ri_restrict.
Author: Paul Jungwirth <pj@illuminatedcomputing.com>
Reviewed-by: Rustam ALLAKOV <rustamallakov@gmail.com>
Reviewed-by: Dean Rasheed <dean.a.rasheed@gmail.com>
Reviewed-by: Robert Haas <robertmhaas@gmail.com>
Discussion: https://postgr.es/m/CA+renyUp=xja80rBaB6NpY3RRdi750y046x28bo_xg29zKY72Q@mail.gmail.com A src/test/isolation/expected/fk-snapshot-3.out
M src/test/isolation/isolation_schedule
A src/test/isolation/specs/fk-snapshot-3.spec
Fill testing gap for possible referential integrity violation
commit : a2b4102a21ad730ce46b059acf49d72151e979f6
author : Álvaro Herrera <alvherre@kurilemu.de>
date : Thu, 11 Sep 2025 18:11:46 +0200
committer: Álvaro Herrera <alvherre@kurilemu.de>
date : Thu, 11 Sep 2025 18:11:46 +0200 This commit adds a missing isolation test for (non-PERIOD) foreign keys.
With REPEATABLE READ, one transaction can insert a referencing row while
another deletes the referenced row, and both see a valid state. But
after they have committed, the table violates referential integrity.
If the INSERT precedes the DELETE, we use a crosscheck snapshot to see
the just-added row, so that the DELETE can raise a foreign key error.
You can see the table violate referential integrity if you change
ri_restrict to pass false for detectNewRows to ri_PerformCheck.
A crosscheck snapshot is not needed when the DELETE comes first, because
the INSERT's trigger takes a FOR KEY SHARE lock that sees the row now
marked for deletion, waits for that transaction to commit, and raises a
serialization error. I (Paul) added a test for that too though.
We already have a similar test (in ri-triggers.spec) for SERIALIZABLE
snapshot isolation showing that you can implement foreign keys with just
pl/pgSQL, but that test does nothing to validate ri_triggers.c. We also
have tests (in fk-snapshot.spec) for other concurrency scenarios, but
not this one: we test concurrently deleting both the referencing and
referenced row, when the constraint activates a cascade/set null action.
But those tests don't exercise ri_restrict, and the consequence of
omitting a crosscheck comparison is different: a serialization failure,
not a referential integrity violation.
Author: Paul Jungwirth <pj@illuminatedcomputing.com>
Reviewed-by: Rustam ALLAKOV <rustamallakov@gmail.com>
Reviewed-by: Dean Rasheed <dean.a.rasheed@gmail.com>
Reviewed-by: Robert Haas <robertmhaas@gmail.com>
Discussion: https://postgr.es/m/CA+renyUp=xja80rBaB6NpY3RRdi750y046x28bo_xg29zKY72Q@mail.gmail.com A src/test/isolation/expected/fk-snapshot-2.out
M src/test/isolation/isolation_schedule
A src/test/isolation/specs/fk-snapshot-2.spec
Remove checks for no longer supported GCC versions
commit : 4fbe0151455fefbef7abc9d507adb04c978beb0d
author : Peter Eisentraut <peter@eisentraut.org>
date : Thu, 11 Sep 2025 11:55:29 +0200
committer: Peter Eisentraut <peter@eisentraut.org>
date : Thu, 11 Sep 2025 11:55:29 +0200 Since commit f5e0186f865 (Raise C requirement to C11), we effectively
require at least GCC version 4.7, so checks for older versions can be
removed.
Reviewed-by: Andres Freund <andres@anarazel.de>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://www.postgresql.org/message-id/flat/a0f817ee-fb86-483a-8a14-b6f7f5991b6e%40eisentraut.org M src/include/c.h
M src/include/port/atomics/generic-gcc.h
Remove stray semicolon at global scope
commit : 368c38dd47c209fa95d2df855d62bcde386f3037
author : Peter Eisentraut <peter@eisentraut.org>
date : Thu, 11 Sep 2025 11:55:29 +0200
committer: Peter Eisentraut <peter@eisentraut.org>
date : Thu, 11 Sep 2025 11:55:29 +0200 The Sun Studio compiler complains about an empty declaration here.
Note for future historians: This does not mean that this compiler is
still of current interest for anyone using PostgreSQL. But we can let
this small fix be its parting gift.
Reviewed-by: Andres Freund <andres@anarazel.de>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://www.postgresql.org/message-id/flat/a0f817ee-fb86-483a-8a14-b6f7f5991b6e%40eisentraut.org M src/backend/replication/logical/slotsync.c
Fix intermittent test failure introduced in 6456c6e2c4.
commit : 01d793698f5921547a7b5e1e003722c17f552574
author : Amit Kapila <akapila@postgresql.org>
date : Thu, 11 Sep 2025 09:33:48 +0000
committer: Amit Kapila <akapila@postgresql.org>
date : Thu, 11 Sep 2025 09:33:48 +0000 The test assumes that a backend will execute COMMIT PREPARED on the
publisher and hit the injection point commit-after-delay-checkpoint within
the commit critical section. This should cause the apply worker on the
subscriber to wait for the transaction to complete.
However, the test does not guarantee that the injection point is actually
triggered, creating a race condition where the apply worker may proceed
prematurely during COMMIT PREPARED.
This commit resolves the issue by explicitly waiting for the injection
point to be hit before continuing with the test, ensuring consistent and
reliable behavior.
Author: Zhijie Hou <houzj.fnst@fujitsu.com>
Reviewed-by: shveta malik <shveta.malik@gmail.com>
Discussion: https://postgr.es/m/TY4PR01MB1690751D1CA8C128B0770EC6F9409A@TY4PR01MB16907.jpnprd01.prod.outlook.com M src/test/subscription/t/035_conflicts.pl
doc: Fix indentation in func-datetime.sgml.
commit : 2bbbb2eca9303df590cc79be74b13cad259124a5
author : Dean Rasheed <dean.a.rasheed@gmail.com>
date : Thu, 11 Sep 2025 09:48:12 +0100
committer: Dean Rasheed <dean.a.rasheed@gmail.com>
date : Thu, 11 Sep 2025 09:48:12 +0100 Incorrect indentation introduced by commit faf071b5538. M doc/src/sgml/func/func-datetime.sgml
doc: Improve description of new random(min, max) functions.
commit : 9c24111c4dad850bc2625c2113bb3d2dfd592efc
author : Dean Rasheed <dean.a.rasheed@gmail.com>
date : Thu, 11 Sep 2025 09:25:47 +0100
committer: Dean Rasheed <dean.a.rasheed@gmail.com>
date : Thu, 11 Sep 2025 09:25:47 +0100 Mention that the new variants of random(min, max) are affected by
setseed(), like the original functions.
Reported-by: Marcos Pegoraro <marcos@f10.com.br>
Discussion: https://postgr.es/m/CAB-JLwb1=drA3Le6uZXDBi_tCpeS1qm6XQU7dKwac_x91Z4qDg@mail.gmail.com M doc/src/sgml/func/func-datetime.sgml
M doc/src/sgml/func/func-math.sgml
Fix description of WAL record blocks in hash_xlog.h
commit : 26eadf4d2b14a8a8d110b214dbb7ef952fbf8e93
author : Michael Paquier <michael@paquier.xyz>
date : Thu, 11 Sep 2025 17:17:04 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Thu, 11 Sep 2025 17:17:04 +0900 hash_xlog.h included descriptions for the blocks used in WAL records
that were was not completely consistent with how the records are
generated, with one block missing for SQUEEZE_PAGE, and inconsistent
descriptions used for block 0 in VACUUM_ONE_PAGE and MOVE_PAGE_CONTENTS.
This information was incorrect since c11453ce0aea, cross-checking the
logic for the record generation.
Author: Kirill Reshke <reshkekirill@gmail.com>
Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Discussion: https://postgr.es/m/CALdSSPj1j=a1d1hVA3oabRFz0hSU3KKrYtZPijw4UPUM7LY9zw@mail.gmail.com
Backpatch-through: 13 M src/include/access/hash_xlog.h
Fix incorrect file reference in guc.h
commit : c88ce73eda2e0a818d730c5b72475ef99cc9c4cf
author : Michael Paquier <michael@paquier.xyz>
date : Thu, 11 Sep 2025 10:15:33 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Thu, 11 Sep 2025 10:15:33 +0900 GucSource_Names was documented as being in guc.c, but since 0a20ff54f5e6
it is located in guc_tables.c. The reference to the location of
GucSource_Names is important, as GucSource needs to be kept in sync with
GucSource_Names.
Author: David G. Johnston <david.g.johnston@gmail.com>
Discussion: https://postgr.es/m/CAKFQuwYPgAHWPYjPzK7iXzhSZ6MKR8w20_Nz7ZXpOvx=kZbs7A@mail.gmail.com
Backpatch-through: 16 M src/include/utils/guc.h
Avoid faulty alignment of Datums in build_sorted_items().
commit : 09036dc71c682b0bf7234ed39c1429ed99fbe442
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Wed, 10 Sep 2025 17:51:24 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Wed, 10 Sep 2025 17:51:24 -0400 If sizeof(Pointer) is 4 then sizeof(SortItem) will be 12, so that
if data->numrows is odd then we placed the values array at a location
that's not a multiple of 8. That was fine when sizeof(Datum) was also
4, but in the wake of commit 2a600a93c it makes some alignment-picky
machines unhappy. (You need a 32-bit machine that nonetheless expects
8-byte alignment of 8-byte quantities, which is an odd-seeming
combination but it does exist outside the Intel universe.)
To fix, MAXALIGN the space allocated to the SortItem array.
In passing, let's make the "len" variable be Size not int,
just for paranoia's sake.
This code was arguably not too safe even before 2a600a93c, but at
present I don't see a strong argument for back-patching.
Reported-by: Tomas Vondra <tomas@vondra.me>
Author: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/87036018-8d70-40ad-a0ac-192b07bd7b04@vondra.me M src/backend/statistics/extended_stats.c
Eliminate duplicative hashtempcxt in nodeSubplan.c.
commit : bdc6cfcd12f5c95799328e05aa4bfa75cfe3e79f
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Wed, 10 Sep 2025 16:15:08 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Wed, 10 Sep 2025 16:15:08 -0400 Instead of building a separate memory context that's used just
for running hash functions, make the hash functions run in the
per-tuple context of the node's innerecontext. This saves a
little space at runtime, and it avoids needing to reset two
contexts instead of one inside buildSubPlanHash's main loop.
This largely reverts commit 133924e13. That's safe to do now
because bf6c614a2 decoupled the evaluation context used by
TupleHashTableMatch from that used for hash function evaluation,
so that there's no longer a risk of resetting the innerecontext
too soon.
Per discussion of bug #19040, although this is not directly
a fix for that.
Author: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Haiyang Li <mohen.lhy@alibaba-inc.com>
Reviewed-by: Fei Changhong <feichanghong@qq.com>
Discussion: https://postgr.es/m/19040-c9b6073ef814f48c@postgresql.org M src/backend/executor/nodeSubplan.c
M src/include/nodes/execnodes.h
Fix memory leakage in nodeSubplan.c.
commit : abdeacdb0920d94dec7500d09f6f29fbb2f6310d
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Wed, 10 Sep 2025 16:05:03 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Wed, 10 Sep 2025 16:05:03 -0400 If the hash functions used for hashing tuples leaked any memory,
we failed to clean that up, resulting in query-lifespan memory
leakage in queries using hashed subplans. One way that could
happen is if the values being hashed require de-toasting, since
most of our hash functions don't trouble to clean up de-toasted
inputs.
Prior to commit bf6c614a2, this leakage was largely masked
because TupleHashTableMatch would reset hashtable->tempcxt
(via execTuplesMatch). But it doesn't do that anymore, and
that's not really the right place for this anyway: doing it
there could reset the tempcxt many times per hash lookup,
or not at all. Instead put reset calls into ExecHashSubPlan
and buildSubPlanHash. Along the way to that, rearrange
ExecHashSubPlan so that there's just one place to call
MemoryContextReset instead of several.
This amounts to accepting the de-facto API spec that the caller
of the TupleHashTable routines is responsible for resetting the
tempcxt adequately often. Although the other callers seem to
get this right, it was not documented anywhere, so add a comment
about it.
Bug: #19040
Reported-by: Haiyang Li <mohen.lhy@alibaba-inc.com>
Author: Haiyang Li <mohen.lhy@alibaba-inc.com>
Reviewed-by: Fei Changhong <feichanghong@qq.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/19040-c9b6073ef814f48c@postgresql.org
Backpatch-through: 13 M src/backend/executor/execGrouping.c
M src/backend/executor/nodeSubplan.c
meson: Build numeric.c with -ftree-vectorize.
commit : 9016fa7e3bcde8ae4c3d63c707143af147486a10
author : Nathan Bossart <nathan@postgresql.org>
date : Wed, 10 Sep 2025 11:21:12 -0500
committer: Nathan Bossart <nathan@postgresql.org>
date : Wed, 10 Sep 2025 11:21:12 -0500 autoconf builds have compiled this file with -ftree-vectorize since
commit 8870917623, but meson builds seem to have missed the memo.
Reviewed-by: Jeff Davis <pgsql@j-davis.com>
Discussion: https://postgr.es/m/aL85CeasM51-0D1h%40nathan
Backpatch-through: 16 M src/backend/utils/adt/meson.build
Fix CREATE TABLE LIKE with not-valid check constraint
commit : 33eec809402bfbf3eb0d01ad5b023d3d05fcb3bc
author : Peter Eisentraut <peter@eisentraut.org>
date : Wed, 10 Sep 2025 11:49:53 +0200
committer: Peter Eisentraut <peter@eisentraut.org>
date : Wed, 10 Sep 2025 11:49:53 +0200 In CREATE TABLE ... LIKE, any check constraints copied from the source
table should be set to valid if they are ENFORCED (the default).
Bug introduced in commit ca87c415e2f.
Author: jian he <jian.universality@gmail.com>
Discussion: https://www.postgresql.org/message-id/CACJufxH%3D%2Bod8Wy0P4L3_GpapNwLUP3oAes5UFRJ7yTxrM_M5kg%40mail.gmail.com M src/backend/parser/parse_utilcmd.c
M src/test/regress/expected/create_table_like.out
M src/test/regress/sql/create_table_like.sql
Remove dynahash.h
commit : e6da68a6e1d60a037b63a9c9ed36e5ef0a996769
author : Michael Paquier <michael@paquier.xyz>
date : Wed, 10 Sep 2025 14:11:50 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Wed, 10 Sep 2025 14:11:50 +0900 All the callers of my_log2() are now limited inside dynahash.c, so let's
remove this header. The same capability is provided by pg_bitutils.h
already.
Discussion: https://postgr.es/m/CAEZATCUJPQD_7sC-wErak2CQGNa6bj2hY-mr8wsBki=kX7f2_A@mail.gmail.com M src/backend/utils/hash/dynahash.c
D src/include/utils/dynahash.h
Replace callers of dynahash.h's my_log() by equivalent in pg_bitutils.h
commit : b1187266e077265cb061cbedd502e94179dc7b21
author : Michael Paquier <michael@paquier.xyz>
date : Wed, 10 Sep 2025 11:20:46 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Wed, 10 Sep 2025 11:20:46 +0900 All the calls replaced by this commit use 4-byte integers for their
variables used in input of my_log2(). Hence, the limit against
too-large inputs does not really apply. Thresholds are also applied, as
of:
- In nodeAgg.c, the number of partitions is limited by
HASHAGG_MAX_PARTITIONS.
- In nodeHash.c, ExecChooseHashTableSize() caps its maximum number of
buckets based on HashJoinTuple and palloc() allocation limit.
- In worker.c, the number of subxacts tracked by ApplySubXactData uses
uint32, making pg_ceil_log2_64() safe to use directly.
Several approaches have been discussed, like an integration with
thresholds in pg_bitutils.h, but it was found confusing. This uses
Dean's idea, which gives a simpler result than what I came up with to be
able to remove dynahash.h. dynahash.h will be removed in a follow-up
commit, removing some duplication with the ceil log2 routines.
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Reviewed-by: Dean Rasheed <dean.a.rasheed@gmail.com>
Discussion: https://postgr.es/m/CAEZATCUJPQD_7sC-wErak2CQGNa6bj2hY-mr8wsBki=kX7f2_A@mail.gmail.com M src/backend/executor/nodeAgg.c
M src/backend/executor/nodeHash.c
M src/backend/replication/logical/worker.c
Fix leak with SMgrRelations in startup process
commit : 8c8f7b199d9095dbc2e101a4614043b5ae13bde3
author : Michael Paquier <michael@paquier.xyz>
date : Wed, 10 Sep 2025 07:23:05 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Wed, 10 Sep 2025 07:23:05 +0900 The startup process does not process shared invalidation messages, only
sending them, and never calls AtEOXact_SMgr() which clean up any
unpinned SMgrRelations. Hence, it is never able to free SMgrRelations
on a periodic basis, bloating its hashtable over time.
Like the checkpointer and the bgwriter, this commit takes a conservative
approach by freeing periodically SMgrRelations when replaying a
checkpoint record, either online or shutdown, so as the startup process
has a way to perform a periodic cleanup.
Issue caused by 21d9c3ee4ef7, so backpatch down to v17.
Author: Jingtang Zhang <mrdrivingduck@gmail.com>
Reviewed-by: Yuhang Qiu <iamqyh@gmail.com>
Discussion: https://postgr.es/m/28C687D4-F335-417E-B06C-6612A0BD5A10@gmail.com
Backpatch-through: 17 M src/backend/access/transam/xlog.c
Fix documentation for shmem_startup_hook.
commit : d96c854dfc634212193007ca58f8978bc272d457
author : Nathan Bossart <nathan@postgresql.org>
date : Tue, 9 Sep 2025 14:35:30 -0500
committer: Nathan Bossart <nathan@postgresql.org>
date : Tue, 9 Sep 2025 14:35:30 -0500 This section claims that each backend executes the
shmem_startup_hook shortly after attaching to shared memory, which
is true for EXEC_BACKEND builds, but not for others. This commit
adds this important detail.
Oversight in commit 964152c476.
Reported-by: Sami Imseih <samimseih@gmail.com>
Reviewed-by: Sami Imseih <samimseih@gmail.com>
Discussion: https://postgr.es/m/CAA5RZ0vEGT1eigGbVt604LkXP6mUPMwPMxQoRCbFny44w%2B9EUQ%40mail.gmail.com
Backpatch-through: 17 M doc/src/sgml/xfunc.sgml
test_slru: Fix LWLock tranche allocation in EXEC_BACKEND builds.
commit : 530cfa8eb50ca5a2151dfc50a6a5999ec8aff148
author : Nathan Bossart <nathan@postgresql.org>
date : Tue, 9 Sep 2025 14:09:36 -0500
committer: Nathan Bossart <nathan@postgresql.org>
date : Tue, 9 Sep 2025 14:09:36 -0500 Currently, test_slru's shmem_startup_hook unconditionally generates
new LWLock tranche IDs. This is fine on non-EXEC_BACKEND builds,
where only the postmaster executes this hook, but on EXEC_BACKEND
builds, every backend executes it, too. To fix, only generate the
tranche IDs in the postmaster process by checking the
IsUnderPostmaster variable.
This is arguably a bug fix and could be back-patched, but since the
damage is limited to some extra unused tranche IDs in a test
module, I'm not going to bother.
Reported-by: Sami Imseih <samimseih@gmail.com>
Reviewed-by: Sami Imseih <samimseih@gmail.com>
Discussion: https://postgr.es/m/CAA5RZ0vaAuonaf12CeDddQJu5xKL%2B6xVyS%2B_q1%2BcH%3D33JXV82w%40mail.gmail.com M src/test/modules/test_slru/test_slru.c
Fix typo in comment
commit : 81a61fde84ffc74f7b3c7854ed4193cc4d31f78b
author : Peter Eisentraut <peter@eisentraut.org>
date : Tue, 9 Sep 2025 15:33:46 +0200
committer: Peter Eisentraut <peter@eisentraut.org>
date : Tue, 9 Sep 2025 15:33:46 +0200 Author: Alexandra Wang <alexandra.wang.oss@gmail.com>
Discussion: https://www.postgresql.org/message-id/CAK98qZ0whQ%3Dc%2BJGXbGSEBxCtLgy6sf-YGYqsKTAGsS-wt0wj%2BA%40mail.gmail.com M src/backend/utils/adt/jsonbsubs.c
Add date and timestamp variants of random(min, max).
commit : faf071b553830d39fc583beabcaf56ed65259acc
author : Dean Rasheed <dean.a.rasheed@gmail.com>
date : Tue, 9 Sep 2025 10:39:30 +0100
committer: Dean Rasheed <dean.a.rasheed@gmail.com>
date : Tue, 9 Sep 2025 10:39:30 +0100 This adds 3 new variants of the random() function:
random(min date, max date) returns date
random(min timestamp, max timestamp) returns timestamp
random(min timestamptz, max timestamptz) returns timestamptz
Each returns a random value x in the range min <= x <= max.
Author: Damien Clochard <damien@dalibo.info>
Reviewed-by: Greg Sabino Mullane <htamfids@gmail.com>
Reviewed-by: Dean Rasheed <dean.a.rasheed@gmail.com>
Reviewed-by: Vik Fearing <vik@postgresfriends.org>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://postgr.es/m/f524d8cab5914613d9e624d9ce177d3d@dalibo.info M doc/src/sgml/func/func-datetime.sgml
M doc/src/sgml/func/func-math.sgml
M src/backend/utils/adt/pseudorandomfuncs.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/test/regress/expected/random.out
M src/test/regress/sql/random.sql
Fix Coverity issue reported in commit a850be2fe.
commit : 5ac3c1ac22cb325844d0bee37f79f2c11931b32e
author : Amit Kapila <akapila@postgresql.org>
date : Tue, 9 Sep 2025 03:18:22 +0000
committer: Amit Kapila <akapila@postgresql.org>
date : Tue, 9 Sep 2025 03:18:22 +0000 Address a potential SIGSEGV that may occur when the tablesync worker
attempts to locate a deleted row while applying changes. This situation
arises during conflict detection for update-deleted scenarios.
To prevent this crash, ensure that the operation is errored out early if
the leader apply worker is unavailable. Since the leader worker maintains
the necessary conflict detection metadata, proceeding without it serves no
purpose and risks reporting incorrect conflict type.
In the passing, improve a nearby comment.
Reported by Tom Lane as per Coverity
Author: shveta malik <shveta.malik@gmail.com>
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>
Discussion: https://postgr.es/m/334468.1757280992@sss.pgh.pa.us M src/backend/replication/logical/worker.c
Add error codes when vacuum discovers VM corruption
commit : 8ec97e78a7713a1ebf4976b55c19f6c9bc2716d9
author : Melanie Plageman <melanieplageman@gmail.com>
date : Mon, 8 Sep 2025 17:13:31 -0400
committer: Melanie Plageman <melanieplageman@gmail.com>
date : Mon, 8 Sep 2025 17:13:31 -0400 Commit fd6ec93bf890314a and other previous work established the
principle that when an error is potentially reachable in case of on-disk
corruption but is not expected to be reached otherwise,
ERRCODE_DATA_CORRUPTED should be used. This allows log monitoring
software to search for evidence of corruption by filtering on the error
code.
Enhance the existing log messages emitted when the heap page is found to
be inconsistent with the VM by adding this error code.
Suggested-by: Andrey Borodin <x4mmm@yandex-team.ru>
Author: Melanie Plageman <melanieplageman@gmail.com>
Reviewed-by: Robert Haas <robertmhaas@gmail.com>
Discussion: https://postgr.es/m/87DD95AA-274F-4F4F-BAD9-7738E5B1F905%40yandex-team.ru M src/backend/access/heap/vacuumlazy.c
meson: build checksums with extra optimization flags.
commit : 9af672bcb245950e58198119ba6eb17043fd3a6d
author : Jeff Davis <jdavis@postgresql.org>
date : Mon, 8 Sep 2025 12:29:42 -0700
committer: Jeff Davis <jdavis@postgresql.org>
date : Mon, 8 Sep 2025 12:29:42 -0700 Use -funroll-loops and -ftree-vectorize when building checksum.c to
match what autoconf does.
Discussion: https://postgr.es/m/a81f2f7ef34afc24a89c613671ea017e3651329c.camel@j-davis.com
Reviewed-by: Andres Freund <andres@anarazel.de> M src/backend/storage/page/meson.build
pg_upgrade: Transfer pg_largeobject_metadata's files when possible.
commit : 3bcfcd815e1a2d51772ba27e0d034467f0344f15
author : Nathan Bossart <nathan@postgresql.org>
date : Mon, 8 Sep 2025 14:19:48 -0500
committer: Nathan Bossart <nathan@postgresql.org>
date : Mon, 8 Sep 2025 14:19:48 -0500 Commit 161a3e8b68 taught pg_upgrade to use COPY for large object
metadata for upgrades from v12 and newer, which is much faster to
restore than the proper large object commands. For upgrades from
v16 and newer, we can take this a step further and transfer the
large object metadata files as if they were user tables. We can't
transfer the files from older versions because the aclitem data
type (needed by pg_largeobject_metadata.lomacl) changed its storage
format in v16 (see commit 7b378237aa). Note that this commit is
essentially a revert of commit 12a53c732c.
There are a couple of caveats. First, we still need to COPY the
corresponding pg_shdepend rows for large objects. Second, we need
to COPY anything in pg_largeobject_metadata with a comment or
security label, else restoring those will fail. This means that an
upgrade in which every large object has a comment or security label
won't gain anything from this commit, but it should at least avoid
making those unusual use-cases any worse.
pg_upgrade must also take care to transfer the relfilenodes of
pg_largeobject_metadata and its index, as was done for
pg_largeobject in commits d498e052b4 and bbe08b8869.
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://postgr.es/m/aJ3_Gih_XW1_O2HF%40nathan M src/backend/commands/tablecmds.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_upgrade/Makefile
M src/bin/pg_upgrade/info.c
M src/bin/pg_upgrade/pg_upgrade.c
M src/bin/pg_upgrade/t/006_transfer_modes.pl
Remove unused xl_heap_prune member, reason
commit : 4b5f206de2bb9152a99a5c218caf2580cc5a0e9e
author : Melanie Plageman <melanieplageman@gmail.com>
date : Mon, 8 Sep 2025 14:25:10 -0400
committer: Melanie Plageman <melanieplageman@gmail.com>
date : Mon, 8 Sep 2025 14:25:10 -0400 f83d709760d8 refactored xl_heap_prune and added an unused member,
reason. While PruneReason is used when constructing this WAL record to
set the WAL record definition, it doesn't need to be stored in a
separate field in the record. Remove it.
We won't backport this, since modifying an exposed struct definition to
remove an unused field would do more harm than good.
Author: Melanie Plageman <melanieplageman@gmail.com>
Reported-by: Andres Freund <andres@anarazel.de>
Reviewed-by: Robert Haas <robertmhaas@gmail.com>
Discussion: https://postgr.es/m/tvvtfoxz5ykpsctxjbzxg3nldnzfc7geplrt2z2s54pmgto27y%40hbijsndifu45 M src/include/access/heapam_xlog.h
Don't generate fake "*TLOCRN*" or "*TROCRN*" aliases, either.
commit : 5a170e992a4d402ef0e1b8ce7284cd78879ece73
author : Robert Haas <rhaas@postgresql.org>
date : Mon, 8 Sep 2025 12:58:07 -0400
committer: Robert Haas <rhaas@postgresql.org>
date : Mon, 8 Sep 2025 12:58:07 -0400 This is just like the previous two commits, except that this fix
actually doesn't change any regression test outputs.
Author: Robert Haas <rhaas@postgresql.org>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/CA+TgmoYSYmDA2GvanzPMci084n+mVucv0bJ0HPbs6uhmMN6HMg@mail.gmail.com M src/backend/rewrite/rewriteSearchCycle.c
Don't generate fake "ANY_subquery" aliases, either.
commit : 6f79024df3461f794aace8bbc8706d8e5f7da091
author : Robert Haas <rhaas@postgresql.org>
date : Mon, 8 Sep 2025 12:24:02 -0400
committer: Robert Haas <rhaas@postgresql.org>
date : Mon, 8 Sep 2025 12:24:02 -0400 This is just like the previous commit, but for a different invented
alias name.
Author: Robert Haas <rhaas@postgresql.org>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/CA+TgmoYSYmDA2GvanzPMci084n+mVucv0bJ0HPbs6uhmMN6HMg@mail.gmail.com M src/backend/optimizer/plan/subselect.c
M src/test/regress/expected/memoize.out
M src/test/regress/expected/subselect.out
Don't generate fake "*SELECT*" or "*SELECT* %d" subquery aliases.
commit : 585e31fcb6dfcb1d88cfee2371f565574db24869
author : Robert Haas <rhaas@postgresql.org>
date : Mon, 8 Sep 2025 11:50:33 -0400
committer: Robert Haas <rhaas@postgresql.org>
date : Mon, 8 Sep 2025 11:50:33 -0400 rte->alias should point only to a user-written alias, but in these
cases that principle was violated. Fixing this causes some regression
test output changes: wherever rte->alias previously had a value and
is now NULL, rte->eref is now set to a generated name rather than to
rte->alias; and the scheme used to generate eref names differs from
what we were doing for aliases.
The upshot is that instead of "*SELECT*" or "*SELECT* %d",
EXPLAIN will now emit "unnamed_subquery" or "unnamed_subquery_%d".
But that's a reasonable descriptor, and we were already producing
that in yet other cases, so this seems not too objectionable.
Author: Tom Lane <tgl@sss.pgh.pa.us>
Co-authored-by: Robert Haas <rhaas@postgresql.org>
Discussion: https://postgr.es/m/CA+TgmoYSYmDA2GvanzPMci084n+mVucv0bJ0HPbs6uhmMN6HMg@mail.gmail.com M contrib/postgres_fdw/expected/postgres_fdw.out
M src/backend/executor/functions.c
M src/backend/parser/analyze.c
M src/test/regress/expected/partition_prune.out
M src/test/regress/expected/rangefuncs.out
M src/test/regress/expected/union.out
Remove unneeded VM pin from VM replay
commit : 3399c265543ec3cdbeff2fa2900e03b326705f63
author : Melanie Plageman <melanieplageman@gmail.com>
date : Mon, 8 Sep 2025 10:22:42 -0400
committer: Melanie Plageman <melanieplageman@gmail.com>
date : Mon, 8 Sep 2025 10:22:42 -0400 Previously, heap_xlog_visible() called visibilitymap_pin() even after
getting a buffer from XLogReadBufferForRedoExtended() -- which returns a
pinned buffer containing the specified block of the visibility map.
This would just have resulted in visibilitymap_pin() returning early
since the specified page was already present and pinned, but it was
confusing extraneous code, so remove it. It doesn't seem worth
backporting, though.
It appears to be an oversight in 2c03216.
While we are at it, remove two VM-related redundant asserts in the COPY
FREEZE code path. visibilitymap_set() already asserts that
PD_ALL_VISIBLE is set on the heap page and checks that the vmbuffer
contains the bits corresponding to the specified heap block, so callers
do not also need to check this.
Author: Melanie Plageman <melanieplageman@gmail.com>
Reported-by: Melanie Plageman <melanieplageman@gmail.com>
Reported-by: Kirill Reshke <reshkekirill@gmail.com>
Reviewed-by: Kirill Reshke <reshkekirill@gmail.com>
Reviewed-by: Andres Freund <andres@anarazel.de>
Discussion: https://postgr.es/m/CALdSSPhu7WZd%2BEfQDha1nz%3DDC93OtY1%3DUFEdWwSZsASka_2eRQ%40mail.gmail.com M src/backend/access/heap/heapam.c
M src/backend/access/heap/heapam_xlog.c
Add test to prevent premature removal of conflict-relevant data.
commit : 6456c6e2c4ad1cf9752e09cce37bfcfe2190c5e0
author : Amit Kapila <akapila@postgresql.org>
date : Mon, 8 Sep 2025 11:38:02 +0000
committer: Amit Kapila <akapila@postgresql.org>
date : Mon, 8 Sep 2025 11:38:02 +0000 A test has been added to ensure that conflict-relevant data is not
prematurely removed when a concurrent prepared transaction is being
committed on the publisher.
This test introduces an injection point that simulates the presence of a
prepared transaction in the commit phase, validating that the system
correctly delays conflict slot advancement until the transaction is fully
committed.
Additionally, the test serves as a safeguard for developers, ensuring that
the acquisition of the commit timestamp does not occur before marking
DELAY_CHKPT_IN_COMMIT in RecordTransactionCommitPrepared.
Reported-by: Robert Haas <robertmhaas@gmail.com>
Author: Zhijie Hou <houzj.fnst@fujitsu.com>
Reviewed-by: shveta malik <shveta.malik@gmail.com>
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>
Discussion: https://postgr.es/m/OS9PR01MB16913F67856B0DA2A909788129400A@OS9PR01MB16913.jpnprd01.prod.outlook.com M src/backend/access/transam/twophase.c
M src/test/subscription/Makefile
M src/test/subscription/meson.build
M src/test/subscription/t/035_conflicts.pl
Fix corruption of pgstats shared hashtable due to OOM failures
commit : 8191e0c16a0373f851a9f5a8112e3aec105b5276
author : Michael Paquier <michael@paquier.xyz>
date : Mon, 8 Sep 2025 15:52:23 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Mon, 8 Sep 2025 15:52:23 +0900 A new pgstats entry is created as a two-step process:
- The entry is looked at in the shared hashtable of pgstats, and is
inserted if not found.
- When not found and inserted, its fields are then initialized. This
part include a DSA chunk allocation for the stats data of the new entry.
As currently coded, if the DSA chunk allocation fails due to an
out-of-memory failure, an ERROR is generated, leaving in the pgstats
shared hashtable an inconsistent entry due to the first step, as the
entry has already been inserted in the hashtable. These broken entries
can then be found by other backends, crashing them.
There are only two callers of pgstat_init_entry(), when loading the
pgstats file at startup and when creating a new pgstats entry. This
commit changes pgstat_init_entry() so as we use dsa_allocate_extended()
with DSA_ALLOC_NO_OOM, making it return NULL on allocation failure
instead of failing. This way, a backend failing an entry creation can
take appropriate cleanup actions in the shared hashtable before throwing
an error. Currently, this means removing the entry from the shared
hashtable before throwing the error for the allocation failure.
Out-of-memory errors unlikely happen in the wild, and we do not bother
with back-patches when these are fixed, usually. However, the problem
dealt with here is a degree worse as it breaks the shared memory state
of pgstats, impacting other processes that may look at an inconsistent
entry that a different process has failed to create.
Author: Mikhail Kot <mikhail.kot@databricks.com>
Discussion: https://postgr.es/m/CAAi9E7jELo5_-sBENftnc2E8XhW2PKZJWfTC3i2y-GMQd2bcqQ@mail.gmail.com
Backpatch-through: 15 M src/backend/utils/activity/pgstat.c
M src/backend/utils/activity/pgstat_shmem.c
Post-commit review fixes for 228c370868.
commit : 1f7e9ba3ac4eff13041abcc4c9c517ad835fa449
author : Amit Kapila <akapila@postgresql.org>
date : Mon, 8 Sep 2025 06:10:15 +0000
committer: Amit Kapila <akapila@postgresql.org>
date : Mon, 8 Sep 2025 06:10:15 +0000 This commit fixes three issues:
1) When a disabled subscription is created with retain_dead_tuples set to true,
the launcher is not woken up immediately, which may lead to delays in creating
the conflict detection slot.
Creating the conflict detection slot is essential even when the subscription is
not enabled. This ensures that dead tuples are retained, which is necessary for
accurately identifying the type of conflict during replication.
2) Conflict-related data was unnecessarily retained when the subscription does
not have a table.
3) Conflict-relevant data could be prematurely removed before applying
prepared transactions on the publisher that are in the commit critical section.
This issue occurred because the backend executing COMMIT PREPARED was not
accounted for during the computation of oldestXid in the commit phase on
the publisher. As a result, the subscriber could advance the conflict
slot's xmin without waiting for such COMMIT PREPARED transactions to
complete.
We fixed this issue by identifying prepared transactions that are in the
commit critical section during computation of oldestXid in commit phase.
Author: Zhijie Hou <houzj.fnst@fujitsu.com>
Reviewed-by: shveta malik <shveta.malik@gmail.com>
Reviewed-by: Dilip Kumar <dilipbalaut@gmail.com>
Reviewed-by: Nisha Moond <nisha.moond412@gmail.com>
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>
Discussion: https://postgr.es/m/OS9PR01MB16913DACB64E5721872AA5C02943BA@OS9PR01MB16913.jpnprd01.prod.outlook.com
Discussion: https://postgr.es/m/OS9PR01MB16913F67856B0DA2A909788129400A@OS9PR01MB16913.jpnprd01.prod.outlook.com M src/backend/access/transam/twophase.c
M src/backend/commands/subscriptioncmds.c
M src/backend/replication/logical/tablesync.c
M src/backend/replication/logical/worker.c
M src/backend/replication/walsender.c
M src/include/access/twophase.h
M src/include/replication/worker_internal.h
M src/test/subscription/t/035_conflicts.pl
Update parser README to include parse_jsontable.c
commit : 43eb2c541941479714c11de9cfb7c67b54f1810d
author : Michael Paquier <michael@paquier.xyz>
date : Mon, 8 Sep 2025 10:07:14 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Mon, 8 Sep 2025 10:07:14 +0900 The README was missing parse_jsontable.c which handles JSON_TABLE.
Oversight in de3600452b61.
Author: Karthik S <karthikselvaam@gmail.com>
Discussion: https://postgr.es/m/CAK4gQD9gdcj+vq_FZGp=Rv-W+41v8_C7cmCUmDeu=cfrOdfXEw@mail.gmail.com
Backpatch-through: 17 M src/backend/parser/README
Allow to log raw parse tree.
commit : 06473f5a344df8c9594ead90a609b86f6724cff8
author : Tatsuo Ishii <ishii@postgresql.org>
date : Sat, 6 Sep 2025 07:49:51 +0900
committer: Tatsuo Ishii <ishii@postgresql.org>
date : Sat, 6 Sep 2025 07:49:51 +0900 This commit allows to log the raw parse tree in the same way we
currently log the parse tree, rewritten tree, and plan tree.
To avoid unnecessary log noise for users not interested in this
detail, a new GUC option, "debug_print_raw_parse", has been added.
When starting the PostgreSQL process with "-d N", and N is 3 or higher,
debug_print_raw_parse is enabled automatically, alongside
debug_print_parse.
Author: Chao Li <lic@highgo.com>
Reviewed-by: Tender Wang <tndrwang@gmail.com>
Reviewed-by: Tatsuo Ishii <ishii@postgresql.org>
Reviewed-by: John Naylor <johncnaylorls@gmail.com>
Discussion: https://postgr.es/m/CAEoWx2mcO0Gpo4vd8kPMAFWeJLSp0MeUUnaLdE1x0tSVd-VzUw%40mail.gmail.com M doc/src/sgml/config.sgml
M doc/src/sgml/rules.sgml
M src/backend/tcop/postgres.c
M src/backend/utils/misc/guc_parameters.dat
M src/backend/utils/misc/guc_tables.c
M src/backend/utils/misc/postgresql.conf.sample
M src/include/utils/guc.h
bufmgr: Remove freelist, always use clock-sweep
commit : 2c789405275928ce0d2ceb7c4add91d27df92502
author : Andres Freund <andres@anarazel.de>
date : Fri, 5 Sep 2025 12:25:59 -0400
committer: Andres Freund <andres@anarazel.de>
date : Fri, 5 Sep 2025 12:25:59 -0400 This set of changes removes the list of available buffers and instead simply
uses the clock-sweep algorithm to find and return an available buffer. This
also removes the have_free_buffer() function and simply caps the
pg_autoprewarm process to at most NBuffers.
While on the surface this appears to be removing an optimization it is in fact
eliminating code that induces overhead in the form of synchronization that is
problematic for multi-core systems.
The main reason for removing the freelist, however, is not the moderate
improvement in scalability, but that having the freelist would require
dedicated complexity in several upcoming patches. As we have not been able to
find a case benefiting from the freelist...
Author: Greg Burd <greg@burd.me>
Reviewed-by: Tomas Vondra <tomas@vondra.me>
Reviewed-by: Andres Freund <andres@anarazel.de>
Discussion: https://postgr.es/m/70C6A5B5-2A20-4D0B-BC73-EB09DD62D61C@getmailspring.com M contrib/pg_prewarm/autoprewarm.c
M src/backend/storage/buffer/README
M src/backend/storage/buffer/buf_init.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/buffer/freelist.c
M src/include/storage/buf_internals.h
bufmgr: Use consistent naming of the clock-sweep algorithm
commit : 50e4c6ace5e69fbe69868c270a1c76acd4cb12ec
author : Andres Freund <andres@anarazel.de>
date : Fri, 5 Sep 2025 12:25:59 -0400
committer: Andres Freund <andres@anarazel.de>
date : Fri, 5 Sep 2025 12:25:59 -0400 Minor edits to comments only.
Author: Greg Burd <greg@burd.me>
Reviewed-by: Tomas Vondra <tomas@vondra.me>
Reviewed-by: Andres Freund <andres@anarazel.de>
Discussion: https://postgr.es/m/70C6A5B5-2A20-4D0B-BC73-EB09DD62D61C@getmailspring.com M src/backend/storage/buffer/README
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/buffer/freelist.c
M src/backend/storage/buffer/localbuf.c
M src/include/storage/buf_internals.h
Add assert and log message to visibilitymap_set
commit : e3d5ddb7ca91e5982e9d4cff9eef210d97e4f47e
author : Melanie Plageman <melanieplageman@gmail.com>
date : Fri, 5 Sep 2025 09:33:36 -0400
committer: Melanie Plageman <melanieplageman@gmail.com>
date : Fri, 5 Sep 2025 09:33:36 -0400 Add an assert to visibilitymap_set() that the provided heap buffer is
exclusively locked, which is expected.
Also, enhance the debug logging message to specify which VM flags were
set.
Based on a related suggestion by Kirill Reshke on an in-progress
patchset.
Author: Melanie Plageman <melanieplageman@gmail.com>
Reviewed-by: Kirill Reshke <reshkekirill@gmail.com>
Reviewed-by: Andres Freund <andres@anarazel.de>
Discussion: https://postgr.es/m/CALdSSPhAU56g1gGVT0%2BwG8RrSWE6qW8TOfNJS1HNAWX6wPgbFA%40mail.gmail.com M src/backend/access/heap/visibilitymap.c
Fix concurrent update issue with MERGE.
commit : 6ede13d1b5f515df0a199a7a830e448dab1511c0
author : Dean Rasheed <dean.a.rasheed@gmail.com>
date : Fri, 5 Sep 2025 08:18:18 +0100
committer: Dean Rasheed <dean.a.rasheed@gmail.com>
date : Fri, 5 Sep 2025 08:18:18 +0100 When executing a MERGE UPDATE action, if there is more than one
concurrent update of the target row, the lock-and-retry code would
sometimes incorrectly identify the latest version of the target tuple,
leading to incorrect results.
This was caused by using the ctid field from the TM_FailureData
returned by table_tuple_lock() in a case where the result was TM_Ok,
which is unsafe because the TM_FailureData struct is not guaranteed to
be fully populated in that case. Instead, it should use the tupleid
passed to (and updated by) table_tuple_lock().
To reduce the chances of similar errors in the future, improve the
commentary for table_tuple_lock() and TM_FailureData to make it
clearer that table_tuple_lock() updates the tid passed to it, and most
fields of TM_FailureData should not be relied on in non-failure cases.
An exception to this is the "traversed" field, which is set in both
success and failure cases.
Reported-by: Dmitry <dsy.075@yandex.ru>
Author: Yugo Nagata <nagata@sraoss.co.jp>
Reviewed-by: Dean Rasheed <dean.a.rasheed@gmail.com>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://postgr.es/m/1570d30e-2b95-4239-b9c3-f7bf2f2f8556@yandex.ru
Backpatch-through: 15 M src/backend/executor/nodeModifyTable.c
M src/include/access/tableam.h
M src/test/isolation/expected/merge-match-recheck.out
M src/test/isolation/specs/merge-match-recheck.spec
Fix outdated comments in slru.c
commit : 567d27e8e2b752743626eb259ba75ecdc936eaf3
author : Michael Paquier <michael@paquier.xyz>
date : Fri, 5 Sep 2025 14:10:08 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Fri, 5 Sep 2025 14:10:08 +0900 SlruRecentlyUsed() is an inline function since 53c2a97a9266, not a
macro. The description of long_segment_names was missing at the top of
SimpleLruInit(), part forgotten in 4ed8f0913bfd.
Author: Julien Rouhaud <rjuju123@gmail.com>
Discussion: https://postgr.es/m/aLpBLMOYwEQkaleF@jrouhaud
Backpatch-through: 17 M src/backend/access/transam/slru.c
Switch some numeric-related functions to use soft error reporting
commit : 4246a977bad6e76c4276a0d52def8a3dced154bb
author : Michael Paquier <michael@paquier.xyz>
date : Fri, 5 Sep 2025 13:53:47 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Fri, 5 Sep 2025 13:53:47 +0900 This commit changes some functions related to the data type numeric to
use the soft error reporting rather than a custom boolean flag (called
"have_error") that callers of these functions could rely on to bypass
the generation of ERROR reports, letting the callers do their own error
handling (timestamp, jsonpath and numeric_to_char() require them).
This results in the removal of some boilerplate code that was required
to handle both the ereport() and the "have_error" code paths bypassing
ereport(), unifying everything under the soft error reporting facility.
While on it, some duplicated error messages are removed. The function
upgraded in this commit were suffixed with "_opt_error" in their names.
They are renamed to "_safe" instead.
This change relies on d9f7f5d32f20, that has introduced the soft error
reporting infrastructure.
Author: Amul Sul <sulamul@gmail.com>
Reviewed-by: Dean Rasheed <dean.a.rasheed@gmail.com>
Discussion: https://postgr.es/m/CAAJ_b96No5h5tRuR+KhcC44YcYUCw8WAHuLoqqyyop8_k3+JDQ@mail.gmail.com M src/backend/utils/adt/formatting.c
M src/backend/utils/adt/jsonpath_exec.c
M src/backend/utils/adt/numeric.c
M src/backend/utils/adt/timestamp.c
M src/include/utils/numeric.h
Change pg_lsn_in_internal() to use soft error reporting
commit : ae453120085f7da8f4082bb912e9668410cdccab
author : Michael Paquier <michael@paquier.xyz>
date : Fri, 5 Sep 2025 12:59:29 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Fri, 5 Sep 2025 12:59:29 +0900 pg_lsn includes pg_lsn_in_internal() for the purpose of parsing a LSN
position for the GUC recovery_target_lsn (21f428ebde39). It relies on a
boolean called "have_error" that would be set when the LSN parsing
fails, then let its callers handle any errors.
d9f7f5d32f20 has added support for soft error reporting. This commit
removes some boilerplate code and switches the routine to use soft error
reporting directly, giving to the callers of pg_lsn_in_internal()
the possibility to be fed the error message generated on failure.
pg_lsn_in_internal() routine is renamed to pg_lsn_in_safe(), for
consistency with other similar routines that are given an escontext.
Author: Amul Sul <sulamul@gmail.com>
Reviewed-by: Dean Rasheed <dean.a.rasheed@gmail.com>
Discussion: https://postgr.es/m/CAAJ_b96No5h5tRuR+KhcC44YcYUCw8WAHuLoqqyyop8_k3+JDQ@mail.gmail.com M src/backend/access/transam/xlogrecovery.c
M src/backend/utils/adt/pg_lsn.c
M src/include/utils/pg_lsn.h
Revert recent change to RequestNamedLWLockTranche().
commit : d814d7fc3d5257ae258b502229fc7ca97c97270a
author : Nathan Bossart <nathan@postgresql.org>
date : Thu, 4 Sep 2025 15:34:48 -0500
committer: Nathan Bossart <nathan@postgresql.org>
date : Thu, 4 Sep 2025 15:34:48 -0500 Commit 38b602b028 modified this function to allocate enough space
for MAX_NAMED_TRANCHES (256) requests, which is likely far more
than most clusters need. This commit reverts that change so that
it first allocates enough space for only 16 requests and resizes
the array when necessary. While at it, remove the check for too
many tranches from this function. We can now rely on
InitializeLWLocks() to do that check via its calls to
LWLockNewTrancheId() for the named tranches.
Reviewed-by: Sami Imseih <samimseih@gmail.com>
Discussion: https://postgr.es/m/aLmzwC2dRbqk14y6%40nathan M src/backend/storage/lmgr/lwlock.c
Clean up newly added guc_tables.inc.c
commit : f0478149c34dfe02e0f43fc5f832a63a864dc364
author : Peter Eisentraut <peter@eisentraut.org>
date : Thu, 4 Sep 2025 12:57:03 +0200
committer: Peter Eisentraut <peter@eisentraut.org>
date : Thu, 4 Sep 2025 12:57:03 +0200 There was a missing makefile rule to clean up the guc_tables.inc.c
symlink in src/include/. Oversight in commit 63599896545.
Author: Nathan Bossart <nathandbossart@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/dae6fe89-1e0c-4c3f-8d92-19d23374fb10%40eisentraut.org M src/include/Makefile
Adjust commentary for WaitEventLWLock in wait_event_names.txt.
commit : 1129d3e4c8883f25642d1f44750b4d36e29ec006
author : Nathan Bossart <nathan@postgresql.org>
date : Thu, 4 Sep 2025 10:18:42 -0500
committer: Nathan Bossart <nathan@postgresql.org>
date : Thu, 4 Sep 2025 10:18:42 -0500 In addition to changing a couple of references for clarity, this
commit combines the two similar comments. M src/backend/utils/activity/wait_event_names.txt
Fix replica identity check for MERGE.
commit : fc6600fc1cd13b695fbde4b5f3ff0d2e97c36dea
author : Dean Rasheed <dean.a.rasheed@gmail.com>
date : Thu, 4 Sep 2025 11:45:44 +0100
committer: Dean Rasheed <dean.a.rasheed@gmail.com>
date : Thu, 4 Sep 2025 11:45:44 +0100 When executing a MERGE, check that the target relation supports all
actions mentioned in the MERGE command. Specifically, check that it
has a REPLICA IDENTITY if it publishes updates or deletes and the
MERGE command contains update or delete actions. Failing to do this
can silently break replication.
Author: Zhijie Hou <houzj.fnst@fujitsu.com>
Reviewed-by: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>
Reviewed-by: Dean Rasheed <dean.a.rasheed@gmail.com>
Tested-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://postgr.es/m/OS3PR01MB57180C87E43A679A730482DF94B62@OS3PR01MB5718.jpnprd01.prod.outlook.com
Backpatch-through: 15 M src/backend/executor/execMain.c
M src/test/regress/expected/publication.out
M src/test/regress/sql/publication.sql
Fix replica identity check for INSERT ON CONFLICT DO UPDATE.
commit : 5386bfb9c1f566887d084e4ea2e350e7efd188c1
author : Dean Rasheed <dean.a.rasheed@gmail.com>
date : Thu, 4 Sep 2025 11:27:53 +0100
committer: Dean Rasheed <dean.a.rasheed@gmail.com>
date : Thu, 4 Sep 2025 11:27:53 +0100 If an INSERT has an ON CONFLICT DO UPDATE clause, the executor must
check that the target relation supports UPDATE as well as INSERT. In
particular, it must check that the target relation has a REPLICA
IDENTITY if it publishes updates. Formerly, it was not doing this
check, which could lead to silently breaking replication.
Fix by adding such a check to CheckValidResultRel(), which requires
adding a new onConflictAction argument. In back-branches, preserve ABI
compatibility by introducing a wrapper function with the original
signature.
Author: Zhijie Hou <houzj.fnst@fujitsu.com>
Reviewed-by: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>
Reviewed-by: Dean Rasheed <dean.a.rasheed@gmail.com>
Tested-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://postgr.es/m/OS3PR01MB57180C87E43A679A730482DF94B62@OS3PR01MB5718.jpnprd01.prod.outlook.com
Backpatch-through: 13 M src/backend/commands/copyfrom.c
M src/backend/executor/execMain.c
M src/backend/executor/execPartition.c
M src/backend/executor/nodeModifyTable.c
M src/include/executor/executor.h
M src/test/regress/expected/publication.out
M src/test/regress/sql/publication.sql
Fix incorrect comment in pgstat_backend.c
commit : 09119238a18191dea3deed635a2b2a6ffe904932
author : Michael Paquier <michael@paquier.xyz>
date : Thu, 4 Sep 2025 08:34:51 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Thu, 4 Sep 2025 08:34:51 +0900 The counters saved from pgWalUsage, used for the difference calculations
when flushing the backend WAL stats, are updated when calling
pgstat_flush_backend() under PGSTAT_BACKEND_FLUSH_WAL, and not
pgstat_report_wal(). The comment updated in this commit referenced the
latter, but it is perfectly OK to flush the backend stats independently
of the WAL stats.
Noticed while looking at this area of the code, introduced by
76def4cdd7c2 as a copy-pasto.
Backpatch-through: 18 M src/backend/utils/activity/pgstat_backend.c
Make libpq_pipeline.c shorter and more uniform via helper functions.
commit : e351e5c4fea463d9f96557913f7f767af3795c32
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Wed, 3 Sep 2025 16:07:57 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Wed, 3 Sep 2025 16:07:57 -0400 There are many places in this test program that need to consume a
PGresult while checking that its PQresultStatus is as-expected, or
related tasks such as checking that PQgetResult has nothing more to
return. These tasks were open-coded in a rather inconsistent way,
leading to some outright bugs, some memory leakage, and frequent
inconsistencies about what would be reported in event of an error.
Invent a few helper functions to standardize the behavior and
reduce code duplication. Also, rename the one pre-existing helper
function from confirm_query_canceled to consume_query_cancel, per
Álvaro's suggestion that "confirm" is a poor choice of verb for a
function that will discard the PGresult.
While at it, clean up assorted other places that were leaking
PGresults or even server connections. This is pure neatnik-ism,
since the test doesn't run long enough for those leaks to be of
any real-world concern.
While this fixes some things that are clearly bugs, it's only
a test program, and none of the bugs seem serious enough to
justify back-patching.
Bug: #18960
Reported-by: Dmitry Kovalenko <d.kovalenko@postgrespro.ru>
Author: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Álvaro Herrera <alvherre@kurilemu.de>
Discussion: https://postgr.es/m/18960-09cd4a5100152e58@postgresql.org M src/test/modules/libpq_pipeline/libpq_pipeline.c
Move dynamically-allocated LWLock tranche names to shared memory.
commit : 38b602b0289fe1dbaf31d5737fba2d42a1e90371
author : Nathan Bossart <nathan@postgresql.org>
date : Wed, 3 Sep 2025 13:57:48 -0500
committer: Nathan Bossart <nathan@postgresql.org>
date : Wed, 3 Sep 2025 13:57:48 -0500 There are two ways for shared libraries to allocate their own
LWLock tranches. One way is to call RequestNamedLWLockTranche() in
a shmem_request_hook, which requires the library to be loaded via
shared_preload_libraries. The other way is to call
LWLockNewTrancheId(), which is not subject to the same
restrictions. However, LWLockNewTrancheId() does require each
backend to store the tranche's name in backend-local memory via
LWLockRegisterTranche(). This API is a little cumbersome and leads
to things like unhelpful pg_stat_activity.wait_event values in
backends that haven't loaded the library.
This commit moves these LWLock tranche names to shared memory, thus
eliminating the need for each backend to call
LWLockRegisterTranche(). Instead, the tranche name must be
provided to LWLockNewTrancheId(), which immediately makes the name
available to all backends. Since the tranche name array is
append-only, lookups can ordinarily avoid locking as long as their
local copy of the LWLock counter is greater than the requested
tranche ID.
One downside of this approach is that we now have a hard limit on
both the length of tranche names (NAMEDATALEN-1 bytes) and the
number of dynamically-allocated tranches (256). Besides a limit of
NAMEDATALEN-1 bytes for tranche names registered via
RequestNamedLWLockTranche(), no such limits previously existed. We
could avoid these new limits by using dynamic shared memory, but
the complexity involved didn't seem worth it. We briefly
considered making the tranche limit user-configurable but
ultimately decided against that, too. Since there is still a lot
of time left in the v19 development cycle, it's possible we will
revisit this choice.
Author: Sami Imseih <samimseih@gmail.com>
Reviewed-by: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Rahila Syed <rahilasyed90@gmail.com>
Reviewed-by: Andres Freund <andres@anarazel.de>
Discussion: https://postgr.es/m/CAA5RZ0vvED3naph8My8Szv6DL4AxOVK3eTPS0qXsaKi%3DbVdW2A%40mail.gmail.com M contrib/pg_prewarm/autoprewarm.c
M doc/src/sgml/xfunc.sgml
M src/backend/postmaster/launch_backend.c
M src/backend/storage/ipc/dsm_registry.c
M src/backend/storage/lmgr/lwlock.c
M src/include/storage/lwlock.h
M src/test/modules/test_dsa/test_dsa.c
M src/test/modules/test_dsm_registry/test_dsm_registry.c
M src/test/modules/test_radixtree/test_radixtree.c
M src/test/modules/test_slru/test_slru.c
M src/test/modules/test_tidstore/test_tidstore.c
ci: Explicitly enable Meson features
commit : 7b0fb9f5c68e7c7161a88b442f41b5345cd6cdd0
author : Jacob Champion <jchampion@postgresql.org>
date : Wed, 3 Sep 2025 07:54:24 -0700
committer: Jacob Champion <jchampion@postgresql.org>
date : Wed, 3 Sep 2025 07:54:24 -0700 Meson's "auto" feature mode silently disables features with missing
prerequisites, which is nice for development but can lead to false
positives in the CI (such as my commit b0635bfda, which broke OAuth
detection on OpenBSD). Use an explicit feature list in the Cirrus config
instead; this mirrors the --with-XXX experience of Autoconf.
While we're here, also move common configuration options into a single
variable, MESON_COMMON_PG_CONFIG_ARGS, as suggested by Peter. The
resulting hierarchy is as follows:
MESON_COMMON_PG_CONFIG_ARGS "global" Meson configuration options
MESON_COMMON_FEATURES the default set of CI features, to be used
unless there's a specific reason not to
MESON_FEATURES per-OS feature configuration, overriding
the above
The current exceptions to the use of MESON_COMMON_FEATURES are
- SanityCheck, which uses almost no dependencies;
- Windows - VS, whose feature list has diverged significantly from the
others; and
- Linux, which continues to use 'auto' features so that autodetection is
still tested in the CI. (Options shared between 64- and 32-bit builds
can go into LINUX_MESON_FEATURES instead.)
Author: Nazir Bilal Yavuz <byavuz81@gmail.com>
Suggested-by: Jacob Champion <jacob.champion@enterprisedb.com>
Suggested-by: Peter Eisentraut <peter@eisentraut.org>
Reviewed-by: Andres Freund <andres@anarazel.de>
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>
Reviewed-by: Jacob Champion <jacob.champion@enterprisedb.com>
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Discussion: https://postgr.es/m/flat/CAN55FZ0aO8d_jkyRijcGP8qO%3DXH09qG%3Dpw0ZZDvB4LMzuXYU1w%40mail.gmail.com M .cirrus.tasks.yml
ci: Remove extra PG_TEST_EXTRA from NetBSD/OpenBSD
commit : 01c59380032fef5f0ce88234b04d0021dfd47d3e
author : Jacob Champion <jchampion@postgresql.org>
date : Wed, 3 Sep 2025 07:54:15 -0700
committer: Jacob Champion <jchampion@postgresql.org>
date : Wed, 3 Sep 2025 07:54:15 -0700 The PG_TEST_EXTRA environment variable is already set at the top level.
As of 3d1aec225, Meson tasks will use this by default, so there's no
need for another intermediate variable.
Author: Nazir Bilal Yavuz <byavuz81@gmail.com>
Suggested-by: Peter Eisentraut <peter@eisentraut.org>
Discussion: https://postgr.es/m/flat/CAN55FZ0aO8d_jkyRijcGP8qO%3DXH09qG%3Dpw0ZZDvB4LMzuXYU1w%40mail.gmail.com M .cirrus.tasks.yml
Fix mistake in new GUC tables source
commit : 01d6e5b2cf90737395344a8233cae5891c191357
author : Peter Eisentraut <peter@eisentraut.org>
date : Wed, 3 Sep 2025 11:48:35 +0200
committer: Peter Eisentraut <peter@eisentraut.org>
date : Wed, 3 Sep 2025 11:48:35 +0200 Commit 63599896545 had it so that the parameter "debug_discard_caches"
did not exist unless DISCARD_CACHES_ENABLED was defined (typically via
enabling asserts). This was a mistake, it did not correspond to the
prior setup. Several tests use this parameter, so they were now
failing if you did not have asserts enabled. M src/backend/utils/misc/guc_parameters.dat
Generate GUC tables from .dat file
commit : 63599896545c7869f7dd28cd593e8b548983d613
author : Peter Eisentraut <peter@eisentraut.org>
date : Wed, 3 Sep 2025 09:11:48 +0200
committer: Peter Eisentraut <peter@eisentraut.org>
date : Wed, 3 Sep 2025 09:11:48 +0200 Store the information in guc_tables.c in a .dat file similar to the
catalog data in src/include/catalog/, and generate a part of
guc_tables.c from that. The goal is to make it easier to edit that
information, and to be able to make changes to the downstream data
structures more easily. (Essentially, those are the same reasons as
for the original adoption of the .dat format.)
Reviewed-by: John Naylor <johncnaylorls@gmail.com>
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>
Reviewed-by: David E. Wheeler <david@justatheory.com>
Discussion: https://www.postgresql.org/message-id/flat/dae6fe89-1e0c-4c3f-8d92-19d23374fb10%40eisentraut.org M src/backend/utils/.gitignore
M src/backend/utils/Makefile
A src/backend/utils/misc/gen_guc_tables.pl
A src/backend/utils/misc/guc_parameters.dat
M src/backend/utils/misc/guc_tables.c
M src/bin/pg_dump/dumputils.c
M src/include/libpq/libpq.h
M src/include/utils/.gitignore
M src/include/utils/guc.h
M src/include/utils/inval.h
M src/include/utils/meson.build
M src/timezone/pgtz.c
Fix planner error when estimating SubPlan cost
commit : aba8f61c30911cbac1a310b7d21777e04711c66e
author : Richard Guo <rguo@postgresql.org>
date : Wed, 3 Sep 2025 16:00:38 +0900
committer: Richard Guo <rguo@postgresql.org>
date : Wed, 3 Sep 2025 16:00:38 +0900 SubPlan nodes are typically built very early, before any RelOptInfos
have been constructed for the parent query level. As a result, the
simple_rel_array in the parent root has not yet been initialized.
Currently, during cost estimation of a SubPlan's testexpr, we may call
examine_variable() to look up statistical data about the expressions.
This can lead to "no relation entry for relid" errors.
To fix, pass root as NULL to cost_qual_eval() in cost_subplan(), since
the root does not yet contain enough information to safely consult
statistics.
One exception is SubPlan nodes built for the initplans of MIN/MAX
aggregates from indexes. In this case, having a NULL root is safe
because testexpr will be NULL. Additionally, an initplan will by
definition not consult anything from the parent plan.
Backpatch to all supported branches. Although the reported call path
that triggers this error is not reachable prior to v17, there's no
guarantee that other code paths -- especially in extensions -- could
not encounter the same issue when cost_qual_eval() is called with a
root that lacks a valid simple_rel_array. The test case is not
included in pre-v17 branches though.
Bug: #19037
Reported-by: Alexander Lakhin <exclusion@gmail.com>
Diagnosed-by: Tom Lane <tgl@sss.pgh.pa.us>
Author: Richard Guo <guofenglinux@gmail.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/19037-3d1c7bb553c7ce84@postgresql.org
Backpatch-through: 13 M src/backend/optimizer/path/costsize.c
M src/test/regress/expected/subselect.out
M src/test/regress/sql/subselect.sql
Fix use-after-free issue in slot synchronization.
commit : f2dbc83501d441a98f7799863e1b6f18af8e8fbe
author : Amit Kapila <akapila@postgresql.org>
date : Wed, 3 Sep 2025 06:31:05 +0000
committer: Amit Kapila <akapila@postgresql.org>
date : Wed, 3 Sep 2025 06:31:05 +0000 Author: Shlok Kyal <shlok.kyal.oss@gmail.com>
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>
Backpatch-through: 18, where it was introduced
Discussion: https://postgr.es/m/CANhcyEXMrcEdzj-RNGJam0nJHM4y+ttdWsgUCFmXciM7BNKc7A@mail.gmail.com M src/backend/replication/logical/slotsync.c
M src/backend/replication/slotfuncs.c
libpq: Fix PQtrace() format for non-printable characters
commit : db9405493b489c6a348c97f532753290eea8adbd
author : Michael Paquier <michael@paquier.xyz>
date : Wed, 3 Sep 2025 12:54:23 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Wed, 3 Sep 2025 12:54:23 +0900 PQtrace() was generating its output for non-printable characters without
casting the characters printed with unsigned char, leading to some extra
"\xffffff" generated in the output due to the fact that char may be
signed.
Oversights introduced by commit 198b3716dba6, so backpatch down to v14.
Author: Ran Benita <ran@unusedvar.com>
Discussion: https://postgr.es/m/a3383211-4539-459b-9d51-95c736ef08e0@app.fastmail.com
Backpatch-through: 14 M src/interfaces/libpq/fe-trace.c
Update outdated references to the SLRU ControlLock
commit : c6ea528b470f45832437f2a937cf2f4483d23737
author : Michael Paquier <michael@paquier.xyz>
date : Wed, 3 Sep 2025 10:20:28 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Wed, 3 Sep 2025 10:20:28 +0900 SLRU bank locks are referred as "bank locks" or "SLRU bank locks" in the
code comments. The comments updated in this commit use the latter term.
Oversight in 53c2a97a9266, that has replaced the single ControlLock by
the bank control locks.
Author: Julien Rouhaud <julien.rouhaud@free.fr>
Discussion: https://postgr.es/m/aLUT2UO8RjJOzZNq@jrouhaud
Backpatch-through: 17 M src/backend/access/transam/slru.c
M src/include/access/slru.h
Add HINT for COPY TO when WHERE clause is used.
commit : 229911c4bf9a4acfb2b81cff148fd8391e0a577b
author : Fujii Masao <fujii@postgresql.org>
date : Wed, 3 Sep 2025 08:33:54 +0900
committer: Fujii Masao <fujii@postgresql.org>
date : Wed, 3 Sep 2025 08:33:54 +0900 COPY TO does not support a WHERE clause, and currently fails with the error:
ERROR: WHERE clause not allowed with COPY TO
Since the intended behavior can be achieved by using
COPY (SELECT ... WHERE ...) TO, this commit adds a HINT
to the error message:
HINT: Try the COPY (SELECT ... WHERE ...) TO variant.
This makes the error more informative and helps users
quickly find the alternative usage.
Author: Atsushi Torikoshi <torikoshia@oss.nttdata.com>
Reviewed-by: Jim Jones <jim.jones@uni-muenster.de>
Discussion: https://postgr.es/m/3520c224c5ffac0113aef84a9179f37e@oss.nttdata.com M src/backend/parser/gram.y
M src/test/regress/expected/copy2.out
Change ReplicationSlotPersistentData's "synced" member to a bool.
commit : 510777a2d56b5de5f55d3e995c0d0242eb630eb1
author : Nathan Bossart <nathan@postgresql.org>
date : Tue, 2 Sep 2025 16:53:54 -0500
committer: Nathan Bossart <nathan@postgresql.org>
date : Tue, 2 Sep 2025 16:53:54 -0500 Note that this doesn't require bumping SLOT_VERSION because we
require sizeof(bool) == 1, thanks to commit 97525bc5c8.
Overight in commit ddd5f4f54a.
Discussion: Ranier Vilela <ranier.vf@gmail.com> M src/include/replication/slot.h
Improve error message for duplicate labels when creating an enum type.
commit : 1b1960c8c9e81171efabdd9e3393b4eec1ffc477
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Tue, 2 Sep 2025 13:50:56 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Tue, 2 Sep 2025 13:50:56 -0400 Previously, duplicate labels in CREATE TYPE AS ENUM were caught by
the unique index on pg_enum, resulting in a generic error message.
While this was evidently intentional, it's not terribly user-friendly,
nor consistent with the ALTER TYPE cases which take more care with
such errors. This patch adds an explicit check to produce a more
user-friendly and descriptive error message.
A potential objection to this implementation is that it adds O(N^2)
work to the creation operation. However, quick testing finds that
that's pretty negligible below 1000 enum labels, and tolerable even
at 10000. So it doesn't really seem worth being smarter.
Author: Yugo Nagata <nagata@sraoss.co.jp>
Reviewed-by: Rahila Syed <rahilasyed90@gmail.com>
Reviewed-by: Jim Jones <jim.jones@uni-muenster.de>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/20250704000402.37e605ab0c59c300965a17ee@sraoss.co.jp M src/backend/catalog/pg_enum.c
M src/test/regress/expected/enum.out
M src/test/regress/sql/enum.sql
Generate pgstat_count_slru*() functions for slru using macros
commit : eccba079c2ea7d6b40a02de774e773e3aaf4bdda
author : Michael Paquier <michael@paquier.xyz>
date : Tue, 2 Sep 2025 16:22:03 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Tue, 2 Sep 2025 16:22:03 +0900 This change replaces seven functions definitions by macros, reducing a
bit some repetitive patterns in the code. An interesting side effect is
that this removes an inconsistency in the naming of SLRU increment
functions with the field names.
This change is similar to 850f4b4c8cab, 8018ffbf5895 or 83a1a1b56645.
Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Discussion: https://postgr.es/m/aLHA//gr4dTpDHHC@ip-10-97-1-34.eu-west-3.compute.internal M src/backend/access/transam/slru.c
M src/backend/utils/activity/pgstat_slru.c
M src/include/pgstat.h
Add max_retention_duration option to subscriptions.
commit : a850be2fe653b3b529969946c1cefe0fd9e34a8d
author : Amit Kapila <akapila@postgresql.org>
date : Tue, 2 Sep 2025 03:20:18 +0000
committer: Amit Kapila <akapila@postgresql.org>
date : Tue, 2 Sep 2025 03:20:18 +0000 This commit introduces a new subscription parameter,
max_retention_duration, aimed at mitigating excessive accumulation of dead
tuples when retain_dead_tuples is enabled and the apply worker lags behind
the publisher.
When the time spent advancing a non-removable transaction ID exceeds the
max_retention_duration threshold, the apply worker will stop retaining
conflict detection information. In such cases, the conflict slot's xmin
will be set to InvalidTransactionId, provided that all apply workers
associated with the subscription (with retain_dead_tuples enabled) confirm
the retention duration has been exceeded.
To ensure retention status persists across server restarts, a new column
subretentionactive has been added to the pg_subscription catalog. This
prevents unnecessary reactivation of retention logic after a restart.
The conflict detection slot will not be automatically re-initialized
unless a new subscription is created with retain_dead_tuples = true, or
the user manually re-enables retain_dead_tuples.
A future patch will introduce support for automatic slot re-initialization
once at least one apply worker confirms that the retention duration is
within the configured max_retention_duration.
Author: Zhijie Hou <houzj.fnst@fujitsu.com>
Reviewed-by: shveta malik <shveta.malik@gmail.com>
Reviewed-by: Nisha Moond <nisha.moond412@gmail.com>
Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com>
Reviewed-by: Dilip Kumar <dilipbalaut@gmail.com>
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>
Discussion: https://postgr.es/m/OS0PR01MB5716BE80DAEB0EE2A6A5D1F5949D2@OS0PR01MB5716.jpnprd01.prod.outlook.com M doc/src/sgml/catalogs.sgml
M doc/src/sgml/ref/alter_subscription.sgml
M doc/src/sgml/ref/create_subscription.sgml
M src/backend/catalog/pg_subscription.c
M src/backend/catalog/system_views.sql
M src/backend/commands/subscriptioncmds.c
M src/backend/replication/logical/launcher.c
M src/backend/replication/logical/worker.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dump.h
M src/bin/psql/describe.c
M src/bin/psql/tab-complete.in.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_subscription.h
M src/include/catalog/pg_subscription_rel.h
M src/include/commands/subscriptioncmds.h
M src/include/replication/worker_internal.h
M src/test/regress/expected/subscription.out
M src/test/regress/sql/subscription.sql
M src/test/subscription/t/035_conflicts.pl
postgres_fdw: Use psql variables for connection parameters
commit : 36aed19fd99021ad9f727e4fd4bceb086a7cf54d
author : Michael Paquier <michael@paquier.xyz>
date : Mon, 1 Sep 2025 09:02:03 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Mon, 1 Sep 2025 09:02:03 +0900 Several statements need to reference the current connection's current
database name and current port value. Until now, this has been
accomplished by creating dynamic SQL statements inside of a DO block,
which is not as easy to parse. It also takes away some of the
granularity of any error messages that might occur, making debugging
harder.
By capturing the connection-specific settings into psql variables, it
becomes possible to write simpler SQL statements for the FDW objects.
This eliminates most of DO blocks used in this test, making it a bit
more readable and shorter.
Author: Author: Corey Huinker <corey.huinker@gmail.com>
Discussion: https://postgr.es/m/CADkLM=cpUiJ3QF7aUthTvaVMmgQcm7QqZBRMDLhBRTR+gJX-Og@mail.gmail.com M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/sql/postgres_fdw.sql
Fix const-simplification for constraints and stats
commit : 317c117d6d23cff98c1259701495422bc952a7dd
author : Richard Guo <rguo@postgresql.org>
date : Sun, 31 Aug 2025 08:59:48 +0900
committer: Richard Guo <rguo@postgresql.org>
date : Sun, 31 Aug 2025 08:59:48 +0900 Constraint expressions and statistics expressions loaded from the
system catalogs need to be run through const-simplification, because
the planner will be comparing them to similarly-processed qual
clauses. Without this step, the planner may fail to detect valid
matches.
Currently, NullTest clauses in these expressions may not be reduced
correctly during const-simplification. This happens because their Var
nodes do not yet have the correct varno when eval_const_expressions is
applied. Since eval_const_expressions relies on varno to reduce
NullTest quals, incorrect varno can cause problems.
Additionally, for statistics expressions, eval_const_expressions is
called with root set to NULL, which also inhibits NullTest reduction.
This patch fixes the issue by ensuring that Vars are updated to have
the correct varno before const-simplification, and that a valid root
is passed to eval_const_expressions when needed.
Author: Richard Guo <guofenglinux@gmail.com>
Discussion: https://postgr.es/m/19007-4cc6e252ed8aa54a@postgresql.org M src/backend/optimizer/util/plancat.c
M src/test/regress/expected/predicate.out
M src/test/regress/sql/predicate.sql
add_commit_links.pl: error out if missing major version number
commit : 0c6d572c11730913c8207462c5231982e6ca16cc
author : Bruce Momjian <bruce@momjian.us>
date : Sat, 30 Aug 2025 18:26:08 -0400
committer: Bruce Momjian <bruce@momjian.us>
date : Sat, 30 Aug 2025 18:26:08 -0400 Reported-by: Tom Lane
Author: Tom Lane
Discussion: https://postgr.es/m/53125.1756591456@sss.pgh.pa.us M src/tools/add_commit_links.pl
Prepare DSM registry for upcoming changes to LWLock tranche names.
commit : 5487058b56e0a27b6b8f6bb7e819f107587c1e54
author : Nathan Bossart <nathan@postgresql.org>
date : Fri, 29 Aug 2025 20:34:53 -0500
committer: Nathan Bossart <nathan@postgresql.org>
date : Fri, 29 Aug 2025 20:34:53 -0500 A proposed patch would place a limit of NAMEDATALEN-1 (i.e., 63)
bytes on the names of dynamically-allocated LWLock tranches, but
GetNamedDSA() and GetNamedDSHash() may register tranches with
longer names. This commit lowers the maximum DSM registry entry
name length to NAMEDATALEN-1 bytes and modifies GetNamedDSHash() to
create only one tranche, thereby allowing us to keep the DSM
registry's tranche names below NAMEDATALEN bytes.
Author: Sami Imseih <samimseih@gmail.com>
Discussion: https://postgr.es/m/aKzIg1JryN1qhNuy%40nathan M src/backend/storage/ipc/dsm_registry.c
Provide error context when an error is thrown within WaitOnLock().
commit : f727b63e810724c7187f38b2580b2915bdbc3c9c
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Fri, 29 Aug 2025 15:43:34 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Fri, 29 Aug 2025 15:43:34 -0400 Show the requested lock level and the object being waited on,
in the same format we use for deadlock reports and similar errors.
This is particularly helpful for debugging lock-timeout errors,
since otherwise the user has very little to go on about which
lock timed out. The performance cost of setting up the callback
should be negligible compared to the other tracing support already
present in WaitOnLock.
As in the deadlock-report case, we just show numeric object OIDs,
because it seems too scary to try to perform catalog lookups
in this context.
Reported-by: Steve Baldwin <steve.baldwin@gmail.com>
Author: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/1602369.1752167154@sss.pgh.pa.us M src/backend/storage/lmgr/lock.c
pg_dump: Fix compression API errorhandling
commit : e686010c5b47f2e7f7e4e8d31ef69efadbbc4d72
author : Daniel Gustafsson <dgustafsson@postgresql.org>
date : Fri, 29 Aug 2025 19:28:46 +0200
committer: Daniel Gustafsson <dgustafsson@postgresql.org>
date : Fri, 29 Aug 2025 19:28:46 +0200 Compression in pg_dump is abstracted using an API with multiple
implementations which can be selected at runtime by the user.
The API and its implementations have evolved over time, notable
commits include bf9aa490db, e9960732a9, 84adc8e20, and 0da243fed.
The errorhandling defined by the API was however problematic and
the implementations had a few bugs and/or were not following the
API specification. This commit modifies the API to ensure that
callers can perform errorhandling efficiently and fixes all the
implementations such that they all implement the API in the same
way. A full list of the changes can be seen below.
* write_func:
- Make write_func throw an error on all error conditions. All
callers of write_func were already checking for success and
calling pg_fatal on all errors, so we might as well make the
API support that case directly with simpler errorhandling as
a result.
* open_func:
- zstd: move stream initialization from the open function to
the read and write functions as they can have fatal errors.
Also ensure to dup the file descriptor like none and gzip.
- lz4: Ensure to dup the file descriptor like none and gzip.
* close_func:
- zstd: Ensure to close the file descriptor even if closing
down the compressor fails, and clean up state allocation on
fclose failures. Make sure to capture errors set by fclose.
- lz4: Ensure to close the file descriptor even if closing
down the compressor fails, and instead of calling pg_fatal
log the failures using pg_log_error. Make sure to capture
errors set by fclose.
- none: Make sure to catch errors set by fclose.
* read_func / gets_func:
- Make read_func unconditionally return the number of read
bytes instead of making it optional per implementation.
- lz4: Make sure to call throw an error and not return -1
- gzip: gzread returning zero cannot be assumed to indicate
EOF as it is documented to return zero for some types of
errors.
- lz4, zstd: Convert the _read_internal helper functions to
not call pg_fatal on errors to be able to handle gets_func
returning NULL on error.
* getc_func:
- zstd: Use an unsigned char rather than an int to read char
into.
* LZ4Stream_init:
- Make sure to not switch to inited state until we know that
initialization succeeded and reset errno just in case.
On top of these changes there are minor comment cleanups and
improvements as well as an attempt to consistently reset errno
in codepaths where it is inspected.
This work was initiated by a report of API misuse, which turned
into a larger body of work. As this is an internal API these
changes can be backpatched into all affected branches.
Author: Tom Lane <tgl@sss.pgh.pa.us>
Author: Daniel Gustafsson <daniel@yesql.se>
Reported-by: Evgeniy Gorbanev <gorbanyoves@basealt.ru>
Discussion: https://postgr.es/m/517794.1750082166@sss.pgh.pa.us
Backpatch-through: 16 M src/bin/pg_dump/compress_gzip.c
M src/bin/pg_dump/compress_io.c
M src/bin/pg_dump/compress_io.h
M src/bin/pg_dump/compress_lz4.c
M src/bin/pg_dump/compress_none.c
M src/bin/pg_dump/compress_zstd.c
M src/bin/pg_dump/pg_backup_archiver.c
M src/bin/pg_dump/pg_backup_directory.c
Make LWLockCounter a global variable.
commit : 67fcf48c3bb3cc3cf51788332701ffb694fb108b
author : Nathan Bossart <nathan@postgresql.org>
date : Fri, 29 Aug 2025 12:13:37 -0500
committer: Nathan Bossart <nathan@postgresql.org>
date : Fri, 29 Aug 2025 12:13:37 -0500 Using the LWLockCounter requires first calculating its address in
shared memory like this:
LWLockCounter = (int *) ((char *) MainLWLockArray - sizeof(int));
Commit 82e861fbe1 started this trend in order to fix EXEC_BACKEND
builds, but it could also be fixed by adding it to the
BackendParameters struct. The current approach is somewhat
difficult to follow, so this commit switches to the latter. While
at it, swap around the code in LWLockShmemSize() to match the order
of assignments in CreateLWLocks() for added readability.
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Discussion: https://postgr.es/m/aLDLnan9gNCS9fHx%40nathan M src/backend/postmaster/launch_backend.c
M src/backend/storage/lmgr/lwlock.c
M src/include/storage/lwlock.h
Fix .gitignore for src/interfaces/libpq-oauth.
commit : 66fa3b5eef6e4764a3beb097ecc9e04b6d956bc9
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Fri, 29 Aug 2025 12:05:58 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Fri, 29 Aug 2025 12:05:58 -0400 This missed files created when running the oauth tests. M src/interfaces/libpq-oauth/.gitignore
Remove unused parameter from ProcessSlotSyncInterrupts().
commit : 6fbd7b93c615f34df63ee978e97c6eb0c85255de
author : Nathan Bossart <nathan@postgresql.org>
date : Fri, 29 Aug 2025 10:56:10 -0500
committer: Nathan Bossart <nathan@postgresql.org>
date : Fri, 29 Aug 2025 10:56:10 -0500 Oversight in commit 93db6cbda0.
Author: ChangAo Chen <cca5507@qq.com>
Discussion: https://postgr.es/m/tencent_7B42BBE8D0A5C28DDAB91436192CBCCB8307%40qq.com M src/backend/replication/logical/slotsync.c
Silence -Wmissing-variable-declarations in headerscheck.
commit : 8722e7965fd24bf94c278fb86cab99d0c5360532
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Fri, 29 Aug 2025 10:46:13 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Fri, 29 Aug 2025 10:46:13 -0400 Newer gcc versions will emit warnings about missing extern
declarations if certain header files are compiled by themselves.
Add the "extern" declarations needed to quiet that.
Author: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Discussion: https://postgr.es/m/1127775.1754417387@sss.pgh.pa.us M src/interfaces/ecpg/test/expected/preproc-strings.c
M src/interfaces/ecpg/test/preproc/strings.h
M src/tools/gen_keywordlist.pl
Fix possible use after free in expand_partitioned_rtentry()
commit : da9f9f75e5ce27a45878ffa262156d18f0046188
author : David Rowley <drowley@postgresql.org>
date : Sat, 30 Aug 2025 00:50:50 +1200
committer: David Rowley <drowley@postgresql.org>
date : Sat, 30 Aug 2025 00:50:50 +1200 It's possible that if the only live partition is concurrently dropped
and try_table_open() fails, that the bms_del_member() will pfree the
live_parts Bitmapset. Since the bms_del_member() call does not assign
the result back to the live_parts local variable, the while loop could
segfault as that variable would still reference the pfree'd Bitmapset.
Backpatch to 15. 52f3de874 was backpatched to 14, but there's no
bms_del_member() there due to live_parts not yet existing in RelOptInfo in
that version. Technically there's no bug in version 15 as
bms_del_member() didn't pfree when the set became empty prior to
00b41463c (from v16). Applied to v15 anyway to keep the code similar and
to avoid the bad coding pattern.
Author: Bernd Reiß <bd_reiss@gmx.at>
Reviewed-by: David Rowley <dgrowleyml@gmail.com>
Discussion: https://postgr.es/m/6b88f27a-c45c-4826-8e37-d61a04d90182@gmx.at
Backpatch-through: 15 M src/backend/optimizer/util/inherit.c
CREATE STATISTICS: improve misleading error message
commit : f225473cbae2cca5e1fde376aa4217a6b3a3f770
author : Álvaro Herrera <alvherre@kurilemu.de>
date : Fri, 29 Aug 2025 14:43:47 +0200
committer: Álvaro Herrera <alvherre@kurilemu.de>
date : Fri, 29 Aug 2025 14:43:47 +0200 I think the error message for a different condition was inadvertently
copied.
This problem seems to have been introduced by commit a4d75c86bf15.
Author: Álvaro Herrera <alvherre@kurilemu.de>
Reported-by: jian he <jian.universality@gmail.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Backpatch-through: 14
Discussion: https://postgr.es/m/CACJufxEZ48toGH0Em_6vdsT57Y3L8pLF=DZCQ_gCii6=C3MeXw@mail.gmail.com M src/backend/tcop/utility.c
M src/test/regress/expected/stats_ext.out
M src/test/regress/sql/stats_ext.sql
Fix typo in isolation test spec
commit : 5d7f58848ce59d9e09b7214d2541ab3ec853f89c
author : Daniel Gustafsson <dgustafsson@postgresql.org>
date : Fri, 29 Aug 2025 13:08:32 +0200
committer: Daniel Gustafsson <dgustafsson@postgresql.org>
date : Fri, 29 Aug 2025 13:08:32 +0200 Replace 'committs' with 'commits'.
Author: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>
Discussion: https://postgr.es/m/CAEoWx2=BESkfXsZ9jQW+1NcGTazKuj2wEXsPm1_EpgzHs0BHDQ@mail.gmail.com M src/test/isolation/specs/eval-plan-qual-trigger.spec
headerscheck: Document that --with-llvm is required
commit : f5d07085822a144afb169d0f422e25689cb6209f
author : Peter Eisentraut <peter@eisentraut.org>
date : Fri, 29 Aug 2025 09:30:50 +0200
committer: Peter Eisentraut <peter@eisentraut.org>
date : Fri, 29 Aug 2025 09:30:50 +0200 We already documented that other --with-* options are required for a
successful run. It turns out --with-llvm is also required.
Suggested-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://www.postgresql.org/message-id/flat/1127775.1754417387%40sss.pgh.pa.us M src/tools/pginclude/README
headerscheck: Ignore Windows-specific header
commit : da0413373c092295d89d4523be6a956c34d39540
author : Peter Eisentraut <peter@eisentraut.org>
date : Fri, 29 Aug 2025 09:00:29 +0200
committer: Peter Eisentraut <peter@eisentraut.org>
date : Fri, 29 Aug 2025 09:00:29 +0200 Ignore src/include/port/win32/sys/resource.h. At least on macOS,
including this results in warnings and errors because of duplication
with system headers:
../src/include/port/win32/sys/resource.h:10:9: warning: 'RUSAGE_CHILDREN' redefined
../src/include/port/win32/sys/resource.h:16:1: error: redefinition of struct or union 'struct rusage'
Since we are also not checking similar system-replacement headers for
Windows, it makes sense to exclude this one, too.
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://www.postgresql.org/message-id/flat/1127775.1754417387%40sss.pgh.pa.us M src/tools/pginclude/headerscheck
headerscheck: Use ICU_CFLAGS
commit : 664e0d678965719fe0d385aa3a8f2777058b119b
author : Peter Eisentraut <peter@eisentraut.org>
date : Fri, 29 Aug 2025 09:00:29 +0200
committer: Peter Eisentraut <peter@eisentraut.org>
date : Fri, 29 Aug 2025 09:00:29 +0200 Otherwise, headerscheck will fail if the ICU headers are in a location
not reached by the normal CFLAGS/CPPFLAGS:
../src/include/utils/pg_locale.h:21:10: fatal error: unicode/ucol.h: No such file or directory
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://www.postgresql.org/message-id/flat/1127775.1754417387%40sss.pgh.pa.us M src/tools/pginclude/headerscheck
Mark ItemPointer arguments as const in tuple/table lock functions
commit : 991295f387a6a453fe061831bcc36294989fe77b
author : Peter Eisentraut <peter@eisentraut.org>
date : Fri, 29 Aug 2025 07:33:50 +0200
committer: Peter Eisentraut <peter@eisentraut.org>
date : Fri, 29 Aug 2025 07:33:50 +0200 The functions LockTuple, ConditionalLockTuple, UnlockTuple, and
XactLockTableWait take an ItemPointer argument that they do not
modify, so the argument can be const-qualified to better convey intent
and allow the compiler to enforce immutability.
Author: Chao Li <li.evan.chao@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/CAEoWx2m9e4rECHBwpRE4%2BGCH%2BpbYZXLh2f4rB1Du5hDfKug%2BOg%40mail.gmail.com M src/backend/storage/lmgr/lmgr.c
M src/include/storage/lmgr.h
Remove unneeded casts of BufferGetPage() result
commit : 710e6c4301ee3c739a171ea12ed141b1f8df0d93
author : Peter Eisentraut <peter@eisentraut.org>
date : Fri, 29 Aug 2025 07:09:02 +0200
committer: Peter Eisentraut <peter@eisentraut.org>
date : Fri, 29 Aug 2025 07:09:02 +0200 BufferGetPage() already returns type Page, so casting it to Page
doesn't achieve anything. A sizable number of call sites does this
casting; remove that.
This was already done inconsistently in the code in the first import
in 1996 (but didn't exist in the pre-1995 code), and it was then
apparently just copied around.
Author: Kirill Reshke <reshkekirill@gmail.com>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Richard Guo <guofenglinux@gmail.com>
Reviewed-by: Álvaro Herrera <alvherre@kurilemu.de>
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Discussion: https://www.postgresql.org/message-id/flat/CALdSSPgFhc5=vLqHdk-zCcnztC0zEY3EU_Q6a9vPEaw7FkE9Vw@mail.gmail.com M contrib/amcheck/verify_gin.c
M contrib/bloom/blvacuum.c
M contrib/pgstattuple/pgstatindex.c
M contrib/pgstattuple/pgstattuple.c
M src/backend/access/brin/brin_xlog.c
M src/backend/access/gin/ginvacuum.c
M src/backend/access/gin/ginxlog.c
M src/backend/access/gist/gist.c
M src/backend/access/gist/gistbuild.c
M src/backend/access/gist/gistvacuum.c
M src/backend/access/gist/gistxlog.c
M src/backend/access/hash/hash_xlog.c
M src/backend/access/heap/heapam.c
M src/backend/access/heap/heapam_handler.c
M src/backend/access/heap/heapam_xlog.c
M src/backend/access/heap/pruneheap.c
M src/backend/access/heap/visibilitymap.c
M src/backend/access/nbtree/nbtxlog.c
M src/backend/access/spgist/spgvacuum.c
M src/backend/access/spgist/spgxlog.c
M src/backend/access/transam/xlogutils.c
M src/backend/commands/sequence.c
Fix semijoin unique-ification for child relations
commit : 97b0f36bde9a08bc6f004438ff8fc0afbcb418c0
author : Richard Guo <rguo@postgresql.org>
date : Fri, 29 Aug 2025 13:14:12 +0900
committer: Richard Guo <rguo@postgresql.org>
date : Fri, 29 Aug 2025 13:14:12 +0900 For a child relation, we should not assume that its parent's
unique-ified relation (or unique-ified path in v18) always exists. In
cases where all RHS columns that need to be unique-ified are equated
to constants, the unique-ified relation/path for the parent table is
not built, as there are no columns left to unique-ify. Failing to
account for this can result in a SIGSEGV crash during planning.
This patch checks whether the parent's unique-ified relation or path
exists and skips unique-ification of the child relation if it does
not.
Author: Richard Guo <guofenglinux@gmail.com>
Discussion: https://postgr.es/m/CAMbWs49MOdLW2c+qbLHHBt8VBu=4ONpM91D19=AWeW93eFUF6A@mail.gmail.com
Backpatch-through: 18 M src/backend/optimizer/plan/planner.c
M src/test/regress/expected/join.out
M src/test/regress/sql/join.sql
Use LW_SHARED in walsummarizer.c for WALSummarizerLock lock where possible.
commit : fabd8b8e2a72bac9e5a361856a355bd5bb2e61b8
author : Masahiko Sawada <msawada@postgresql.org>
date : Thu, 28 Aug 2025 17:06:42 -0700
committer: Masahiko Sawada <msawada@postgresql.org>
date : Thu, 28 Aug 2025 17:06:42 -0700 Previously, we used LW_EXCLUSIVE in several places despite only reading
WalSummarizerCtl fields. This patch reduces the lock level to LW_SHARED
where we are only reading the shared fields.
Backpatch to 17, where wal summarization was introduced.
Reviewed-by: Nathan Bossart <nathandbossart@gmail.com>
Discussion: https://postgr.es/m/CAD21AoDdKhf_9oriEYxY-JCdF+Oe_muhca3pcdkMEdBMzyHyKw@mail.gmail.com
Backpatch-through: 17 M src/backend/postmaster/walsummarizer.c
Fix "variable not found in subplan target lists" in semijoin de-duplication.
commit : b8a1bdc458e3e81898a1fe3d26188bc1dcbac965
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Thu, 28 Aug 2025 13:49:20 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Thu, 28 Aug 2025 13:49:20 -0400 One mechanism we have for implementing semi-joins is to de-duplicate
the output of the RHS and then treat the join as a plain inner join.
Initial construction of the join's SpecialJoinInfo identifies the
RHS columns that need to be de-duplicated, but later we may find that
some of those don't need to be handled explicitly, either because
they're known to be constant or because they are redundant with some
previous column.
Up to now, while sort-based de-duplication handled such cases well,
hash-based de-duplication didn't: we'd still hash on all of the
originally-identified columns. This is probably not a very big
deal performance-wise, but in the wake of commit a3179ab69 it can
cause planner errors. That happens when join elimination causes
recalculation of variables' attr_needed bitmapsets, and we decide
that a variable mentioned in a semijoin clause doesn't need to be
propagated up to the join level anymore.
There are a number of ways we could slice the blame for this, but the
only fix that doesn't result in pessimizing plans for loosely-related
cases is to be more careful about not hashing columns we don't
actually need to de-duplicate. We can install that consideration
into create_unique_paths in master, or the predecessor code in
create_unique_path in v18, without much refactoring.
(As follow-up work, it might be a good idea to look at more-invasive
refactoring, in hopes of preventing other bugs in this area. But
with v18 release so close, there's not time for that now, nor would
we be likely to want to put such refactoring into v18 anyway.)
Reported-by: Sergey Soloviev <sergey.soloviev@tantorlabs.ru>
Diagnosed-by: Richard Guo <guofenglinux@gmail.com>
Author: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Richard Guo <guofenglinux@gmail.com>
Discussion: https://postgr.es/m/1fd1a421-4609-4d46-a1af-ab74d5de504a@tantorlabs.ru
Backpatch-through: 18 M src/backend/optimizer/plan/planner.c
M src/test/regress/expected/aggregates.out
M src/test/regress/expected/join.out
M src/test/regress/sql/aggregates.sql
M src/test/regress/sql/join.sql
Glossary: improve definition of "relation"
commit : 16a9165ce4a45f11aa042e12ab62be8ce6b2b93b
author : Álvaro Herrera <alvherre@kurilemu.de>
date : Thu, 28 Aug 2025 18:16:08 +0200
committer: Álvaro Herrera <alvherre@kurilemu.de>
date : Thu, 28 Aug 2025 18:16:08 +0200 Define the more general term first, then the Postgres-specific meaning.
Wording from Tom Lane.
Discussion: https://postgr.es/m/CACJufxEZ48toGH0Em_6vdsT57Y3L8pLF=DZCQ_gCii6=C3MeXw@mail.gmail.com M doc/src/sgml/glossary.sgml
Avoid including commands/dbcommands.h in so many places
commit : 325fc0ab14d11fc87da594857ffbb6636affe7c0
author : Álvaro Herrera <alvherre@kurilemu.de>
date : Thu, 28 Aug 2025 12:39:04 +0200
committer: Álvaro Herrera <alvherre@kurilemu.de>
date : Thu, 28 Aug 2025 12:39:04 +0200 This has been done historically because of get_database_name (which
since commit cb98e6fb8fd4 belongs in lsyscache.c/h, so let's move it
there) and get_database_oid (which is in the right place, but whose
declaration should appear in pg_database.h rather than dbcommands.h).
Clean this up.
Also, xlogreader.h and stringinfo.h are no longer needed by dbcommands.h
since commit f1fd515b393a, so remove them.
Author: Álvaro Herrera <alvherre@kurilemu.de>
Reviewed-by: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://postgr.es/m/202508191031.5ipojyuaswzt@alvherre.pgsql M contrib/sepgsql/database.c
M contrib/sepgsql/label.c
M src/backend/access/heap/vacuumlazy.c
M src/backend/access/transam/multixact.c
M src/backend/access/transam/varsup.c
M src/backend/catalog/aclchk.c
M src/backend/catalog/namespace.c
M src/backend/catalog/objectaddress.c
M src/backend/catalog/pg_shdepend.c
M src/backend/commands/analyze.c
M src/backend/commands/comment.c
M src/backend/commands/dbcommands.c
M src/backend/commands/indexcmds.c
M src/backend/commands/publicationcmds.c
M src/backend/commands/schemacmds.c
M src/backend/commands/subscriptioncmds.c
M src/backend/commands/trigger.c
M src/backend/parser/parse_expr.c
M src/backend/parser/parse_target.c
M src/backend/postmaster/autovacuum.c
M src/backend/replication/logical/slotsync.c
M src/backend/replication/walsender.c
M src/backend/storage/ipc/procarray.c
M src/backend/utils/adt/acl.c
M src/backend/utils/adt/dbsize.c
M src/backend/utils/adt/misc.c
M src/backend/utils/adt/regproc.c
M src/backend/utils/adt/xml.c
M src/backend/utils/cache/lsyscache.c
M src/include/catalog/pg_database.h
M src/include/commands/dbcommands.h
M src/include/utils/lsyscache.h
M src/test/modules/worker_spi/worker_spi.c
Message style improvements
commit : 80f11061323499ef2d07af32ae993473115ca176
author : Peter Eisentraut <peter@eisentraut.org>
date : Wed, 27 Aug 2025 21:17:58 +0200
committer: Peter Eisentraut <peter@eisentraut.org>
date : Wed, 27 Aug 2025 21:17:58 +0200 An improvement pass over the new stats import functionality. M src/backend/statistics/attribute_stats.c
M src/backend/statistics/relation_stats.c
M src/backend/statistics/stat_utils.c
M src/test/regress/expected/stats_import.out
aio: Stop using enum bitfields due to bad code generation
commit : 5865150b6d535ecea241e9ad3038564cb7768b9a
author : Andres Freund <andres@anarazel.de>
date : Wed, 27 Aug 2025 19:12:11 -0400
committer: Andres Freund <andres@anarazel.de>
date : Wed, 27 Aug 2025 19:12:11 -0400 During an investigation into rather odd aio related errors on macos, observed
by Alexander and Konstantin, we started to wonder if bitfield access is
related to the error. At the moment it looks like it is related, we cannot
reproduce the failures when replacing the bitfields. In addition, the problem
can only be reproduced with some compiler [versions] and not everyone has been
able to reproduce the issue.
The observed problem is that, very rarely, PgAioHandle->{state,target} are in
an inconsistent state, after having been checked to be in a valid state not
long before, triggering an assertion failure. Unfortunately, this could be
caused by wrong compiler code generation or somehow of missing memory barriers
- we don't really know. In theory there should not be any concurrent write
access to the handle in the state the bug is triggered, as the handle was idle
and is just being initialized.
Separately from the bug, we observed that at least gcc and clang generate
rather terrible code for the bitfield access. Even if it's not clear if the
observed assertion failure is actually caused by the bitfield somehow, the bad
code generation alone is sufficient reason to stop using bitfields.
Therefore, replace the enum bitfields with uint8s and instead cast in each
switch statement.
Reported-by: Alexander Lakhin <exclusion@gmail.com>
Reported-by: Konstantin Knizhnik <knizhnik@garret.ru>
Discussion: https://postgr.es/m/1500090.1745443021@sss.pgh.pa.us
Backpatch-through: 18 M src/backend/storage/aio/aio.c
M src/backend/storage/aio/aio_funcs.c
M src/backend/storage/aio/aio_io.c
M src/backend/storage/aio/method_io_uring.c
M src/include/storage/aio_internal.h
Put back intra-grant-inplace.spec test coverage
commit : 310d04169a41c20fa2e84ba6e40cffc10b8fa065
author : Peter Eisentraut <peter@eisentraut.org>
date : Wed, 27 Aug 2025 16:47:23 +0200
committer: Peter Eisentraut <peter@eisentraut.org>
date : Wed, 27 Aug 2025 16:47:23 +0200 Commit d31bbfb6590 lost some test coverage, because the situation
being tested, a concurrent DROP, cannot happen anymore. Put the test
coverage back with a bit of a trick, by deleting directly from the
catalog table.
Co-authored-by: Noah Misch <noah@leadboat.com>
Reviewed-by: Heikki Linnakangas <hlinnaka@iki.fi>
Discussion: https://www.postgresql.org/message-id/flat/bf72b82c-124d-4efa-a484-bb928e9494e4@eisentraut.org M src/test/isolation/expected/intra-grant-inplace.out
M src/test/isolation/specs/intra-grant-inplace.spec
Improve objectNamesToOids() comment
commit : e36fa9319b1366ee0194e130a9a77c4af7ee1853
author : Peter Eisentraut <peter@eisentraut.org>
date : Wed, 27 Aug 2025 16:46:51 +0200
committer: Peter Eisentraut <peter@eisentraut.org>
date : Wed, 27 Aug 2025 16:46:51 +0200 Commit d31bbfb6590 removed the comment at objectNamesToOids() that
there is no locking, because that commit added locking. But to fix
all the problems, we'd still need a stronger lock. So put the comment
back with more a detailed explanation.
Co-authored-by: Noah Misch <noah@leadboat.com>
Reviewed-by: Heikki Linnakangas <hlinnaka@iki.fi>
Discussion: https://www.postgresql.org/message-id/flat/bf72b82c-124d-4efa-a484-bb928e9494e4@eisentraut.org M src/backend/catalog/aclchk.c
Fix: Don't strip $libdir from nested module_pathnames
commit : 990c8db1827c0c96fb20cb4fbfcc9690e9b45e15
author : Peter Eisentraut <peter@eisentraut.org>
date : Wed, 27 Aug 2025 15:46:39 +0200
committer: Peter Eisentraut <peter@eisentraut.org>
date : Wed, 27 Aug 2025 15:46:39 +0200 This patch fixes a bug in how 'load_external_function' handles
'$libdir/ prefixes in module paths.
Previously, 'load_external_function' would unconditionally strip
'$libdir/' from the beginning of the 'filename' string. This caused
an issue when the path was nested, such as "$libdir/nested/my_lib".
Stripping the prefix resulted in a path of "nested/my_lib", which
would fail to be found by the expand_dynamic_library_name function
because the original '$libdir' macro was removed.
To fix this, the code now checks for the presence of an additional
directory separator ('/' or '\') after the '$libdir/' prefix. The
prefix is only stripped if the remaining string does not contain a
separator. This ensures that simple filenames like '"$libdir/my_lib"'
are correctly handled, while nested paths are left intact for
'expand_dynamic_library_name' to process correctly.
Reported-by: Dilip Kumar <dilipbalaut@gmail.com>
Co-authored-by: Matheus Alcantara <matheusssilv97@gmail.com>
Co-authored-by: Dilip Kumar <dilipbalaut@gmail.com>
Reviewed-by: Srinath Reddy Sadipiralla <srinath2133@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/CAFiTN-uKNzAro4tVwtJhF1UqcygfJ%2BR%2BRL%3Db-_ZMYE3LdHoGhA%40mail.gmail.com M src/backend/utils/fmgr/dfmgr.c
Check for more Unicode functions during upgrade.
commit : ef5b87b970dc28adeeb88191fbf66c9d6298b112
author : Jeff Davis <jdavis@postgresql.org>
date : Tue, 26 Aug 2025 22:55:14 -0700
committer: Jeff Davis <jdavis@postgresql.org>
date : Tue, 26 Aug 2025 22:55:14 -0700 When checking for expression indexes that may be affected by a Unicode
update during upgrade, check for a few more functions. Specifically,
check for documented regexp functions, as well as the new CASEFOLD()
function.
Also, fully-qualify references to pg_catalog.text and
pg_catalog.regtype.
Discussion: https://postgr.es/m/399b656a3abb0c9283538a040f72199c0601525c.camel@j-davis.com
Backpatch-through: 18 M src/bin/pg_upgrade/check.c
oauth: Explicitly depend on -pthread
commit : 85b380162cd6c66752d1dd020a2d9700da0903c9
author : Jacob Champion <jchampion@postgresql.org>
date : Tue, 26 Aug 2025 14:16:31 -0700
committer: Jacob Champion <jchampion@postgresql.org>
date : Tue, 26 Aug 2025 14:16:31 -0700 Followup to 4e1e41733 and 52ecd05ae. oauth-utils.c uses
pthread_sigmask(), requiring -pthread on Debian bullseye at minimum.
Reported-by: Christoph Berg <myon@debian.org>
Tested-by: Christoph Berg <myon@debian.org>
Discussion: https://postgr.es/m/aK4PZgC0wuwQ5xSK%40msg.df7cb.de
Backpatch-through: 18 M meson.build
M src/interfaces/libpq-oauth/Makefile
Message style improvements
commit : e567e22290544c57293f8e5a913292dacd3bcd1a
author : Peter Eisentraut <peter@eisentraut.org>
date : Tue, 26 Aug 2025 22:48:00 +0200
committer: Peter Eisentraut <peter@eisentraut.org>
date : Tue, 26 Aug 2025 22:48:00 +0200 Mostly adding some quoting. M src/backend/catalog/storage.c
M src/backend/storage/aio/method_io_uring.c
M src/backend/storage/buffer/bufmgr.c
M src/test/modules/test_aio/t/001_aio.pl
Document privileges required for vacuumdb --missing-stats-only.
commit : 984d7165dde7133dbdddc95e95ff56bbb177f628
author : Nathan Bossart <nathan@postgresql.org>
date : Tue, 26 Aug 2025 14:49:01 -0500
committer: Nathan Bossart <nathan@postgresql.org>
date : Tue, 26 Aug 2025 14:49:01 -0500 When vacuumdb's --missing-stats-only option is used, the catalog
query for retrieving the list of relations to process must read
pg_statistic and pg_statistic_ext_data. However, those catalogs
can only be read by superusers by default, so --missing-stats-only
is effectively superuser-only. This is unfortunate, but since the
option is primarily intended for use by administrators after
running pg_upgrade, let's just live with it for v18. This commit
adds a note about the aforementioned privilege requirements to the
documentation for --missing-stats-only.
We first tried to improve matters by modifying the query to read
the pg_stats and pg_stats_ext system views instead. While that is
indeed more lenient from a privilege standpoint, it is also
borderline incomprehensible. pg_stats shows rows for which the
user has the SELECT privilege on the corresponding column, and
pg_stats_ext shows rows for tables the user owns. Meanwhile,
ANALYZE requires either MAINTAIN on the table or, for non-shared
relations, ownership of the database. But even if the privilege
discrepancies were tolerable, the performance impact was not.
Ultimately, the modified query was substantially more expensive, so
we abandoned the idea.
For v19, perhaps we could introduce a simple, inexpensive way to
discover which relations are missing statistics, such as a system
function or view with similar privilege requirements to ANALYZE.
Unfortunately, it is far too late for anything like that in v18.
Reviewed-by: Yugo Nagata <nagata@sraoss.co.jp>
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>
Discussion: https://postgr.es/m/CAHGQGwHh43suEfss1wvBsk7vqiou%3DUY0zcy8HGyE5hBp%2BHZ7SQ%40mail.gmail.com
Backpatch-through: 18 M doc/src/sgml/ref/vacuumdb.sgml
Put "excludeOnly" GIN scan keys at the end of the scankey array.
commit : 327b7324d0715f5e1cdd3765f96a486c7b47e778
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Tue, 26 Aug 2025 12:08:57 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Tue, 26 Aug 2025 12:08:57 -0400 Commit 4b754d6c1 introduced the concept of an excludeOnly scan key,
which cannot select matching index entries but can reject
non-matching tuples, for example a tsquery such as '!term'. There are
poorly-documented assumptions that such scan keys do not appear as the
first scan key. ginNewScanKey did nothing to ensure that, however,
with the result that certain GIN index searches could go into an
infinite loop while apparently-equivalent queries with the clauses in
a different order were fine.
Fix by teaching ginNewScanKey to place all excludeOnly scan keys
after all not-excludeOnly ones. So far as we know at present,
it might be sufficient to avoid the case where the very first
scan key is excludeOnly; but I'm not very convinced that there
aren't other dependencies on the ordering.
Bug: #19031
Reported-by: Tim Wood <washwithcare@gmail.com>
Author: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/19031-0638148643d25548@postgresql.org
Backpatch-through: 13 M contrib/pg_trgm/expected/pg_trgm.out
M contrib/pg_trgm/sql/pg_trgm.sql
M src/backend/access/gin/ginscan.c
Do CHECK_FOR_INTERRUPTS inside, not before, scanGetItem.
commit : b55068236c5e92e211a6bbf8816933fdac02da80
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Tue, 26 Aug 2025 11:38:41 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Tue, 26 Aug 2025 11:38:41 -0400 The CHECK_FOR_INTERRUPTS call in gingetbitmap turns out to be
inadequate to prevent a long uninterruptible loop, because
we now know a case where looping occurs within scanGetItem.
While the next patch will fix the bug that caused that, it
seems foolish to assume that no similar patterns are possible.
Let's do the CFI within scanGetItem's retry loop, instead.
This demonstrably allows canceling out of the loop exhibited
in bug #19031.
Bug: #19031
Reported-by: Tim Wood <washwithcare@gmail.com>
Author: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/19031-0638148643d25548@postgresql.org
Backpatch-through: 13 M src/backend/access/gin/ginget.c
Improve RowMark handling during Self-Join Elimination
commit : 5f6f951f88e53630b3ebe9bde762a9612ca6202f
author : Alexander Korotkov <akorotkov@postgresql.org>
date : Sun, 24 Aug 2025 03:34:22 +0300
committer: Alexander Korotkov <akorotkov@postgresql.org>
date : Sun, 24 Aug 2025 03:34:22 +0300 The Self-Join Elimination SJE feature messes up keeping and removing RowMark's
in remove_self_joins_one_group(). That didn't lead to user-level error,
because the planned RowMark is only used to reference a rtable entry in later
execution stages. An RTE entry for keeping and removing relations is
identical and refers to the same relation OID.
To reduce confusion and prevent future issues, this commit cleans up the code
and fixes the incorrect behaviour. Furthermore, it includes sanity checks in
setrefs.c on existing non-null RTE and RelOptInfo entries for each RowMark.
Discussion: https://postgr.es/m/18c6bd6c-6d2a-419a-b0da-dfedef34b585%40gmail.com
Author: Andrei Lepikhov <lepihov@gmail.com>
Reviewed-by: Greg Sabino Mullane <htamfids@gmail.com>
Backpatch-through: 18 M src/backend/optimizer/plan/analyzejoins.c
M src/backend/optimizer/plan/setrefs.c
Refactor variable names in remove_self_joins_one_group()
commit : d713cf9b65ae1e7090a62c83bd78dec867871185
author : Alexander Korotkov <akorotkov@postgresql.org>
date : Tue, 26 Aug 2025 12:51:32 +0300
committer: Alexander Korotkov <akorotkov@postgresql.org>
date : Tue, 26 Aug 2025 12:51:32 +0300 Rename inner and outer to rrel and krel, respectively, to highlight their
connection to r and k indexes. For the same reason, rename imark and omark
to rmark and kmark.
Discussion: https://postgr.es/m/18c6bd6c-6d2a-419a-b0da-dfedef34b585%40gmail.com
Author: Andrei Lepikhov <lepihov@gmail.com>
Reviewed-by: Greg Sabino Mullane <htamfids@gmail.com>
Backpatch-through: 18 M src/backend/optimizer/plan/analyzejoins.c
Further clarify documentation for the initcap function
commit : f8ce9ed220b5edd8ba751706bbcdbcc5b64be66e
author : Alexander Korotkov <akorotkov@postgresql.org>
date : Tue, 26 Aug 2025 12:49:44 +0300
committer: Alexander Korotkov <akorotkov@postgresql.org>
date : Tue, 26 Aug 2025 12:49:44 +0300 This is a follow-up for commit c2c2c7e225. It further clarifies the
following in the initcap function documentation:
* Document that title case is used for digraphs in specific locales,
* Reference particular ICU function used,
* Add note about the purpose of the function.
Discussion: https://postgr.es/m/804cc10ef95d4d3b298e76b181fd9437%40postgrespro.ru
Author: Oleg Tselebrovskiy <o.tselebrovskiy@postgrespro.ru>
Co-authored-by: Alexander Korotkov <aekorotkov@gmail.com>
Reviewed-by: Jeff Davis <pgsql@j-davis.com>
Reviewed-by: Peter Eisentraut <peter@eisentraut.org> M doc/src/sgml/func/func-string.sgml
Raise C requirement to C11
commit : f5e0186f865cc188ef6f4b2bc77d0c028f78195e
author : Peter Eisentraut <peter@eisentraut.org>
date : Tue, 26 Aug 2025 10:43:14 +0200
committer: Peter Eisentraut <peter@eisentraut.org>
date : Tue, 26 Aug 2025 10:43:14 +0200 This changes configure and meson.build to require at least C11,
instead of the previous C99. The installation documentation is
updated accordingly.
configure.ac previously used AC_PROG_CC_C99 to activate C99. But
there is no AC_PROG_CC_C11 in Autoconf 2.69, because it's too
old. (Also, post-2.69, the AC_PROG_CC_Cnn macros were deprecated and
AC_PROG_CC activates the last supported C mode.) We could update the
required Autoconf version, but that might be a separate project that
no one wants to undertake at the moment. Instead, we open-code the
test for C11 using some inspiration from later Autoconf versions. But
instead of writing an elaborate test program, we keep it simple and
just check __STDC_VERSION__, which should be good enough in practice.
In meson.build, we update the existing C99 test to C11, but again we
just check for __STDC_VERSION__.
This also removes the separate option for the conforming preprocessor
on MSVC, added by commit 8fd9bb1d965, since that is activated
automatically in C11 mode.
Note, we don't use the "official" way to set the C standard in Meson
using the c_std project option, because that is impossible to use
correctly (see <https://github.com/mesonbuild/meson/issues/14717>).
Reviewed-by: David Rowley <dgrowleyml@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/01a69441-af54-4822-891b-ca28e05b215a@eisentraut.org M configure
M configure.ac
M doc/src/sgml/installation.sgml
M doc/src/sgml/sources.sgml
M meson.build
Message wording improvements
commit : 99234e9ddc02f45eb122f83d49031e2c517d0af8
author : Peter Eisentraut <peter@eisentraut.org>
date : Mon, 25 Aug 2025 22:59:00 +0200
committer: Peter Eisentraut <peter@eisentraut.org>
date : Mon, 25 Aug 2025 22:59:00 +0200 Use "row" instead of "tuple" for user-facing information for
logical replication conflicts. M doc/src/sgml/logical-replication.sgml
M src/backend/executor/execReplication.c
M src/backend/replication/logical/conflict.c
M src/include/replication/conflict.h
M src/test/subscription/t/001_rep_changes.pl
M src/test/subscription/t/013_partition.pl
M src/test/subscription/t/029_on_error.pl
M src/test/subscription/t/030_origin.pl
M src/test/subscription/t/035_conflicts.pl
Use PqMsg_* macros in applyparallelworker.c.
commit : 989b2e4d5c95f6b183e76f3eb06d2d360651ccf2
author : Nathan Bossart <nathan@postgresql.org>
date : Mon, 25 Aug 2025 14:11:01 -0500
committer: Nathan Bossart <nathan@postgresql.org>
date : Mon, 25 Aug 2025 14:11:01 -0500 Oversight in commit f4b54e1ed9.
Author: Ranier Vilela <ranier.vf@gmail.com>
Discussion: https://postgr.es/m/CAEudQAobFsHaLMypA6C96-9YExvF4AcU1xNPoPuNYRVm3mq4dg%40mail.gmail.com M src/backend/replication/logical/applyparallelworker.c
oauth: Add unit tests for multiplexer handling
commit : 4e1e417330d42cb19c7d439cd50eea20f25c7518
author : Jacob Champion <jchampion@postgresql.org>
date : Mon, 25 Aug 2025 09:27:45 -0700
committer: Jacob Champion <jchampion@postgresql.org>
date : Mon, 25 Aug 2025 09:27:45 -0700 To better record the internal behaviors of oauth-curl.c, add a unit test
suite for the socket and timer handling code. This is all based on TAP
and driven by our existing Test::More infrastructure.
This commit is a replay of 1443b6c0e, which was reverted due to
buildfarm failures. Compared with that, this version protects the build
targets in the Makefile with a with_libcurl conditional, and it tweaks
the code style in 001_oauth.pl.
Reviewed-by: Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>
Reviewed-by: Andrew Dunstan <andrew@dunslane.net>
Discussion: https://postgr.es/m/CAOYmi+nDZxJHaWj9_jRSyf8uMToCADAmOfJEggsKW-kY7aUwHA@mail.gmail.com
Discussion: https://postgr.es/m/CAOYmi+m=xY0P_uAzAP_884uF-GhQ3wrineGwc9AEnb6fYxVqVQ@mail.gmail.com M src/interfaces/libpq-oauth/Makefile
M src/interfaces/libpq-oauth/meson.build
A src/interfaces/libpq-oauth/t/001_oauth.pl
A src/interfaces/libpq-oauth/test-oauth-curl.c
oauth: Always link with -lm for floor()
commit : 52ecd05aeef851b7d3688b0f0a633132c691eb32
author : Jacob Champion <jchampion@postgresql.org>
date : Mon, 25 Aug 2025 09:27:39 -0700
committer: Jacob Champion <jchampion@postgresql.org>
date : Mon, 25 Aug 2025 09:27:39 -0700 libpq-oauth uses floor() but did not link against libm. Since libpq
itself uses -lm, nothing in the buildfarm has had problems with
libpq-oauth yet, and it seems difficult to hit a failure in practice.
But commit 1443b6c0e attempted to add an executable based on
libpq-oauth, which ran into link-time failures with Clang due to this
omission. It seems prudent to fix this for both the module and the
executable simultaneously so that no one trips over it in the future.
This is a Makefile-only change. The Meson side already pulls in libm,
through the os_deps dependency.
Discussion: https://postgr.es/m/CAOYmi%2Bn6ORcmV10k%2BdAs%2Bp0b9QJ4bfpk0WuHQaF5ODXxM8Y36A%40mail.gmail.com
Backpatch-through: 18 M src/interfaces/libpq-oauth/Makefile
Use PqMsg_* macros in fe-protocol3.c.
commit : 3ef2b863a376af35e8d5f2cd1bb4311ec7a9f299
author : Nathan Bossart <nathan@postgresql.org>
date : Mon, 25 Aug 2025 11:08:26 -0500
committer: Nathan Bossart <nathan@postgresql.org>
date : Mon, 25 Aug 2025 11:08:26 -0500 Oversight in commit f4b54e1ed9.
Reviewed-by: Jacob Champion <jacob.champion@enterprisedb.com>
Reviewed-by: Fabrízio de Royes Mello <fabriziomello@gmail.com>
Discussion: https://postgr.es/m/aKx5vEbbP03JNgtp%40nathan M src/include/libpq/protocol.h
M src/interfaces/libpq/fe-protocol3.c
Formatting cleanup of guc_tables.c
commit : 878656dbde0d2fd4b85a8c63566e2a9f0d0f4952
author : Peter Eisentraut <peter@eisentraut.org>
date : Mon, 25 Aug 2025 08:28:17 +0200
committer: Peter Eisentraut <peter@eisentraut.org>
date : Mon, 25 Aug 2025 08:28:17 +0200 This cleans up a few minor formatting inconsistencies.
Reviewed-by: John Naylor <johncnaylorls@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/dae6fe89-1e0c-4c3f-8d92-19d23374fb10%40eisentraut.org M src/backend/utils/misc/guc_tables.c
Rewrite previous commit's test for TestUpgradeXversion compatibility.
commit : ad4412480d3ff475a6dfa4a7f449702eff78312d
author : Noah Misch <noah@leadboat.com>
date : Sat, 23 Aug 2025 16:46:20 -0700
committer: Noah Misch <noah@leadboat.com>
date : Sat, 23 Aug 2025 16:46:20 -0700 v17 introduced the MAINTAIN ON TABLES privilege. That changed the
applicable "baseacls" reaching buildACLCommands(). That yielded
spurious TestUpgradeXversion diffs. Change to use a TYPES privilege.
Types have the same one privilege in all supported versions, so they
avoid the problem. Per buildfarm. Back-patch to v13, like that commit.
Discussion: https://postgr.es/m/20250823144505.88.nmisch@google.com
Backpatch-through: 13 M src/test/regress/expected/privileges.out
M src/test/regress/sql/privileges.sql
Sort DO_DEFAULT_ACL dump objects independent of OIDs.
commit : b61a5c4bed7df87120df587731840e51ea7c7525
author : Noah Misch <noah@leadboat.com>
date : Fri, 22 Aug 2025 20:50:28 -0700
committer: Noah Misch <noah@leadboat.com>
date : Fri, 22 Aug 2025 20:50:28 -0700 Commit 0decd5e89db9f5edb9b27351082f0d74aae7a9b6 missed DO_DEFAULT_ACL,
leading to assertion failures, potential dump order instability, and
spurious schema diffs. Back-patch to v13, like that commit.
Reported-by: Alexander Lakhin <exclusion@gmail.com>
Author: Kirill Reshke <reshkekirill@gmail.com>
Discussion: https://postgr.es/m/d32aaa8d-df7c-4f94-bcb3-4c85f02bea21@gmail.com
Backpatch-through: 13 M src/bin/pg_dump/pg_dump_sort.c
M src/test/regress/expected/privileges.out
M src/test/regress/sql/privileges.sql
Revert "Get rid of WALBufMappingLock"
commit : c13070a27b63d9ce4850d88a63bf889a6fde26f0
author : Alexander Korotkov <akorotkov@postgresql.org>
date : Fri, 22 Aug 2025 18:44:39 +0300
committer: Alexander Korotkov <akorotkov@postgresql.org>
date : Fri, 22 Aug 2025 18:44:39 +0300 This reverts commit bc22dc0e0ddc2dcb6043a732415019cc6b6bf683.
It appears that conditional variables are not suitable for use inside
critical sections. If WaitLatch()/WaitEventSetWaitBlock() face postmaster
death, they exit, releasing all locks instead of PANIC. In certain
situations, this leads to data corruption.
Reported-by: Andrey Borodin <x4mmm@yandex-team.ru>
Discussion: https://postgr.es/m/B3C69B86-7F82-4111-B97F-0005497BB745%40yandex-team.ru
Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Aleksander Alekseev <aleksander@tigerdata.com>
Reviewed-by: Kirill Reshke <reshkekirill@gmail.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Thomas Munro <thomas.munro@gmail.com>
Reviewed-by: Tomas Vondra <tomas@vondra.me>
Reviewed-by: Andres Freund <andres@anarazel.de>
Reviewed-by: Yura Sokolov <y.sokolov@postgrespro.ru>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Backpatch-through: 18 M src/backend/access/transam/xlog.c
M src/backend/utils/activity/wait_event_names.txt
M src/include/storage/lwlocklist.h
vacuumdb: Fix --missing-stats-only with virtual generated columns.
commit : b63952a7811319a6525a9ea23afa294a900fa895
author : Nathan Bossart <nathan@postgresql.org>
date : Fri, 22 Aug 2025 11:11:28 -0500
committer: Nathan Bossart <nathan@postgresql.org>
date : Fri, 22 Aug 2025 11:11:28 -0500 Statistics aren't created for virtual generated columns, so
"vacuumdb --missing-stats-only" always chooses to analyze tables
that have them. To fix, modify vacuumdb's query for retrieving
relations that are missing statistics to exclude those columns.
Oversight in commit edba754f05.
Author: Yugo Nagata <nagata@sraoss.co.jp>
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>
Reviewed-by: Corey Huinker <corey.huinker@gmail.com>
Discussion: https://postgr.es/m/20250820104226.8ba51e43164cd590b863ce41%40sraoss.co.jp
Backpatch-through: 18 M src/bin/scripts/t/100_vacuumdb.pl
M src/bin/scripts/vacuumdb.c
Revert unnecessary check for NULL
commit : 807ee417e562c355360e891f415e6e8e6e4c40ed
author : Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Fri, 22 Aug 2025 14:47:19 +0300
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Fri, 22 Aug 2025 14:47:19 +0300 Jelte pointed out that this was unnecessary, but I failed to remove it
before pushing f6f0542266. Oops.
Reviewed-by: Jelte Fennema-Nio <postgres@jeltef.nl>
Discussion: https://www.postgresql.org/message-id/CAGECzQT%3DxNV-V%2BvFC7YQwYQMj0wGN61b3p%3DJ1_rL6M0vbjTtrA@mail.gmail.com
Backpatch-through: 18 M src/interfaces/libpq/fe-protocol3.c
libpq: Be strict about cancel key lengths
commit : e411a8d25a4b39e5a896f765ca91636057e261fc
author : Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Fri, 22 Aug 2025 14:39:29 +0300
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Fri, 22 Aug 2025 14:39:29 +0300 The protocol documentation states that the maximum length of a cancel
key is 256 bytes. This starts checking for that limit in libpq.
Otherwise third party backend implementations will probably start
using more bytes anyway. We also start requiring that a protocol 3.0
connection does not send a longer cancel key, to make sure that
servers don't start breaking old 3.0-only clients by accident. Finally
this also restricts the minimum key length to 4 bytes (both in the
protocol spec and in the libpq implementation).
Author: Jelte Fennema-Nio <postgres@jeltef.nl>
Reviewed-by: Jacob Champion <jchampion@postgresql.org>
Discussion: https://www.postgresql.org/message-id/df892f9f-5923-4046-9d6f-8c48d8980b50@iki.fi
Backpatch-through: 18 M doc/src/sgml/protocol.sgml
M src/interfaces/libpq/fe-protocol3.c
libpq: Handle OOM by disconnecting instead of hanging or skipping msgs
commit : f6f0542266f0a04e94ac2a67ae6890d6095101ab
author : Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Fri, 22 Aug 2025 14:39:25 +0300
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Fri, 22 Aug 2025 14:39:25 +0300 In most cases, if an out-of-memory situation happens, we attach the
error message to the connection and report it at the next
PQgetResult() call. However, there are a few cases, while processing
messages that are not associated with any particular query, where we
handled failed allocations differently and not very nicely:
- If we ran out of memory while processing an async notification,
getNotify() either returned EOF, which stopped processing any
further data until more data was received from the server, or
silently dropped the notification. Returning EOF is problematic
because if more data never arrives, e.g. because the connection was
used just to wait for the notification, or because the next
ReadyForQuery was already received and buffered, it would get stuck
forever. Silently dropping a notification is not nice either.
- (New in v18) If we ran out of memory while receiving BackendKeyData
message, getBackendKeyData() returned EOF, which has the same issues
as in getNotify().
- If we ran out of memory while saving a received a ParameterStatus
message, we just skipped it. A later call to PQparameterStatus()
would return NULL, even though the server did send the status.
Change all those cases to terminate the connnection instead. Our
options for reporting those errors are limited, but it seems better to
terminate than try to soldier on. Applications should handle
connection loss gracefully, whereas silently missing a notification,
parameter status, or cancellation key could cause much weirder
problems.
This also changes the error message on OOM while expanding the input
buffer. It used to report "cannot allocate memory for input buffer",
followed by "lost synchronization with server: got message type ...".
The "lost synchronization" message seems unnecessary, so remove that
and report only "cannot allocate memory for input buffer". (The
comment speculated that the out of memory could indeed be caused by
loss of sync, but that seems highly unlikely.)
This evolved from a more narrow patch by Jelte Fennema-Nio, which was
reviewed by Jacob Champion.
Somewhat arbitrarily, backpatch to v18 but no further. These are
long-standing issues, but we haven't received any complaints from the
field. We can backpatch more later, if needed.
Co-authored-by: Jelte Fennema-Nio <postgres@jeltef.nl>
Reviewed-by: Jelte Fennema-Nio <postgres@jeltef.nl>
Reviewed-by: Jacob Champion <jchampion@postgresql.org>
Discussion: https://www.postgresql.org/message-id/df892f9f-5923-4046-9d6f-8c48d8980b50@iki.fi
Backpatch-through: 18 M src/interfaces/libpq/fe-exec.c
M src/interfaces/libpq/fe-protocol3.c
M src/interfaces/libpq/libpq-int.h
Use ereport() rather than elog()
commit : 661f821ef0c3078c70096b09dc44fb8fed56f2b4
author : Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Fri, 22 Aug 2025 13:35:05 +0300
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Fri, 22 Aug 2025 13:35:05 +0300 Noah pointed this out before I committed 50f770c3d9, but I
accidentally pushed the old version with elog() anyway. Oops.
Reported-by: Noah Misch <noah@leadboat.com>
Discussion: https://www.postgresql.org/message-id/20250820003756.31.nmisch@google.com M src/backend/access/heap/heapam.c
M src/backend/access/index/indexam.c
Revert GetTransactionSnapshot() to return historic snapshot during LR
commit : 50f770c3d92cfb2d62724d8c810d37c1f6249a11
author : Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Fri, 22 Aug 2025 13:07:46 +0300
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Fri, 22 Aug 2025 13:07:46 +0300 Commit 1585ff7387 changed GetTransactionSnapshot() to throw an error
if it's called during logical decoding, instead of returning the
historic snapshot. I made that change for extra protection, because a
historic snapshot can only be used to access catalog tables while
GetTransactionSnapshot() is usually called when you're executing
arbitrary queries. You might get very subtle visibility problems if
you tried to use the historic snapshot for arbitrary queries.
There's no built-in code in PostgreSQL that calls
GetTransactionSnapshot() during logical decoding, but it turns out
that the pglogical extension does just that, to evaluate row filter
expressions. You would get weird results if the row filter runs
arbitrary queries, but it is sane as long as you don't access any
non-catalog tables. Even though there are no checks to enforce that in
pglogical, a typical row filter expression does not access any tables
and works fine. Accessing tables marked with the user_catalog_table =
true option is also OK.
To fix pglogical with row filters, and any other extensions that might
do similar things, revert GetTransactionSnapshot() to return a
historic snapshot during logical decoding.
To try to still catch the unsafe usage of historic snapshots, add
checks in heap_beginscan() and index_beginscan() to complain if you
try to use a historic snapshot to scan a non-catalog table. We're very
close to the version 18 release however, so add those new checks only
in master.
Backpatch-through: 18
Reported-by: Noah Misch <noah@leadboat.com>
Reviewed-by: Noah Misch <noah@leadboat.com>
Discussion: https://www.postgresql.org/message-id/20250809222338.cc.nmisch@google.com M src/backend/access/heap/heapam.c
M src/backend/access/index/indexam.c
M src/backend/utils/time/snapmgr.c
M src/include/utils/snapmgr.h
Reduce lock level for ALTER DOMAIN ... VALIDATE CONSTRAINT
commit : 16a0039dc0d1d0cdfadaf38cd3a30f3c8f590c48
author : Peter Eisentraut <peter@eisentraut.org>
date : Fri, 22 Aug 2025 08:51:29 +0200
committer: Peter Eisentraut <peter@eisentraut.org>
date : Fri, 22 Aug 2025 08:51:29 +0200 Reduce from ShareLock to ShareUpdateExclusivelock. Validation during
ALTER DOMAIN ... ADD CONSTRAINT keeps using ShareLock.
Example:
create domain d1 as int;
create table t (a d1);
alter domain d1 add constraint cc10 check (value > 10) not valid;
begin;
alter domain d1 validate constraint cc10;
-- another session
insert into t values (8);
Now we should still be able to perform DML operations on table t while
the domain constraint is being validated. The equivalent works
already on table constraints.
Author: jian he <jian.universality@gmail.com>
Reviewed-by: Dilip Kumar <dilipbalaut@gmail.com>
Reviewed-by: wenhui qiu <qiuwenhuifx@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/CACJufxHz92A88NLRTA2msgE2dpXpE-EoZ2QO61od76-6bfqurA%40mail.gmail.com M src/backend/commands/typecmds.c
Doc: Fix typo in logicaldecoding.sgml.
commit : 123e65fdb7fe51920ad29119484148ea1b0afcd2
author : Amit Kapila <akapila@postgresql.org>
date : Fri, 22 Aug 2025 05:29:36 +0000
committer: Amit Kapila <akapila@postgresql.org>
date : Fri, 22 Aug 2025 05:29:36 +0000 Author: Hayato Kuroda <kuroda.hayato@fujitsu.com>
Backpatch-through: 17, where it was introduced
Discussion: https://postgr.es/m/OSCPR01MB149662EC5467B4135398E3731F532A@OSCPR01MB14966.jpnprd01.prod.outlook.com M doc/src/sgml/logicaldecoding.sgml
Change dynahash.c and hsearch.h to use int64 instead of long
commit : 13b935cd5217457f62e9936fce668d15515a3072
author : Michael Paquier <michael@paquier.xyz>
date : Fri, 22 Aug 2025 11:59:02 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Fri, 22 Aug 2025 11:59:02 +0900 This code was relying on "long", which is signed 8 bytes everywhere
except on Windows where it is 4 bytes, that could potentially expose it
to overflows, even if the current uses in the code are fine as far as I
know. This code is now able to rely on the same sizeof() variable
everywhere, with int64. long was used for sizes, partition counts and
entry counts.
Some callers of the dynahash.c routines used long declarations, that can
be cleaned up to use int64 instead. There was one shortcut based on
SIZEOF_LONG, that can be removed. long is entirely removed from
dynahash.c and hsearch.h.
Similar work was done in b1e5c9fa9ac4.
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Discussion: https://postgr.es/m/aKQYp-bKTRtRauZ6@paquier.xyz M contrib/pg_stat_statements/pg_stat_statements.c
M src/backend/catalog/storage.c
M src/backend/storage/ipc/shmem.c
M src/backend/storage/lmgr/lock.c
M src/backend/storage/lmgr/predicate.c
M src/backend/utils/hash/dynahash.c
M src/include/storage/shmem.h
M src/include/utils/dynahash.h
M src/include/utils/hsearch.h
Ignore temporary relations in RelidByRelfilenumber()
commit : ef03ea01fe47a02cd9e7fd24a9cf98daacdf4550
author : Michael Paquier <michael@paquier.xyz>
date : Fri, 22 Aug 2025 09:03:59 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Fri, 22 Aug 2025 09:03:59 +0900 Temporary relations may share the same RelFileNumber with a permanent
relation, or other temporary relations associated with other sessions.
Being able to uniquely identify a temporary relation would require
RelidByRelfilenumber() to know about the proc number of the temporary
relation it wants to identify, something it is not designed for since
its introduction in f01d1ae3a104.
There are currently three callers of RelidByRelfilenumber():
- autoprewarm.
- Logical decoding, reorder buffer.
- pg_filenode_relation(), that attempts to find a relation OID based on
a tablespace OID and a RelFileNumber.
This makes the situation problematic particularly for the first two
cases, leading to the possibility of random ERRORs due to
inconsistencies that temporary relations can create in the cache
maintained by RelidByRelfilenumber(). The third case should be less of
an issue, as I suspect that there are few direct callers of
pg_filenode_relation().
The window where the ERRORs are happen is very narrow, requiring an OID
wraparound to create a lookup conflict in RelidByRelfilenumber() with a
temporary table reusing the same OID as another relation already cached.
The problem is easier to reach in workloads with a high OID consumption
rate, especially with a higher number of temporary relations created.
We could get pg_filenode_relation() and RelidByRelfilenumber() to work
with temporary relations if provided the means to identify them with an
optional proc number given in input, but the years have also shown that
we do not have a use case for it, yet. Note that this could not be
backpatched if pg_filenode_relation() needs changes. It is simpler to
ignore temporary relations.
Reported-by: Shenhao Wang <wangsh.fnst@fujitsu.com>
Author: Vignesh C <vignesh21@gmail.com>
Reviewed-By: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>
Reviewed-By: Robert Haas <robertmhaas@gmail.com>
Reviewed-By: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Reviewed-By: Takamichi Osumi <osumi.takamichi@fujitsu.com>
Reviewed-By: Michael Paquier <michael@paquier.xyz>
Reviewed-By: Masahiko Sawada <sawada.mshk@gmail.com>
Reported-By: Shenhao Wang <wangsh.fnst@fujitsu.com>
Discussion: https://postgr.es/m/bbaaf9f9-ebb2-645f-54bb-34d6efc7ac42@fujitsu.com
Backpatch-through: 13 M doc/src/sgml/func/func-admin.sgml
M src/backend/utils/adt/dbsize.c
M src/backend/utils/cache/relfilenumbermap.c
M src/test/regress/expected/alter_table.out
M src/test/regress/expected/create_table.out
M src/test/regress/sql/alter_table.sql
M src/test/regress/sql/create_table.sql
Use consistent type for pgaio_io_get_id() result
commit : 47932f3cdc4c221dbd9207cb21e63c862fedd189
author : Peter Eisentraut <peter@eisentraut.org>
date : Thu, 21 Aug 2025 19:40:12 +0200
committer: Peter Eisentraut <peter@eisentraut.org>
date : Thu, 21 Aug 2025 19:40:12 +0200 The result of pgaio_io_get_id() was being assigned to a mix of int and
uint32 variables. This fixes it to use int consistently, which seems
the most correct. Also change the queue empty special value in
method_worker.c to -1 from UINT32_MAX.
Reviewed-by: Andres Freund <andres@anarazel.de>
Discussion: https://www.postgresql.org/message-id/70c784b3-f60b-4652-b8a6-75e5f051243e%40eisentraut.org M src/backend/storage/aio/aio_funcs.c
M src/backend/storage/aio/method_worker.c
Disallow server start with sync_replication_slots = on and wal_level < logical.
commit : 12da45742cfd15d9fab151b25400d96a1febcbde
author : Fujii Masao <fujii@postgresql.org>
date : Thu, 21 Aug 2025 22:18:11 +0900
committer: Fujii Masao <fujii@postgresql.org>
date : Thu, 21 Aug 2025 22:18:11 +0900 Replication slot synchronization (sync_replication_slots = on)
requires wal_level to be logical. This commit prevents the server
from starting if sync_replication_slots is enabled but wal_level
is set to minimal or replica.
Failing early during startup helps users catch invalid configurations
immediately, which is important because changing wal_level requires
a server restart.
Author: Fujii Masao <masao.fujii@gmail.com>
Reviewed-by: Shveta Malik <shveta.malik@gmail.com>
Discussion: https://postgr.es/m/CAH0PTU_pc3oHi__XESF9ZigCyzai1Mo3LsOdFyQA4aUDkm01RA@mail.gmail.com M src/backend/postmaster/postmaster.c
PL/Python: Add event trigger support
commit : 53eff471c69dc8b0c01f046d3fdcc460eb90d0e5
author : Peter Eisentraut <peter@eisentraut.org>
date : Thu, 21 Aug 2025 09:15:55 +0200
committer: Peter Eisentraut <peter@eisentraut.org>
date : Thu, 21 Aug 2025 09:15:55 +0200 Allow event triggers to be written in PL/Python. It provides a TD
dictionary with some information about the event trigger.
Author: Euler Taveira <euler@eulerto.com>
Co-authored-by: Dimitri Fontaine <dimitri@2ndQuadrant.fr>
Reviewed-by: Pavel Stehule <pavel.stehule@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/03f03515-2068-4f5b-b357-8fb540883c38%40app.fastmail.com M doc/src/sgml/plpython.sgml
M src/pl/plpython/expected/plpython_trigger.out
M src/pl/plpython/plpy_exec.c
M src/pl/plpython/plpy_exec.h
M src/pl/plpython/plpy_main.c
M src/pl/plpython/plpy_procedure.h
M src/pl/plpython/sql/plpython_trigger.sql
PL/Python: Refactor for event trigger support
commit : 6e09c960ebb353c6cbcc05191c68aea4079df277
author : Peter Eisentraut <peter@eisentraut.org>
date : Thu, 21 Aug 2025 09:15:49 +0200
committer: Peter Eisentraut <peter@eisentraut.org>
date : Thu, 21 Aug 2025 09:15:49 +0200 Change is_trigger type from boolean to enum. That's a preparation for
adding event trigger support.
Author: Euler Taveira <euler@eulerto.com>
Co-authored-by: Dimitri Fontaine <dimitri@2ndQuadrant.fr>
Reviewed-by: Pavel Stehule <pavel.stehule@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/03f03515-2068-4f5b-b357-8fb540883c38%40app.fastmail.com M src/pl/plpython/plpy_exec.c
M src/pl/plpython/plpy_main.c
M src/pl/plpython/plpy_procedure.c
M src/pl/plpython/plpy_procedure.h
M src/tools/pgindent/typedefs.list
Apply some fat commas to commands of TAP tests
commit : e8eb98754b112cf00d328becbe33958229cb20bf
author : Michael Paquier <michael@paquier.xyz>
date : Thu, 21 Aug 2025 14:17:26 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Thu, 21 Aug 2025 14:17:26 +0900 This is similar to 19c6e92b13b2, in order to keep the style used in the
scripts consistent for the option names and values used in commands.
The places updated in this commit have been added recently in
71ea0d679543.
These changes are cosmetic; there is no need for a backpatch. M src/bin/pg_combinebackup/t/002_compare_backups.pl
M src/bin/pg_upgrade/t/002_pg_upgrade.pl
M src/test/recovery/t/027_stream_regress.pl
doc: Improve description of wal_compression
commit : b5d87a823f2f828f65005b31f0a547549f164e5f
author : Michael Paquier <michael@paquier.xyz>
date : Thu, 21 Aug 2025 13:25:03 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Thu, 21 Aug 2025 13:25:03 +0900 The description of this GUC provides a list of the situations where
full-page writes are generated. However, it is not completely exact,
mentioning only the cases where full_page_writes=on or base backups. It
is possible to generate full-page writes in more situations than these
two, making the description confusing as it implies that no other cases
exist.
The description is slightly reworded to take into account that other
cases are possible, without mentioning them directly to minimize the
maintenance burden should FPWs be generated in more contexts in the
future.
Author: Jingtang Zhang <mrdrivingduck@gmail.com>
Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Xuneng Zhou <xunengzhou@gmail.com>
Discussion: https://postgr.es/m/CAPsk3_CtAYa_fy4p6=x7qtoutrdKvg1kGk46D5fsE=sMt2546g@mail.gmail.com
Backpatch-through: 13 M doc/src/sgml/config.sgml
Fix re-execution of a failed SQLFunctionCache entry.
commit : a67d4847a4319ddee8a8ee7d8945c07301ada66e
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Wed, 20 Aug 2025 16:09:18 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Wed, 20 Aug 2025 16:09:18 -0400 If we error out during execution of a SQL-language function, we will
often leave behind non-null pointers in its SQLFunctionCache's cplan
and eslist fields. This is problematic if the SQLFunctionCache is
re-used, because those pointers will point at resources that were
released during error cleanup. This problem escaped detection so far
because ordinarily we won't re-use an FmgrInfo+SQLFunctionCache struct
after a query error. However, in the rather improbable case that
someone implements an opclass support function in SQL language, there
will be long-lived FmgrInfos for it in the relcache, and then the
problem is reachable after the function throws an error.
To fix, add a flag to SQLFunctionCache that tracks whether execution
escapes out of fmgr_sql, and clear out the relevant fields during
init_sql_fcache if so. (This is going to need more thought if we ever
try to share FMgrInfos across threads; but it's very far from being
the only problem such a project will encounter, since many functions
regard fn_extra as being query-local state.)
This broke at commit 0313c5dc6; before that we did not try to re-use
SQLFunctionCache state across calls. Hence, back-patch to v18.
Bug: #19026
Reported-by: Alexander Lakhin <exclusion@gmail.com>
Author: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/19026-90aed5e71d0c8af3@postgresql.org
Backpatch-through: 18 M src/backend/executor/functions.c
M src/test/regress/expected/create_function_sql.out
M src/test/regress/sql/create_function_sql.sql
Minor error message enhancement
commit : e9c043a11ac402d376def531a12883d1dac15315
author : Peter Eisentraut <peter@eisentraut.org>
date : Wed, 20 Aug 2025 18:12:08 +0200
committer: Peter Eisentraut <peter@eisentraut.org>
date : Wed, 20 Aug 2025 18:12:08 +0200 In refuseDupeIndexAttach(), change from
errdetail("Another index is already attached for partition \"%s\"."...)
to
errdetail("Another index \"%s\" is already attached for partition \"%s\"."...)
so we can easily understand which index is already attached for
partition \"%s\".
Author: Jian He <jian.universality@gmail.com>
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Discussion: https://www.postgresql.org/message-id/flat/CACJufxGBfykJ_1ztk9T%2BL_gLmkOSOF%2BmL9Mn4ZPydz-rh%3DLccQ%40mail.gmail.com M src/backend/commands/tablecmds.c
M src/test/regress/expected/indexing.out
Fix assertion failure with replication slot release in single-user mode
commit : 1f2e51e3c7c2042e4cb184b9a9030c1353de298e
author : Michael Paquier <michael@paquier.xyz>
date : Wed, 20 Aug 2025 15:00:04 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Wed, 20 Aug 2025 15:00:04 +0900 Some replication slot manipulations (logical decoding via SQL,
advancing) were failing an assertion when releasing a slot in
single-user mode, because active_pid was not set in a ReplicationSlot
when its slot is acquired.
ReplicationSlotAcquire() has some logic to be able to work with the
single-user mode. This commit sets ReplicationSlot->active_pid to
MyProcPid, to let the slot-related logic fall-through, considering the
single process as the one holding the slot.
Some TAP tests are added for various replication slot functions with the
single-user mode, while on it, for slot creation, drop, advancing, copy
and logical decoding with multiple slot types (temporary, physical vs
logical). These tests are skipped on Windows, as direct calls of
postgres --single would fail on permission failures. There is no
platform-specific behavior that needs to be checked, so living with this
restriction should be fine. The CI is OK with that, now let's see what
the buildfarm tells.
Author: Hayato Kuroda <kuroda.hayato@fujitsu.com>
Reviewed-by: Paul A. Jungwirth <pj@illuminatedcomputing.com>
Reviewed-by: Mutaamba Maasha <maasha@gmail.com>
Discussion: https://postgr.es/m/OSCPR01MB14966ED588A0328DAEBE8CB25F5FA2@OSCPR01MB14966.jpnprd01.prod.outlook.com
Backpatch-through: 13 M src/backend/replication/slot.c
M src/test/modules/test_misc/Makefile
M src/test/modules/test_misc/meson.build
A src/test/modules/test_misc/t/008_replslot_single_user.pl
vacuumdb: Make vacuumdb --analyze-only process partitioned tables.
commit : 6429e5b771dbb98aa56441677b79cdb58f6e1675
author : Fujii Masao <fujii@postgresql.org>
date : Wed, 20 Aug 2025 13:16:06 +0900
committer: Fujii Masao <fujii@postgresql.org>
date : Wed, 20 Aug 2025 13:16:06 +0900 vacuumdb should follow the behavior of the underlying VACUUM and ANALYZE
commands. When --analyze-only is used, it ought to analyze regular tables,
materialized views, and partitioned tables, just as ANALYZE (with no explicit
target tables) does. Otherwise, it should only process regular tables and
materialized views, since VACUUM skips partitioned tables when no targets
are given.
Previously, vacuumdb --analyze-only skipped partitioned tables. This was
inconsistent, and also inconvenient after pg_upgrade, where --analyze-only
is typically used to gather missing statistics.
This commit fixes the behavior so that vacuumdb --analyze-only also processes
partitioned tables. As a result, both vacuumdb --analyze-only and
ANALYZE (with no explicit targets) now analyze regular tables,
partitioned tables, and materialized views, but not foreign tables.
Because this is a nontrivial behavior change, it is applied only to master.
Reported-by: Zechman, Derek S <Derek.S.Zechman@snapon.com>
Author: Laurenz Albe <laurenz.albe@cybertec.at>
Co-authored-by: Mircea Cadariu <cadariu.mircea@gmail.com>
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>
Discussion: https://postgr.es/m/CO1PR04MB8281387B9AD9DE30976966BBC045A%40CO1PR04MB8281.namprd04.prod.outlook.com M doc/src/sgml/ref/vacuumdb.sgml
M src/bin/scripts/t/100_vacuumdb.pl
M src/bin/scripts/vacuumdb.c
Fix comment for MAX_SIMUL_LWLOCKS.
commit : 3eec0e65331e4a38d0c8b3ac251ea3885452fd71
author : Nathan Bossart <nathan@postgresql.org>
date : Tue, 19 Aug 2025 16:48:22 -0500
committer: Nathan Bossart <nathan@postgresql.org>
date : Tue, 19 Aug 2025 16:48:22 -0500 This comment mentions that pg_buffercache locks all buffer
partitions simultaneously, but it hasn't done so since v10.
Oversight in commit 6e654546fb.
Reviewed-by: Andres Freund <andres@anarazel.de>
Discussion: https://postgr.es/m/aKTuAHVEuYCUmmIy%40nathan M src/backend/storage/lmgr/lwlock.c
Add CHECK_FOR_INTERRUPTS in contrib/pg_buffercache functions.
commit : eab9e4e27c0c433dbfe09914e69c875dda2af63f
author : Masahiko Sawada <msawada@postgresql.org>
date : Tue, 19 Aug 2025 12:11:42 -0700
committer: Masahiko Sawada <msawada@postgresql.org>
date : Tue, 19 Aug 2025 12:11:42 -0700 This commit adds CHECK_FOR_INTERRUPTS to loops iterating over shared
buffers in several pg_buffercache functions, allowing them to be
interrupted during long-running operations.
Backpatch to all supported versions. Add CHECK_FOR_INTERRUPTS to the
loop in pg_buffercache_pages() in all supported branches, and to
pg_buffercache_summary() and pg_buffercache_usage_counts() in version
16 and newer.
Author: SATYANARAYANA NARLAPURAM <satyanarlapuram@gmail.com>
Discussion: https://postgr.es/m/CAHg+QDcejeLx7WunFT3DX6XKh1KshvGKa8F5au8xVhqVvvQPRw@mail.gmail.com
Backpatch-through: 13 M contrib/pg_buffercache/pg_buffercache_pages.c
Fix misspelling of "tranche" in dsa.h.
commit : c6abf24ebfecf0ef4f7d21750e198959b8b61586
author : Nathan Bossart <nathan@postgresql.org>
date : Tue, 19 Aug 2025 10:43:15 -0500
committer: Nathan Bossart <nathan@postgresql.org>
date : Tue, 19 Aug 2025 10:43:15 -0500 Oversight in commit bb952c8c8b.
Discussion: https://postgr.es/m/aKOWzsCPgrsoEG1Q%40nathan M src/include/utils/dsa.h
doc: Improve pgoutput documentation.
commit : 38c5fbd97ee6a8409c6c41d6af0c06169cd51c2b
author : Fujii Masao <fujii@postgresql.org>
date : Tue, 19 Aug 2025 18:54:27 +0900
committer: Fujii Masao <fujii@postgresql.org>
date : Tue, 19 Aug 2025 18:54:27 +0900 This commit updates the pgoutput documentation with the following changes:
- Specify the data type for each pgoutput option.
- Clarify the relationship between proto_version and options such as
streaming and two_phase.
- Add a note on the use of pg_logical_slot_peek_changes and
pg_logical_slot_get_changes with pgoutput.
Author: Fujii Masao <masao.fujii@gmail.com>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Hayato Kuroda <kuroda.hayato@fujitsu.com>
Discussion: https://postgr.es/m/CAHGQGwFJTbygdhhjR_iP4Oem=Lo1xsptWWOq825uoW+hG_Lfnw@mail.gmail.com M doc/src/sgml/func/func-admin.sgml
M doc/src/sgml/logicaldecoding.sgml
doc: Improve documentation discoverability for pgoutput.
commit : 34a62c2c7fae00c08aa618c584ce4c52969dbf87
author : Fujii Masao <fujii@postgresql.org>
date : Tue, 19 Aug 2025 18:53:56 +0900
committer: Fujii Masao <fujii@postgresql.org>
date : Tue, 19 Aug 2025 18:53:56 +0900 Previously, the documentation for pgoutput was located in the section on
the logical streaming replication protocol, and there was no index entry
for it. As a result, users had difficulty finding information about pgoutput.
This commit moves the pgoutput documentation under the logical decoding
section and adds an index entry, making it easier for users to locate and
access this information.
Author: Fujii Masao <masao.fujii@gmail.com>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Hayato Kuroda <kuroda.hayato@fujitsu.com>
Reviewed-by: Euler Taveira <euler@eulerto.com>
Discussion: https://postgr.es/m/CAHGQGwFJTbygdhhjR_iP4Oem=Lo1xsptWWOq825uoW+hG_Lfnw@mail.gmail.com M doc/src/sgml/logical-replication.sgml
M doc/src/sgml/logicaldecoding.sgml
M doc/src/sgml/protocol.sgml
Add src/include/catalog/README
commit : 16d434d53d56c5dd1919ca07274193ee2600ed1b
author : Peter Eisentraut <peter@eisentraut.org>
date : Tue, 19 Aug 2025 08:03:53 +0200
committer: Peter Eisentraut <peter@eisentraut.org>
date : Tue, 19 Aug 2025 08:03:53 +0200 This just includes a link to the bki documentation, to help people get
started.
Before commit 372728b0d49, there was a README at
src/backend/catalog/README, but then this was moved to the SGML
documentation. So this effectively puts back a link to what was
moved. But src/include/catalog/ is probably a better location,
because that's where all the interesting files are.
Co-authored-by: Florents Tselai <florents.tselai@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/CA+v5N400GJFJ9RyXAX7hFKbtF7vVQGvWdFWEfcSQmvVhi9xfrA@mail.gmail.com A src/include/catalog/README
Fix self-deadlock during DROP SUBSCRIPTION.
commit : aa21e49225a1b4f8465dee5a9410e52b5a889f90
author : Amit Kapila <akapila@postgresql.org>
date : Tue, 19 Aug 2025 05:33:17 +0000
committer: Amit Kapila <akapila@postgresql.org>
date : Tue, 19 Aug 2025 05:33:17 +0000 The DROP SUBSCRIPTION command performs several operations: it stops the
subscription workers, removes subscription-related entries from system
catalogs, and deletes the replication slot on the publisher server.
Previously, this command acquired an AccessExclusiveLock on
pg_subscription before initiating these steps.
However, while holding this lock, the command attempts to connect to the
publisher to remove the replication slot. In cases where the connection is
made to a newly created database on the same server as subscriber, the
cache-building process during connection tries to acquire an
AccessShareLock on pg_subscription, resulting in a self-deadlock.
To resolve this issue, we reduce the lock level on pg_subscription during
DROP SUBSCRIPTION from AccessExclusiveLock to RowExclusiveLock. Earlier,
the higher lock level was used to prevent the launcher from starting a new
worker during the drop operation, as a restarted worker could become
orphaned.
Now, instead of relying on a strict lock, we acquire an AccessShareLock on
the specific subscription being dropped and re-validate its existence
after acquiring the lock. If the subscription is no longer valid, the
worker exits gracefully. This approach avoids the deadlock while still
ensuring that orphan workers are not created.
Reported-by: Alexander Lakhin <exclusion@gmail.com>
Author: Dilip Kumar <dilipbalaut@gmail.com>
Reviewed-by: vignesh C <vignesh21@gmail.com>
Reviewed-by: Hayato Kuroda <kuroda.hayato@fujitsu.com>
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>
Backpatch-through: 13
Discussion: https://postgr.es/m/18988-7312c868be2d467f@postgresql.org M src/backend/commands/subscriptioncmds.c
M src/backend/replication/logical/worker.c
M src/test/subscription/t/100_bugs.pl
Refactor ReadMultiXactCounts() into GetMultiXactInfo()
commit : a977e419ee6ee15cb7bd45d7c9b7540cf183d1e2
author : Michael Paquier <michael@paquier.xyz>
date : Tue, 19 Aug 2025 14:04:09 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Tue, 19 Aug 2025 14:04:09 +0900 This provides a single entry point to access some information about the
state of MultiXacts, able to return some data about multixacts offsets
and counts. Originally this function was only able to return some
information about the number of multixacts and multixact members,
extended here to provide some data about the oldest multixact ID in use
and the oldest offset, if known.
This change has been proposed in a patch that aims at providing more
monitoring capabilities for multixacts, and it is useful on its own.
GetMultiXactInfo() is added to multixact.h, becoming available for
out-of-core code.
Extracted from a larger patch by the same author.
Author: Naga Appani <nagnrik@gmail.com>
Reviewed-by: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://postgr.es/m/CA+QeY+AAsYK6WvBW4qYzHz4bahHycDAY_q5ECmHkEV_eB9ckzg@mail.gmail.com M src/backend/access/transam/multixact.c
M src/include/access/multixact.h
Remove useless pointer update in StatsShmemInit()
commit : 9b7eb6f02e8d4affb225dd0aa239c8e7e0ff2cba
author : Michael Paquier <michael@paquier.xyz>
date : Tue, 19 Aug 2025 09:54:18 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Tue, 19 Aug 2025 09:54:18 +0900 This pointer was not used after its last update. This variable
assignment was most likely a vestige artifact of the earlier versions of
the patch set that have led to 5891c7a8ed8f.
This pointer update is useless, so let's remove it. It removes one call
to pgstat_dsa_init_size(), making the code slightly easier to grasp.
Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Discussion: https://postgr.es/m/aKLsu2sdpnyeuSSc@ip-10-97-1-34.eu-west-3.compute.internal M src/backend/utils/activity/pgstat_shmem.c
Simplify relation_has_unique_index_for()
commit : bf9ee294e567654231c5b2fef09b8a5367907366
author : Richard Guo <rguo@postgresql.org>
date : Tue, 19 Aug 2025 09:37:04 +0900
committer: Richard Guo <rguo@postgresql.org>
date : Tue, 19 Aug 2025 09:37:04 +0900 Now that the only call to relation_has_unique_index_for() that
supplied an exprlist and oprlist has been removed, the loop handling
those lists is effectively dead code. This patch removes that loop
and simplifies the function accordingly.
Author: Richard Guo <guofenglinux@gmail.com>
Discussion: https://postgr.es/m/CAMbWs4-EBnaRvEs7frTLbsXiweSTUXifsteF-d3rvv01FKO86w@mail.gmail.com M src/backend/optimizer/path/indxpath.c
M src/backend/optimizer/plan/analyzejoins.c
M src/include/optimizer/paths.h
Pathify RHS unique-ification for semijoin planning
commit : 24225ad9aafc576295e210026d8ffa9f50d61145
author : Richard Guo <rguo@postgresql.org>
date : Tue, 19 Aug 2025 09:35:40 +0900
committer: Richard Guo <rguo@postgresql.org>
date : Tue, 19 Aug 2025 09:35:40 +0900 There are two implementation techniques for semijoins: one uses the
JOIN_SEMI jointype, where the executor emits at most one matching row
per left-hand side (LHS) row; the other unique-ifies the right-hand
side (RHS) and then performs a plain inner join.
The latter technique currently has some drawbacks related to the
unique-ification step.
* Only the cheapest-total path of the RHS is considered during
unique-ification. This may cause us to miss some optimization
opportunities; for example, a path with a better sort order might be
overlooked simply because it is not the cheapest in total cost. Such
a path could help avoid a sort at a higher level, potentially
resulting in a cheaper overall plan.
* We currently rely on heuristics to choose between hash-based and
sort-based unique-ification. A better approach would be to generate
paths for both methods and allow add_path() to decide which one is
preferable, consistent with how path selection is handled elsewhere in
the planner.
* In the sort-based implementation, we currently pay no attention to
the pathkeys of the input subpath or the resulting output. This can
result in redundant sort nodes being added to the final plan.
This patch improves semijoin planning by creating a new RelOptInfo for
the RHS rel to represent its unique-ified version. It then generates
multiple paths that represent elimination of distinct rows from the
RHS, considering both a hash-based implementation using the cheapest
total path of the original RHS rel, and sort-based implementations
that either exploit presorted input paths or explicitly sort the
cheapest total path. All resulting paths compete in add_path(), and
those deemed worthy of consideration are added to the new RelOptInfo.
Finally, the unique-ified rel is joined with the other side of the
semijoin using a plain inner join.
As a side effect, most of the code related to the JOIN_UNIQUE_OUTER
and JOIN_UNIQUE_INNER jointypes -- used to indicate that the LHS or
RHS path should be made unique -- has been removed. Besides, the
T_Unique path now has the same meaning for both semijoins and upper
DISTINCT clauses: it represents adjacent-duplicate removal on
presorted input. This patch unifies their handling by sharing the
same data structures and functions.
This patch also removes the UNIQUE_PATH_NOOP related code along the
way, as it is dead code -- if the RHS rel is provably unique, the
semijoin should have already been simplified to a plain inner join by
analyzejoins.c.
Author: Richard Guo <guofenglinux@gmail.com>
Reviewed-by: Alexandra Wang <alexandra.wang.oss@gmail.com>
Reviewed-by: wenhui qiu <qiuwenhuifx@gmail.com>
Discussion: https://postgr.es/m/CAMbWs4-EBnaRvEs7frTLbsXiweSTUXifsteF-d3rvv01FKO86w@mail.gmail.com M src/backend/optimizer/README
M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/path/joinpath.c
M src/backend/optimizer/path/joinrels.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/prep/prepunion.c
M src/backend/optimizer/util/pathnode.c
M src/backend/optimizer/util/relnode.c
M src/include/nodes/nodes.h
M src/include/nodes/pathnodes.h
M src/include/optimizer/pathnode.h
M src/include/optimizer/planner.h
M src/test/regress/expected/join.out
M src/test/regress/expected/partition_join.out
M src/test/regress/expected/subselect.out
M src/test/regress/sql/subselect.sql
M src/tools/pgindent/typedefs.list
test_ddl_deparse: Rename test create_sequence_1 to create_sequence
commit : 3c07944d048c82ae67884c1f09e81f53f769ac2a
author : Michael Paquier <michael@paquier.xyz>
date : Tue, 19 Aug 2025 09:08:57 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Tue, 19 Aug 2025 09:08:57 +0900 This test was the only one named following the convention used for
alternate output files. This was a little bit confusing when looking at
the diffs of the test, because one would think that the diffs are based
on an uncommon case, as alternate outputs are usually used for uncommon
configuration scenarios.
create_sequence_1 was the only test in the tree using such a name, and
it had no alternate output.
Reviewed-by: Kirill Reshke <reshkekirill@gmail.com>
Discussion: https://postgr.es/m/aKLY6wCa_OInr3kY@paquier.xyz M src/test/modules/test_ddl_deparse/Makefile
R100 src/test/modules/test_ddl_deparse/expected/create_sequence_1.out src/test/modules/test_ddl_deparse/expected/create_sequence.out
M src/test/modules/test_ddl_deparse/meson.build
R100 src/test/modules/test_ddl_deparse/sql/create_sequence_1.sql src/test/modules/test_ddl_deparse/sql/create_sequence.sql
Remove unneeded header declarations in multixact.c
commit : 24e71d53f88e1a37506cf1c9967b6db5d685f249
author : Michael Paquier <michael@paquier.xyz>
date : Tue, 19 Aug 2025 08:57:20 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Tue, 19 Aug 2025 08:57:20 +0900 Two header declarations were related to SQL-callable functions, that
should have been cleaned up in df9133fa6384. Some more includes can be
removed on closer inspection, so let's clean up these as well, while on
it.
Reported-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/345438.1755524834@sss.pgh.pa.us M src/backend/access/transam/multixact.c
Remove HASH_DEBUG output from dynahash.c
commit : a98ccf727ebbb6d620b1a7995012f1751f261075
author : David Rowley <drowley@postgresql.org>
date : Tue, 19 Aug 2025 11:14:21 +1200
committer: David Rowley <drowley@postgresql.org>
date : Tue, 19 Aug 2025 11:14:21 +1200 This existed in a semi broken stated from be0a66666 until 296cba276.
Recent discussion has questioned the value of having this at all as it
only outputs static information from various of the hash table's
properties when the hash table is created.
Author: Hayato Kuroda (Fujitsu) <kuroda.hayato@fujitsu.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/OSCPR01MB1496650D03FA0293AB9C21416F534A@OSCPR01MB14966.jpnprd01.prod.outlook.com M src/backend/utils/hash/dynahash.c
Use elog(DEBUG4) for dynahash.c statistics output
commit : 05fcb9667c371fda93830b87269c01d74ca247e5
author : David Rowley <drowley@postgresql.org>
date : Tue, 19 Aug 2025 10:57:44 +1200
committer: David Rowley <drowley@postgresql.org>
date : Tue, 19 Aug 2025 10:57:44 +1200 Previously this was being output to stderr. This commit adjusts things
to use elog(DEBUG4). Here we also adjust the format of the message to
add the hash table name and also put the message on a single line. This
should make grepping the logs for this information easier.
Also get rid of the global hash table statistics. This seems very dated
and didn't fit very well with trying to put all the statistics for a
specific hash table on a single log line.
The main aim here is to allow it so we can have at least one buildfarm
member build with HASH_STATISTICS to help prevent future changes from
breaking things in that area. ca3891251 recently fixed some issues
here.
In passing, switch to using uint64 data types rather than longs for the
usage counters. The long type is 32 bits on some platforms we support.
Author: David Rowley <dgrowleyml@gmail.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://postgr.es/m/CAApHDvoccvJ9CG5zx+i-EyCzJbcL5K=CzqrnL_YN59qaL5hiaw@mail.gmail.com M src/backend/utils/hash/dynahash.c
M src/include/utils/hsearch.h
Fix missing "use Test::More" in Kerberos.pm.
commit : 5e8f05cd70a6a5446801b4c733874bd6603eba7b
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Mon, 18 Aug 2025 14:54:59 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Mon, 18 Aug 2025 14:54:59 -0400 Apparently the only Test::More function this script uses is
BAIL_OUT, so this omission just results in the wrong error
output appearing in the cases where it bails out.
Seems to have been an oversight in commit 9f899562d which
split Kerberos.pm out of another script.
Author: Maxim Orlov <orlovmg@gmail.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/CACG=ezY1Dp-S94b78nN0ZuaBGGcMUB6_nF-VyYUwPt1ArFqmGA@mail.gmail.com
Backpatch-through: 17 M src/test/perl/PostgreSQL/Test/Kerberos.pm
Detect buffer underflow in get_th()
commit : c61d51d50006a2a7bfe25d62ea0677e318febedc
author : Peter Eisentraut <peter@eisentraut.org>
date : Mon, 18 Aug 2025 11:03:22 +0200
committer: Peter Eisentraut <peter@eisentraut.org>
date : Mon, 18 Aug 2025 11:03:22 +0200 Input with zero length can result in a buffer underflow when
accessing *(num + (len - 1)), as (len - 1) would produce a negative
index. Add an assertion for zero-length input to prevent it.
This was found by ALT Linux Team.
Reviewing the call sites shows that get_th() currently cannot be
applied to an empty string: it is always called on a string containing
a number we've just printed. Therefore, an assertion rather than a
user-facing error message is sufficient.
Co-authored-by: Alexander Kuznetsov <kuznetsovam@altlinux.org>
Discussion: https://www.postgresql.org/message-id/flat/e22df993-cdb4-4d0a-b629-42211ebed582@altlinux.org M src/backend/utils/adt/formatting.c
Move SQL-callable code related to multixacts into its own file
commit : df9133fa63843627fb3579c89d892dc3d9ea2b95
author : Michael Paquier <michael@paquier.xyz>
date : Mon, 18 Aug 2025 14:52:34 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Mon, 18 Aug 2025 14:52:34 +0900 A patch is under discussion to add more SQL capabilities related to
multixacts, and this move avoids bloating the file more than necessary.
This affects pg_get_multixact_members(). A side effect of this move is
the requirement to add mxstatus_to_string() to multixact.h.
Extracted from a larger patch by the same author, tweaked by me.
Author: Naga Appani <nagnrik@gmail.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Reviewed-by: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>
Discussion: https://postgr.es/m/CA+QeY+AAsYK6WvBW4qYzHz4bahHycDAY_q5ECmHkEV_eB9ckzg@mail.gmail.com M src/backend/access/transam/multixact.c
M src/backend/utils/adt/Makefile
M src/backend/utils/adt/meson.build
A src/backend/utils/adt/multixactfuncs.c
M src/include/access/multixact.h
meson: Move C99 test earlier
commit : 4a4038068bb29eff2516296fc842b88741625afd
author : Peter Eisentraut <peter@eisentraut.org>
date : Mon, 18 Aug 2025 07:35:55 +0200
committer: Peter Eisentraut <peter@eisentraut.org>
date : Mon, 18 Aug 2025 07:35:55 +0200 Move the test for compiler options for C99 earlier in meson.build,
before we make use of the compiler for other tests. That way, if any
command-line options are needed, subsequent tests will also use them.
This is at the moment a theoretical problem, but it seems better to
get this correct. It also matches the order in the Autoconf-based
build more closely.
Discussion: https://www.postgresql.org/message-id/flat/01a69441-af54-4822-891b-ca28e05b215a@eisentraut.org M meson.build
Refactor init_params() in sequence.c to not use FormData_pg_sequence_data
commit : ba3d93b2e806a877f26922e0f9e1845d0ef1511b
author : Michael Paquier <michael@paquier.xyz>
date : Mon, 18 Aug 2025 11:38:44 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Mon, 18 Aug 2025 11:38:44 +0900 init_params() sets up "last_value" and "is_called" for a sequence
relation holdind its metadata, based on the sequence properties in
pg_sequences. "log_cnt" is the third property that can be updated in
this routine for FormData_pg_sequence_data, tracking when WAL records
should be generated for a sequence after nextval() iterations. This
routine is called when creating or altering a sequence.
This commit refactors init_params() to not depend anymore on
FormData_pg_sequence_data, removing traces of it in sequence.c, making
easier the manipulation of metadata related to sequences. The knowledge
about "log_cnt" is replaced with a more general "reset_state" flag, to
let the caller know if the sequence state should be reset. In the case
of in-core sequences, this relates to WAL logging. We still need to
depend on FormData_pg_sequence.
Author: Michael Paquier <michael@paquier.xyz>
Reviewed-by: Kirill Reshke <reshkekirill@gmail.com>
Reviewed-by: Tomas Vondra <tomas@vondra.me>
Discussion: https://postgr.es/m/ZWlohtKAs0uVVpZ3@paquier.xyz M src/backend/commands/sequence.c
Remove md5() call from isolation test for CLUSTER and TOAST
commit : 97ca67377aa289762af432c96c5204685b3ecd21
author : Michael Paquier <michael@paquier.xyz>
date : Mon, 18 Aug 2025 08:18:09 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Mon, 18 Aug 2025 08:18:09 +0900 This test was failing because MD5 computations are not supported in
these environments. This switches the test to rely on sha256() instead,
providing the same coverage while avoiding the failure.
Oversight in f57e214d1cbb. Per buildfarm members gecko, molamola,
shikra and froghopper.
Discussion: https://postgr.es/m/aKJijS2ZRfRZiYb0@paquier.xyz M src/test/isolation/specs/cluster-toast-value-reuse.spec
Update obsolete comments in ResultRelInfo struct.
commit : 5a8ab650a782ffb78325fa66607a5fbb25c5c74a
author : Etsuro Fujita <efujita@postgresql.org>
date : Sun, 17 Aug 2025 19:40:00 +0900
committer: Etsuro Fujita <efujita@postgresql.org>
date : Sun, 17 Aug 2025 19:40:00 +0900 Commit c5b7ba4e6 changed things so that the ri_RootResultRelInfo field
of this struct is set for both partitions and inheritance children and
used for tuple routing and transition capture (before that commit, it
was only set for partitions to route tuples into), but failed to update
these comments.
Author: Etsuro Fujita <etsuro.fujita@gmail.com>
Reviewed-by: Dean Rasheed <dean.a.rasheed@gmail.com>
Discussion: https://postgr.es/m/CAPmGK14NF5CcdCmTZpxrvpvBiT0y4EqKikW1r_wAu1CEHeOmUA%40mail.gmail.com
Backpatch-through: 14 M src/include/nodes/execnodes.h
Add isolation test for TOAST value reuse during CLUSTER
commit : f57e214d1cbb748b1e9be79e1b30d85fcbc9e340
author : Michael Paquier <michael@paquier.xyz>
date : Sun, 17 Aug 2025 15:20:01 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Sun, 17 Aug 2025 15:20:01 +0900 This test exercises the corner case in toast_save_datum() where CLUSTER
operations encounter duplicated TOAST references, reusing the existing
TOAST data instead of creating redundant copies.
During table rewrites like CLUSTER, both live and recently-dead versions
of a row may reference the same TOAST value. When copying the second or
later version of such a row, the system checks if a TOAST value already
exists in the new TOAST table using toastrel_valueid_exists(). If
found, toast_save_datum() sets data_todo = 0 so as redundant data is not
stored, ensuring only one copy of the TOAST value exists in the new
table.
The test relies on a combination of UPDATE, CLUSTER, and checks of the
TOAST values used before and after the relation rewrite, to make sure
that the same values are reused across the rewrite.
This is a continuation of 69f75d671475 to make sure that this corner
case keeps working should we mess with this area of the code.
Author: Nikhil Kumar Veldanda <veldanda.nikhilkumar17@gmail.com>
Discussion: https://postgr.es/m/CAFAfj_E+kw5P713S8_jZyVgQAGVFfzFiTUJPrgo-TTtJJoazQw@mail.gmail.com A src/test/isolation/expected/cluster-toast-value-reuse.out
M src/test/isolation/isolation_schedule
A src/test/isolation/specs/cluster-toast-value-reuse.spec
Fix typos in comments.
commit : 928da6ff1254f471941e43f9ad258cc6b1f037e4
author : Masahiko Sawada <msawada@postgresql.org>
date : Sat, 16 Aug 2025 01:11:40 -0700
committer: Masahiko Sawada <msawada@postgresql.org>
date : Sat, 16 Aug 2025 01:11:40 -0700 Oversight in commit fd5a1a0c3e56.
Author: Tender Wang <tndrwang@gmail.com>
Discussion: https://postgr.es/m/CAHewXNmTT3M_w4NngG=6G3mdT3iJ6DdncTqV9YnGXBPHW8XYtA@mail.gmail.com M src/backend/executor/execReplication.c
M src/backend/replication/logical/worker.c
Fix constant when extracting timestamp from UUIDv7.
commit : 37265ca01f0f361a3aff23e27dfc81b66057a039
author : Masahiko Sawada <msawada@postgresql.org>
date : Fri, 15 Aug 2025 11:58:53 -0700
committer: Masahiko Sawada <msawada@postgresql.org>
date : Fri, 15 Aug 2025 11:58:53 -0700 When extracting a timestamp from a UUIDv7, a conversion from
milliseconds to microseconds was using the incorrect constant
NS_PER_US instead of US_PER_MS. Although both constants have the same
value, this fix improves code clarity by using the semantically
correct constant.
Backpatch to v18, where UUIDv7 was introduced.
Author: Erik Nordström <erik@tigerdata.com>
Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com>
Discussion: https://postgr.es/m/CACAa4V+i07eaP6h4MHNydZeX47kkLPwAg0sqe67R=M5tLdxNuQ@mail.gmail.com
Backpatch-through: 18 M src/backend/utils/adt/uuid.c
Fix git whitespace warning
commit : 2e2e7ff7b891fcb880c1c221e41208dcb0787290
author : Peter Eisentraut <peter@eisentraut.org>
date : Fri, 15 Aug 2025 10:29:16 +0200
committer: Peter Eisentraut <peter@eisentraut.org>
date : Fri, 15 Aug 2025 10:29:16 +0200 Recent changes to src/tools/ci/README triggered warnings like
src/tools/ci/README:88: leftover conflict marker
Raise conflict-marker-size in .gitattributes to avoid these. M .gitattributes
Add TAP tests for LDAP connection parameter lookup
commit : 8212c8393906fe31d999a6b0d1e4cacb206529a3
author : Peter Eisentraut <peter@eisentraut.org>
date : Fri, 15 Aug 2025 09:04:54 +0200
committer: Peter Eisentraut <peter@eisentraut.org>
date : Fri, 15 Aug 2025 09:04:54 +0200 Add TAP tests that tests the LDAP Lookup of Connection Parameters
functionality in libpq. Prior to this commit, LDAP test coverage only
existed for the server-side authentication functionality and for
connection service file with parameters directly specified in the
file. The tests included here test a pg_service.conf that contains a
link to an LDAP system that contains all of the connection parameters.
Author: Andrew Jackson <andrewjackson947@gmail.com>
Discussion: https://www.postgresql.org/message-id/CAKK5BkHixcivSCA9pfd_eUp7wkLRhvQ6OtGLAYrWC%3Dk7E76LDQ%40mail.gmail.com M src/test/ldap/meson.build
A src/test/ldap/t/003_ldap_connection_param_lookup.pl
Fix invalid format string in HASH_DEBUG code
commit : 296cba276081192a18c484c0716bf290c16bf362
author : David Rowley <drowley@postgresql.org>
date : Fri, 15 Aug 2025 18:05:44 +1200
committer: David Rowley <drowley@postgresql.org>
date : Fri, 15 Aug 2025 18:05:44 +1200 This seems to have been broken back in be0a66666.
Reported-by: Hayato Kuroda (Fujitsu) <kuroda.hayato@fujitsu.com>
Author: David Rowley <dgrowleyml@gmail.com>
Discussion: https://postgr.es/m/OSCPR01MB14966E11EEFB37D7857FCEDB7F535A@OSCPR01MB14966.jpnprd01.prod.outlook.com
Backpatch-through: 14 M src/backend/utils/hash/dynahash.c
Fix failing -D HASH_STATISTICS builds
commit : ca38912512a9b913542fa4f535885b4e5ccff02f
author : David Rowley <drowley@postgresql.org>
date : Fri, 15 Aug 2025 17:23:45 +1200
committer: David Rowley <drowley@postgresql.org>
date : Fri, 15 Aug 2025 17:23:45 +1200 This seems to have been broken for a few years by cc5ef90ed.
Author: Hayato Kuroda (Fujitsu) <kuroda.hayato@fujitsu.com>
Reviewed-by: David Rowley <dgrowleyml@gmail.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/OSCPR01MB14966E11EEFB37D7857FCEDB7F535A@OSCPR01MB14966.jpnprd01.prod.outlook.com
Backpatch-through: 17 M src/backend/utils/hash/dynahash.c
Add Asserts to validate prevbit values in bms_prev_member
commit : b4632883d44eae892e28dafbf674e6ac3dfd824d
author : David Rowley <drowley@postgresql.org>
date : Fri, 15 Aug 2025 16:33:07 +1200
committer: David Rowley <drowley@postgresql.org>
date : Fri, 15 Aug 2025 16:33:07 +1200 bms_prev_member() could attempt to access memory outside of the words[]
array in cases where the prevbit was a number < -1 or > a->nwords *
BITS_PER_BITMAPWORD + 1.
Here we add the Asserts to help draw attention to bogus callers so we're
more likely to catch them during development.
In passing, fix wording of bms_prev_member's header comment which talks
about how we expect the callers to ensure only valid prevbit values are
used.
Author: Greg Burd <greg@burd.me>
Reviewed-by: David Rowley <dgrowleyml@gmail.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/2000A717-1FFE-4031-827B-9330FB2E9065%40getmailspring.com M src/backend/nodes/bitmapset.c
Add SQL test for TOAST value allocations on rewrite
commit : 69f75d6714753e594fb383d2e53a8003a8b54dfd
author : Michael Paquier <michael@paquier.xyz>
date : Fri, 15 Aug 2025 12:30:36 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Fri, 15 Aug 2025 12:30:36 +0900 The SQL test added in this commit check a specific code path that had no
coverage until now. When a TOAST datum is rewritten, toast_save_datum()
has a dedicated path to make sure that a new value is allocated if it
does not exist on the TOAST table yet.
This test uses a trick with PLAIN and EXTERNAL storage, with a tuple
large enough to be toasted and small enough to fit on a page. It is
initially stored in plain more, and the rewrite forces the tuple to be
stored externally. The key point is that there is no value allocated
during the initial insert, and that there is one after the rewrite. A
second pattern checked is the reuse of the same value across rewrites,
using \gset.
A set of patches under discussion is messing up with this area of the
code, so this makes sure that such rewrite cases remain consistent
across the board.
Author: Nikhil Kumar Veldanda <veldanda.nikhilkumar17@gmail.com>
Co-authored-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://postgr.es/m/CAFAfj_E+kw5P713S8_jZyVgQAGVFfzFiTUJPrgo-TTtJJoazQw@mail.gmail.com M src/test/regress/expected/vacuum.out
M src/test/regress/sql/vacuum.sql
ci: Simplify ci-os-only handling
commit : 60b64e6a31a21449f4db49017417c225ee322986
author : Andres Freund <andres@anarazel.de>
date : Thu, 14 Aug 2025 11:48:04 -0400
committer: Andres Freund <andres@anarazel.de>
date : Thu, 14 Aug 2025 11:48:04 -0400 Handle 'ci-os-only' occurrences in the .cirrus.star file instead of
.cirrus.tasks.yml file. Now, 'ci-os-only' occurrences are controlled
from one central place instead of dealing with them in each task.
Author: Andres Freund <andres@anarazel.de>
Reviewed-by: Nazir Bilal Yavuz <byavuz81@gmail.com>
Discussion: https://postgr.es/m/20240413021221.hg53rvqlvldqh57i%40awork3.anarazel.de
Backpatch: 15-, where CI support was added M .cirrus.star
M .cirrus.tasks.yml
ci: Per-repo configuration for manually trigger tasks
commit : 49cba82bec1f4fc815f929cb57064d780ee0032a
author : Andres Freund <andres@anarazel.de>
date : Thu, 14 Aug 2025 11:22:58 -0400
committer: Andres Freund <andres@anarazel.de>
date : Thu, 14 Aug 2025 11:22:58 -0400 We do not want to trigger some tasks by default, to avoid using too many
compute credits. These tasks have to be manually triggered to be run. But
e.g. for cfbot we do have sufficient resources, so we always want to start
those tasks.
With this commit, an individual repository can be configured to trigger
them automatically using an environment variable defined under
"Repository Settings", for example:
REPO_CI_AUTOMATIC_TRIGGER_TASKS="mingw netbsd openbsd"
This will enable cfbot to turn them on by default when running tests for the
Commitfest app.
Backpatch this back to PG 15, even though PG 15 does not have any manually
triggered task. Keeping the CI infrastructure the same seems advantageous.
Author: Andres Freund <andres@anarazel.de>
Co-authored-by: Thomas Munro <thomas.munro@gmail.com>
Co-authored-by: Nazir Bilal Yavuz <byavuz81@gmail.com>
Reviewed-by: Nazir Bilal Yavuz <byavuz81@gmail.com>
Discussion: https://postgr.es/m/20240413021221.hg53rvqlvldqh57i%40awork3.anarazel.de
Backpatch-through: 16 M .cirrus.star
M .cirrus.tasks.yml
M .cirrus.yml
M src/tools/ci/README
Avoid including tableam.h and xlogreader.h in nbtree.h
commit : d0e7e04ede165abc95ca16bd9fa93284cc4dac6d
author : Álvaro Herrera <alvherre@kurilemu.de>
date : Thu, 14 Aug 2025 17:48:46 +0200
committer: Álvaro Herrera <alvherre@kurilemu.de>
date : Thu, 14 Aug 2025 17:48:46 +0200 Doing that seems rather random and unnecessary. This commit removes
those and fixes fallout, which is pretty minimal. We do need to add a
forward declaration of struct TM_IndexDeleteOp (whose full definition
appears in tableam.h) so that _bt_delitems_delete_check()'s declaration
can use it.
Author: Álvaro Herrera <alvherre@kurilemu.de>
Reviewed-by: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Discussion: https://postgr.es/m/202508051109.lzk3lcuzsaxo@alvherre.pgsql M contrib/btree_gist/btree_bool.c
M contrib/btree_gist/btree_cash.c
M contrib/btree_gist/btree_date.c
M contrib/btree_gist/btree_enum.c
M contrib/btree_gist/btree_float4.c
M contrib/btree_gist/btree_float8.c
M contrib/btree_gist/btree_inet.c
M contrib/btree_gist/btree_int2.c
M contrib/btree_gist/btree_int4.c
M contrib/btree_gist/btree_int8.c
M contrib/btree_gist/btree_interval.c
M contrib/btree_gist/btree_macaddr.c
M contrib/btree_gist/btree_macaddr8.c
M contrib/btree_gist/btree_oid.c
M contrib/btree_gist/btree_time.c
M contrib/btree_gist/btree_ts.c
M contrib/btree_gist/btree_utils_var.c
M contrib/btree_gist/btree_uuid.c
M src/backend/access/nbtree/nbtdedup.c
M src/backend/access/nbtree/nbtinsert.c
M src/backend/access/nbtree/nbtpreprocesskeys.c
M src/backend/access/nbtree/nbtsort.c
M src/backend/access/nbtree/nbtsplitloc.c
M src/backend/access/nbtree/nbtutils.c
M src/backend/utils/sort/tuplesortvariants.c
M src/include/access/nbtree.h
Don't leak memory during failure exit from SelectConfigFiles().
commit : ed0736172170bdae800b28e3555241b82854f09f
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Thu, 14 Aug 2025 11:39:19 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Thu, 14 Aug 2025 11:39:19 -0400 Make sure the memory allocated by make_absolute_path() is freed
when SelectConfigFiles() fails. Since all the callers will exit
immediately in that case, there's no practical gain here, but
silencing Valgrind leak complaints seems useful. In any case,
it was inconsistent that only one of the failure exits did this.
Author: Aleksander Alekseev <aleksander@tigerdata.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/CAJ7c6TMByXE8dc7zDvDWTQjk6o-XXAdRg_RAg5CBaUOgFPV3LQ%40mail.gmail.com M src/backend/utils/misc/guc.c
Fix LSN format in debug message
commit : 4ec6e22b4358e8c8fbfa7cfd6d3314ae41663247
author : Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Thu, 14 Aug 2025 13:31:18 +0300
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Thu, 14 Aug 2025 13:31:18 +0300 Commit 2633dae2e48 standardized all existing messages to use `%X/%08X`
for LSNs, but this one crept back in after the commit. M src/backend/replication/logical/worker.c
Fix compilation warning with SerializeClientConnectionInfo()
commit : 6304256e79c70f6446e840023fbf1cbee47fb08e
author : Michael Paquier <michael@paquier.xyz>
date : Thu, 14 Aug 2025 16:21:50 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Thu, 14 Aug 2025 16:21:50 +0900 This function uses an argument named "maxsize" that is only used in
assertions, being set once outside the assertion area. Recent gcc
versions with -Wunused-but-set-parameter complain about a warning when
building without assertions enabled, because of that.
In order to fix this issue, PG_USED_FOR_ASSERTS_ONLY is added to the
function argument of SerializeClientConnectionInfo(), which is the first
time we are doing so in the tree. The CI is fine with the change, but
let's see what the buildfarm has to say on the matter.
Reviewed-by: Andres Freund <andres@anarazel.de>
Reviewed-by: Jacob Champion <jchampion@postgresql.org>
Discussion: https://postgr.es/m/pevajesswhxafjkivoq3yvwxga77tbncghlf3gq5fvchsvfuda@6uivg25sb3nx
Backpatch-through: 16 M src/backend/utils/init/miscinit.c
Revert logical snapshot filename format change in SnapBuildSnapshotExists().
commit : e9a31c0cc604b015363d0aa5b018e8cea9d1d9a7
author : Fujii Masao <fujii@postgresql.org>
date : Thu, 14 Aug 2025 12:33:14 +0900
committer: Fujii Masao <fujii@postgresql.org>
date : Thu, 14 Aug 2025 12:33:14 +0900 Commit 2633dae2e48 standardized LSN formatting but mistakenly changed
the logical snapshot filename format in SnapBuildSnapshotExists() from
"%X-%X.snap" to "%08X-%08X.snap". Other code still used the original
"%X-%X.snap" format, causing the replication slot synchronization worker
to fail to find existing snapshot files and produce excessive log messages.
This commit restores the original "%X-%X.snap" format
in SnapBuildSnapshotExists() to resolve the issue.
Author: Shveta Malik <shveta.malik@gmail.com>
Discussion: https://postgr.es/m/CAHGQGwHuHPB-ucAk_Tq3uSs4Fdziu1Jp_AA_RD3m5Ycky7m48w@mail.gmail.com M src/backend/replication/logical/snapbuild.c
Fix incorrect LSN format in comment.
commit : 12f3639ee70254dc5d83f170c2f34cfeb444980e
author : Fujii Masao <fujii@postgresql.org>
date : Thu, 14 Aug 2025 11:12:03 +0900
committer: Fujii Masao <fujii@postgresql.org>
date : Thu, 14 Aug 2025 11:12:03 +0900 The comment previously used %X/08X, which is wrong.
Updated it to the standardized format %X/%08X.
Author: Japin Li <japinli@hotmail.com>
Discussion: https://postgr.es/m/ME0P300MB0445A37908EFCCD15E6D749DB62BA@ME0P300MB0445.AUSP300.PROD.OUTLOOK.COM M src/include/access/xlogdefs.h
Grab the low-hanging fruit from forcing USE_FLOAT8_BYVAL to true.
commit : ee54046601de2d14ca9107ba04c50178d9b52fe6
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Wed, 13 Aug 2025 17:18:13 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Wed, 13 Aug 2025 17:18:13 -0400 Remove conditionally-compiled code for the other case.
Replace uses of FLOAT8PASSBYVAL with constant "true", mainly because
it was quite confusing in cases where the type we were dealing with
wasn't float8.
I left the associated pg_control and Pg_magic_struct fields in place.
Perhaps we should get rid of them, but it would save little, so it
doesn't seem worth thinking hard about the compatibility implications.
I just labeled them "vestigial" in places where that seemed helpful.
Author: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Discussion: https://postgr.es/m/1749799.1752797397@sss.pgh.pa.us M contrib/btree_gist/btree_time.c
M contrib/btree_gist/btree_ts.c
M src/backend/access/common/tupdesc.c
M src/backend/access/index/indexam.c
M src/backend/access/transam/xlog.c
M src/backend/catalog/genbki.pl
M src/backend/optimizer/plan/planagg.c
M src/backend/optimizer/plan/planner.c
M src/backend/parser/parse_node.c
M src/backend/rewrite/rewriteSearchCycle.c
M src/backend/utils/adt/arrayfuncs.c
M src/backend/utils/adt/int8.c
M src/backend/utils/adt/numeric.c
M src/backend/utils/adt/orderedsetaggs.c
M src/backend/utils/adt/rangetypes_typanalyze.c
M src/backend/utils/fmgr/fmgr.c
M src/bin/initdb/initdb.c
M src/bin/pg_resetwal/pg_resetwal.c
M src/include/c.h
M src/include/catalog/pg_type.dat
M src/include/fmgr.h
M src/include/postgres.h
Grab the low-hanging fruit from forcing sizeof(Datum) to 8.
commit : 6aebedc38497ecebda22caf61bcadf78a8331b52
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Wed, 13 Aug 2025 17:11:54 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Wed, 13 Aug 2025 17:11:54 -0400 Remove conditionally-compiled code for smaller Datum widths,
and simplify comments that describe cases no longer of interest.
I also fixed up a few more places that were not using
DatumGetIntXX where they should, and made some cosmetic
adjustments such as using sizeof(int64) not sizeof(Datum)
in places where that fit better with the surrounding code.
One thing I remembered while preparing this part is that SP-GiST
stores pass-by-value prefix keys as Datums, so that the on-disk
representation depends on sizeof(Datum). That's even more
unfortunate than the existing commentary makes it out to be,
because now there is a hazard that the change of sizeof(Datum)
will break SP-GiST indexes on 32-bit machines. It appears that
there are no existing SP-GiST opclasses that are actually
affected; and if there are some that I didn't find, the number
of installations that are using them on 32-bit machines is
doubtless tiny. So I'm proceeding on the assumption that we
can get away with this, but it's something to worry about.
(gininsert.c looks like it has a similar problem, but it's okay
because the "tuples" it's constructing are just transient data
within the tuplesort step. That's pretty poorly documented
though, so I added some comments.)
Author: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Discussion: https://postgr.es/m/1749799.1752797397@sss.pgh.pa.us M doc/src/sgml/xfunc.sgml
M src/backend/access/gin/gininsert.c
M src/backend/access/gist/gistproc.c
M src/backend/access/nbtree/nbtcompare.c
M src/backend/catalog/pg_type.c
M src/backend/utils/adt/mac.c
M src/backend/utils/adt/network.c
M src/backend/utils/adt/numeric.c
M src/backend/utils/adt/timestamp.c
M src/backend/utils/adt/uuid.c
M src/backend/utils/adt/varlena.c
M src/backend/utils/sort/tuplesort.c
M src/include/access/gin_tuple.h
M src/include/access/spgist_private.h
M src/include/access/tupmacs.h
M src/include/port/pg_bswap.h
M src/include/utils/sortsupport.h
Make type Datum be 8 bytes wide everywhere.
commit : 2a600a93c7be5b0bf8cacb1af78009db12bc4857
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Wed, 13 Aug 2025 16:35:06 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Wed, 13 Aug 2025 16:35:06 -0400 This patch makes sizeof(Datum) be 8 on all platforms including
32-bit ones. The objective is to allow USE_FLOAT8_BYVAL to be true
everywhere, and in consequence to remove a lot of code that is
specific to pass-by-reference handling of float8, int8, etc. The
code for abbreviated sort keys can be simplified similarly. In this
way we can reduce the maintenance effort involved in supporting 32-bit
platforms, without going so far as to actually desupport them. Since
Datum is strictly an in-memory concept, this has no impact on on-disk
storage, though an initdb or pg_upgrade will be needed to fix affected
catalog entries.
We have required platforms to support [u]int64 for ages, so this
breaks no supported platform. We can expect that this change will
make 32-bit builds a bit slower and more memory-hungry, although being
able to use pass-by-value handling of 8-byte types may buy back some
of that. But we stopped optimizing for 32-bit cases a long time ago,
and this seems like just another step on that path.
This initial patch simply forces the correct type definition and
USE_FLOAT8_BYVAL setting, and cleans up a couple of minor compiler
complaints that ensued. This is sufficient for testing purposes.
In the wake of a bunch of Datum-conversion cleanups by Peter
Eisentraut, this now compiles cleanly with gcc on a 32-bit platform.
(I'd only tested the previous version with clang, which it turns out
is less picky than gcc about width-changing coercions.)
There is a good deal of now-dead code that I'll remove in separate
follow-up patches.
A catversion bump is required because this affects initial catalog
contents (on 32-bit machines) in two ways: pg_type.typbyval changes
for some built-in types, and Const nodes in stored views/rules will
now have 8 bytes not 4 for pass-by-value types.
Author: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Discussion: https://postgr.es/m/1749799.1752797397@sss.pgh.pa.us M src/backend/storage/ipc/ipc.c
M src/backend/utils/resowner/resowner.c
M src/include/catalog/catversion.h
M src/include/nodes/nodes.h
M src/include/pg_config_manual.h
M src/include/postgres.h
ci: windows: Stop using DEBUG:FASTLINK
commit : 66f8765c5331a7a27eafb1d498a12ac04bfbdab2
author : Andres Freund <andres@anarazel.de>
date : Wed, 13 Aug 2025 15:52:10 -0400
committer: Andres Freund <andres@anarazel.de>
date : Wed, 13 Aug 2025 15:52:10 -0400 Currently the pdb file for libpq and some other libraries are named the same
for the static and shared libraries. That has been the case for a long time,
but recently started failing, after an image update started using a newer
ninja version. The issue is not itself caused by ninja, but just made visible,
as the newer version optimizes the build order and builds the shared libpq
earlier than the static library. Previously both static and shared libraries
were built at the same time, which prevented msvc from detecting the issue.
When using /DEBUG:FASTLINK pdb files cannot be updated, triggering the error.
We were using /DEBUG:FASTLINK due to running out of memory in the past, but
that was when using container based CI images, rather than full VMs.
This isn't really the correct fix (that'd be to deconflict the pdb file
names), but we'd like to get CI to become green again, and a proper fix (in
meson) will presumably take longer.
Suggested-by: Andres Freund <andres@anarazel.de>
Author: Nazir Bilal Yavuz <byavuz81@gmail.com>
Reviewed-by: Jacob Champion <jacob.champion@enterprisedb.com>
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/CAN55FZ1RuBhJmPWs3Oi%3D9UoezDfrtO-VaU67db5%2B0_uy19uF%2BA%40mail.gmail.com
Backpatch-through: 16 M .cirrus.tasks.yml
Add very basic test for kill_prior_tuples
commit : 377b7ab1452418a90d6c46dcef2d4a2d4a4517af
author : Andres Freund <andres@anarazel.de>
date : Wed, 13 Aug 2025 15:17:29 -0400
committer: Andres Freund <andres@anarazel.de>
date : Wed, 13 Aug 2025 15:17:29 -0400 Previously our tests did not exercise kill_prior_tuples for hash and gist. For
gist some related paths were reached, but gist's implementation seems to not
work if all the dead tuples are on one page (or something like that). The
coverage for other index types was rather incidental.
Thus add an explicit test ensuring kill_prior_tuples works at all.
Reviewed-by: Heikki Linnakangas <hlinnaka@iki.fi>
Discussion: https://postgr.es/m/lxzj26ga6ippdeunz6kuncectr5gfuugmm2ry22qu6hcx6oid6@lzx3sjsqhmt6 A src/test/isolation/expected/index-killtuples.out
M src/test/isolation/isolation_schedule
A src/test/isolation/specs/index-killtuples.spec
Don't treat EINVAL from semget() as a hard failure.
commit : 21fddb3d76909e6a4d65485c0eda2cc34b2591a3
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Wed, 13 Aug 2025 11:59:47 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Wed, 13 Aug 2025 11:59:47 -0400 It turns out that on some platforms (at least current macOS, NetBSD,
OpenBSD) semget(2) will return EINVAL if there is a pre-existing
semaphore set with the same key and too few semaphores. Our code
expects EEXIST in that case and treats EINVAL as a hard failure,
resulting in failure during initdb or postmaster start.
POSIX does document EINVAL for too-few-semaphores-in-set, and is
silent on its priority relative to EEXIST, so this behavior arguably
conforms to spec. Nonetheless it's quite problematic because EINVAL
is also documented to mean that nsems is greater than the system's
limit on the number of semaphores per set (SEMMSL). If that is
where the problem lies, retrying would just become an infinite loop.
To resolve this contradiction, retry after EINVAL, but also install a
loop limit that will make us give up regardless of the specific errno
after trying 1000 different keys. (1000 is a pretty arbitrary number,
but it seems like it should be sufficient.) I like this better than
the previous infinite-looping behavior, since it will also keep us out
of trouble if (say) we get EACCES due to a system-level permissions
problem rather than anything to do with a specific semaphore set.
This problem has only been observed in the field in PG 17, which uses
a higher nsems value than other branches (cf. 38da05346, 810a8b1c8).
That makes it possible to get the failure if a new v17 postmaster
has a key collision with an existing postmaster of another branch.
In principle though, we might see such a collision against a semaphore
set created by some other application, in which case all branches are
vulnerable on these platforms. Hence, backpatch.
Reported-by: Gavin Panella <gavinpanella@gmail.com>
Author: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/CALL7chmzY3eXHA7zHnODUVGZLSvK3wYCSP0RmcDFHJY8f28Q3g@mail.gmail.com
Backpatch-through: 13 M src/backend/port/sysv_sema.c
Adjust some table column widths in PDF
commit : 05f506a5158e7779484fc4dec731942eb809e609
author : Peter Eisentraut <peter@eisentraut.org>
date : Wed, 13 Aug 2025 17:40:13 +0200
committer: Peter Eisentraut <peter@eisentraut.org>
date : Wed, 13 Aug 2025 17:40:13 +0200 Make some column widths more pleasing.
Note: Some of this relies on the reduced body indents introduced by
commit 37e06ba6e82.
Author: Noboru Saito <noborusai@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/CAAM3qnLyMUD79XF+SqAVwWCwURCF3hyuFY9Ki9Csbqs-zMwwnw@mail.gmail.com M doc/src/sgml/datatype.sgml
M doc/src/sgml/func/func-formatting.sgml
M doc/src/sgml/func/func-info.sgml
M doc/src/sgml/func/func-matching.sgml
M doc/src/sgml/storage.sgml
Improve PDF documentation margins
commit : 37e06ba6e82b44fc6ebfc9e52d71f0c21d0044c4
author : Peter Eisentraut <peter@eisentraut.org>
date : Wed, 13 Aug 2025 15:47:46 +0200
committer: Peter Eisentraut <peter@eisentraut.org>
date : Wed, 13 Aug 2025 15:47:46 +0200 Set body indent to 0 to make use of the horizontal space better (and
some reviewers thought it was also more readable).
Add some left and right margin to the warning boxes, otherwise they
drift too far off the page in combination with the above change.
Author: Noboru Saito <noborusai@gmail.com>
Reviewed-by: Hayato Kuroda (Fujitsu) <kuroda.hayato@fujitsu.com>
Reviewed-by: Florents Tselai <florents.tselai@gmail.com>
Reviewed-by: Tatsuo Ishii <ishii@postgresql.org>
Discussion: https://www.postgresql.org/message-id/flat/CAAM3qnLyMUD79XF+SqAVwWCwURCF3hyuFY9Ki9Csbqs-zMwwnw@mail.gmail.com M doc/src/sgml/stylesheet-fo.xsl
Clean up order in stylesheete-fo.xsl
commit : 8081e54bc52a0ea77cbe38a2a439598f361a5089
author : Peter Eisentraut <peter@eisentraut.org>
date : Wed, 13 Aug 2025 15:07:51 +0200
committer: Peter Eisentraut <peter@eisentraut.org>
date : Wed, 13 Aug 2025 15:07:51 +0200 Make a separate section for release notes customization. Commits
f986882ffd6 and 8a6e85b46e0 put those into the middle of unrelated
things. M doc/src/sgml/stylesheet-fo.xsl
postgres_fdw: Fix tests with ANALYZE and remote sampling
commit : 783cbb6d5e8bdf87d321286f210983c177ead967
author : Michael Paquier <michael@paquier.xyz>
date : Wed, 13 Aug 2025 13:11:19 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Wed, 13 Aug 2025 13:11:19 +0900 The tests fixed in this commit were changing the sampling setting of a
foreign server, but then were analyzing a local table instead of a
foreign table, meaning that the test was not running for its original
purpose.
This commit changes the ANALYZE commands to analyze the foreign table,
and changes the foreign table definition to point to a valid remote
table. Attempting to analyze the foreign table "analyze_ftable" would
have failed before this commit, because "analyze_rtable1" is not defined
on the remote side.
Issue introduced by 8ad51b5f446b.
Author: Corey Huinker <corey.huinker@gmail.com>
Discussion: https://postgr.es/m/CADkLM=cpUiJ3QF7aUthTvaVMmgQcm7QqZBRMDLhBRTR+gJX-Og@mail.gmail.com
Backpatch-through: 16 M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/sql/postgres_fdw.sql
libpq: Set LDAP protocol version 3
commit : 5f19d13dfed35d8d4ed80d555f2d32b106771b61
author : Peter Eisentraut <peter@eisentraut.org>
date : Tue, 12 Aug 2025 20:52:32 +0200
committer: Peter Eisentraut <peter@eisentraut.org>
date : Tue, 12 Aug 2025 20:52:32 +0200 Some LDAP servers reject the default version 2 protocol. So set
version 3 before starting the connection. This matches how the
backend LDAP code has worked all along.
Co-authored-by: Andrew Jackson <andrewjackson947@gmail.com>
Reviewed-by: Pavel Seleznev <pavel.seleznev@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/CAKK5BkHixcivSCA9pfd_eUp7wkLRhvQ6OtGLAYrWC%3Dk7E76LDQ%40mail.gmail.com M src/interfaces/libpq/fe-connect.c
Reduce ExecSeqScan* code size using pg_assume()
commit : b227b0bb4e032e19b3679bedac820eba3ac0d1cf
author : Andres Freund <andres@anarazel.de>
date : Mon, 11 Aug 2025 15:41:34 -0400
committer: Andres Freund <andres@anarazel.de>
date : Mon, 11 Aug 2025 15:41:34 -0400 fb9f955025f optimized code generation by using specialized variants of
ExecSeqScan* for [not] having a qual, projection etc. This allowed the
compiler to optimize the code out the code for qual / projection. However, as
observed by David Rowley at the time, the compiler couldn't prove the
opposite, i.e. that the qual etc *are* present.
By using pg_assume(), introduced in d65eb5b1b84, we can tell the compiler that
the relevant variables are non-null.
This reduces the code size to a surprising degree and seems to lead to a small
but reproducible performance gain.
Reviewed-by: Amit Langote <amitlangote09@gmail.com> Discussion:
https://postgr.es/m/CA+HiwqFk-MbwhfX_kucxzL8zLmjEt9MMcHi2YF=DyhPrSjsBEA@mail.gmail.com M src/backend/executor/nodeSeqscan.c
meson: add and use stamp files for generated headers
commit : 01d6832c109bcc37acb30e934b7c472334b7c291
author : Andres Freund <andres@anarazel.de>
date : Mon, 11 Aug 2025 15:14:39 -0400
committer: Andres Freund <andres@anarazel.de>
date : Mon, 11 Aug 2025 15:14:39 -0400 Without using stamp files, meson lists the generated headers as the dependency
for every .c file, bloating build.ninja by more than 2x. Processing all the
dependencies also increases the time to generate build.ninja.
The immediate benefit is that this makes re-configuring and clean builds a bit
faster. The main motivation however is that I have other patches that
introduce additional build targets that further would increase the size of
build.ninja, making re-configuring more noticeably slower.
Reviewed-by: Nazir Bilal Yavuz <byavuz81@gmail.com>
Discussion: https://postgr.es/m/cgkdgvzdpinkacf4v33mky7tbmk467oda5dd4dlmucjjockxzi@xkqfvjoq4uiy M meson.build
M src/backend/meson.build
M src/fe_utils/meson.build
M src/include/meson.build
Restrict psql meta-commands in plain-text dumps.
commit : 71ea0d6795438f95f4ee6e35867058c44b270d51
author : Nathan Bossart <nathan@postgresql.org>
date : Mon, 11 Aug 2025 09:00:00 -0500
committer: Nathan Bossart <nathan@postgresql.org>
date : Mon, 11 Aug 2025 09:00:00 -0500 A malicious server could inject psql meta-commands into plain-text
dump output (i.e., scripts created with pg_dump --format=plain,
pg_dumpall, or pg_restore --file) that are run at restore time on
the machine running psql. To fix, introduce a new "restricted"
mode in psql that blocks all meta-commands (except for \unrestrict
to exit the mode), and teach pg_dump, pg_dumpall, and pg_restore to
use this mode in plain-text dumps.
While at it, encourage users to only restore dumps generated from
trusted servers or to inspect it beforehand, since restoring causes
the destination to execute arbitrary code of the source superusers'
choice. However, the client running the dump and restore needn't
trust the source or destination superusers.
Reported-by: Martin Rakhmanov
Reported-by: Matthieu Denais <litezeraw@gmail.com>
Reported-by: RyotaK <ryotak.mail@gmail.com>
Suggested-by: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Noah Misch <noah@leadboat.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Security: CVE-2025-8714
Backpatch-through: 13 M doc/src/sgml/ref/pg_dump.sgml
M doc/src/sgml/ref/pg_dumpall.sgml
M doc/src/sgml/ref/pg_restore.sgml
M doc/src/sgml/ref/pgupgrade.sgml
M doc/src/sgml/ref/psql-ref.sgml
M src/bin/pg_combinebackup/t/002_compare_backups.pl
M src/bin/pg_dump/dumputils.c
M src/bin/pg_dump/dumputils.h
M src/bin/pg_dump/pg_backup.h
M src/bin/pg_dump/pg_backup_archiver.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dumpall.c
M src/bin/pg_dump/pg_restore.c
M src/bin/pg_dump/t/002_pg_dump.pl
M src/bin/pg_upgrade/t/002_pg_upgrade.pl
M src/bin/psql/command.c
M src/bin/psql/help.c
M src/bin/psql/t/001_basic.pl
M src/bin/psql/tab-complete.in.c
M src/test/recovery/t/027_stream_regress.pl
M src/test/regress/expected/psql.out
M src/test/regress/sql/psql.sql
Convert newlines to spaces in names written in v11+ pg_dump comments.
commit : 70693c645f6e490b9ed450e8611e94ab7af3aad2
author : Noah Misch <noah@leadboat.com>
date : Mon, 11 Aug 2025 06:18:59 -0700
committer: Noah Misch <noah@leadboat.com>
date : Mon, 11 Aug 2025 06:18:59 -0700 Maliciously-crafted object names could achieve SQL injection during
restore. CVE-2012-0868 fixed this class of problem at the time, but
later work reintroduced three cases. Commit
bc8cd50fefd369b217f80078585c486505aafb62 (back-patched to v11+ in
2023-05 releases) introduced the pg_dump case. Commit
6cbdbd9e8d8f2986fde44f2431ed8d0c8fce7f5d (v12+) introduced the two
pg_dumpall cases. Move sanitize_line(), unchanged, to dumputils.c so
pg_dumpall has access to it in all supported versions. Back-patch to
v13 (all supported versions).
Reviewed-by: Robert Haas <robertmhaas@gmail.com>
Reviewed-by: Nathan Bossart <nathandbossart@gmail.com>
Backpatch-through: 13
Security: CVE-2025-8715 M src/bin/pg_dump/dumputils.c
M src/bin/pg_dump/dumputils.h
M src/bin/pg_dump/pg_backup_archiver.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dumpall.c
M src/bin/pg_dump/t/002_pg_dump.pl
M src/bin/pg_dump/t/003_pg_dump_with_server.pl
Fix security checks in selectivity estimation functions.
commit : 22424953cded3f83f0382383773eaf36eb1abda9
author : Dean Rasheed <dean.a.rasheed@gmail.com>
date : Mon, 11 Aug 2025 09:03:11 +0100
committer: Dean Rasheed <dean.a.rasheed@gmail.com>
date : Mon, 11 Aug 2025 09:03:11 +0100 Commit e2d4ef8de86 (the fix for CVE-2017-7484) added security checks
to the selectivity estimation functions to prevent them from running
user-supplied operators on data obtained from pg_statistic if the user
lacks privileges to select from the underlying table. In cases
involving inheritance/partitioning, those checks were originally
performed against the child RTE (which for plain inheritance might
actually refer to the parent table). Commit 553d2ec2710 then extended
that to also check the parent RTE, allowing access if the user had
permissions on either the parent or the child. It turns out, however,
that doing any checks using the child RTE is incorrect, since
securityQuals is set to NULL when creating an RTE for an inheritance
child (whether it refers to the parent table or the child table), and
therefore such checks do not correctly account for any RLS policies or
security barrier views. Therefore, do the security checks using only
the parent RTE. This is consistent with how RLS policies are applied,
and the executor's ACL checks, both of which use only the parent
table's permissions/policies. Similar checks are performed in the
extended stats code, so update that in the same way, centralizing all
the checks in a new function.
In addition, note that these checks by themselves are insufficient to
ensure that the user has access to the table's data because, in a
query that goes via a view, they only check that the view owner has
permissions on the underlying table, not that the current user has
permissions on the view itself. In the selectivity estimation
functions, there is no easy way to navigate from underlying tables to
views, so add permissions checks for all views mentioned in the query
to the planner startup code. If the user lacks permissions on a view,
a permissions error will now be reported at planner-startup, and the
selectivity estimation functions will not be run.
Checking view permissions at planner-startup in this way is a little
ugly, since the same checks will be repeated at executor-startup.
Longer-term, it might be better to move all the permissions checks
from the executor to the planner so that permissions errors can be
reported sooner, instead of creating a plan that won't ever be run.
However, such a change seems too far-reaching to be back-patched.
Back-patch to all supported versions. In v13, there is the added
complication that UPDATEs and DELETEs on inherited target tables are
planned using inheritance_planner(), which plans each inheritance
child table separately, so that the selectivity estimation functions
do not know that they are dealing with a child table accessed via its
parent. Handle that by checking access permissions on the top parent
table at planner-startup, in the same way as we do for views. Any
securityQuals on the top parent table are moved down to the child
tables by inheritance_planner(), so they continue to be checked by the
selectivity estimation functions.
Author: Dean Rasheed <dean.a.rasheed@gmail.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Noah Misch <noah@leadboat.com>
Backpatch-through: 13
Security: CVE-2025-8713 M src/backend/executor/execMain.c
M src/backend/optimizer/plan/planner.c
M src/backend/statistics/extended_stats.c
M src/backend/utils/adt/selfuncs.c
M src/include/executor/executor.h
M src/include/utils/selfuncs.h
M src/test/regress/expected/privileges.out
M src/test/regress/expected/rowsecurity.out
M src/test/regress/expected/stats_ext.out
M src/test/regress/sql/privileges.sql
M src/test/regress/sql/rowsecurity.sql
M src/test/regress/sql/stats_ext.sql
Fix rare bug in read_stream.c's split IO handling.
commit : b421223172a28db2e724d5e35304097fe68a1e38
author : Thomas Munro <tmunro@postgresql.org>
date : Sat, 9 Aug 2025 12:33:06 +1200
committer: Thomas Munro <tmunro@postgresql.org>
date : Sat, 9 Aug 2025 12:33:06 +1200 The internal queue of buffers could become corrupted in a rare edge case
that failed to invalidate an entry, causing a stale buffer to be
"forwarded" to StartReadBuffers(). This is a simple fix for the
immediate problem.
A small API change might be able to remove this and related fragility
entirely, but that will have to wait a bit.
Defect in commit ed0b87ca.
Bug: 19006
Backpatch-through: 18
Reported-by: Alexander Lakhin <exclusion@gmail.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Reviewed-by: Xuneng Zhou <xunengzhou@gmail.com>
Discussion: https://postgr.es/m/19006-80fcaaf69000377e%40postgresql.org M src/backend/storage/aio/read_stream.c
Mop-up for Datum conversion cleanups.
commit : 665c3dbba497b795c4ee46145777bc4eb89c78a1
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Fri, 8 Aug 2025 18:44:57 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Fri, 8 Aug 2025 18:44:57 -0400 Fix a couple more places where an explicit Datum conversion
is needed (not clear how we missed these in ff89e182d and
previous commits).
Replace the minority usage "(Datum) NULL" with "(Datum) 0".
The former depends on the assumption that Datum is the same
width as Pointer, the latter doesn't. Anyway consistency
is a good thing.
This is, I believe, the last of the notational mop-up needed
before we can consider changing Datum to uint64 everywhere.
It's also important cleanup for more aggressive ideas such
as making Datum a struct.
Discussion: https://postgr.es/m/1749799.1752797397@sss.pgh.pa.us
Discussion: https://postgr.es/m/8246d7ff-f4b7-4363-913e-827dadfeb145@eisentraut.org M contrib/ltree/_ltree_gist.c
M src/backend/catalog/pg_aggregate.c
M src/backend/catalog/pg_constraint.c
M src/backend/catalog/pg_conversion.c
M src/backend/catalog/pg_namespace.c
M src/backend/catalog/pg_operator.c
M src/backend/catalog/pg_type.c
M src/backend/executor/spi.c
M src/backend/nodes/readfuncs.c
M src/backend/utils/adt/jsonfuncs.c
M src/backend/utils/adt/rangetypes.c
M src/include/access/htup_details.h
M src/include/access/itup.h
Add missing Datum conversions
commit : ff89e182d42048380dba32fee1b491893c7b4bec
author : Peter Eisentraut <peter@eisentraut.org>
date : Fri, 8 Aug 2025 22:05:05 +0200
committer: Peter Eisentraut <peter@eisentraut.org>
date : Fri, 8 Aug 2025 22:05:05 +0200 Add various missing conversions from and to Datum. The previous code
mostly relied on implicit conversions or its own explicit casts
instead of using the correct DatumGet*() or *GetDatum() functions.
We think these omissions are harmless. Some actual bugs that were
discovered during this process have been committed
separately (80c758a2e1d, fd2ab03fea2).
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://www.postgresql.org/message-id/flat/8246d7ff-f4b7-4363-913e-827dadfeb145%40eisentraut.org M contrib/btree_gist/btree_enum.c
M contrib/btree_gist/btree_numeric.c
M contrib/btree_gist/btree_utils_num.c
M contrib/intarray/_int_op.c
M contrib/pageinspect/heapfuncs.c
M contrib/pgrowlocks/pgrowlocks.c
M contrib/seg/seg.c
M src/backend/access/brin/brin.c
M src/backend/access/brin/brin_bloom.c
M src/backend/access/brin/brin_minmax.c
M src/backend/access/brin/brin_minmax_multi.c
M src/backend/access/common/heaptuple.c
M src/backend/access/common/toast_internals.c
M src/backend/catalog/objectaddress.c
M src/backend/catalog/pg_proc.c
M src/backend/catalog/pg_publication.c
M src/backend/catalog/pg_shdepend.c
M src/backend/commands/event_trigger.c
M src/backend/commands/subscriptioncmds.c
M src/backend/commands/tablecmds.c
M src/backend/commands/trigger.c
M src/backend/commands/tsearchcmds.c
M src/backend/commands/user.c
M src/backend/executor/execExprInterp.c
M src/backend/statistics/attribute_stats.c
M src/backend/storage/aio/aio_funcs.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/ipc/shmem.c
M src/backend/storage/lmgr/lock.c
M src/backend/utils/adt/datum.c
M src/backend/utils/adt/jsonpath_exec.c
M src/backend/utils/adt/lockfuncs.c
M src/backend/utils/adt/multirangetypes.c
M src/backend/utils/adt/rangetypes.c
M src/backend/utils/adt/rangetypes_spgist.c
M src/backend/utils/adt/rowtypes.c
M src/backend/utils/adt/waitfuncs.c
M src/backend/utils/cache/attoptcache.c
M src/backend/utils/cache/lsyscache.c
M src/backend/utils/cache/relcache.c
M src/backend/utils/cache/syscache.c
M src/backend/utils/sort/sortsupport.c
M src/backend/utils/sort/tuplesortvariants.c
M src/pl/plperl/plperl.c
M src/test/regress/regress.c
Remove useless/superfluous Datum conversions
commit : dcfc0f891273eeeb85ce6e723decf5cc37f9b1c3
author : Peter Eisentraut <peter@eisentraut.org>
date : Fri, 8 Aug 2025 22:05:05 +0200
committer: Peter Eisentraut <peter@eisentraut.org>
date : Fri, 8 Aug 2025 22:05:05 +0200 Remove useless DatumGetFoo() and FooGetDatum() calls. These are
places where no conversion from or to Datum was actually happening.
We think these extra calls covered here were harmless. Some actual
bugs that were discovered during this process have been committed
separately (80c758a2e1d, 2242b26ce47).
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://www.postgresql.org/message-id/flat/8246d7ff-f4b7-4363-913e-827dadfeb145%40eisentraut.org M src/backend/commands/alter.c
M src/backend/executor/execExprInterp.c
M src/backend/rewrite/rewriteDefine.c
M src/backend/statistics/extended_stats.c
M src/backend/tsearch/ts_parse.c
M src/backend/utils/activity/pgstat.c
M src/backend/utils/adt/json.c
M src/backend/utils/adt/multirangetypes.c
M src/backend/utils/adt/rangetypes.c
M src/backend/utils/adt/varlena.c
M src/backend/utils/cache/relcache.c
postgres_fdw and dblink should check if backend has MyProcPort
commit : 138750dde4a8b939a30a6d650c6c8146192b39cb
author : Peter Eisentraut <peter@eisentraut.org>
date : Fri, 8 Aug 2025 19:34:31 +0200
committer: Peter Eisentraut <peter@eisentraut.org>
date : Fri, 8 Aug 2025 19:34:31 +0200 before checking ->has_scram_keys. MyProcPort is NULL in background
workers. So this could crash for example if a background worker
accessed a suitable configured foreign table.
Author: Alexander Pyhalov <a.pyhalov@postgrespro.ru>
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Reviewed-by: Matheus Alcantara <matheusssilv97@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/27b29a35-9b96-46a9-bc1a-914140869dac%40gmail.com M contrib/dblink/dblink.c
M contrib/postgres_fdw/connection.c
Revert "oauth: Add unit tests for multiplexer handling"
commit : ebaaf386adb133010c2024256521b993c5e53e98
author : Jacob Champion <jchampion@postgresql.org>
date : Fri, 8 Aug 2025 10:16:37 -0700
committer: Jacob Champion <jchampion@postgresql.org>
date : Fri, 8 Aug 2025 10:16:37 -0700 Commit 1443b6c0e introduced buildfarm breakage for Autoconf animals,
which expect to be able to run `make installcheck` on the libpq-oauth
directory even if libcurl support is disabled. Some other Meson animals
complained of a missing -lm link as well.
Since this is the day before a freeze, revert for now and come back
later.
Discussion: https://postgr.es/m/CAOYmi%2BnCkoh3zB%2BGkZad44%3DFNskwUg6F1kmuxqQZzng7Zgj5tw%40mail.gmail.com M src/interfaces/libpq-oauth/Makefile
M src/interfaces/libpq-oauth/meson.build
D src/interfaces/libpq-oauth/t/001_oauth.pl
D src/interfaces/libpq-oauth/test-oauth-curl.c
oauth: Add unit tests for multiplexer handling
commit : 1443b6c0eaa2b464affc0c3aacb3c3bf09efcd6d
author : Jacob Champion <jchampion@postgresql.org>
date : Fri, 8 Aug 2025 08:45:01 -0700
committer: Jacob Champion <jchampion@postgresql.org>
date : Fri, 8 Aug 2025 08:45:01 -0700 To better record the internal behaviors of oauth-curl.c, add a unit test
suite for the socket and timer handling code. This is all based on TAP
and driven by our existing Test::More infrastructure.
Reviewed-by: Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>
Discussion: https://postgr.es/m/CAOYmi+nDZxJHaWj9_jRSyf8uMToCADAmOfJEggsKW-kY7aUwHA@mail.gmail.com M src/interfaces/libpq-oauth/Makefile
M src/interfaces/libpq-oauth/meson.build
A src/interfaces/libpq-oauth/t/001_oauth.pl
A src/interfaces/libpq-oauth/test-oauth-curl.c
oauth: Track total call count during a client flow
commit : 3e311664e4974ea0eef708d54256aacbb0239c95
author : Jacob Champion <jchampion@postgresql.org>
date : Fri, 8 Aug 2025 08:44:56 -0700
committer: Jacob Champion <jchampion@postgresql.org>
date : Fri, 8 Aug 2025 08:44:56 -0700 Tracking down the bugs that led to the addition of comb_multiplexer()
and drain_timer_events() was difficult, because an inefficient flow is
not visibly different from one that is working properly. To help
maintainers notice when something has gone wrong, track the number of
calls into the flow as part of debug mode, and print the total when the
flow finishes.
A new test makes sure the total count is less than 100. (We expect
something on the order of 10.) This isn't foolproof, but it is able to
catch several regressions in the logic of the prior two commits, and
future work to add TLS support to the oauth_validator test server should
strengthen it as well.
Backpatch-through: 18
Discussion: https://postgr.es/m/CAOYmi+nDZxJHaWj9_jRSyf8uMToCADAmOfJEggsKW-kY7aUwHA@mail.gmail.com M src/interfaces/libpq-oauth/oauth-curl.c
M src/test/modules/oauth_validator/t/001_server.pl
oauth: Remove expired timers from the multiplexer
commit : 1749a12f0d2005ba23236089f0a32e6c6c1533f0
author : Jacob Champion <jchampion@postgresql.org>
date : Fri, 8 Aug 2025 08:44:52 -0700
committer: Jacob Champion <jchampion@postgresql.org>
date : Fri, 8 Aug 2025 08:44:52 -0700 In a case similar to the previous commit, an expired timer can remain
permanently readable if Curl does not remove the timeout itself. Since
that removal isn't guaranteed to happen in real-world situations,
implement drain_timer_events() to reset the timer before calling into
drive_request().
Moving to drain_timer_events() happens to fix a logic bug in the
previous caller of timer_expired(), which treated an error condition as
if the timer were expired instead of bailing out.
The previous implementation of timer_expired() gave differing results
for epoll and kqueue if the timer was reset. (For epoll, a reset timer
was considered to be expired, and for kqueue it was not.) This didn't
previously cause problems, since timer_expired() was only called while
the timer was known to be set, but both implementations now use the
kqueue logic.
Reviewed-by: Thomas Munro <thomas.munro@gmail.com>
Backpatch-through: 18
Discussion: https://postgr.es/m/CAOYmi+nDZxJHaWj9_jRSyf8uMToCADAmOfJEggsKW-kY7aUwHA@mail.gmail.com M src/interfaces/libpq-oauth/oauth-curl.c
oauth: Ensure unused socket registrations are removed
commit : 3d9c03429a82c199a77563ae5d57c4c9cefa3d41
author : Jacob Champion <jchampion@postgresql.org>
date : Fri, 8 Aug 2025 08:44:46 -0700
committer: Jacob Champion <jchampion@postgresql.org>
date : Fri, 8 Aug 2025 08:44:46 -0700 If Curl needs to switch the direction of a socket's registration (e.g.
from CURL_POLL_IN to CURL_POLL_OUT), it expects the old registration to
be discarded. For epoll, this happened via EPOLL_CTL_MOD, but for
kqueue, the old registration would remain if it was not explicitly
removed by Curl.
Explicitly remove the opposite-direction event during registrations. (If
that event doesn't exist, we'll just get an ENOENT, which will be
ignored by the same code that handles CURL_POLL_REMOVE.) A few
assertions are also added to strengthen the relationship between the
number of events added, the number of events pulled off the queue, and
the lengths of the kevent arrays.
Reviewed-by: Thomas Munro <thomas.munro@gmail.com>
Backpatch-through: 18
Discussion: https://postgr.es/m/CAOYmi+nDZxJHaWj9_jRSyf8uMToCADAmOfJEggsKW-kY7aUwHA@mail.gmail.com M src/interfaces/libpq-oauth/oauth-curl.c
oauth: Remove stale events from the kqueue multiplexer
commit : ff5b0824b3b0c58bbb322719628c42b7a4751dd9
author : Jacob Champion <jchampion@postgresql.org>
date : Fri, 8 Aug 2025 08:44:37 -0700
committer: Jacob Champion <jchampion@postgresql.org>
date : Fri, 8 Aug 2025 08:44:37 -0700 If a socket is added to the kqueue, becomes readable/writable, and
subsequently becomes non-readable/writable again, the kqueue itself will
remain readable until either the socket registration is removed, or the
stale event is cleared via a call to kevent().
In many simple cases, Curl itself will remove the socket registration
quickly, but in real-world usage, this is not guaranteed to happen. The
kqueue can then remain stuck in a permanently readable state until the
request ends, which results in pointless wakeups for the client and
wasted CPU time.
Implement comb_multiplexer() to call kevent() and unstick any stale
events that would cause unnecessary callbacks. This is called right
after drive_request(), before we return control to the client to wait.
Suggested-by: Thomas Munro <thomas.munro@gmail.com>
Co-authored-by: Thomas Munro <thomas.munro@gmail.com>
Reviewed-by: Thomas Munro <thomas.munro@gmail.com>
Backpatch-through: 18
Discussion: https://postgr.es/m/CAOYmi+nDZxJHaWj9_jRSyf8uMToCADAmOfJEggsKW-kY7aUwHA@mail.gmail.com M src/interfaces/libpq-oauth/oauth-curl.c
Remove obsolete comment.
commit : b5cd74612c26ec3f96dfe3689acd634db9385d2e
author : Thomas Munro <tmunro@postgresql.org>
date : Sat, 9 Aug 2025 01:40:17 +1200
committer: Thomas Munro <tmunro@postgresql.org>
date : Sat, 9 Aug 2025 01:40:17 +1200 Remove a comment about potential for AIO in StartReadBuffersImpl(),
because that change happened. M src/backend/storage/buffer/bufmgr.c
Fix incorrect lack of Datum conversion in _int_matchsel()
commit : fd2ab03fea23ad6183fe694e750c901c6ff38479
author : Peter Eisentraut <peter@eisentraut.org>
date : Fri, 8 Aug 2025 12:06:06 +0200
committer: Peter Eisentraut <peter@eisentraut.org>
date : Fri, 8 Aug 2025 12:06:06 +0200 The code used
return (Selectivity) 0.0;
where
PG_RETURN_FLOAT8(0.0);
would be correct.
On 64-bit systems, these are pretty much equivalent, but on 32-bit
systems, PG_RETURN_FLOAT8() correctly produces a pointer, but the old
wrong code would return a null pointer, possibly leading to a crash
elsewhere.
We think this code is actually not reachable because bqarr_in won't
accept an empty query, and there is no other function that will
create query_int values. But better be safe and not let such
incorrect code lie around.
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://www.postgresql.org/message-id/flat/8246d7ff-f4b7-4363-913e-827dadfeb145%40eisentraut.org M contrib/intarray/_int_selfuncs.c
Fix oversight in FindTriggerIncompatibleWithInheritance.
commit : 9e63f83a7e7f8211581bfe9e9d05b72695261f4f
author : Etsuro Fujita <efujita@postgresql.org>
date : Fri, 8 Aug 2025 17:35:00 +0900
committer: Etsuro Fujita <efujita@postgresql.org>
date : Fri, 8 Aug 2025 17:35:00 +0900 This function is called from ATExecAttachPartition/ATExecAddInherit,
which prevent tables with row-level triggers with transition tables from
becoming partitions or inheritance children, to check if there is such a
trigger on the given table, but failed to check if a found trigger is
row-level, causing the caller functions to needlessly prevent a table
with only a statement-level trigger with transition tables from becoming
a partition or inheritance child. Repair.
Oversight in commit 501ed02cf.
Author: Etsuro Fujita <etsuro.fujita@gmail.com>
Discussion: https://postgr.es/m/CAPmGK167mXzwzzmJ_0YZ3EZrbwiCxtM1vogH_8drqsE6PtxRYw%40mail.gmail.com
Backpatch-through: 13 M src/backend/commands/trigger.c
M src/test/regress/expected/triggers.out
M src/test/regress/sql/triggers.sql
pg_dump: Fix incorrect parsing of object types in pg_dump --filter.
commit : 85ccd7e30a6dd378e025a918916f7b1d72004001
author : Fujii Masao <fujii@postgresql.org>
date : Fri, 8 Aug 2025 14:36:39 +0900
committer: Fujii Masao <fujii@postgresql.org>
date : Fri, 8 Aug 2025 14:36:39 +0900 Previously, pg_dump --filter could misinterpret invalid object types
in the filter file as valid ones. For example, the invalid object type
"table-data" (likely a typo for the valid "table_data") could be
mistakenly recognized as "table", causing pg_dump to succeed
when it should have failed.
This happened because pg_dump identified keywords as sequences of
ASCII alphabetic characters, treating non-alphabetic characters
(like hyphens) as keyword boundaries. As a result, "table-data" was
parsed as "table".
To fix this, pg_dump --filter now treats keywords as strings of
non-whitespace characters, ensuring invalid types like "table-data"
are correctly rejected.
Back-patch to v17, where the --filter option was introduced.
Author: Fujii Masao <masao.fujii@gmail.com>
Reviewed-by: Xuneng Zhou <xunengzhou@gmail.com>
Reviewed-by: Srinath Reddy <srinath2133@gmail.com>
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>
Discussion: https://postgr.es/m/CAHGQGwFzPKUwiV5C-NLBqz1oK1+z9K8cgrF+LcxFem-p3_Ftug@mail.gmail.com
Backpatch-through: 17 M src/bin/pg_dump/filter.c
M src/bin/pg_dump/t/005_pg_dump_filterfile.pl
Disallow collecting transition tuples from child foreign tables.
commit : 62a1211d3389095b685a4f80f7b864794cf114f6
author : Etsuro Fujita <efujita@postgresql.org>
date : Fri, 8 Aug 2025 10:50:00 +0900
committer: Etsuro Fujita <efujita@postgresql.org>
date : Fri, 8 Aug 2025 10:50:00 +0900 Commit 9e6104c66 disallowed transition tables on foreign tables, but
failed to account for cases where a foreign table is a child table of a
partitioned/inherited table on which transition tables exist, leading to
incorrect transition tuples collected from such foreign tables for
queries on the parent table triggering transition capture. This
occurred not only for inherited UPDATE/DELETE but for partitioned INSERT
later supported by commit 3d956d956, which should have handled it at
least for the INSERT case, but didn't.
To fix, modify ExecAR*Triggers to throw an error if the given relation
is a foreign table requesting transition capture. Also, this commit
fixes make_modifytable so that in case of an inherited UPDATE/DELETE
triggering transition capture, FDWs choose normal operations to modify
child foreign tables, not DirectModify; which is needed because they
would otherwise skip the calls to ExecAR*Triggers at execution, causing
unexpected behavior.
Author: Etsuro Fujita <etsuro.fujita@gmail.com>
Reviewed-by: Amit Langote <amitlangote09@gmail.com>
Discussion: https://postgr.es/m/CAPmGK14QJYikKzBDCe3jMbpGENnQ7popFmbEgm-XTNuk55oyHg%40mail.gmail.com
Backpatch-through: 13 M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/sql/postgres_fdw.sql
M src/backend/commands/trigger.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/util/plancat.c
M src/include/optimizer/plancat.h
Add information about "generation" when dropping twice pgstats entry
commit : 84b32fd2283090b2ab87dc38445d487e98e9e231
author : Michael Paquier <michael@paquier.xyz>
date : Fri, 8 Aug 2025 09:07:10 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Fri, 8 Aug 2025 09:07:10 +0900 Dropping twice a pgstats entry should not happen, and the error report
generated was missing the "generation" counter (tracking when an entry
is reused) that has been added in 818119afccd3.
Like d92573adcb02, backpatch down to v15 where this information is
useful to have, to gather more information from instances where the
problem shows up. A report has shown that this error path has been
reached on a standby based on 17.3, for a relation stats entry and an
OID close to wraparound.
Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Discussion: https://postgr.es/m/CAN4RuQvYth942J2+FcLmJKgdpq6fE5eqyFvb_PuskxF2eL=Wzg@mail.gmail.com
Backpatch-through: 15 M src/backend/utils/activity/pgstat_shmem.c
meson: Fix install-quiet after clean
commit : 4ae03be5473417ba5850bb0c1f0e60c1a0998dc9
author : Jacob Champion <jchampion@postgresql.org>
date : Thu, 7 Aug 2025 15:31:28 -0700
committer: Jacob Champion <jchampion@postgresql.org>
date : Thu, 7 Aug 2025 15:31:28 -0700 libpq-oauth was missing from the installed_targets list, so
$ ninja clean && ninja install-quiet
failed with the error message
ERROR: File 'src/interfaces/libpq-oauth/libpq-oauth.a' could not be found
It seems a little odd to have to tell Meson what's missing, since it
clearly knows how to build that file during regular installation. But
the "quiet" variant we've created must use --no-rebuild, to avoid
spawning concurrent ninja processes that would step on each other.
Reported-by: Andres Freund <andres@anarazel.de>
Backpatch-through: 18
Discussion: https://postgr.es/m/hbpqdwxkfnqijaxzgdpvdtp57s7gwxa5d6sbxswovjrournlk6%404jnb2gzan4em M meson.build
doc: add float as an alias for double precision.
commit : 04b7ff3cd33c0b9574eed3b662c16d810a903bd4
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Thu, 7 Aug 2025 18:04:45 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Thu, 7 Aug 2025 18:04:45 -0400 Although the "Floating-Point Types" section says that "float" data
type is taken to mean "double precision", this information was not
reflected in the data type table that lists all data type aliases.
Reported-by: alexander.kjall@hafslund.no
Author: Euler Taveira <euler@eulerto.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/175456294638.800.12038559679827947313@wrigleys.postgresql.org
Backpatch-through: 13 M doc/src/sgml/datatype.sgml
Extend int128.h to support more numeric code.
commit : d699687b329e031cd90e967b39c3fd8a53ef8208
author : Dean Rasheed <dean.a.rasheed@gmail.com>
date : Thu, 7 Aug 2025 15:49:24 +0100
committer: Dean Rasheed <dean.a.rasheed@gmail.com>
date : Thu, 7 Aug 2025 15:49:24 +0100 This adds a few more functions to int128.h, allowing more of numeric.c
to use 128-bit integers on all platforms.
Specifically, int64_div_fast_to_numeric() and the following aggregate
functions can now use 128-bit integers for improved performance on all
platforms, rather than just platforms with native support for int128:
- SUM(int8)
- AVG(int8)
- STDDEV_POP(int2 or int4)
- STDDEV_SAMP(int2 or int4)
- VAR_POP(int2 or int4)
- VAR_SAMP(int2 or int4)
In addition to improved performance on platforms lacking native
128-bit integer support, this significantly simplifies this numeric
code by allowing a lot of conditionally compiled code to be deleted.
A couple of numeric functions (div_var_int64() and sqrt_var()) still
contain conditionally compiled 128-bit integer code that only works on
platforms with native 128-bit integer support. Making those work more
generally would require rolling our own higher precision 128-bit
division, which isn't supported for now.
Author: Dean Rasheed <dean.a.rasheed@gmail.com>
Reviewed-by: John Naylor <johncnaylorls@gmail.com>
Discussion: https://postgr.es/m/CAEZATCWgBMc9ZwKMYqQpaQz2X6gaamYRB+RnMsUNcdMcL2Mj_w@mail.gmail.com M src/backend/utils/adt/numeric.c
M src/include/common/int128.h
M src/test/modules/test_int128/test_int128.c
M src/test/regress/expected/aggregates.out
M src/test/regress/sql/aggregates.sql
doc: Formatting improvements
commit : 0ef891e54175c6646a132bc00e330ff64edb9888
author : Peter Eisentraut <peter@eisentraut.org>
date : Thu, 7 Aug 2025 13:29:08 +0200
committer: Peter Eisentraut <peter@eisentraut.org>
date : Thu, 7 Aug 2025 13:29:08 +0200 Small touch-up on commits 25505082f0e and 50fd428b2b9. Fix the
formatting of the example messages in the documentation and adjust the
wording to match the code. M doc/src/sgml/logicaldecoding.sgml
Fix checkpointer shared memory allocation
commit : 466c5435fd45209546c502bd1e8ee5b76b1cc0a1
author : Alexander Korotkov <akorotkov@postgresql.org>
date : Thu, 7 Aug 2025 14:29:02 +0300
committer: Alexander Korotkov <akorotkov@postgresql.org>
date : Thu, 7 Aug 2025 14:29:02 +0300 Use Min(NBuffers, MAX_CHECKPOINT_REQUESTS) instead of NBuffers in
CheckpointerShmemSize() to match the actual array size limit set in
CheckpointerShmemInit(). This prevents wasting shared memory when
NBuffers > MAX_CHECKPOINT_REQUESTS. Also, fix the comment.
Reported-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/1439188.1754506714%40sss.pgh.pa.us
Author: Xuneng Zhou <xunengzhou@gmail.com>
Co-authored-by: Alexander Korotkov <aekorotkov@gmail.com> M src/backend/postmaster/checkpointer.c
Update ICU C++ API symbols
commit : 90bfae9f93e7eb0328cc8288bd09234315997ec8
author : John Naylor <john.naylor@postgresql.org>
date : Thu, 7 Aug 2025 17:10:52 +0700
committer: John Naylor <john.naylor@postgresql.org>
date : Thu, 7 Aug 2025 17:10:52 +0700 Recent ICU versions have added U_SHOW_CPLUSPLUS_HEADER_API, and we need
to set this to zero as well to hide the ICU C++ APIs from pg_locale.h
Per discussion, we want cpluspluscheck to work cleanly in backbranches,
so backpatch both this and its predecessor commit ed26c4e25a4 to all
supported versions.
Reported-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/1115793.1754414782%40sss.pgh.pa.us
Backpatch-through: 13 M src/include/utils/pg_locale.h
pg_upgrade: Improve message indentation
commit : 1beda2c3cf5842c37edd7081468a703052c6d0f0
author : Peter Eisentraut <peter@eisentraut.org>
date : Thu, 7 Aug 2025 11:48:43 +0200
committer: Peter Eisentraut <peter@eisentraut.org>
date : Thu, 7 Aug 2025 11:48:43 +0200 Fix commit f295494d338 to use consistent four-space indentation for
verbose messages. M src/bin/pg_upgrade/check.c
Simplify non-native 64x64-bit multiplication in int128.h.
commit : d8a08dbee46c4121bbb819df1c98533824974c45
author : Dean Rasheed <dean.a.rasheed@gmail.com>
date : Thu, 7 Aug 2025 09:52:30 +0100
committer: Dean Rasheed <dean.a.rasheed@gmail.com>
date : Thu, 7 Aug 2025 09:52:30 +0100 In the non-native code in int128_add_int64_mul_int64(), use signed
64-bit integer multiplication instead of unsigned multiplication for
the first three product terms. This simplifies the code needed to add
each product term to the result, leading to more compact and efficient
code. The actual performance gain is quite modest, but it seems worth
it to improve the code's readability.
Author: Dean Rasheed <dean.a.rasheed@gmail.com>
Reviewed-by: John Naylor <johncnaylorls@gmail.com>
Discussion: https://postgr.es/m/CAEZATCWgBMc9ZwKMYqQpaQz2X6gaamYRB+RnMsUNcdMcL2Mj_w@mail.gmail.com M src/include/common/int128.h
Optimise non-native 128-bit addition in int128.h.
commit : d9bb8ef093d62763cfd19d37e6bb8182998a3f88
author : Dean Rasheed <dean.a.rasheed@gmail.com>
date : Thu, 7 Aug 2025 09:20:02 +0100
committer: Dean Rasheed <dean.a.rasheed@gmail.com>
date : Thu, 7 Aug 2025 09:20:02 +0100 On platforms without native 128-bit integer support, simplify the test
for carry in int128_add_uint64() by noting that the low-part addition
is unsigned integer arithmetic, which is just modular arithmetic.
Therefore the test for carry can simply be written as "new value < old
value" (i.e., a test for modular wrap-around). This can then be made
branchless so that on modern compilers it produces the same machine
instructions as native 128-bit addition, making it significantly
simpler and faster.
Similarly, the test for carry in int128_add_int64() can be written in
much the same way, but with an extra term to compensate for the sign
of the value being added. Again, on modern compilers this leads to
branchless code, often identical to the native 128-bit integer
addition machine code.
Author: Dean Rasheed <dean.a.rasheed@gmail.com>
Reviewed-by: John Naylor <johncnaylorls@gmail.com>
Discussion: https://postgr.es/m/CAEZATCWgBMc9ZwKMYqQpaQz2X6gaamYRB+RnMsUNcdMcL2Mj_w@mail.gmail.com M src/include/common/int128.h
Improve tests of date_trunc() with infinity and unsupported units
commit : 572c0f1b0e2a9ed61816239f59d568217079bb8c
author : Michael Paquier <michael@paquier.xyz>
date : Thu, 7 Aug 2025 11:49:25 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Thu, 7 Aug 2025 11:49:25 +0900 Commit d85ce012f99f has added some new error handling code to
date_trunc() of timestamp, timestamptz, and interval with infinite
values.
However, the new test cases added by that commit did not actually test
all of the new code, missing coverage for the following cases:
1) For timestamp without time zone:
1-1) infinite value with valid unit
1-2) infinite value with unsupported unit
1-3) finite value with unsupported unit, for a code path older than
d85ce012f99f.
2) For timestamp with time zone, without a time zone specified for the
truncation:
2-1) infinite value with valid unit
2-2) infinite value with unsupported unit
2-3) finite value with unsupported unit, for a code path older than
d85ce012f99f.
3) For timestamp with time zone, with a time zone specified for the
truncation:
3-1) infinite value with valid unit.
3-2) infinite value with unsupported unit.
This commit also provides coverage for the bug fixed in 2242b26ce472,
through cases 2-1) and 3-1), when using an infinite value with a valid
unit, with[out] the optional time zone parameter used for the
truncation.
Author: Peter Eisentraut <peter@eisentraut.org>
Discussion: https://postgr.es/m/2d320b6f-b4af-4fbc-9eec-5d0fa15d187b@eisentraut.org
Discussion: https://postgr.es/m/4bf60a84-2862-4a53-acd5-8eddf134a60e@eisentraut.org
Backpatch-through: 18 M src/test/regress/expected/timestamp.out
M src/test/regress/expected/timestamptz.out
M src/test/regress/sql/timestamp.sql
M src/test/regress/sql/timestamptz.sql
Fix incorrect Datum conversion in timestamptz_trunc_internal()
commit : 2242b26ce472db9ac69dc71008c566ea9cd3a5fd
author : Michael Paquier <michael@paquier.xyz>
date : Thu, 7 Aug 2025 11:02:04 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Thu, 7 Aug 2025 11:02:04 +0900 The code used a PG_RETURN_TIMESTAMPTZ() where the return type is
TimestampTz and not a Datum.
On 64-bit systems, there is no effect since this just ends up casting
64-bit integers back and forth. On 32-bit systems, timestamptz is
pass-by-reference. PG_RETURN_TIMESTAMPTZ() allocates new memory and
returns the address, meaning that the caller could interpret this as a
timestamp value.
The effect is using "date_trunc(..., 'infinity'::timestamptz) will
return random values (instead of the correct return value 'infinity').
Bug introduced in commit d85ce012f99f.
Author: Peter Eisentraut <peter@eisentraut.org>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/2d320b6f-b4af-4fbc-9eec-5d0fa15d187b@eisentraut.org
Discussion: https://postgr.es/m/4bf60a84-2862-4a53-acd5-8eddf134a60e@eisentraut.org
Backpatch-through: 18 M src/backend/utils/adt/timestamp.c
Expand usage of macros for protocol characters.
commit : 9ea3b6f751abd7701f3f32d9df26d66410754c94
author : Nathan Bossart <nathan@postgresql.org>
date : Wed, 6 Aug 2025 13:37:00 -0500
committer: Nathan Bossart <nathan@postgresql.org>
date : Wed, 6 Aug 2025 13:37:00 -0500 This commit makes use of the existing PqMsg_* macros in more places
and adds new PqReplMsg_* and PqBackupMsg_* macros for use in
special replication and backup messages, respectively.
Author: Dave Cramer <davecramer@gmail.com>
Co-authored-by: Fabrízio de Royes Mello <fabriziomello@gmail.com>
Reviewed-by: Jacob Champion <jacob.champion@enterprisedb.com>
Reviewed-by: Álvaro Herrera <alvherre@kurilemu.de>
Reviewed-by: Euler Taveira <euler@eulerto.com>
Discussion: https://postgr.es/m/aIECfYfevCUpenBT@nathan
Discussion: https://postgr.es/m/CAFcNs%2Br73NOUb7%2BqKrV4HHEki02CS96Z%2Bx19WaFgE087BWwEng%40mail.gmail.com M src/backend/backup/basebackup_copy.c
M src/backend/replication/logical/applyparallelworker.c
M src/backend/replication/logical/worker.c
M src/backend/replication/walreceiver.c
M src/backend/replication/walsender.c
M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pg_basebackup/pg_recvlogical.c
M src/bin/pg_basebackup/receivelog.c
M src/include/libpq/protocol.h
Rename transformRelOptions()'s "namspace" parameter to "nameSpace".
commit : 35baa60cc7f374401f06c7dc422e93bcf31b942b
author : Nathan Bossart <nathan@postgresql.org>
date : Wed, 6 Aug 2025 12:08:07 -0500
committer: Nathan Bossart <nathan@postgresql.org>
date : Wed, 6 Aug 2025 12:08:07 -0500 The name "namspace" looks like a typo, but it was presumably meant
to avoid using the "namespace" C++ keyword. This commit renames
the parameter to "nameSpace" to prevent future confusion while
still avoiding the keyword.
Reviewed-by: Álvaro Herrera <alvherre@kurilemu.de>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>
Discussion: https://postgr.es/m/aJJxpfsDfiQ1VbJ5%40nathan M src/backend/access/common/reloptions.c
M src/include/access/reloptions.h
Fix typo in comment.
commit : 99139c46cbf2bda7880592c4e5da1ebf177888ac
author : Fujii Masao <fujii@postgresql.org>
date : Wed, 6 Aug 2025 22:52:13 +0900
committer: Fujii Masao <fujii@postgresql.org>
date : Wed, 6 Aug 2025 22:52:13 +0900 Author: Chao Li <lic@highgo.com>
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>
Discussion: https://postgr.es/m/CD9B2247-617A-4761-8338-2705C8728E2A@highgo.com M src/interfaces/ecpg/compatlib/informix.c
Refactor int128.h, bringing the native and non-native code together.
commit : 5761d991c98471b7dab3147b71f9caf00a6f8ce4
author : Dean Rasheed <dean.a.rasheed@gmail.com>
date : Wed, 6 Aug 2025 11:37:07 +0100
committer: Dean Rasheed <dean.a.rasheed@gmail.com>
date : Wed, 6 Aug 2025 11:37:07 +0100 This rearranges the code in src/include/common/int128.h, so that the
native and non-native implementations of each function are together
inside the function body (as they are in src/include/common/int.h),
rather than being in separate parts of the file.
This improves readability and maintainability, making it easier to
compare the native and non-native implementations, and avoiding the
need to duplicate every function comment and declaration.
Author: Dean Rasheed <dean.a.rasheed@gmail.com>
Reviewed-by: John Naylor <johncnaylorls@gmail.com>
Discussion: https://postgr.es/m/CAEZATCWgBMc9ZwKMYqQpaQz2X6gaamYRB+RnMsUNcdMcL2Mj_w@mail.gmail.com M src/include/common/int128.h
Fix printf format specfiers in test_int128 module.
commit : 811633105a38bc40ff2f75879a4b9a1113bb0347
author : Dean Rasheed <dean.a.rasheed@gmail.com>
date : Wed, 6 Aug 2025 10:16:14 +0100
committer: Dean Rasheed <dean.a.rasheed@gmail.com>
date : Wed, 6 Aug 2025 10:16:14 +0100 Compiler warnings introduced by 8c7445a0081.
Author: Dean Rasheed <dean.a.rasheed@gmail.com> M src/test/modules/test_int128/test_int128.c
Remove INT64_HEX_FORMAT and UINT64_HEX_FORMAT
commit : 73d33be4dab7923bf879b82e8ea5fa214099b516
author : Peter Eisentraut <peter@eisentraut.org>
date : Wed, 6 Aug 2025 10:54:48 +0200
committer: Peter Eisentraut <peter@eisentraut.org>
date : Wed, 6 Aug 2025 10:54:48 +0200 These were introduced (commit efdc7d74753) at the same time as we were
moving to using the standard inttypes.h format macros (commit
a0ed19e0a9e). It doesn't seem useful to keep a new already-deprecated
interface like this with only a few users, so remove the new symbols
again and have the callers use PRIx64.
(Also, INT64_HEX_FORMAT was kind of a misnomer, since hex formats all
use unsigned types.)
Reviewed-by: Nathan Bossart <nathandbossart@gmail.com>
Reviewed-by: Thomas Munro <thomas.munro@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/0ac47b5d-e5ab-4cac-98a7-bdee0e2831e4%40eisentraut.org M contrib/postgres_fdw/option.c
M src/backend/utils/error/csvlog.c
M src/backend/utils/error/elog.c
M src/backend/utils/error/jsonlog.c
M src/include/c.h
M src/test/modules/test_radixtree/test_radixtree.c
Convert src/tools/testint128.c into a test module.
commit : 8c7445a008109100f9784ea2d8e02cb6769dfb09
author : Dean Rasheed <dean.a.rasheed@gmail.com>
date : Wed, 6 Aug 2025 09:41:11 +0100
committer: Dean Rasheed <dean.a.rasheed@gmail.com>
date : Wed, 6 Aug 2025 09:41:11 +0100 This creates a new test module src/test/modules/test_int128 and moves
src/tools/testint128.c into it so that it can be built using the
normal build system, allowing the 128-bit integer arithmetic functions
in src/include/common/int128.h to be tested automatically. For now,
the tests are skipped on platforms that don't have native int128
support.
While at it, fix the test128 union in the test code: the "hl" member
of test128 was incorrectly defined to be a union instead of a struct,
which meant that the tests were only ever setting and checking half of
each 128-bit integer value.
Author: Dean Rasheed <dean.a.rasheed@gmail.com>
Reviewed-by: John Naylor <johncnaylorls@gmail.com>
Discussion: https://postgr.es/m/CAEZATCWgBMc9ZwKMYqQpaQz2X6gaamYRB+RnMsUNcdMcL2Mj_w@mail.gmail.com M src/include/common/int128.h
M src/test/modules/Makefile
M src/test/modules/meson.build
A src/test/modules/test_int128/.gitignore
A src/test/modules/test_int128/Makefile
A src/test/modules/test_int128/meson.build
A src/test/modules/test_int128/t/001_test_int128.pl
R070 src/tools/testint128.c src/test/modules/test_int128/test_int128.c
Add regression test for short varlenas saved in TOAST relations
commit : 225ebfe30a1ae9fda74f3d8f98ea6fa511b60624
author : Michael Paquier <michael@paquier.xyz>
date : Wed, 6 Aug 2025 17:22:03 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Wed, 6 Aug 2025 17:22:03 +0900 toast_save_datum() has for a very long time some code able to handle
short varlenas (values up to 126 bytes reduced to a 1-byte header),
converting such varlenas to an external on-disk TOAST pointer with the
value saved uncompressed in the secondary TOAST relation.
There was zero coverage for this code path. This commit adds a test
able to exercise it, relying on two external attributes, one with a low
toast_tuple_target, so as it is possible to trigger the threshold for
the insertion of short varlenas into the TOAST relation.
Author: Nikhil Kumar Veldanda <veldanda.nikhilkumar17@gmail.com>
Co-authored-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://postgr.es/m/aJAl7-NvIk0kZByz@paquier.xyz M src/test/regress/expected/strings.out
M src/test/regress/sql/strings.sql
doc: Recommend ANALYZE after ALTER TABLE ... SET EXPRESSION AS.
commit : 0b6aea03843dc75871b0490c6302a71a8fecb53d
author : Fujii Masao <fujii@postgresql.org>
date : Wed, 6 Aug 2025 16:47:20 +0900
committer: Fujii Masao <fujii@postgresql.org>
date : Wed, 6 Aug 2025 16:47:20 +0900 ALTER TABLE ... SET EXPRESSION AS removes statistics for the target column,
so running ANALYZE afterward is recommended. But this was previously not
documented, even though a similar recommendation exists for
ALTER TABLE ... SET DATA TYPE, which also clears the column's statistics.
This commit updates the documentation to include the ANALYZE recommendation
for SET EXPRESSION AS.
Since v18, virtual generated columns are supported, and these columns never
have statistics. Therefore, ANALYZE is not needed after SET DATA TYPE or
SET EXPRESSION AS when used on virtual generated columns. This commit also
updates the documentation to clarify that ANALYZE is unnecessary in such cases.
Back-patch the ANALYZE recommendation for SET EXPRESSION AS to v17
where the feature was introduced, and the note about virtual generated
columns to v18 where those columns were added.
Author: Yugo Nagata <nagata@sraoss.co.jp>
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>
Discussion: https://postgr.es/m/20250804151418.0cf365bd2855d606763443fe@sraoss.co.jp
Backpatch-through: 17 M doc/src/sgml/ref/alter_table.sgml
Suppress maybe-uninitialized warning.
commit : b5c53b403c93393c3725558294cbf4dbfb575e42
author : Masahiko Sawada <msawada@postgresql.org>
date : Tue, 5 Aug 2025 15:30:28 -0700
committer: Masahiko Sawada <msawada@postgresql.org>
date : Tue, 5 Aug 2025 15:30:28 -0700 Following commit e035863c9a0, building with -O0 began triggering
warnings about potentially uninitialized 'workbuf' usage. While
theoretically the initialization isn't necessary since VARDATA()
doesn't access the contents of the pointed-to object, this commit
explicitly initializes the workbuf variable to suppress the warning.
Buildfarm members adder and flaviventris have shown the warning.
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/CAD21AoCOZxfqnNgfM5yVKJZYnOq5m2Q96fBGy1fovEqQ9V4OZA@mail.gmail.com M src/backend/storage/large_object/inv_api.c
Fix incorrect return value in brin_minmax_multi_distance_numeric().
commit : 80c758a2e1d720a942610f2f889448d69ce2ce95
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Tue, 5 Aug 2025 16:51:10 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Tue, 5 Aug 2025 16:51:10 -0400 The result of "DirectFunctionCall1(numeric_float8, d)" is already in
Datum form, but the code was incorrectly applying PG_RETURN_FLOAT8()
to it. On machines where float8 is pass-by-reference, this would
result in complete garbage, since an unpredictable pointer value
would be treated as an integer and then converted to float. It's not
entirely clear how much of a problem would ensue on 64-bit hardware,
but certainly interpreting a float8 bitpattern as uint64 and then
converting that to float isn't the intended behavior.
As luck would have it, even the complete-garbage case doesn't break
BRIN indexes, since the results are only used to make choices about
how to merge values into ranges: at worst, we'd make poor choices
resulting in an inefficient index. Doubtless that explains the lack
of field complaints. However, users with BRIN indexes that use the
numeric_minmax_multi_ops opclass may wish to reindex in hopes of
making their indexes more efficient.
Author: Peter Eisentraut <peter@eisentraut.org>
Co-authored-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/2093712.1753983215@sss.pgh.pa.us
Backpatch-through: 14 M src/backend/access/brin/brin_minmax_multi.c
Put PG_TEST_EXTRA doc items back in alphabetical order
commit : 455a040d966897edd3901f044945398450da338a
author : Álvaro Herrera <alvherre@kurilemu.de>
date : Tue, 5 Aug 2025 20:22:32 +0200
committer: Álvaro Herrera <alvherre@kurilemu.de>
date : Tue, 5 Aug 2025 20:22:32 +0200 A few items appears to have added in random order over the years. M doc/src/sgml/regress.sgml
Hide expensive pg_upgrade test behind PG_TEST_EXTRA
commit : 37fc1803cc12120f19184cd952865cc35e0f1755
author : Álvaro Herrera <alvherre@kurilemu.de>
date : Tue, 5 Aug 2025 20:09:42 +0200
committer: Álvaro Herrera <alvherre@kurilemu.de>
date : Tue, 5 Aug 2025 20:09:42 +0200 This new test is very expensive. Make it opt-in.
Discussion: https://postgr.es/m/202508051433.ebznuqrxt4b2@alvherre.pgsql M doc/src/sgml/regress.sgml
M src/bin/pg_upgrade/t/002_pg_upgrade.pl
Add backup_type column to pg_stat_progress_basebackup.
commit : deb674454c5cb7ecabecee2e04ca929eee570df4
author : Masahiko Sawada <msawada@postgresql.org>
date : Tue, 5 Aug 2025 10:50:45 -0700
committer: Masahiko Sawada <msawada@postgresql.org>
date : Tue, 5 Aug 2025 10:50:45 -0700 This commit introduces a new column backup_type that indicates the
type of backup being performed: either 'full' or 'incremental'.
Bump catalog version.
Author: Shinya Kato <shinya11.kato@gmail.com>
Reviewed-by: Yugo Nagata <nagata@sraoss.co.jp>
Discussion: https://postgr.es/m/CAOzEurQuzbHwTj1ehk1a+eeQDidJPyrE5s6mYumkjwjZnurhkQ@mail.gmail.com M doc/src/sgml/monitoring.sgml
M src/backend/backup/basebackup.c
M src/backend/backup/basebackup_progress.c
M src/backend/catalog/system_views.sql
M src/include/backup/basebackup_sink.h
M src/include/catalog/catversion.h
M src/include/commands/progress.h
M src/test/regress/expected/rules.out
Don't copy datlocale from template unless provider matches.
commit : 295a39770e6f7d9c117d52f86ff0596b7d9a590e
author : Jeff Davis <jdavis@postgresql.org>
date : Tue, 5 Aug 2025 09:06:05 -0700
committer: Jeff Davis <jdavis@postgresql.org>
date : Tue, 5 Aug 2025 09:06:05 -0700 During CREATE DATABASE, if changing the locale provider, require that
a new locale is specified rather than trying to reinterpret the
template's locale using the new provider.
This only affects the behavior when the template uses the builtin
provider and CREATE DATABASE specifies the ICU provider without
specifying the locale. Previously, that may have succeeded due to
loose validation by ICU, whereas now that will cause an error. Because
it can cause an error, backport only to unreleased versions.
Discussion: https://postgr.es/m/5038b33a6dc639009f4b3d43fa6ae0c5ba9e04f7.camel@j-davis.com
Backpatch-through: 18 M src/backend/commands/dbcommands.c
Mop-up for commit e035863c9.
commit : f291751ef86ec407b3e67a951f55e79fb160ae10
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Tue, 5 Aug 2025 12:11:33 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Tue, 5 Aug 2025 12:11:33 -0400 Neither Peter nor I had tried this with USE_VALGRIND ...
Per buildfarm member skink. M src/backend/access/common/printtup.c
Convert varatt.h access macros to static inline functions.
commit : e035863c9a04beeecc254c3bfe48dab58e389e10
author : Peter Eisentraut <peter@eisentraut.org>
date : Tue, 5 Aug 2025 17:01:25 +0200
committer: Peter Eisentraut <peter@eisentraut.org>
date : Tue, 5 Aug 2025 17:01:25 +0200 We've only bothered converting the external interfaces, not the
endian-dependent internal macros (which should not be used by any
callers other than the interface functions in this header, anyway).
The VARTAG_1B_E() changes are required for C++ compatibility.
Author: Peter Eisentraut <peter@eisentraut.org>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/928ea48f-77c6-417b-897c-621ef16685a6@eisentraut.org M doc/src/sgml/xfunc.sgml
M src/include/varatt.h
Fix varatt versus Datum type confusions
commit : 0f5ade7a367c16d823c75a81abb10e2ec98b4206
author : Peter Eisentraut <peter@eisentraut.org>
date : Tue, 5 Aug 2025 12:11:36 +0200
committer: Peter Eisentraut <peter@eisentraut.org>
date : Tue, 5 Aug 2025 12:11:36 +0200 Macros like VARDATA() and VARSIZE() should be thought of as taking
values of type pointer to struct varlena or some other related struct.
The way they are implemented, you can pass anything to it and it will
cast it right. But this is in principle incorrect. To fix, add the
required DatumGetPointer() calls. Or in a couple of cases, remove
superfluous PointerGetDatum() calls.
It is planned in a subsequent patch to change macros like VARDATA()
and VARSIZE() to inline functions, which will enforce stricter typing.
This is in preparation for that.
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://www.postgresql.org/message-id/flat/928ea48f-77c6-417b-897c-621ef16685a6%40eisentraut.org M contrib/hstore/hstore_gin.c
M contrib/hstore/hstore_gist.c
M contrib/hstore/hstore_io.c
M contrib/hstore/hstore_op.c
M contrib/test_decoding/test_decoding.c
M src/backend/access/brin/brin_minmax_multi.c
M src/backend/access/common/heaptuple.c
M src/backend/access/common/reloptions.c
M src/backend/access/common/toast_internals.c
M src/backend/access/gin/gininsert.c
M src/backend/access/spgist/spgutils.c
M src/backend/access/table/toast_helper.c
M src/backend/replication/logical/proto.c
M src/backend/replication/pgoutput/pgoutput.c
M src/backend/statistics/mcv.c
M src/backend/tsearch/ts_selfuncs.c
M src/backend/utils/adt/jsonb_gin.c
M src/backend/utils/adt/jsonb_op.c
M src/backend/utils/adt/jsonfuncs.c
M src/backend/utils/adt/jsonpath_exec.c
M src/backend/utils/adt/multirangetypes.c
M src/backend/utils/adt/rangetypes.c
M src/backend/utils/adt/tsvector_op.c
Fix various hash function uses
commit : 2ad6e80de9a6300daffcc0987667e45012fbecde
author : Peter Eisentraut <peter@eisentraut.org>
date : Tue, 5 Aug 2025 11:38:34 +0200
committer: Peter Eisentraut <peter@eisentraut.org>
date : Tue, 5 Aug 2025 11:38:34 +0200 These instances were using Datum-returning functions where a
lower-level function returning uint32 would be more appropriate.
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://www.postgresql.org/message-id/flat/8246d7ff-f4b7-4363-913e-827dadfeb145%40eisentraut.org M contrib/sepgsql/uavc.c
M src/backend/access/common/tupdesc.c
M src/backend/storage/file/fileset.c
M src/backend/utils/adt/multirangetypes.c
M src/backend/utils/adt/rangetypes.c
M src/backend/utils/cache/catcache.c
Throw ERROR when publish_generated_columns is specified without a value.
commit : c9a5860f7a56cc639d6a73519b8b2a00d26d960c
author : Amit Kapila <akapila@postgresql.org>
date : Tue, 5 Aug 2025 09:34:22 +0000
committer: Amit Kapila <akapila@postgresql.org>
date : Tue, 5 Aug 2025 09:34:22 +0000 Previously, specifying the publication option 'publish_generated_columns'
without an explicit value would incorrectly default to 'stored', which is
not the intended behavior.
This patch fixes the issue by raising an ERROR when no value is provided
for 'publish_generated_columns', ensuring that users must explicitly
specify a valid option.
Author: Peter Smith <smithpb2250@gmail.com>
Reviewed-by: vignesh C <vignesh21@gmail.com>
Backpatch-through: 18, where it was introduced
Discussion: https://postgr.es/m/CAHut+PsCUCWiEKmB10DxhoPfXbF6jw5RD9ib2LuaQeA_XraW7w@mail.gmail.com M src/backend/commands/publicationcmds.c
M src/test/regress/expected/publication.out
M src/test/regress/sql/publication.sql
Fix mixups of FooGetDatum() vs. DatumGetFoo()
commit : 1469e312977c8a5baeb1f9cb4222d171faf285b3
author : Peter Eisentraut <peter@eisentraut.org>
date : Tue, 5 Aug 2025 10:53:49 +0200
committer: Peter Eisentraut <peter@eisentraut.org>
date : Tue, 5 Aug 2025 10:53:49 +0200 Some of these were accidentally reversed, but there was no ill effect.
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://www.postgresql.org/message-id/flat/8246d7ff-f4b7-4363-913e-827dadfeb145%40eisentraut.org M contrib/pageinspect/btreefuncs.c
M contrib/pageinspect/gistfuncs.c
M src/backend/access/common/printsimple.c
M src/backend/access/nbtree/nbtcompare.c
M src/backend/access/transam/xlog.c
Minor test fixes in 035_standby_logical_decoding.pl
commit : 6551a05d9cf8ea75c0db232b661dadd16e595854
author : Melanie Plageman <melanieplageman@gmail.com>
date : Mon, 4 Aug 2025 15:07:32 -0400
committer: Melanie Plageman <melanieplageman@gmail.com>
date : Mon, 4 Aug 2025 15:07:32 -0400 Import usleep, which, due to an oversight in oversight in commit
48796a98d5ae was used but not imported.
Correct the comparison string used in two logfile checks. Previously, it
was incorrect and thus the test could never have failed.
Also wordsmith a comment to make it clear when hot_standby_feedback is
meant to be on during the test scenarios.
Reported-by: Melanie Plageman <melanieplageman@gmail.com>
Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com>
Discussion: https://postgr.es/m/flat/CAAKRu_YO2mEm%3DZWZKPjTMU%3DgW5Y83_KMi_1cr51JwavH0ctd7w%40mail.gmail.com
Backpatch-through: 16 M src/test/recovery/t/035_standby_logical_decoding.pl
Fix typo in create_index.sql.
commit : 88f0fdabead51539aa5bdefcf188f07d4651ee10
author : Dean Rasheed <dean.a.rasheed@gmail.com>
date : Mon, 4 Aug 2025 16:18:59 +0100
committer: Dean Rasheed <dean.a.rasheed@gmail.com>
date : Mon, 4 Aug 2025 16:18:59 +0100 Introduced by 578b229718e.
Author: Dean Rasheed <dean.a.rasheed@gmail.com>
Reviewed-by: Tender Wang <tndrwang@gmail.com>
Discussion: https://postgr.es/m/CAEZATCV_CzRSOPMf1gbHQ7xTmyrV6kE7ViCBD6B81WF7GfTAEA@mail.gmail.com
Backpatch-through: 13 M src/test/regress/expected/create_index.out
M src/test/regress/sql/create_index.sql
Split func.sgml into more manageable pieces
commit : 4e23c9ef65accde7eb3e56aa28d50ae5cf79b64b
author : Andrew Dunstan <andrew@dunslane.net>
date : Mon, 4 Aug 2025 08:56:48 -0400
committer: Andrew Dunstan <andrew@dunslane.net>
date : Mon, 4 Aug 2025 08:56:48 -0400 func.sgml has grown over the years to the point where it is very
difficult to manage. This commit splits out each sect1 piece into its
own file, which is then included in the main file, so that the built
documentation should be identical to the pre-split documentation. All
these new files are placed in a new "func" subdirectory, and the
previous func.sgml is removed.
Done using scripts developed by:
Author: jian he <jian.universality@gmail.com>
Discussion: https://postgr.es/m/CACJufxFgAh1--EMwOjMuANe=VTmjkNaZjH+AzSe04-8ZCGiESA@mail.gmail.com M doc/src/sgml/filelist.sgml
D doc/src/sgml/func.sgml
A doc/src/sgml/func/allfiles.sgml
A doc/src/sgml/func/func-admin.sgml
A doc/src/sgml/func/func-aggregate.sgml
A doc/src/sgml/func/func-array.sgml
A doc/src/sgml/func/func-binarystring.sgml
A doc/src/sgml/func/func-bitstring.sgml
A doc/src/sgml/func/func-comparison.sgml
A doc/src/sgml/func/func-comparisons.sgml
A doc/src/sgml/func/func-conditional.sgml
A doc/src/sgml/func/func-datetime.sgml
A doc/src/sgml/func/func-enum.sgml
A doc/src/sgml/func/func-event-triggers.sgml
A doc/src/sgml/func/func-formatting.sgml
A doc/src/sgml/func/func-geometry.sgml
A doc/src/sgml/func/func-info.sgml
A doc/src/sgml/func/func-json.sgml
A doc/src/sgml/func/func-logical.sgml
A doc/src/sgml/func/func-matching.sgml
A doc/src/sgml/func/func-math.sgml
A doc/src/sgml/func/func-merge-support.sgml
A doc/src/sgml/func/func-net.sgml
A doc/src/sgml/func/func-range.sgml
A doc/src/sgml/func/func-sequence.sgml
A doc/src/sgml/func/func-srf.sgml
A doc/src/sgml/func/func-statistics.sgml
A doc/src/sgml/func/func-string.sgml
A doc/src/sgml/func/func-subquery.sgml
A doc/src/sgml/func/func-textsearch.sgml
A doc/src/sgml/func/func-trigger.sgml
A doc/src/sgml/func/func-uuid.sgml
A doc/src/sgml/func/func-window.sgml
A doc/src/sgml/func/func-xml.sgml
A doc/src/sgml/func/func.sgml
Improve prep_buildtree
commit : 6ae268cf284c5a706455e164f8879bd721296535
author : Peter Eisentraut <peter@eisentraut.org>
date : Mon, 4 Aug 2025 09:08:10 +0200
committer: Peter Eisentraut <peter@eisentraut.org>
date : Mon, 4 Aug 2025 09:08:10 +0200 When prep_buildtree is used to prepare a build tree when the source
directory already contains another build tree, then it will produce
the directory structure of the first build tree in the second one.
For example, if there is
postgresql/
postgresql/build1/
and a new build tree postgresql/build2/ is prepared, then this will
produce
postgresql/build2/build1/
because it just copies all subdirectories of the source tree. This is
not harmful, but it's pretty stupid and can be confusing, and it slows
down prep_buildtree when there are many build trees.
When prep_buildtree was first created, it was more common for the
build tree to be outside the source tree, in which case this is not a
problem. But now with the arrival of meson, it appears to be more
common (and also the way it is documented in the PostgreSQL
documentation) to have the build tree inside the source tree. (To be
clear: This change does not affect meson at all. But it would be an
issue for example if you have a meson build tree and a configure build
tree under the same source tree.)
To fix this, change the "find" command to process only those top-level
directories that we know about (namely config, contrib, doc, src). (I
alternatively looked for ways to ignore directories that looked like
build directories, but that seemed extremely complicated.) With that,
we can also remove the code that ignores directories related to
source-control management.
In passing, also remove the workaround for handling prebuilt docs,
since that has been obsolete since commit 54fac0e5050.
Reviewed-by: Nazir Bilal Yavuz <byavuz81@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/8b96b07f-1f48-46e9-b26e-01b2c9e4ac8d%40eisentraut.org M config/prep_buildtree
Rename XLogData protocol message to WALData
commit : 07684443b1e03cd56a6a9dee589f5de91e3f9a34
author : Álvaro Herrera <alvherre@kurilemu.de>
date : Mon, 4 Aug 2025 14:03:01 +0200
committer: Álvaro Herrera <alvherre@kurilemu.de>
date : Mon, 4 Aug 2025 14:03:01 +0200 This name is only used as documentation, and using this name is
consistent with its byte being a 'w'. Renaming it would also make the
use of a symbolic name based on the word "WAL" rather than the obsolete
"XLog" term more consistent, per future commits along the lines of
37c7a7eeb6d1, 4a68d5008869, f4b54e1ed985.
Discussion: https://postgr.es/m/aIECfYfevCUpenBT@nathan M doc/src/sgml/protocol.sgml
M src/bin/pg_basebackup/pg_recvlogical.c
M src/bin/pg_basebackup/receivelog.c
Avoid unexpected shutdown when sync_replication_slots is enabled.
commit : 4614d53d4ef4d2249df45adedd85da8129feee94
author : Fujii Masao <fujii@postgresql.org>
date : Mon, 4 Aug 2025 20:51:42 +0900
committer: Fujii Masao <fujii@postgresql.org>
date : Mon, 4 Aug 2025 20:51:42 +0900 Previously, enabling sync_replication_slots while wal_level was not set
to logical could cause the server to shut down. This was because
the postmaster performed a configuration check before launching
the slot synchronization worker and raised an ERROR if the settings
were incompatible. Since ERROR is treated as FATAL in the postmaster,
this resulted in the entire server shutting down unexpectedly.
This commit changes the postmaster to log that message with a LOG-level
instead of raising an ERROR, allowing the server to continue running
even with the misconfiguration.
Back-patch to v17, where slot synchronization was introduced.
Reported-by: Hugo DUBOIS <hdubois@scaleway.com>
Author: Fujii Masao <masao.fujii@gmail.com>
Reviewed-by: Hugo DUBOIS <hdubois@scaleway.com>
Reviewed-by: Shveta Malik <shveta.malik@gmail.com>
Discussion: https://postgr.es/m/CAH0PTU_pc3oHi__XESF9ZigCyzai1Mo3LsOdFyQA4aUDkm01RA@mail.gmail.com
Backpatch-through: 17 M src/backend/replication/logical/slotsync.c
doc: mention unusability of dropped CHECK to verify NOT NULL
commit : 126665289fa8e0f7b30165674983f079a5896d91
author : Álvaro Herrera <alvherre@kurilemu.de>
date : Mon, 4 Aug 2025 13:26:45 +0200
committer: Álvaro Herrera <alvherre@kurilemu.de>
date : Mon, 4 Aug 2025 13:26:45 +0200 It's possible to use a CHECK (col IS NOT NULL) constraint to skip
scanning a table for nulls when adding a NOT NULL constraint on the same
column. However, if the CHECK constraint is dropped on the same command
that the NOT NULL is added, this fails, i.e., makes the NOT NULL addition
slow. The best we can do about it at this stage is to document this so
that users aren't taken by surprise.
(In Postgres 18 you can directly add the NOT NULL constraint as NOT
VALID instead, so there's no longer much use for the CHECK constraint,
therefore no point in building mechanism to support the case better.)
Reported-by: Andrew <psy2000usa@yahoo.com>
Reviewed-by: David G. Johnston <david.g.johnston@gmail.com>
Discussion: https://postgr.es/m/175385113607.786.16774570234342968908@wrigleys.postgresql.org M doc/src/sgml/ref/alter_table.sgml
Fix incorrect comment regarding mod_since_analyze
commit : bca9a1900c87df86dd10d227910050cf85000c53
author : David Rowley <drowley@postgresql.org>
date : Mon, 4 Aug 2025 17:43:22 +1200
committer: David Rowley <drowley@postgresql.org>
date : Mon, 4 Aug 2025 17:43:22 +1200 Author: Yugo Nagata <nagata@sraoss.co.jp>
Discussion: https://postgr.es/m/20250804140120.280c2d6a9d2ea687cd167743@sraoss.co.jp M src/backend/commands/analyze.c
Detect and report update_deleted conflicts.
commit : fd5a1a0c3e566f7fc860838084466a1c25944281
author : Amit Kapila <akapila@postgresql.org>
date : Mon, 4 Aug 2025 04:02:47 +0000
committer: Amit Kapila <akapila@postgresql.org>
date : Mon, 4 Aug 2025 04:02:47 +0000 This enhancement builds upon the infrastructure introduced in commit
228c370868, which enables the preservation of deleted tuples and their
origin information on the subscriber. This capability is crucial for
handling concurrent transactions replicated from remote nodes.
The update introduces support for detecting update_deleted conflicts
during the application of update operations on the subscriber. When an
update operation fails to locate the target row-typically because it has
been concurrently deleted-we perform an additional table scan. This scan
uses the SnapshotAny mechanism and we do this additional scan only when
the retain_dead_tuples option is enabled for the relevant subscription.
The goal of this scan is to locate the most recently deleted tuple-matching
the old column values from the remote update-that has not yet been removed
by VACUUM and is still visible according to our slot (i.e., its deletion
is not older than conflict-detection-slot's xmin). If such a tuple is
found, the system reports an update_deleted conflict, including the origin
and transaction details responsible for the deletion.
This provides a groundwork for more robust and accurate conflict
resolution process, preventing unexpected behavior by correctly
identifying cases where a remote update clashes with a deletion from
another origin.
Author: Zhijie Hou <houzj.fnst@fujitsu.com>
Reviewed-by: shveta malik <shveta.malik@gmail.com>
Reviewed-by: Nisha Moond <nisha.moond412@gmail.com>
Reviewed-by: Dilip Kumar <dilipbalaut@gmail.com>
Reviewed-by: Hayato Kuroda <kuroda.hayato@fujitsu.com>
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>
Discussion: https://postgr.es/m/OS0PR01MB5716BE80DAEB0EE2A6A5D1F5949D2@OS0PR01MB5716.jpnprd01.prod.outlook.com M doc/src/sgml/catalogs.sgml
M doc/src/sgml/logical-replication.sgml
M doc/src/sgml/monitoring.sgml
M doc/src/sgml/ref/create_subscription.sgml
M src/backend/catalog/system_views.sql
M src/backend/executor/execReplication.c
M src/backend/replication/logical/conflict.c
M src/backend/replication/logical/worker.c
M src/backend/utils/adt/pgstatfuncs.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/include/executor/executor.h
M src/include/replication/conflict.h
M src/include/replication/worker_internal.h
M src/test/regress/expected/rules.out
M src/test/subscription/t/035_conflicts.pl
Take a little more care in set_backtrace().
commit : 5c8eda1f72a2b0a8c48ada9b872eb5ef581f7c81
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Sun, 3 Aug 2025 13:01:17 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Sun, 3 Aug 2025 13:01:17 -0400 Coverity complained that the "errtrace" string is leaked if we return
early because backtrace_symbols fails. Another criticism that could
be leveled at this is that not providing any hint of what happened is
user-unfriendly. Fix that.
The odds of a leak here are small, and typically it wouldn't matter
anyway since the leak will be in ErrorContext which will soon get
reset. So I'm not feeling a need to back-patch. M src/backend/utils/error/elog.c
Avoid leakage of zero-length arrays in partition_bounds_copy().
commit : 4fbfdde58e4cd091f88737dffa241b08c23d8829
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Sat, 2 Aug 2025 21:26:21 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Sat, 2 Aug 2025 21:26:21 -0400 If ndatums is zero, the code would allocate zero-length boundKinds
and boundDatums chunks, which would have nothing pointing to them,
leading to Valgrind complaints. Rearrange the code to avoid the
useless pallocs, and also to not bother computing byval/typlen when
they aren't used.
I'm unsure why I didn't see this in my Valgrind testing back in May.
This code hasn't changed since then, but maybe we added a regression
test that reaches this edge case. Or possibly I just failed to
notice the reports, which do say "0 bytes lost".
Author: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/285483.1746756246@sss.pgh.pa.us M src/backend/partitioning/partbounds.c
Silence complaints about leaks in PlanCacheComputeResultDesc.
commit : b102c8c4733cf76ff0635dc440ee8dd11487ed95
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Sat, 2 Aug 2025 19:44:10 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Sat, 2 Aug 2025 19:44:10 -0400 CompleteCachedPlan intentionally doesn't worry about small
leaks from PlanCacheComputeResultDesc. However, Valgrind
knows nothing of engineering tradeoffs and complains anyway.
Silence it by doing things the hard way if USE_VALGRIND.
I don't really love this patch, because it makes the handling
of plansource->resultDesc different from the handling of query
dependencies and search_path just above, which likewise are willing
to accept small leaks into the cached plan's context. However,
those cases aren't provoking Valgrind complaints. (Perhaps in a
CLOBBER_CACHE_ALWAYS build, they would?) For the moment, this
makes the src/pl/plpgsql tests leak-free according to Valgrind.
Author: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Andres Freund <andres@anarazel.de>
Discussion: https://postgr.es/m/285483.1746756246@sss.pgh.pa.us M src/backend/utils/cache/plancache.c
Suppress complaints about leaks in TS dictionary loading.
commit : 7f6ededa764b287ba593a2bb7fd566df8053213e
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Sat, 2 Aug 2025 19:43:53 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Sat, 2 Aug 2025 19:43:53 -0400 Like the situation with function cache loading, text search
dictionary loading functions tend to leak some cruft into the
dictionary's long-lived cache context. To judge by the examples in
the core regression tests, not very many bytes are at stake.
Moreover, I don't see a way to prevent such leaks without changing the
API for TS template initialization functions: right now they do not
have to worry about making sure that their results are long-lived.
Hence, I think we should install a suppression rule rather than trying
to fix this completely. However, I did grab some low-hanging fruit:
several places were leaking the result of get_tsearch_config_filename.
This seems worth doing mostly because they are inconsistent with other
dictionaries that were freeing it already.
Author: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Andres Freund <andres@anarazel.de>
Discussion: https://postgr.es/m/285483.1746756246@sss.pgh.pa.us M src/backend/tsearch/dict_ispell.c
M src/backend/tsearch/dict_synonym.c
M src/backend/tsearch/dict_thesaurus.c
M src/backend/utils/cache/ts_cache.c
M src/tools/valgrind.supp
Suppress complaints about leaks in function cache loading.
commit : 2c7b4ad24dda86a73d80df063e9a56c3ecb1e4bb
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Sat, 2 Aug 2025 19:43:04 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Sat, 2 Aug 2025 19:43:04 -0400 PL/pgSQL and SQL-function parsing leak some stuff into the long-lived
function cache context. This isn't really a huge practical problem,
since it's not a large amount of data and the cruft will be recovered
if we have to re-parse the function. It's not clear that it's worth
working any harder than the previous patch did to eliminate these
leak complaints, so instead silence them with a suppression rule.
This suppression rule also hides the fact that CachedFunction structs
are intentionally leaked in some cases because we're unsure if any
fn_extra pointers remain. That might be nice to do something about
eventually, but it's not clear how.
Author: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Andres Freund <andres@anarazel.de>
Discussion: https://postgr.es/m/285483.1746756246@sss.pgh.pa.us M src/tools/valgrind.supp
Reduce leakage during PL/pgSQL function compilation.
commit : 9f18fa9995628fef752d704d874eeed0bab815e5
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Sat, 2 Aug 2025 19:39:03 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Sat, 2 Aug 2025 19:39:03 -0400 format_procedure leaks memory, so run it in a short-lived context
not the session-lifespan cache context for the PL/pgSQL function.
parse_datatype called the core parser in the function's cache context,
thus leaking potentially a lot of storage into that context. We were
also being a bit careless with the TypeName structures made in that
code path and others. Most of the time we don't need to retain the
TypeName, so make sure it is made in the short-lived temp context,
and copy it only if we do need to retain it.
These are far from the only leaks in PL/pgSQL compilation, but
they're the biggest as far as I've seen, and further improvement
looks like it'd require delicate and bug-prone surgery.
Author: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Andres Freund <andres@anarazel.de>
Discussion: https://postgr.es/m/285483.1746756246@sss.pgh.pa.us M src/pl/plpgsql/src/pl_comp.c
M src/pl/plpgsql/src/pl_gram.y
Silence Valgrind leakage complaints in more-or-less-hackish ways.
commit : db01c90b2f024298b08dca8aed6b43a2347dee0e
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Sat, 2 Aug 2025 19:32:12 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Sat, 2 Aug 2025 19:32:12 -0400 These changes don't actually fix any leaks. They just make sure that
Valgrind will find pointers to data structures that remain allocated
at process exit, and thus not falsely complain about leaks. In
particular, we are trying to avoid situations where there is no
pointer to the beginning of an allocated block (except possibly
within the block itself, which Valgrind won't count).
* Because dynahash.c never frees hashtable storage except by deleting
the whole hashtable context, it doesn't bother to track the individual
blocks of elements allocated by element_alloc(). This results in
"possibly lost" complaints from Valgrind except when the first element
of each block is actively in use. (Otherwise it'll be on a freelist,
but very likely only reachable via "interior pointers" within element
blocks, which doesn't satisfy Valgrind.)
To fix, if we're building with USE_VALGRIND, expend an extra pointer's
worth of space in each element block so that we can chain them all
together from the HTAB header. Skip this in shared hashtables though:
Valgrind doesn't track those, and we'd need additional locking to make
it safe to manipulate a shared chain.
While here, update a comment obsoleted by 9c911ec06.
* Put the dlist_node fields of catctup and catclist structs first.
This ensures that the dlist pointers point to the starts of these
palloc blocks, and thus that Valgrind won't consider them
"possibly lost".
* The postmaster's PMChild structs and the autovac launcher's
avl_dbase structs also have the dlist_node-is-not-first problem,
but putting it first still wouldn't silence the warning because we
bulk-allocate those structs in an array, so that Valgrind sees a
single allocation. Commonly the first array element will be pointed
to only from some later element, so that the reference would be an
interior pointer even if it pointed to the array start. (This is the
same issue as for dynahash elements.) Since these are pretty simple
data structures, I don't feel too bad about faking out Valgrind by
just keeping a static pointer to the array start.
(This is all quite hacky, and it's not hard to imagine usages where
we'd need some other idea in order to have reasonable leak tracking of
structures that are only accessible via dlist_node lists. But these
changes seem to be enough to silence this class of leakage complaints
for the moment.)
* Free a couple of data structures manually near the end of an
autovacuum worker's run when USE_VALGRIND, and ensure that the final
vac_update_datfrozenxid() call is done in a non-permanent context.
This doesn't have any real effect on the process's total memory
consumption, since we're going to exit as soon as that last
transaction is done. But it does pacify Valgrind.
* Valgrind complains about the postmaster's socket-files and
lock-files lists being leaked, which we can silence by just
not nulling out the static pointers to them.
* Valgrind seems not to consider the global "environ" variable as
a valid root pointer; so when we allocate a new environment array,
it claims that data is leaked. To fix that, keep our own
statically-allocated copy of the pointer, similarly to the previous
item.
Author: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Andres Freund <andres@anarazel.de>
Discussion: https://postgr.es/m/285483.1746756246@sss.pgh.pa.us M src/backend/libpq/pqcomm.c
M src/backend/postmaster/autovacuum.c
M src/backend/postmaster/pmchild.c
M src/backend/utils/hash/dynahash.c
M src/backend/utils/init/miscinit.c
M src/backend/utils/misc/ps_status.c
M src/include/utils/catcache.h
Fix assorted pretty-trivial memory leaks in the backend.
commit : e78d1d6d47dc7f04fb59fddfc38bab73ec8f1e82
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Sat, 2 Aug 2025 19:07:53 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Sat, 2 Aug 2025 19:07:53 -0400 In the current system architecture, none of these are worth obsessing
over; most are once-per-process leaks. However, Valgrind complains
about all of them, and if we get to using threads rather than
processes for backend sessions, it will become more interesting to
avoid per-session leaks.
* Fix leaks in StartupXLOG() and ShutdownWalRecovery().
* Fix leakage of pq_mq_handle in a parallel worker.
While at it, move mq_putmessage's "Assert(pq_mq_handle != NULL)"
to someplace where it's not trivially useless.
* Fix leak in logicalrep_worker_detach().
* Don't leak the startup-packet buffer in ProcessStartupPacket().
* Fix leak in evtcache.c's DecodeTextArrayToBitmapset().
If the presented array is toasted, this neglected to free the
detoasted copy, which was then leaked into EventTriggerCacheContext.
* I'm distressed by the amount of code that BuildEventTriggerCache
is willing to run while switched into a long-lived cache context.
Although the detoasted array is the only leak that Valgrind reports,
let's tighten things up while we're here. (DecodeTextArrayToBitmapset
is still run in the cache context, so doing this doesn't remove the
need for the detoast fix. But it reduces the surface area for other
leaks.)
* load_domaintype_info() intentionally leaked some intermediate cruft
into the long-lived DomainConstraintCache's memory context, reasoning
that the amount of leakage will typically not be much so it's not
worth doing a copyObject() of the final tree to avoid that. But
Valgrind knows nothing of engineering tradeoffs and complains anyway.
On the whole, the copyObject doesn't cost that much and this is surely
not a performance-critical code path, so let's do it the clean way.
* MarkGUCPrefixReserved didn't bother to clean up removed placeholder
GUCs at all, which shows up as a leak in one regression test.
It seems appropriate for it to do as much cleanup as
define_custom_variable does when replacing placeholders, so factor
that code out into a helper function. define_custom_variable's logic
was one brick shy of a load too: it forgot to free the separate
allocation for the placeholder's name.
Author: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Andres Freund <andres@anarazel.de>
Reviewed-by: Richard Guo <guofenglinux@gmail.com>
Discussion: https://postgr.es/m/285483.1746756246@sss.pgh.pa.us M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogrecovery.c
M src/backend/libpq/pqmq.c
M src/backend/replication/logical/launcher.c
M src/backend/tcop/backend_startup.c
M src/backend/utils/cache/evtcache.c
M src/backend/utils/cache/typcache.c
M src/backend/utils/misc/guc.c
Fix MemoryContextAllocAligned's interaction with Valgrind.
commit : 9e9190154ef204a4e814dcc99f763398f7094667
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Sat, 2 Aug 2025 18:31:39 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Sat, 2 Aug 2025 18:31:39 -0400 Arrange that only the "aligned chunk" part of the allocated space is
included in a Valgrind vchunk. This suppresses complaints about that
vchunk being possibly lost because PG is retaining only pointers to
the aligned chunk. Also make sure that trailing wasted space is
marked NOACCESS.
As a tiny performance improvement, arrange that MCXT_ALLOC_ZERO zeroes
only the returned "aligned chunk", not the wasted padding space.
In passing, fix GetLocalBufferStorage to use MemoryContextAllocAligned
instead of rolling its own implementation, which was equally broken
according to Valgrind.
Author: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Andres Freund <andres@anarazel.de>
Discussion: https://postgr.es/m/285483.1746756246@sss.pgh.pa.us M src/backend/storage/buffer/localbuf.c
M src/backend/utils/mmgr/alignedalloc.c
M src/backend/utils/mmgr/mcxt.c
Improve our support for Valgrind's leak tracking.
commit : bb049a79d3447e97c0d4fa220600c423c4474bf9
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Sat, 2 Aug 2025 18:26:19 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Sat, 2 Aug 2025 18:26:19 -0400 When determining whether an allocated chunk is still reachable,
Valgrind will consider only pointers within what it believes to be
allocated chunks. Normally, all of a block obtained from malloc()
would be considered "allocated" --- but it turns out that if we use
VALGRIND_MEMPOOL_ALLOC to designate sub-section(s) of a malloc'ed
block as allocated, all the rest of that malloc'ed block is ignored.
This leads to lots of false positives of course. In particular,
in any multi-malloc-block context, all but the primary block were
reported as leaked. We also had a problem with context "ident"
strings, which were reported as leaked unless there was some other
pointer to them besides the one in the context header.
To fix, we need to use VALGRIND_MEMPOOL_ALLOC to designate
a context's management structs (the context struct itself and
any per-block headers) as allocated chunks. That forces moving
the VALGRIND_CREATE_MEMPOOL/VALGRIND_DESTROY_MEMPOOL calls into
the per-context-type code, so that the pool identifier can be
made as soon as we've allocated the initial block, but otherwise
it's fairly straightforward. Note that in Valgrind's eyes there
is no distinction between these allocations and the allocations
that the mmgr modules hand out to user code. That's fine for
now, but perhaps someday we'll want to do better yet.
When reading this patch, it's helpful to start with the comments
added at the head of mcxt.c.
Author: Andres Freund <andres@anarazel.de>
Co-authored-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/285483.1746756246@sss.pgh.pa.us
Discussion: https://postgr.es/m/20210317181531.7oggpqevzz6bka3g@alap3.anarazel.de M src/backend/utils/mmgr/aset.c
M src/backend/utils/mmgr/bump.c
M src/backend/utils/mmgr/generation.c
M src/backend/utils/mmgr/mcxt.c
M src/backend/utils/mmgr/slab.c
M src/include/utils/memdebug.h
Fix assertion failure in pgbench when handling multiple pipeline sync messages.
commit : 12efa48978c6dba5eca1b95758127181783fb217
author : Fujii Masao <fujii@postgresql.org>
date : Sun, 3 Aug 2025 10:49:03 +0900
committer: Fujii Masao <fujii@postgresql.org>
date : Sun, 3 Aug 2025 10:49:03 +0900 Previously, when running pgbench in pipeline mode with a custom script
that triggered retriable errors (e.g., serialization errors),
an assertion failure could occur:
Assertion failed: (res == ((void*)0)), function discardUntilSync, file pgbench.c, line 3515.
The root cause was that pgbench incorrectly assumed only a single
pipeline sync message would be received at the end. In reality,
multiple pipeline sync messages can be sent and must be handled properly.
This commit fixes the issue by updating pgbench to correctly process
multiple pipeline sync messages, preventing the assertion failure.
Back-patch to v15, where the bug was introduced.
Author: Fujii Masao <masao.fujii@gmail.com>
Reviewed-by: Tatsuo Ishii <ishii@postgresql.org>
Discussion: https://postgr.es/m/CAHGQGwFAX56Tfx+1ppo431OSWiLLuW72HaGzZ39NkLkop6bMzQ@mail.gmail.com
Backpatch-through: 15 M src/bin/pgbench/pgbench.c
Simplify options in pg_dump and pg_restore.
commit : 6a46089e458f2d700dd3b8c3f6fc782de933529a
author : Jeff Davis <jdavis@postgresql.org>
date : Sat, 2 Aug 2025 07:51:42 -0700
committer: Jeff Davis <jdavis@postgresql.org>
date : Sat, 2 Aug 2025 07:51:42 -0700 Remove redundant options --with-data and --with-schema, and rename
--with-statistics to just --statistics.
Reviewed-by: Nathan Bossart <nathandbossart@gmail.com>
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>
Discussion: https://postgr.es/m/f379d0aeefe8effe13302a436bc28f549f09e924.camel@j-davis.com
Backpatch-through: 18 M doc/src/sgml/ref/pg_dump.sgml
M doc/src/sgml/ref/pg_dumpall.sgml
M doc/src/sgml/ref/pg_restore.sgml
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dumpall.c
M src/bin/pg_dump/pg_restore.c
M src/bin/pg_dump/t/002_pg_dump.pl
M src/bin/pg_upgrade/dump.c
Fix typo in foreign_key.sql
commit : 2106fe25a1c025a75effb7fefcbd47c68d4b9914
author : Michael Paquier <michael@paquier.xyz>
date : Sat, 2 Aug 2025 19:54:23 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Sat, 2 Aug 2025 19:54:23 +0900 Introduced by eec0040c4bcd.
Author: Chao Li <lic@highgo.com>
Discussion: https://postgr.es/m/CAEoWx2kKMdtWKQiYNuwG2L41YwHA7G3sUsRfD9esPJwZyX1+Eg@mail.gmail.com
Backpatch-through: 18 M src/test/regress/expected/foreign_key.out
M src/test/regress/sql/foreign_key.sql
Doc: clarify the restrictions of AFTER triggers with transition tables.
commit : 37e774458542f2fc34ce3610c5fe39cf7b1d4818
author : Etsuro Fujita <efujita@postgresql.org>
date : Sat, 2 Aug 2025 18:30:00 +0900
committer: Etsuro Fujita <efujita@postgresql.org>
date : Sat, 2 Aug 2025 18:30:00 +0900 It was not very clear that the triggers are only allowed on plain tables
(not foreign tables). Also, rephrase the documentation for better
readability.
Follow up to commit 9e6104c66.
Reported-by: Etsuro Fujita <etsuro.fujita@gmail.com>
Author: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>
Reviewed-by: Etsuro Fujita <etsuro.fujita@gmail.com>
Discussion: https://postgr.es/m/CAPmGK16XBs9ptNr8Lk4f-tJZogf6y-Prz%3D8yhvJbb_4dpsc3mQ%40mail.gmail.com
Backpatch-through: 13 M doc/src/sgml/ref/create_trigger.sgml
Fix use-after-free with INSERT ON CONFLICT changes in reorderbuffer.c
commit : 3b3fa949009393541e552b8ae42cc2b03be25549
author : Michael Paquier <michael@paquier.xyz>
date : Sat, 2 Aug 2025 17:08:45 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Sat, 2 Aug 2025 17:08:45 +0900 In ReorderBufferProcessTXN(), used to send the data of a transaction to
an output plugin, INSERT ON CONFLICT changes (INTERNAL_SPEC_INSERT) are
delayed until a confirmation record arrives (INTERNAL_SPEC_CONFIRM),
updating the change being processed.
8c58624df462 has added an extra step after processing a change to update
the progress of the transaction, by calling the callback
update_progress_txn() based on the LSN stored in a change after a
threshold of CHANGES_THRESHOLD (100) is reached. This logic has missed
the fact that for an INSERT ON CONFLICT change the data is freed once
processed, hence update_progress_txn() could be called pointing to a LSN
value that's already been freed. This could result in random crashes,
depending on the workload.
Per discussion, this issue is fixed by reusing in update_progress_txn()
the LSN from the change processed found at the beginning of the loop,
meaning that for a INTERNAL_SPEC_CONFIRM change the progress is updated
using the LSN of the INTERNAL_SPEC_CONFIRM change, and not the LSN from
its INTERNAL_SPEC_INSERT change. This is actually more correct, as we
want to update the progress to point to the INTERNAL_SPEC_CONFIRM
change.
Masahiko Sawada has found a nice trick to reproduce the issue: hardcode
CHANGES_THRESHOLD at 1 and run test_decoding (test "ddl" being enough)
on an instance running valgrind. The bug has been analyzed by Ethan
Mertz, who also originally suggested the solution used in this patch.
Issue introduced by 8c58624df462, so backpatch down to v16.
Author: Ethan Mertz <ethan.mertz@gmail.com>
Co-authored-by: Michael Paquier <michael@paquier.xyz>
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>
Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com>
Discussion: https://postgr.es/m/aIsQqDZ7x4LAQ6u1@paquier.xyz
Backpatch-through: 16 M src/backend/replication/logical/reorderbuffer.c
Allow resetting unknown custom GUCs with reserved prefixes.
commit : 9eb6068fb64c36889102a09c030d1d9f4d832821
author : Nathan Bossart <nathan@postgresql.org>
date : Fri, 1 Aug 2025 16:52:11 -0500
committer: Nathan Bossart <nathan@postgresql.org>
date : Fri, 1 Aug 2025 16:52:11 -0500 Currently, ALTER DATABASE/ROLE/SYSTEM RESET [ALL] with an unknown
custom GUC with a prefix reserved by MarkGUCPrefixReserved() errors
(unless a superuser runs a RESET ALL variant). This is problematic
for cases such as an extension library upgrade that removes a GUC.
To fix, simply make sure the relevant code paths explicitly allow
it. Note that we require superuser or privileges on the parameter
to reset it. This is perhaps a bit more restrictive than is
necessary, but it's not clear whether further relaxing the
requirements is safe.
Oversight in commit 88103567cb. The ALTER SYSTEM fix is dependent
on commit 2d870b4aef, which first appeared in v17. Unfortunately,
back-patching that commit would introduce ABI breakage, and while
that breakage seems unlikely to bother anyone, it doesn't seem
worth the risk. Hence, the ALTER SYSTEM part of this commit is
omitted on v15 and v16.
Reported-by: Mert Alev <mert@futo.org>
Reviewed-by: Laurenz Albe <laurenz.albe@cybertec.at>
Discussion: https://postgr.es/m/18964-ba09dea8c98fccd6%40postgresql.org
Backpatch-through: 15 M contrib/auto_explain/Makefile
A contrib/auto_explain/expected/alter_reset.out
M contrib/auto_explain/meson.build
A contrib/auto_explain/sql/alter_reset.sql
M src/backend/utils/misc/guc.c
Fix typo in AutoVacLauncherMain().
commit : a2c6c4ed3145a411c2591ebd7ca14f30dd98b896
author : Masahiko Sawada <msawada@postgresql.org>
date : Fri, 1 Aug 2025 18:02:41 +0000
committer: Masahiko Sawada <msawada@postgresql.org>
date : Fri, 1 Aug 2025 18:02:41 +0000 Author: Yugo Nagata <nagata@sraoss.co.jp>
Discussion: https://postgr.es/m/20250802002027.cd35c481f6c6bae7ca2a3e26@sraoss.co.jp M src/backend/postmaster/autovacuum.c
pg_dump: reject combination of "only" and "with"
commit : 0ed92cf50cc428dad1732a5e604e5450d47acba3
author : Jeff Davis <jdavis@postgresql.org>
date : Fri, 1 Aug 2025 10:06:57 -0700
committer: Jeff Davis <jdavis@postgresql.org>
date : Fri, 1 Aug 2025 10:06:57 -0700 Reviewed-by: Álvaro Herrera <alvherre@kurilemu.de>
Discussion: https://postgr.es/m/8ce896d1a05040905cc1a3afbc04e94d8e95669a.camel@j-davis.com
Backpatch-through: 18 M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_restore.c
M src/bin/pg_dump/t/002_pg_dump.pl
libpq: Complain about missing BackendKeyData later with PGgetCancel()
commit : a4801eb691ed18ca483f3e2b5f313d5610a7c839
author : Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Fri, 1 Aug 2025 18:24:19 +0300
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Fri, 1 Aug 2025 18:24:19 +0300 PostgreSQL always sends the BackendKeyData message at connection
startup, but there are some third party backend implementations out
there that don't support cancellation, and don't send the message
[1]. While the protocol docs left it up for interpretation if that is
valid behavior, libpq in PostgreSQL 17 and below accepted it. It does
not seem like the libpq behavior was intentional though, since it did
so by sending CancelRequest messages with all zeros to such servers
(instead of returning an error or making the cancel a no-op).
In version 18 the behavior was changed to return an error when trying
to create the cancel object with PGgetCancel() or PGcancelCreate().
This was done without any discussion, as part of supporting different
lengths of cancel packets for the new 3.2 version of the protocol.
This commit changes the behavior of PGgetCancel() / PGcancel() once
more to only return an error when the cancel object is actually used
to send a cancellation, instead of when merely creating the object.
The reason to do so is that some clients [2] create a cancel object as
part of their connection creation logic (thus having the cancel object
ready for later when they need it), so if creating the cancel object
returns an error, the whole connection attempt fails. By delaying the
error, such clients will still be able to connect to the third party
backend implementations in question, but when actually trying to
cancel a query, the user will be notified that that is not possible
for the server that they are connected to.
This commit only changes the behavior of the older PGgetCancel() /
PQcancel() functions, not the more modern PQcancelCreate() family of
functions. I.e. PQcancelCreate() returns a failed connection object
(CONNECTION_BAD) if the server didn't send a cancellation key. Unlike
the old PQgetCancel() function, we're not aware of any clients in the
field that use PQcancelCreate() during connection startup in a way
that would prevent connecting to such servers.
[1] AWS RDS Proxy is definitely one of them, and CockroachDB might be
another.
[2] psycopg2 (but not psycopg3).
Author: Jelte Fennema-Nio <postgres@jeltef.nl>
Reviewed-by: Jacob Champion <jacob.champion@enterprisedb.com>
Backpatch-through: 18
Discussion: https://www.postgresql.org/message-id/20250617.101056.1437027795118961504.ishii%40postgresql.org M doc/src/sgml/protocol.sgml
M src/interfaces/libpq/fe-cancel.c
Fix a deadlock during ALTER SUBSCRIPTION ... DROP PUBLICATION.
commit : 2ab2d6f970584b7ca60cfdf6569336903aa88db5
author : Amit Kapila <akapila@postgresql.org>
date : Fri, 1 Aug 2025 07:58:48 +0000
committer: Amit Kapila <akapila@postgresql.org>
date : Fri, 1 Aug 2025 07:58:48 +0000 A deadlock can occur when the DDL command and the apply worker acquire
catalog locks in different orders while dropping replication origins.
The issue is rare in PG16 and higher branches because, in most cases, the
tablesync worker performs the origin drop in those branches, and its
locking sequence does not conflict with DDL operations.
This patch ensures consistent lock acquisition to prevent such deadlocks.
As per buildfarm.
Reported-by: Alexander Lakhin <exclusion@gmail.com>
Author: Ajin Cherian <itsajin@gmail.com>
Reviewed-by: Hayato Kuroda <kuroda.hayato@fujitsu.com>
Reviewed-by: vignesh C <vignesh21@gmail.com>
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>
Backpatch-through: 14, where it was introduced
Discussion: https://postgr.es/m/bab95e12-6cc5-4ebb-80a8-3e41956aa297@gmail.com M src/backend/catalog/pg_subscription.c
M src/backend/replication/logical/tablesync.c
M src/include/catalog/pg_subscription_rel.h
Fix tab completion for ALTER ROLE|USER ... RESET
commit : ca09ef3a6aa69a1250bc83e6d9517f28a2ff181c
author : Tomas Vondra <tomas.vondra@postgresql.org>
date : Thu, 31 Jul 2025 15:17:26 +0200
committer: Tomas Vondra <tomas.vondra@postgresql.org>
date : Thu, 31 Jul 2025 15:17:26 +0200 Commit c407d5426b87 added tab completion for ALTER ROLE|USER ... RESET,
with the intent to offer only the variables actually set on the role.
But as soon as the user started typing something, it would start to
offer all possible matching variables.
Fix this the same way ALTER DATABASE ... RESET does it, i.e. by
properly considering the prefix.
A second issue causing similar symptoms (offering variables that are not
actually set for a role) was caused by a match to another pattern. The
ALTER DATABASE ... RESET was already excluded, so do the same thing for
ROLE/USER.
Report and fix by Dagfinn Ilmari Mannsåker. Backpatch to 18, same as
c407d5426b87.
Author: Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>
Reviewed-by: jian he <jian.universality@gmail.com>
Discussion: https://postgr.es/m/87qzyghw2x.fsf%40wibble.ilmari.org
Discussion: https://postgr.es/m/87tt4lumqz.fsf%40wibble.ilmari.org
Backpatch-through: 18 M src/bin/psql/tab-complete.in.c
Schema-qualify unnest() in ALTER DATABASE ... RESET
commit : dbf5a83d4650fc893838a2f92306b3d6439f55ba
author : Tomas Vondra <tomas.vondra@postgresql.org>
date : Thu, 31 Jul 2025 15:15:44 +0200
committer: Tomas Vondra <tomas.vondra@postgresql.org>
date : Thu, 31 Jul 2025 15:15:44 +0200 Commit 9df8727c5067 failed to schema-quality the unnest() call in the
query used to list the variables in ALTER DATABASE ... RESET. If there's
another unnest() function in the search_path, this could cause either
failures, or even security issues (when the tab-completion gets used by
privileged accounts).
Report and fix by Dagfinn Ilmari Mannsåker. Backpatch to 18, same as
9df8727c5067.
Author: Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>
Reviewed-by: jian he <jian.universality@gmail.com>
Discussion: https://postgr.es/m/87qzyghw2x.fsf%40wibble.ilmari.org
Discussion: https://postgr.es/m/87tt4lumqz.fsf%40wibble.ilmari.org
Backpatch-through: 18 M src/bin/psql/tab-complete.in.c
Sort dump objects independent of OIDs, for the 7 holdout object types.
commit : 0decd5e89db9f5edb9b27351082f0d74aae7a9b6
author : Noah Misch <noah@leadboat.com>
date : Thu, 31 Jul 2025 06:37:56 -0700
committer: Noah Misch <noah@leadboat.com>
date : Thu, 31 Jul 2025 06:37:56 -0700 pg_dump sorts objects by their logical names, e.g. (nspname, relname,
tgname), before dependency-driven reordering. That removes one source
of logically-identical databases differing in their schema-only dumps.
In other words, it helps with schema diffing. The logical name sort
ignored essential sort keys for constraints, operators, PUBLICATION
... FOR TABLE, PUBLICATION ... FOR TABLES IN SCHEMA, operator classes,
and operator families. pg_dump's sort then depended on object OID,
yielding spurious schema diffs. After this change, OIDs affect dump
order only in the event of catalog corruption. While pg_dump also
wrongly ignored pg_collation.collencoding, CREATE COLLATION restrictions
have been keeping that imperceptible in practical use.
Use techniques like we use for object types already having full sort key
coverage. Where the pertinent queries weren't fetching the ignored sort
keys, this adds columns to those queries and stores those keys in memory
for the long term.
The ignorance of sort keys became more problematic when commit
172259afb563d35001410dc6daad78b250924038 added a schema diff test
sensitive to it. Buildfarm member hippopotamus witnessed that.
However, dump order stability isn't a new goal, and this might avoid
other dump comparison failures. Hence, back-patch to v13 (all supported
versions).
Reviewed-by: Robert Haas <robertmhaas@gmail.com>
Discussion: https://postgr.es/m/20250707192654.9e.nmisch@google.com
Backpatch-through: 13 M src/bin/pg_dump/common.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dump.h
M src/bin/pg_dump/pg_dump_sort.c
M src/test/regress/expected/publication.out
M src/test/regress/sql/publication.sql
pg_stat_statements: Add counters for generic and custom plans
commit : 3357471cf9f5e470dfed0c7919bcf31c7efaf2b9
author : Michael Paquier <michael@paquier.xyz>
date : Thu, 31 Jul 2025 11:20:29 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Thu, 31 Jul 2025 11:20:29 +0900 This patch adds two new counters to pg_stat_statements:
- generic_plan_calls
- custom_plan_calls
These counters track how many times a prepared statement was executed
using a generic or custom plan, respectively, providing a global
equivalent at query level, for top and non-top levels, of
pg_prepared_statements whose data is restricted to a single session.
This commit builds upon e125e360020a. The module is bumped to version
1.13. PGSS_FILE_HEADER is bumped as well, something that the latest
patches touching the on-disk format of the PGSS file did not actually
bother with since 2022..
Author: Sami Imseih <samimseih@gmail.com>
Reviewed-by: Ilia Evdokimov <ilya.evdokimov@tantorlabs.com>
Reviewed-by: Andrei Lepikhov <lepihov@gmail.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Reviewed-by: Nikolay Samokhvalov <nik@postgres.ai>
Discussion: https://postgr.es/m/CAA5RZ0uFw8Y9GCFvafhC=OA8NnMqVZyzXPfv_EePOt+iv1T-qQ@mail.gmail.com M contrib/pg_stat_statements/Makefile
M contrib/pg_stat_statements/expected/oldextversions.out
A contrib/pg_stat_statements/expected/plancache.out
M contrib/pg_stat_statements/meson.build
A contrib/pg_stat_statements/pg_stat_statements–1.12–1.13.sql
M contrib/pg_stat_statements/pg_stat_statements.c
M contrib/pg_stat_statements/pg_stat_statements.control
M contrib/pg_stat_statements/sql/oldextversions.sql
A contrib/pg_stat_statements/sql/plancache.sql
M doc/src/sgml/pgstatstatements.sgml
Rename CachedPlanType to PlannedStmtOrigin for PlannedStmt
commit : e125e360020a7b0affd5bea938b749e85d8999d3
author : Michael Paquier <michael@paquier.xyz>
date : Thu, 31 Jul 2025 10:06:34 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Thu, 31 Jul 2025 10:06:34 +0900 Commit 719dcf3c42 introduced a field called CachedPlanType in
PlannedStmt to allow extensions to determine whether a cached plan is
generic or custom.
After discussion, the concepts that we want to track are a bit wider
than initially anticipated, as it is closer to knowing from which
"source" or "origin" a PlannedStmt has been generated or retrieved.
Custom and generic cached plans are a subset of that.
Based on the state of HEAD, we have been able to define two more
origins:
- "standard", for the case where PlannedStmt is generated in
standard_planner(), the most common case.
- "internal", for the fake PlannedStmt generated internally by some
query patterns.
This could be tuned in the future depending on what is needed. This
looks like a good starting point, at least. The default value is called
"UNKNOWN", provided as fallback value. This value is not used in the
core code, the idea is to let extensions building their own PlannedStmts
know about this new field.
Author: Michael Paquier <michael@paquier.xyz>
Co-authored-by: Sami Imseih <samimseih@gmail.com>
Discussion: https://postgr.es/m/aILaHupXbIGgF2wJ@paquier.xyz M src/backend/commands/foreigncmds.c
M src/backend/commands/schemacmds.c
M src/backend/executor/execParallel.c
M src/backend/optimizer/plan/planner.c
M src/backend/tcop/postgres.c
M src/backend/tcop/utility.c
M src/backend/utils/cache/plancache.c
M src/include/nodes/plannodes.h
M src/tools/pgindent/typedefs.list
doc: Adjust documentation for vacuumdb --missing-stats-only.
commit : ee924698d566223e927cf9d505c1ccdacd7061c8
author : Nathan Bossart <nathan@postgresql.org>
date : Wed, 30 Jul 2025 13:04:47 -0500
committer: Nathan Bossart <nathan@postgresql.org>
date : Wed, 30 Jul 2025 13:04:47 -0500 The sentence in question gave readers the impression that vacuumdb
removes statistics for a period of time while analyzing, but it's
actually meant to convey that --analyze-in-stages temporarily
replaces existing statistics with ones generated with lower
statistics targets.
Reported-by: Frédéric Yhuel <frederic.yhuel@dalibo.com>
Reviewed-by: Frédéric Yhuel <frederic.yhuel@dalibo.com>
Reviewed-by: "David G. Johnston" <david.g.johnston@gmail.com>
Reviewed-by: Corey Huinker <corey.huinker@gmail.com>
Reviewed-by: Jeff Davis <pgsql@j-davis.com>
Discussion: https://postgr.es/m/4b94ca16-7a6d-4581-b2aa-4ea79dbc082a%40dalibo.com
Backpatch-through: 18 M doc/src/sgml/ref/vacuumdb.sgml
Teach pg_upgrade to handle in-place tablespaces.
commit : 412036c22d6a605340dbe397da1fb12fccd3897f
author : Nathan Bossart <nathan@postgresql.org>
date : Wed, 30 Jul 2025 10:48:41 -0500
committer: Nathan Bossart <nathan@postgresql.org>
date : Wed, 30 Jul 2025 10:48:41 -0500 Presently, pg_upgrade assumes that all non-default tablespaces
don't move to different directories during upgrade. Unfortunately,
this isn't true for in-place tablespaces, which move to the new
cluster's pg_tblspc directory. This commit teaches pg_upgrade to
handle in-place tablespaces by retrieving the tablespace
directories for both the old and new clusters. In turn, we can
relax the prohibition on non-default tablespaces for same-version
upgrades, i.e., if all non-default tablespaces are in-place,
pg_upgrade may proceed.
This change is primarily intended to enable additional pg_upgrade
testing with non-default tablespaces, as is done in
006_transfer_modes.pl.
Reviewed-by: Corey Huinker <corey.huinker@gmail.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://postgr.es/m/aA_uBLYMUs5D66Nb%40nathan M src/bin/pg_upgrade/check.c
M src/bin/pg_upgrade/info.c
M src/bin/pg_upgrade/parallel.c
M src/bin/pg_upgrade/pg_upgrade.h
M src/bin/pg_upgrade/relfilenumber.c
M src/bin/pg_upgrade/t/006_transfer_modes.pl
M src/bin/pg_upgrade/tablespace.c
Revert Non text modes for pg_dumpall, and pg_restore support
commit : ce9a6244b5b4ce1df71611512a757353803404a5
author : Andrew Dunstan <andrew@dunslane.net>
date : Wed, 30 Jul 2025 11:04:05 -0400
committer: Andrew Dunstan <andrew@dunslane.net>
date : Wed, 30 Jul 2025 11:04:05 -0400 Recent discussions of the mechanisms used to manage global data have
raised concerns about their robustness and security. Rather than try
to deal with those concerns at a very late stage of the release cycle,
the conclusion is to revert these features and work on them for the
next release.
This reverts parts or all of the following commits:
1495eff7bdb Non text modes for pg_dumpall, correspondingly change pg_restore
5db3bf7391d Clean up from commit 1495eff7bdb
289f74d0cb2 Add more TAP tests for pg_dumpall
2ef57908067 Fix a couple of error messages and tests for them
b52a4a5f285 Clean up error messages from 1495eff7bdb
4170298b6ec Further cleanup for directory creation on pg_dump/pg_dumpall
22cb6d28950 Fix memory leak in pg_restore.c
928394b664b Improve various new-to-v18 appendStringInfo calls
39729ec01d2 Fix fat fingering in 22cb6d28950
5822bf21d50 Add missing space in pg_restore documentation.
f09088a01d3 Free memory properly in pg_restore.c
40b9c27014d pg_restore cleanups
4aad2cb7707 Portability fix: isdigit() must be passed an unsigned char.
88e947136b4 Fix typos and grammar in the code
f60420cff66 doc: Alphabetize long options for pg_dump[all].
bc35adee8d7 doc: Put new options in consistent order on man pages
a876464abc7 Message style improvements
dec6643487b Improve pg_dump/pg_dumpall help synopses and terminology
0ebd2425558 Run pgperltidy
Discussion: https://postgr.es/m/20250708212819.09.nmisch@google.com
Backpatch-to: 18
Reviewed-by: Noah Misch <noah@leadboat.com> M doc/src/sgml/ref/pg_dumpall.sgml
M doc/src/sgml/ref/pg_restore.sgml
M src/bin/pg_dump/meson.build
M src/bin/pg_dump/parallel.c
M src/bin/pg_dump/pg_backup.h
M src/bin/pg_dump/pg_backup_archiver.c
M src/bin/pg_dump/pg_backup_archiver.h
M src/bin/pg_dump/pg_backup_tar.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dumpall.c
M src/bin/pg_dump/pg_restore.c
M src/bin/pg_dump/t/001_basic.pl
D src/bin/pg_dump/t/006_pg_dumpall.pl
Fix whitespace
commit : 00c977177956c4b4d12f8c6518d4269b086deca8
author : Peter Eisentraut <peter@eisentraut.org>
date : Wed, 30 Jul 2025 09:51:45 +0200
committer: Peter Eisentraut <peter@eisentraut.org>
date : Wed, 30 Jul 2025 09:51:45 +0200 M doc/src/sgml/pageinspect.sgml
Fix ./configure checks with __cpuidex() and __cpuid()
commit : 1a5212775e46fd573e74c9213392177920f0efd6
author : Michael Paquier <michael@paquier.xyz>
date : Wed, 30 Jul 2025 11:55:42 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Wed, 30 Jul 2025 11:55:42 +0900 The configure checks used two incorrect functions when checking the
presence of some routines in an environment:
- __get_cpuidex() for the check of __cpuidex().
- __get_cpuid() for the check of __cpuid().
This means that Postgres has never been able to detect the presence of
these functions, impacting environments where these exist, like Windows.
Simply fixing the function name does not work. For example, using
configure with MinGW on Windows causes the checks to detect all four of
__get_cpuid(), __get_cpuid_count(), __cpuidex() and __cpuid() to be
available, causing a compilation failure as this messes up with the
MinGW headers as we would include both <intrin.h> and <cpuid.h>.
The Postgres code expects only one in { __get_cpuid() , __cpuid() } and
one in { __get_cpuid_count() , __cpuidex() } to exist. This commit
reshapes the configure checks to do exactly what meson is doing, which
has been working well for us: check one, then the other, but never allow
both to be detected in a given build.
The logic is wrong since 3dc2d62d0486 and 792752af4eb5 where these
checks have been introduced (the second case is most likely a copy-pasto
coming from the first case), with meson documenting that the configure
checks were broken. As far as I can see, they are not once applied
consistently with what the code expects, but let's see if the buildfarm
has different something to say. The comment in meson.build is adjusted
as well, to reflect the new reality.
Author: Lukas Fittl <lukas@fittl.com>
Co-authored-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://postgr.es/m/aIgwNYGVt5aRAqTJ@paquier.xyz
Backpatch-through: 13 M configure
M configure.ac
M meson.build
Handle cancel requests with PID 0 gracefully
commit : 613f64712257d4b94e068e77fb0593e0a71d8df1
author : Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Wed, 30 Jul 2025 00:39:49 +0300
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>
date : Wed, 30 Jul 2025 00:39:49 +0300 If the client sent a query cancel request with backend PID 0, it
tripped an assertion. With assertions disabled, you got this in the
log instead:
LOG: invalid cancel request with PID 0
LOG: wrong key in cancel request for process 0
Query cancellations don't even require authentication, so we better
tolerate bogus requests. Fix by turning the assertion into a regular
runtime check.
Spotted while testing libpq behavior with a modified server that
didn't send BackendKeyData to the client.
Backpatch-through: 18 M src/backend/storage/ipc/procsignal.c
Don't put library-supplied -L/-I switches before user-supplied ones.
commit : 4300d8b6a79d61abb5ca9f901df7bde7a49322b6
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Tue, 29 Jul 2025 15:17:40 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Tue, 29 Jul 2025 15:17:40 -0400 For many optional libraries, we extract the -L and -l switches needed
to link the library from a helper program such as llvm-config. In
some cases we put the resulting -L switches into LDFLAGS ahead of
-L switches specified via --with-libraries. That risks breaking
the user's intention for --with-libraries.
It's not such a problem if the library's -L switch points to a
directory containing only that library, but on some platforms a
library helper may "helpfully" offer a switch such as -L/usr/lib
that points to a directory holding all standard libraries. If the
user specified --with-libraries in hopes of overriding the standard
build of some library, the -L/usr/lib switch prevents that from
happening since it will come before the user-specified directory.
To fix, avoid inserting these switches directly into LDFLAGS during
configure, instead adding them to LIBDIRS or SHLIB_LINK. They will
still eventually get added to LDFLAGS, but only after the switches
coming from --with-libraries.
The same problem exists for -I switches: those coming from
--with-includes should appear before any coming from helper programs
such as llvm-config. We have not heard field complaints about this
case, but it seems certain that a user attempting to override a
standard library could have issues.
The changes for this go well beyond configure itself, however,
because many Makefiles have occasion to manipulate CPPFLAGS to
insert locally-desirable -I switches, and some of them got it wrong.
The correct ordering is any -I switches pointing at within-the-
source-tree-or-build-tree directories, then those from the tree-wide
CPPFLAGS, then those from helper programs. There were several places
that risked pulling in a system-supplied copy of libpq headers, for
example, instead of the in-tree files. (Commit cb36f8ec2 fixed one
instance of that a few months ago, but this exercise found more.)
The Meson build scripts may or may not have any comparable problems,
but I'll leave it to someone else to investigate that.
Reported-by: Charles Samborski <demurgos@demurgos.net>
Author: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/70f2155f-27ca-4534-b33d-7750e20633d7@demurgos.net
Backpatch-through: 13 M config/llvm.m4
M config/programs.m4
M configure
M configure.ac
M src/Makefile.global.in
M src/backend/jit/llvm/Makefile
M src/bin/initdb/Makefile
M src/common/Makefile
M src/interfaces/libpq-oauth/Makefile
M src/interfaces/libpq/Makefile
M src/pl/plpython/Makefile
M src/pl/tcl/Makefile
Update comment
commit : c3019bb778b99f2541779ed23402a8f825a0000b
author : Peter Eisentraut <peter@eisentraut.org>
date : Tue, 29 Jul 2025 18:56:00 +0200
committer: Peter Eisentraut <peter@eisentraut.org>
date : Tue, 29 Jul 2025 18:56:00 +0200 The code being referred to was moved to a different function in commit
eb8312a22a8, so update the comment accordingly. M src/backend/utils/adt/tid.c
Remove unnecessary complication around xmlParseBalancedChunkMemory.
commit : 902f922218894dd69df1874f9f130dbbafff0499
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Tue, 29 Jul 2025 12:47:19 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Tue, 29 Jul 2025 12:47:19 -0400 When I prepared 71c0921b6 et al yesterday, I was thinking that the
logic involving explicitly freeing the node_list output was still
needed to dodge leakage bugs in libxml2. But I was misremembering:
we introduced that only because with early 2.13.x releases we could
not trust xmlParseBalancedChunkMemory's result code, so we had to
look to see if a node list was returned or not. There's no reason
to believe that xmlParseBalancedChunkMemory will fail to clean up
the node list when required, so simplify. (This essentially
completes reverting all the non-cosmetic changes in 6082b3d5d.)
Reported-by: Jim Jones <jim.jones@uni-muenster.de>
Author: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/997668.1753802857@sss.pgh.pa.us
Backpatch-through: 13 M src/backend/utils/adt/xml.c
Add commit 1d1612aec7 to .git-blame-ignore-revs.
commit : 0f3a26feddae7ae403c90742095ff4626d7e5617
author : Nathan Bossart <nathan@postgresql.org>
date : Tue, 29 Jul 2025 10:32:53 -0500
committer: Nathan Bossart <nathan@postgresql.org>
date : Tue, 29 Jul 2025 10:32:53 -0500 M .git-blame-ignore-revs
Split up pgfdw_report_error so that we can mark it pg_noreturn.
commit : 74e121c8dc5184318478dee587cf7d8303ab1357
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Tue, 29 Jul 2025 10:35:01 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Tue, 29 Jul 2025 10:35:01 -0400 pgfdw_report_error has the same design fault as elog/ereport
do, namely that it might or might not return depending on elevel.
While those functions are too widely used to redesign, there are
only about 30 call sites for pgfdw_report_error, and it's not
exposed for extension use. So let's rethink it. Split it into
pgfdw_report_error() which hard-wires ERROR elevel and is marked
pg_noreturn, and pgfdw_report() which allows only elevels less
than ERROR. (Thanks to Álvaro Herrera for suggesting this naming.)
The motivation for doing this now is that in the wake of commit
80aa9848b, which removed a bunch of PG_TRYs from postgres_fdw,
we're seeing more thorough flow analysis there from C compilers
and Coverity. Marking pgfdw_report_error as noreturn where
appropriate should help prevent false-positive complaints.
We could alternatively have invented a macro wrapper similar
to what we use for elog/ereport, but that code is sufficiently
fragile that I didn't find it appetizing to make another copy.
Since 80aa9848b already changed pgfdw_report_error's signature,
this won't make back-patching any harder than it was already.
Author: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/420221.1753714491@sss.pgh.pa.us M contrib/postgres_fdw/connection.c
M contrib/postgres_fdw/postgres_fdw.c
M contrib/postgres_fdw/postgres_fdw.h
Suppress uninitialized-variable warning.
commit : b9ebb92bcb6e0db111deacfbc14f470ce1b3ed8d
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Tue, 29 Jul 2025 09:42:22 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Tue, 29 Jul 2025 09:42:22 -0400 In the wake of commit 80aa9848b, a few compilers think that
postgresAcquireSampleRowsFunc's "reltuples" might be used
uninitialized. The logic is visibly correct, both before
and after that change; presumably what happened here is that
the previous presence of a setjmp() in the function stopped
them from attempting any flow analysis at all. Add a dummy
initialization to silence the warning.
Reported-by: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>
Author: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/CAExHW5tkerCufA_F6oct5dMJ61N+yVrVgYXL7M8dD-5_zXjrDw@mail.gmail.com M contrib/postgres_fdw/postgres_fdw.c
Run pgindent.
commit : 1d1612aec7688139e1a5506df1366b4b6a69605d
author : Robert Haas <rhaas@postgresql.org>
date : Tue, 29 Jul 2025 09:09:42 -0400
committer: Robert Haas <rhaas@postgresql.org>
date : Tue, 29 Jul 2025 09:09:42 -0400 Per buildfarm member koel, Nathan Bossart, and David Rowley. M src/backend/storage/buffer/bufmgr.c
Add regression test for background worker restart after crash.
commit : cc321b1d1c55fe208a394b0f8e0e99c5fb91742c
author : Fujii Masao <fujii@postgresql.org>
date : Tue, 29 Jul 2025 19:43:10 +0900
committer: Fujii Masao <fujii@postgresql.org>
date : Tue, 29 Jul 2025 19:43:10 +0900 Previously, if a background worker crashed and the server restarted
with restart_after_crash enabled, the worker was not restarted
as expected. This issue was fixed by commit b5d084c5353,
which ensures that background workers without the never-restart flag
are correctly restarted after a crash-and-restart cycle.
To guard against regressions, this commit adds a test that verifies
a background worker successfully restarts in such a scenario.
Author: Fujii Masao <masao.fujii@gmail.com>
Reviewed-by: ChangAo Chen <cca5507@qq.com>
Discussion: https://postgr.es/m/CAHGQGwHF-PdUOgiXCH_8K5qBm8b13h0Qt=dSoFXZybXQdbf-tw@mail.gmail.com M src/test/recovery/t/013_crash_restart.pl
Handle timeout in PostgreSQL::Test::Cluster::is_alive()
commit : cb833c1b6d19507b13a1a852feea4dbe5d6f0c20
author : Michael Paquier <michael@paquier.xyz>
date : Tue, 29 Jul 2025 17:03:07 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Tue, 29 Jul 2025 17:03:07 +0900 This commit adds an extra --timeout=PG_TEST_TIMEOUT_DEFAULT to the call
of pg_isready done in is_alive(), so as it is possible to have more
leverage with the call on machines constrained on resources.
By default the timeout is 180s, and it can be changed depending on the
environment where the tests are run.
Per buildfarm member mamba, where the default timeout of 3s used by
pg_isready has proved that it may not be enough as the postmaster may
not have the time it needs to reply to a ping request.
Reported-by: Alexander Lakhin <exclusion@gmail.com>
Reviewed-by: Nazir Bilal Yavuz <byavuz81@gmail.com>
Discussion: https://postgr.es/m/29b637df-f818-4b52-986a-f11ba28300e9@gmail.com M src/test/perl/PostgreSQL/Test/Cluster.pm
Clarify documentation for the initcap function
commit : c2c2c7e225669e81f83a5db3f0f57131cdaa4a2d
author : Alexander Korotkov <akorotkov@postgresql.org>
date : Tue, 29 Jul 2025 10:41:13 +0300
committer: Alexander Korotkov <akorotkov@postgresql.org>
date : Tue, 29 Jul 2025 10:41:13 +0300 This commit documents differences in the definition of word separators for
the initcap function between libc and ICU locale providers.
Backpatch to all supported branches.
Discussion: https://postgr.es/m/804cc10ef95d4d3b298e76b181fd9437%40postgrespro.ru
Author: Oleg Tselebrovskiy <o.tselebrovskiy@postgrespro.ru>
Backpatch-through: 13 M doc/src/sgml/func.sgml
Display Memoize planner estimates in EXPLAIN
commit : 4bc62b86849065939a6b85273fece6b92d6e97bf
author : David Rowley <drowley@postgresql.org>
date : Tue, 29 Jul 2025 15:18:01 +1200
committer: David Rowley <drowley@postgresql.org>
date : Tue, 29 Jul 2025 15:18:01 +1200 There've been a few complaints that it can be overly difficult to figure
out why the planner picked a Memoize plan. To help address that, here we
adjust the EXPLAIN output to display the following additional details:
1) The estimated number of cache entries that can be stored at once
2) The estimated number of unique lookup keys that we expect to see
3) The number of lookups we expect
4) The estimated hit ratio
Technically #4 can be calculated using #1, #2 and #3, but it's not a
particularly obvious calculation, so we opt to display it explicitly.
The original patch by Lukas Fittl only displayed the hit ratio, but
there was a fear that might lead to more questions about how that was
calculated. The idea with displaying all 4 is to be transparent which
may allow queries to be tuned more easily. For example, if #2 isn't
correct then maybe extended statistics or a manual n_distinct estimate can
be used to help fix poor plan choices.
Author: Ilia Evdokimov <ilya.evdokimov@tantorlabs.com>
Author: Lukas Fittl <lukas@fittl.com>
Reviewed-by: David Rowley <dgrowleyml@gmail.com>
Reviewed-by: Andrei Lepikhov <lepihov@gmail.com>
Reviewed-by: Robert Haas <robertmhaas@gmail.com>
Discussion: https://postgr.es/m/CAP53Pky29GWAVVk3oBgKBDqhND0BRBN6yTPeguV_qSivFL5N_g%40mail.gmail.com M src/backend/commands/explain.c
M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/util/pathnode.c
M src/include/nodes/pathnodes.h
M src/include/nodes/plannodes.h
M src/include/optimizer/pathnode.h
Avoid regression in the size of XML input that we will accept.
commit : 71c0921b649d7a800eb2d6f93539890eaa14d979
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Mon, 28 Jul 2025 16:50:41 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Mon, 28 Jul 2025 16:50:41 -0400 This mostly reverts commit 6082b3d5d, "Use xmlParseInNodeContext
not xmlParseBalancedChunkMemory". It turns out that
xmlParseInNodeContext will reject text chunks exceeding 10MB, while
(in most libxml2 versions) xmlParseBalancedChunkMemory will not.
The bleeding-edge libxml2 bug that we needed to work around a year
ago is presumably no longer a factor, and the argument that
xmlParseBalancedChunkMemory is semi-deprecated is not enough to
justify a functionality regression. Hence, go back to doing it
the old way.
Reported-by: Michael Paquier <michael@paquier.xyz>
Author: Michael Paquier <michael@paquier.xyz>
Co-authored-by: Erik Wienhold <ewie@ewie.name>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/aIGknLuc8b8ega2X@paquier.xyz
Backpatch-through: 13 M src/backend/utils/adt/xml.c
Remove misleading hint for "unexpected data beyond EOF" error.
commit : d5b9b2d40262f57f58322ad49f8928fd4a492adb
author : Robert Haas <rhaas@postgresql.org>
date : Mon, 28 Jul 2025 11:15:47 -0400
committer: Robert Haas <rhaas@postgresql.org>
date : Mon, 28 Jul 2025 11:15:47 -0400 Commit ffae5cc5a6024b4e25ec920ed5c4dfac649605f8 added this hint in 2006,
but it's now obsolete and doesn't reflect what users should really check
in this situation. We were not able to agree on a new hint, so just delete
the existing one and update the comments to mention one possibility that
is known to cause problems of this kind: something other than PostgreSQL
is modifying files in the PostgreSQL data directory.
Author: Jakub Wartak <jakub.wartak@enterprisedb.com>
Reviewed-by: Robert Haas <rhaas@postgresql.org>
Reviewed-by: Andres Freund <andres@anarazel.de>
Reviewed-by: Christoph Berg <myon@debian.org>
Discussion: https://postgr.es/m/CAKZiRmxNbcaL76x=09Sxf7aUmrRQJBf8drzDdUHo+j9_eM+VMg@mail.gmail.com M src/backend/storage/buffer/bufmgr.c
Avoid throwing away the error message in syncrep_yyerror.
commit : dcc9820a3526eb8d89c5da75dad32b8ef4bf8545
author : Robert Haas <rhaas@postgresql.org>
date : Thu, 24 Jul 2025 13:30:43 -0400
committer: Robert Haas <rhaas@postgresql.org>
date : Thu, 24 Jul 2025 13:30:43 -0400 Commit 473a575e05979b4dbb28b3f2544f4ec8f184ce65 purported to make this
function stash the error message in *syncrep_parse_result_p, but
it didn't actually.
As a result, an attempt to set synchronous_standby_names to any value
that does not parse resulted in a generic "parser failed." message
rather than anything more specific. This fixes that.
Discussion: http://postgr.es/m/CA+TgmoYF9wPNZ-Q_EMfib_espgHycY-eX__6Tzo2GpYpVXqCdQ@mail.gmail.com
Backpatch-through: 18 M src/backend/replication/syncrep_scanner.l
ecpg: Fix memory leaks in ecpg_auto_prepare()
commit : 3151c264d460c0be09131ce90529073631d70ae8
author : Michael Paquier <michael@paquier.xyz>
date : Mon, 28 Jul 2025 08:38:24 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Mon, 28 Jul 2025 08:38:24 +0900 This routines includes three code paths that can fail, with the
allocated prepared statement name going out of scope.
Per report from Coverity. Oversight in commit a6eabec6808c, that has
played with the order of some ecpg_strdup() calls in this code path. M src/interfaces/ecpg/ecpglib/prepare.c
Fix performance regression with flush of pending fixed-numbered stats
commit : 793928c2d5ac8e60e1e4054fa3b986369777896d
author : Michael Paquier <michael@paquier.xyz>
date : Mon, 28 Jul 2025 08:15:11 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Mon, 28 Jul 2025 08:15:11 +0900 The callback added in fc415edf8ca8 used to check if there is any pending
data to flush for fixed-numbered statistics, done by looping across all
the builtin and custom stats kinds with a call to have_fixed_pending_cb,
is proving to able to show in workloads that do not report any stats
(read-only, no function calls, no WAL, no IO, etc). The code used in
v17 was cheaper than that what HEAD has introduced, relying on three
boolean checks for WAL, SLRU and IO stats.
This commit switches the code to use a more efficient approach than
fc415edf8ca8, with a single boolean flag that can be switched to "true"
by any fixed-numbered stats kinds to force pgstat_report_stat() to go
through one round of reports. The flag is reset by pgstat_report_stat()
once a full round of reports is done. The flag being false means that
fixed-numbered stats kinds saw no activity, and that there is no pending
data to flush.
ac000fca743e took one step in improving the performance by reducing the
number of stats kinds that the backend can hold. This commit takes a
more drastic step by bringing back the code efficiency to what it was
before v18 with a cheap check at the beginning of pgstat_report_stat()
for its fast-exit path.
The callback have_static_pending_cb is removed as an effect of all that.
Reported-by: Andres Freund <andres@anarazel.de>
Reviewed-by: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Discussion: https://postgr.es/m/eb224uegsga2hgq7dfq3ps5cduhpqej7ir2hjxzzozjthrekx5@dysei6buqthe
Backpatch-through: 18 M src/backend/access/transam/xlog.c
M src/backend/utils/activity/pgstat.c
M src/backend/utils/activity/pgstat_backend.c
M src/backend/utils/activity/pgstat_io.c
M src/backend/utils/activity/pgstat_slru.c
M src/backend/utils/activity/pgstat_wal.c
M src/include/utils/pgstat_internal.h
Process sync requests incrementally in AbsorbSyncRequests
commit : 258bf0a2ea8ff86257f750018bfd44397ce7e554
author : Alexander Korotkov <akorotkov@postgresql.org>
date : Sun, 27 Jul 2025 15:07:47 +0300
committer: Alexander Korotkov <akorotkov@postgresql.org>
date : Sun, 27 Jul 2025 15:07:47 +0300 If the number of sync requests is big enough, the palloc() call in
AbsorbSyncRequests() will attempt to allocate more than 1 GB of memory,
resulting in failure. This can lead to an infinite loop in the checkpointer
process, as it repeatedly fails to absorb the pending requests.
This commit introduces the following changes to cope with this problem:
1. Turn pending checkpointer requests array in shared memory into a bounded
ring buffer.
2. Limit maximum ring buffer size to 10M items.
3. Make AbsorbSyncRequests() process requests incrementally in 10K batches.
Even #2 makes the whole queue size fit the maximum palloc() size of 1 GB.
of continuous lock holding.
This commit is for master only. Simpler fix, which just limits a request
queue size to 10M, will be backpatched.
Reported-by: Ekaterina Sokolova <e.sokolova@postgrespro.ru>
Discussion: https://postgr.es/m/db4534f83a22a29ab5ee2566ad86ca92%40postgrespro.ru
Author: Maxim Orlov <orlovmg@gmail.com>
Co-authored-by: Xuneng Zhou <xunengzhou@gmail.com>
Reviewed-by: Andres Freund <andres@anarazel.de>
Reviewed-by: Heikki Linnakangas <hlinnaka@iki.fi>
Reviewed-by: Alexander Korotkov <aekorotkov@gmail.com> M src/backend/postmaster/checkpointer.c
Add assertions for all the required index AM callbacks
commit : 6f22a82a401d267e4bf1fcbcff8d6adb24e14d58
author : Michael Paquier <michael@paquier.xyz>
date : Sun, 27 Jul 2025 17:48:47 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Sun, 27 Jul 2025 17:48:47 +0900 Similar checks are done for the mandatory table AM callbacks. A portion
of the index AM callbacks are optional and can be NULL; the rest is
mandatory and is documented as such in the documentation and in amapi.h.
These checks are useful to detect quickly if all the mandatory callbacks
are defined when implementing a new index access method, as the
assertions are run when loading the AM.
Author: Japin Li <japinli@hotmail.com>
Discussion: https://postgr.es/m/ME0P300MB0445795D31CEAB92C58B41FDB651A@ME0P300MB0445.AUSP300.PROD.OUTLOOK.COM M src/backend/access/index/amapi.c
Add commit 73873805f to .git-blame-ignore-revs.
commit : db6461b1c9aae122b90bb52430f06efb306b371a
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Fri, 25 Jul 2025 16:45:57 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Fri, 25 Jul 2025 16:45:57 -0400 M .git-blame-ignore-revs
Silence leakage complaint about postgres_fdw's InitPgFdwOptions.
commit : 0f9d4d7c12dcebe951061763ca23ee3b6477e7ca
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Fri, 25 Jul 2025 16:37:29 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Fri, 25 Jul 2025 16:37:29 -0400 Valgrind complains that the PQconninfoOption array returned by libpq
is leaked. We apparently believed that we could suppress that warning
by storing that array's address in a static variable. However, modern
C compilers are bright enough to optimize the static variable away.
We could escalate that arms race by making the variable global.
But on the whole it seems better to revise the code so that it
can free libpq's result properly. The only thing that costs
us is copying the parameter-name keywords; which seems like a
pretty negligible cost in a function that runs at most once per
process.
Author: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Matheus Alcantara <matheusssilv97@gmail.com>
Discussion: https://postgr.es/m/2976982.1748049023@sss.pgh.pa.us M contrib/postgres_fdw/option.c
Run pgindent on the changes of the previous patch.
commit : 73873805fb3627cb23937c750fa83ffd8f16fc6c
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Fri, 25 Jul 2025 16:36:44 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Fri, 25 Jul 2025 16:36:44 -0400 This step can be checked mechanically.
Author: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Matheus Alcantara <matheusssilv97@gmail.com>
Discussion: https://postgr.es/m/2976982.1748049023@sss.pgh.pa.us M contrib/dblink/dblink.c
M contrib/postgres_fdw/connection.c
M contrib/postgres_fdw/postgres_fdw.c
M src/include/libpq/libpq-be-fe-helpers.h
Reap the benefits of not having to avoid leaking PGresults.
commit : 80aa9848befc13c188d2775a859deaf172fdd3a2
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Fri, 25 Jul 2025 16:31:43 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Fri, 25 Jul 2025 16:31:43 -0400 Remove a bunch of PG_TRY constructs, de-volatilize related
variables, remove some PQclear calls in error paths.
Aside from making the code simpler and shorter, this should
provide some marginal performance gains.
For ease of review, I did not re-indent code within the removed
PG_TRY constructs. That'll be done in a separate patch.
Author: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Matheus Alcantara <matheusssilv97@gmail.com>
Discussion: https://postgr.es/m/2976982.1748049023@sss.pgh.pa.us M contrib/dblink/dblink.c
M contrib/postgres_fdw/connection.c
M contrib/postgres_fdw/postgres_fdw.c
M contrib/postgres_fdw/postgres_fdw.h
M src/backend/replication/libpqwalreceiver/libpqwalreceiver.c
M src/include/libpq/libpq-be-fe-helpers.h
Create infrastructure to reliably prevent leakage of PGresults.
commit : 7d8f5957792421ec3bb9d1b9b6ca25d689d974b7
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Fri, 25 Jul 2025 16:30:00 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Fri, 25 Jul 2025 16:30:00 -0400 Commit 232d8caea fixed a case where postgres_fdw could lose track
of a PGresult object, resulting in a process-lifespan memory leak.
But I have little faith that there aren't other potential PGresult
leakages, now or in future, in the backend modules that use libpq.
Therefore, this patch proposes infrastructure that makes all
PGresults returned from libpq act as though they are palloc'd
in the CurrentMemoryContext (with the option to relocate them to
another context later). This should greatly reduce the risk of
careless leaks, and it also permits removal of a bunch of code
that attempted to prevent such leaks via PG_TRY blocks.
This patch adds infrastructure that wraps each PGresult in a
"libpqsrv_PGresult" that provides a memory context reset callback
to PQclear the PGresult. Code using this abstraction is inherently
memory-safe to the same extent as we are accustomed to in most backend
code. Furthermore, we add some macros that automatically redirect
calls of the libpq functions concerned with PGresults to use this
infrastructure, so that almost no source-code changes are needed to
wheel this infrastructure into place in all the backend code that
uses libpq.
Perhaps in future we could create similar infrastructure for
PGconn objects, but there seems less need for that.
This patch just creates the infrastructure and makes relevant code
use it, including reverting 232d8caea in favor of this mechanism.
A good deal of follow-on simplification is possible now that we don't
have to be so cautious about freeing PGresults, but I'll put that in
a separate patch.
Author: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Matheus Alcantara <matheusssilv97@gmail.com>
Discussion: https://postgr.es/m/2976982.1748049023@sss.pgh.pa.us M contrib/postgres_fdw/postgres_fdw.c
M contrib/postgres_fdw/postgres_fdw.h
M src/backend/utils/mmgr/mcxt.c
M src/include/libpq/libpq-be-fe-helpers.h
A src/include/libpq/libpq-be-fe.h
M src/include/utils/palloc.h
M src/tools/pgindent/typedefs.list
Fix dynahash's HASH_FIXED_SIZE ("isfixed") option.
commit : 5457ea46d181f8b8dbe1ae482720b23bff4029de
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Fri, 25 Jul 2025 10:56:55 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Fri, 25 Jul 2025 10:56:55 -0400 This flag was effectively a no-op in EXEC_BACKEND (ie, Windows)
builds, because it was kept in the process-local HTAB struct,
and it could only ever become set in the postmaster's copy.
The simplest fix is to move it to the shared HASHHDR struct.
We could keep a copy in HTAB as well, as we do with keysize
and some other fields, but the "too much contention" argument
doesn't seem to apply here: we only examine isfixed during
element_alloc(), which had better not get hit very often for
a shared hashtable.
This oversight dates to 7c797e719 which invented the option.
But back-patching doesn't seem appropriate given the lack of
field complaints. If there is anyone running an affected
workload on Windows, they might be unhappy about the behavior
changing in a minor release.
Author: Aidar Imamov <a.imamov@postgrespro.ru>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/4d0cb35ff01c5c74d2b9a582ecb73823@postgrespro.ru M src/backend/utils/hash/dynahash.c
Refactor grammar to create opt_utility_option_list
commit : 1dfe3ef3f960d6924eb1f18facf4fbdae6e1cc1d
author : Álvaro Herrera <alvherre@kurilemu.de>
date : Fri, 25 Jul 2025 12:03:19 +0200
committer: Álvaro Herrera <alvherre@kurilemu.de>
date : Fri, 25 Jul 2025 12:03:19 +0200 This changes the grammar for REINDEX, CHECKPOINT, CLUSTER, ANALYZE/ANALYSE;
they still accept the same options as before, but the grammar is written
differently for convenience of future development.
Reviewed-by: Nathan Bossart <nathandbossart@gmail.com>
Discussion: https://postgr.es/m/202507231538.ir7pjzoow6oe@alvherre.pgsql M src/backend/parser/gram.y
Fix background worker not restarting after crash-and-restart cycle.
commit : b5d084c5353f29e2e217dfa86f327e14d02998c1
author : Fujii Masao <fujii@postgresql.org>
date : Fri, 25 Jul 2025 18:38:36 +0900
committer: Fujii Masao <fujii@postgresql.org>
date : Fri, 25 Jul 2025 18:38:36 +0900 Previously, if a background worker crashed (e.g., due to a SIGKILL) and
the server restarted due to restart_after_crash being enabled,
the worker was not restarted as expected. Background workers without
the never-restart flag should automatically restart in this case.
This issue was introduced in commit 28a520c0b77, which failed to reset
the rw_pid field in the RegisteredBgWorker struct for the crashed worker.
This commit fixes the problem by resetting rw_pid for all eligible
background workers during the crash-and-restart cycle.
Back-patched to v18, where the bug was introduced.
Bug fix patches were proposed by Andrey Rudometov and ChangAo Chen,
but this commit uses a different approach.
Reported-by: Andrey Rudometov <unlimitedhikari@gmail.com>
Reported-by: ChangAo Chen <cca5507@qq.com>
Author: Andrey Rudometov <unlimitedhikari@gmail.com>
Author: ChangAo Chen <cca5507@qq.com>
Co-authored-by: Fujii Masao <masao.fujii@gmail.com>
Reviewed-by: ChangAo Chen <cca5507@qq.com>
Reviewed-by: Shveta Malik <shveta.malik@gmail.com>
Discussion: https://postgr.es/m/CAF6JsWiO=i24qYitWe6ns1sXqcL86rYxdyU+pNYk-WueKPSySg@mail.gmail.com
Discussion: https://postgr.es/m/tencent_E00A056B3953EE6440F0F40F80EC30427D09@qq.com
Backpatch-through: 18 M src/backend/postmaster/bgworker.c
M src/backend/postmaster/postmaster.c
Fix assertion failure with latch wait in single-user mode
commit : 641f20d4c433b66df2928408fb2b44bd165c2329
author : Michael Paquier <michael@paquier.xyz>
date : Fri, 25 Jul 2025 16:17:13 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Fri, 25 Jul 2025 16:17:13 +0900 LatchWaitSetPostmasterDeathPos, the latch event position for the
postmaster death event, is initialized under IsUnderPostmaster.
WaitLatch() considered it as a valid wait target in single-user mode
(!IsUnderPostmaster), which was incorrect.
One code path found to fail with an assertion failure is a database drop
in single-user mode while waiting in WaitForProcSignalBarrier() after
the drop.
Oversight in commit 84e5b2f07a5e.
Author: Patrick Stählin <me@packi.ch>
Co-authored-by: Ronan Dunklau <ronan.dunklau@aiven.io>
Discussion: https://postgr.es/m/18996-3a2744c8140488de@postgresql.org
Backpatch-through: 18 M src/backend/storage/ipc/latch.c
Lower bounds related to pgstats kinds
commit : ac000fca743eff923d1feb4bc722d905901ae540
author : Michael Paquier <michael@paquier.xyz>
date : Fri, 25 Jul 2025 11:17:48 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Fri, 25 Jul 2025 11:17:48 +0900 This commit changes stats kinds to have the following bounds, making
their handling in core cheaper by default:
- PGSTAT_KIND_CUSTOM_MIN 128 -> 24
- PGSTAT_KIND_MAX 256 -> 32
The original numbers were rather high, and showed an impact on
performance in pgstat_report_stat() for the case of simple queries with
its early-exit path if there are no pending statistics to flush. This
logic will be improved more in a follow-up commit to bring the
performance of pgstat_report_stat() on par with v17 and older versions.
Lowering the bounds is a change worth doing on its own, independently of
the other improvement.
These new numbers should be enough to leave some room for the following
years for built-in and custom stats kinds, with stable ID numbers. At
least that should be enough to start with this facility for extension
developers. It can be always increased in the tree depending on the
requirements wanted.
Per discussion with Andres Freund and Bertrand Drouvot.
Discussion: https://postgr.es/m/eb224uegsga2hgq7dfq3ps5cduhpqej7ir2hjxzzozjthrekx5@dysei6buqthe
Backpatch-through: 18 M src/include/utils/pgstat_kind.h
M src/test/modules/injection_points/injection_stats.c
M src/test/modules/injection_points/injection_stats_fixed.c
Fix return value of visibilitymap_get_status().
commit : 15d33eb1924c1093102b8ce142ede4cb3912e85e
author : Nathan Bossart <nathan@postgresql.org>
date : Thu, 24 Jul 2025 10:13:45 -0500
committer: Nathan Bossart <nathan@postgresql.org>
date : Thu, 24 Jul 2025 10:13:45 -0500 This function is declared as returning a uint8, but it returns a
bool in one code path. To fix, return (uint8) 0 instead of false
there. This should behave exactly the same as before, but it might
prevent future compiler complaints.
Oversight in commit a892234f83.
Author: Julien Rouhaud <rjuju123@gmail.com>
Discussion: https://postgr.es/m/aIHluT2isN58jqHV%40jrouhaud M src/backend/access/heap/visibilitymap.c
Fix duplicate transaction replay during pg_createsubscriber.
commit : e1c3654839e464957675344a1e949489d98b103b
author : Amit Kapila <akapila@postgresql.org>
date : Thu, 24 Jul 2025 09:05:32 +0000
committer: Amit Kapila <akapila@postgresql.org>
date : Thu, 24 Jul 2025 09:05:32 +0000 Previously, the tool could replay the same transaction twice, once during
recovery, then again during replication after the subscriber was set up.
This occurred because the same recovery_target_lsn was used both to
finalize recovery and to start replication. If
recovery_target_inclusive = true, the transaction at that LSN would be
applied during recovery and then sent again by the publisher leading to
duplication.
To prevent this, we now set recovery_target_inclusive = false. This
ensures the transaction at recovery_target_lsn is not reapplied during
recovery, avoiding duplication when replication begins.
Bug #18897
Reported-by: Zane Duffield <duffieldzane@gmail.com>
Author: Shlok Kyal <shlok.kyal.oss@gmail.com>
Reviewed-by: vignesh C <vignesh21@gmail.com>
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>
Backpatch-through: 17, where it was introduced
Discussion: https://postgr.es/m/18897-d3db67535860dddb@postgresql.org M src/bin/pg_basebackup/pg_createsubscriber.c
Introduce field tracking cached plan type in PlannedStmt
commit : 719dcf3c42260ceebfa2e8f6171a61161737a265
author : Michael Paquier <michael@paquier.xyz>
date : Thu, 24 Jul 2025 15:41:18 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Thu, 24 Jul 2025 15:41:18 +0900 PlannedStmt gains a new field, called CachedPlanType, able to track if a
given plan tree originates from the cache and if we are dealing with a
generic or custom cached plan.
This field can be used for monitoring or statistical purposes, in the
executor hooks, for example, based on the planned statement attached to
a QueryDesc. A patch is under discussion for pg_stat_statements to
provide an equivalent of the counters in pg_prepared_statements for
custom and generic plans, to provide a more global view of such data, as
this data is now restricted to the current session.
The concept introduced in this commit is useful on its own, and has been
extracted from a larger patch by the same author.
Author: Sami Imseih <samimseih@gmail.com>
Reviewed-by: Andrei Lepikhov <lepihov@gmail.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://postgr.es/m/CAA5RZ0uFw8Y9GCFvafhC=OA8NnMqVZyzXPfv_EePOt+iv1T-qQ@mail.gmail.com M src/backend/commands/foreigncmds.c
M src/backend/commands/schemacmds.c
M src/backend/executor/execParallel.c
M src/backend/optimizer/plan/planner.c
M src/backend/tcop/postgres.c
M src/backend/tcop/utility.c
M src/backend/utils/cache/plancache.c
M src/include/nodes/plannodes.h
M src/tools/pgindent/typedefs.list
Fix cfbot failure caused by commit 228c370868.
commit : df335618ed87eecdef44a95e453e345a55a14ad8
author : Amit Kapila <akapila@postgresql.org>
date : Thu, 24 Jul 2025 03:51:55 +0000
committer: Amit Kapila <akapila@postgresql.org>
date : Thu, 24 Jul 2025 03:51:55 +0000 Ensure the test waits for the apply worker to exit after disabling the
subscription. This is necessary to safely enable the retain_dead_tuples
option. Also added a similar wait in another part of the test to prevent
unintended apply worker activity that could lead to test failures
post-subscription disable.
Reported by Michael Paquier as per cfbot.
Author: Zhijie Hou <houzj.fnst@fujitsu.com>
Discussion: https://postgr.es/m/aIGLgfRJIBwExoPj@paquier.xyz M src/test/subscription/t/035_conflicts.pl
doc: Add missing index entries and fix title formatting in pg_buffercache docs.
commit : 086b9a33aafeeeaa0af0c806410ea6228f2f63f4
author : Fujii Masao <fujii@postgresql.org>
date : Thu, 24 Jul 2025 11:43:20 +0900
committer: Fujii Masao <fujii@postgresql.org>
date : Thu, 24 Jul 2025 11:43:20 +0900 This commit adds missing index entries for the functions pg_buffercache_numa()
and pg_buffercache_usage_counts() in the pg_buffercache documentation.
It also makes the function titles consistent by adding parentheses after
function names where they were previously missing.
Author: Fujii Masao <masao.fujii@gmail.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://postgr.es/m/7d19af4b-7da3-4862-9f52-ff958960bd8d@oss.nttdata.com
Backpatch-through: 18 M doc/src/sgml/pgbuffercache.sgml
Fix build breakage on Solaris-alikes with late-model GCC.
commit : e6dfd068ed453b8690551dac700d57fbf32ba187
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Wed, 23 Jul 2025 15:44:29 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Wed, 23 Jul 2025 15:44:29 -0400 Solaris has never bothered to add "const" to the second argument
of PAM conversation procs, as all other Unixen did decades ago.
This resulted in an "incompatible pointer" compiler warning when
building --with-pam, but had no more serious effect than that,
so we never did anything about it. However, as of GCC 14 the
case is an error not warning by default.
To complicate matters, recent OpenIndiana (and maybe illumos
in general?) *does* supply the "const" by default, so we can't
just assume that platforms using our solaris template need help.
What we can do, short of building a configure-time probe,
is to make solaris.h #define _PAM_LEGACY_NONCONST, which
causes OpenIndiana's pam_appl.h to revert to the traditional
definition, and hopefully will have no effect anywhere else.
Then we can use that same symbol to control whether we include
"const" in the declaration of pam_passwd_conv_proc().
Bug: #18995
Reported-by: Andrew Watkins <awatkins1966@gmail.com>
Author: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/18995-82058da9ab4337a7@postgresql.org
Backpatch-through: 13 M src/backend/libpq/auth.c
M src/include/port/solaris.h
Cross-check lists of built-in LWLock tranches.
commit : 2047ad068139f0b8c6da73d0b845ca9ba30fb33d
author : Nathan Bossart <nathan@postgresql.org>
date : Wed, 23 Jul 2025 12:06:20 -0500
committer: Nathan Bossart <nathan@postgresql.org>
date : Wed, 23 Jul 2025 12:06:20 -0500 lwlock.c, lwlock.h, and wait_event_names.txt each contain a list of
built-in LWLock tranches. It is easy to miss one or the other when
adding or removing tranches, and discrepancies have adverse effects
(e.g., breaking JOINs between pg_stat_activity and pg_wait_events).
This commit moves the lists of built-in tranches in lwlock.{c,h} to
lwlocklist.h and adds a cross-check to the script that generates
lwlocknames.h. If the lists do not match exactly, building will
fail.
Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://postgr.es/m/aHpOgwuFQfcFMZ/B%40ip-10-97-1-34.eu-west-3.compute.internal M src/backend/storage/lmgr/generate-lwlocknames.pl
M src/backend/storage/lmgr/lwlock.c
M src/backend/utils/activity/wait_event_names.txt
M src/include/storage/lwlock.h
M src/include/storage/lwlocklist.h
Use PqMsg_* macros in walsender.c
commit : 37c7a7eeb6d13aac8edd7af032562233b0769e34
author : Nathan Bossart <nathan@postgresql.org>
date : Wed, 23 Jul 2025 10:29:45 -0500
committer: Nathan Bossart <nathan@postgresql.org>
date : Wed, 23 Jul 2025 10:29:45 -0500 Oversights in commits f4b54e1ed9, dc21234005, and 228c370868.
Author: Dave Cramer <davecramer@gmail.com>
Discussion: https://postgr.es/m/CADK3HH%2BowWVdnbmWH4NHG8%3D%2BkXA_wjsyEVLoY719iJnb%3D%2BtT6A%40mail.gmail.com M src/backend/replication/walsender.c
Move enum RecoveryTargetAction to xlogrecovery.h
commit : 196063d6761d2c8d6f78cc03afad08efc95a0708
author : Álvaro Herrera <alvherre@kurilemu.de>
date : Wed, 23 Jul 2025 11:02:13 +0200
committer: Álvaro Herrera <alvherre@kurilemu.de>
date : Wed, 23 Jul 2025 11:02:13 +0200 Commit 70e81861fadd split out xlogrecovery.c/h and moved some enums
related to recovery targets to xlogrecovery.h. However, it seems that
the enum RecoveryTargetAction was inadvertently left out by that commit.
This commit moves it to xlogrecovery.h for consistency.
Author: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Discussion: https://postgr.es/m/20240904.173013.1132986940678039655.horikyota.ntt@gmail.com M src/include/access/xlog_internal.h
M src/include/access/xlogrecovery.h
Preserve conflict-relevant data during logical replication.
commit : 228c3708685542d34e6f02c74240656327a5c622
author : Amit Kapila <akapila@postgresql.org>
date : Wed, 23 Jul 2025 02:56:00 +0000
committer: Amit Kapila <akapila@postgresql.org>
date : Wed, 23 Jul 2025 02:56:00 +0000 Logical replication requires reliable conflict detection to maintain data
consistency across nodes. To achieve this, we must prevent premature
removal of tuples deleted by other origins and their associated commit_ts
data by VACUUM, which could otherwise lead to incorrect conflict reporting
and resolution.
This patch introduces a mechanism to retain deleted tuples on the
subscriber during the application of concurrent transactions from remote
nodes. Retaining these tuples allows us to correctly ignore concurrent
updates to the same tuple. Without this, an UPDATE might be misinterpreted
as an INSERT during resolutions due to the absence of the original tuple.
Additionally, we ensure that origin metadata is not prematurely removed by
vacuum freeze, which is essential for detecting update_origin_differs and
delete_origin_differs conflicts.
To support this, a new replication slot named pg_conflict_detection is
created and maintained by the launcher on the subscriber. Each apply
worker tracks its own non-removable transaction ID, which the launcher
aggregates to determine the appropriate xmin for the slot, thereby
retaining necessary tuples.
Conflict information retention (deleted tuples and commit_ts) can be
enabled per subscription via the retain_conflict_info option. This is
disabled by default to avoid unnecessary overhead for configurations that
do not require conflict resolution or logging.
During upgrades, if any subscription on the old cluster has
retain_conflict_info enabled, a conflict detection slot will be created to
protect relevant tuples from deletion when the new cluster starts.
This is a foundational work to correctly detect update_deleted conflict
which will be done in a follow-up patch.
Author: Zhijie Hou <houzj.fnst@fujitsu.com>
Reviewed-by: shveta malik <shveta.malik@gmail.com>
Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com>
Reviewed-by: Dilip Kumar <dilipbalaut@gmail.com>
Reviewed-by: Nisha Moond <nisha.moond412@gmail.com>
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>
Discussion: https://postgr.es/m/OS0PR01MB5716BE80DAEB0EE2A6A5D1F5949D2@OS0PR01MB5716.jpnprd01.prod.outlook.com M doc/src/sgml/catalogs.sgml
M doc/src/sgml/config.sgml
M doc/src/sgml/func.sgml
M doc/src/sgml/logical-replication.sgml
M doc/src/sgml/protocol.sgml
M doc/src/sgml/ref/alter_subscription.sgml
M doc/src/sgml/ref/create_subscription.sgml
M src/backend/access/transam/twophase.c
M src/backend/access/transam/xact.c
M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogrecovery.c
M src/backend/catalog/pg_subscription.c
M src/backend/catalog/system_views.sql
M src/backend/commands/subscriptioncmds.c
M src/backend/replication/logical/applyparallelworker.c
M src/backend/replication/logical/launcher.c
M src/backend/replication/logical/reorderbuffer.c
M src/backend/replication/logical/tablesync.c
M src/backend/replication/logical/worker.c
M src/backend/replication/slot.c
M src/backend/replication/walsender.c
M src/backend/storage/ipc/procarray.c
M src/backend/utils/adt/pg_upgrade_support.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dump.h
M src/bin/pg_upgrade/check.c
M src/bin/pg_upgrade/info.c
M src/bin/pg_upgrade/pg_upgrade.c
M src/bin/pg_upgrade/pg_upgrade.h
M src/bin/pg_upgrade/t/004_subscription.pl
M src/bin/psql/describe.c
M src/bin/psql/tab-complete.in.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/include/catalog/pg_subscription.h
M src/include/commands/subscriptioncmds.h
M src/include/replication/logicallauncher.h
M src/include/replication/slot.h
M src/include/replication/worker_internal.h
M src/include/storage/proc.h
M src/include/storage/procarray.h
M src/test/regress/expected/subscription.out
M src/test/regress/sql/subscription.sql
M src/test/subscription/t/035_conflicts.pl
M src/tools/pgindent/typedefs.list
Use strchr instead of strstr for single-char lookups
commit : 039f7ee0fe9a25cf26d915d4b68091e080c6c6ec
author : David Rowley <drowley@postgresql.org>
date : Wed, 23 Jul 2025 12:02:55 +1200
committer: David Rowley <drowley@postgresql.org>
date : Wed, 23 Jul 2025 12:02:55 +1200 Compilers such as gcc and clang seem to perform this rewrite
automatically when the lookup string is known at compile-time to contain
a single character. The MSVC compiler does not seem apply the same
optimization, and the code being adjusted here is within an #ifdef WIN32,
so it seems worth adjusting this with the assumption that strchr() will be
slightly more performant.
There are a couple more instances in contrib/fuzzystrmatch that this
commit could also have adjusted. After some discussion, we deemed those
not important enough to bother with.
Author: Dmitry Mityugov <d.mityugov@postgrespro.ru>
Reviewed-by: Corey Huinker <corey.huinker@gmail.com>
Reviewed-by: David Rowley <drowleyml@gmail.com>
Discussion: https://postgr.es/m/9c1beea6c7a5e9fb6677f26620f1f257%40postgrespro.ru M src/port/pgmkdirp.c
ecpg: Improve error detection around ecpg_strdup()
commit : a6eabec6808cb1b8f20974ad57275b14fc079e3b
author : Michael Paquier <michael@paquier.xyz>
date : Wed, 23 Jul 2025 08:18:36 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Wed, 23 Jul 2025 08:18:36 +0900 Various code paths of the ECPG code did not check for memory allocation
failures, including the specific case where ecpg_strdup() considers a
NULL value given in input as a valid behavior. strdup() returning
itself NULL on failure, there was no way to make the difference between
what could be valid and what should fail.
With the different cases in mind, ecpg_strdup() is redesigned and gains
a new optional argument, giving its callers the possibility to
differentiate allocation failures and valid cases where the caller is
giving a NULL value in input. Most of the ECPG code does not expect a
NULL value, at the exception of ECPGget_desc() (setlocale) and
ECPGconnect(), like dbname being unspecified, with repeated strdup
calls.
The code is adapted to work with this new routine. Note the case of
ecpg_auto_prepare(), where the code order is switched so as we handle
failures with ecpg_strdup() before manipulating any cached data,
avoiding inconsistencies.
This class of failure is unlikely a problem in practice, so no backpatch
is done. Random OOM failures in ECPGconnect() could cause the driver to
connect to a different server than the one wanted by the caller, because
it could fallback to default values instead of the parameters defined
depending on the combinations of allocation failures and successes.
Author: Evgeniy Gorbanev <gorbanyoves@basealt.ru>
Co-authored-by: Aleksander Alekseev <aleksander@tigerdata.com>
Reviewed-by: Álvaro Herrera <alvherre@kurilemu.de>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://postgr.es/m/a6b193c1-6994-4d9c-9059-aca4aaf41ddd@basealt.ru M src/interfaces/ecpg/ecpglib/connect.c
M src/interfaces/ecpg/ecpglib/descriptor.c
M src/interfaces/ecpg/ecpglib/ecpglib_extern.h
M src/interfaces/ecpg/ecpglib/execute.c
M src/interfaces/ecpg/ecpglib/memory.c
M src/interfaces/ecpg/ecpglib/prepare.c
Remove translation marker from libpq-be-fe-helpers.h.
commit : a7ca73af662bc95e14058ac3f8fcf5d257f8bf79
author : Fujii Masao <fujii@postgresql.org>
date : Tue, 22 Jul 2025 22:08:36 +0900
committer: Fujii Masao <fujii@postgresql.org>
date : Tue, 22 Jul 2025 22:08:36 +0900 Commit 112faf1378e introduced a translation marker in libpq-be-fe-helpers.h,
but this caused build failures on some platforms—such as the one reported
by buildfarm member indri—due to linker issues with dblink. This is the same
problem previously addressed in commit 213c959a294.
To fix the issue, this commit removes the translation marker from
libpq-be-fe-helpers.h, following the approach used in 213c959a294.
It also removes the associated gettext_noop() calls added in commit
112faf1378e, as they are no longer needed.
While reviewing this, a gettext_noop() call was also found in
contrib/basic_archive. Since contrib modules don't support translation,
this call has been removed as well.
Per buildfarm member indri.
Author: Fujii Masao <masao.fujii@gmail.com>
Reviewed-by: Álvaro Herrera <alvherre@kurilemu.de>
Discussion: https://postgr.es/m/0e6299d9-608a-4ffa-aeb1-40cb8a99000b@oss.nttdata.com M contrib/basic_archive/basic_archive.c
M contrib/dblink/dblink.c
M contrib/postgres_fdw/connection.c
M src/backend/replication/libpqwalreceiver/libpqwalreceiver.c
M src/include/libpq/libpq-be-fe-helpers.h
aio: Fix assertion, clarify README
commit : d3f97fd1dda31d7bc925b226c2d9bec31bb7a6eb
author : Andres Freund <andres@anarazel.de>
date : Tue, 22 Jul 2025 08:30:52 -0400
committer: Andres Freund <andres@anarazel.de>
date : Tue, 22 Jul 2025 08:30:52 -0400 The assertion wouldn't have triggered for a long while yet, but this won't
accidentally fail to detect the issue if/when it occurs.
Author: Matthias van de Meent <boekewurm+postgres@gmail.com>
Discussion: https://postgr.es/m/CAEze2Wj-43JV4YufW23gm=Uwr7Lkj+p0yKctKHxNm1rwFC+_DQ@mail.gmail.com
Backpatch-through: 18 M src/backend/storage/aio/README.md
M src/include/storage/aio.h
Doc: Fix logical replication examples.
commit : ce6513e96a170510e2c54e82e3ad39fa46babb40
author : Amit Kapila <akapila@postgresql.org>
date : Tue, 22 Jul 2025 06:00:21 +0000
committer: Amit Kapila <akapila@postgresql.org>
date : Tue, 22 Jul 2025 06:00:21 +0000 The definition of \dRp+ was modified in commit 7054186c4e. This patch
updates the column list and row filter examples to align with the revised
definition.
Author: Shlok Kyal <shlok.kyal.oss@gmail.com>
Reviewed by: Peter Smith <smithpb2250@gmail.com>
Backpatch-through: 18, where it was introduced
Discussion: https://postgr.es/m/CANhcyEUvqkSO6b9zi_fs_BBPEge5acj4mf8QKmq2TX-7axa7EQ@mail.gmail.com M doc/src/sgml/logical-replication.sgml
doc: Inform about aminsertcleanup optional NULLness
commit : 19179dbffc8fb9ff12b73fa157a340cff6867ca0
author : Michael Paquier <michael@paquier.xyz>
date : Tue, 22 Jul 2025 14:34:15 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Tue, 22 Jul 2025 14:34:15 +0900 This index AM callback has been introduced in c1ec02be1d79 and it is
optional, currently only being used by BRIN. Optional callbacks are
documented with NULL as possible value in amapi.h and indexam.sgml, but
this callback has missed this part of the description.
Reported-by: Peter Smith <smithpb2250@gmail.com>
Reviewed-by: Japin Li <japinli@hotmail.com>
Discussion: https://postgr.es/m/CAHut+PvgYcPmPDi1YdHMJY5upnyGRpc0N8pk1xNB11xDSBwNog@mail.gmail.com
Backpatch-through: 17 M doc/src/sgml/indexam.sgml
M src/include/access/amapi.h
Log remote NOTICE, WARNING, and similar messages using ereport().
commit : 112faf1378ee62db75cd9e3223c86bf53b8c2736
author : Fujii Masao <fujii@postgresql.org>
date : Tue, 22 Jul 2025 14:16:45 +0900
committer: Fujii Masao <fujii@postgresql.org>
date : Tue, 22 Jul 2025 14:16:45 +0900 Previously, NOTICE, WARNING, and similar messages received from remote
servers over replication, postgres_fdw, or dblink connections were printed
directly to stderr on the local server (e.g., the subscriber). As a result,
these messages lacked log prefixes (e.g., timestamp), making them harder
to trace and correlate with other log entries.
This commit addresses the issue by introducing a custom notice receiver
for replication, postgres_fdw, and dblink connections. These messages
are now logged via ereport(), ensuring they appear in the logs with proper
formatting and context, which improves clarity and aids in debugging.
Author: Vignesh C <vignesh21@gmail.com>
Reviewed-by: Álvaro Herrera <alvherre@kurilemu.de>
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>
Discussion: https://postgr.es/m/CALDaNm2xsHpWRtLm-VL_HJCsaE3+1Y_n-jDEAr3-suxVqc3xoQ@mail.gmail.com M contrib/dblink/dblink.c
M contrib/postgres_fdw/connection.c
M src/backend/replication/libpqwalreceiver/libpqwalreceiver.c
M src/include/libpq/libpq-be-fe-helpers.h
ecpg: Fix NULL pointer dereference during connection lookup
commit : 1b8bbee05d70deae34d0f7484afde03518c07e42
author : Michael Paquier <michael@paquier.xyz>
date : Tue, 22 Jul 2025 14:00:00 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Tue, 22 Jul 2025 14:00:00 +0900 ECPGconnect() caches established connections to the server, supporting
the case of a NULL connection name when a database name is not specified
by its caller.
A follow-up call to ECPGget_PGconn() to get an established connection
from the cached set with a non-NULL name could cause a NULL pointer
dereference if a NULL connection was listed in the cache and checked for
a match. At least two connections are necessary to reproduce the issue:
one with a NULL name and one with a non-NULL name.
Author: Aleksander Alekseev <aleksander@tigerdata.com>
Discussion: https://postgr.es/m/CAJ7c6TNvFTPUTZQuNAoqgzaSGz-iM4XR61D7vEj5PsQXwg2RyA@mail.gmail.com
Backpatch-through: 13 M src/interfaces/ecpg/ecpglib/connect.c
Reduce "Var IS [NOT] NULL" quals during constant folding
commit : e2debb64380ebcf0979708a0fa88d9c8d924005b
author : Richard Guo <rguo@postgresql.org>
date : Tue, 22 Jul 2025 11:21:36 +0900
committer: Richard Guo <rguo@postgresql.org>
date : Tue, 22 Jul 2025 11:21:36 +0900 In commit b262ad440, we introduced an optimization that reduces an IS
[NOT] NULL qual on a NOT NULL column to constant true or constant
false, provided we can prove that the input expression of the NullTest
is not nullable by any outer joins or grouping sets. This deduction
happens quite late in the planner, during the distribution of quals to
rels in query_planner. However, this approach has some drawbacks: we
can't perform any further folding with the constant, and it turns out
to be prone to bugs.
Ideally, this deduction should happen during constant folding.
However, the per-relation information about which columns are defined
as NOT NULL is not available at that point. This information is
currently collected from catalogs when building RelOptInfos for base
or "other" relations.
This patch moves the collection of NOT NULL attribute information for
relations before pull_up_sublinks, storing it in a hash table keyed by
relation OID. It then uses this information to perform the NullTest
deduction for Vars during constant folding. This also makes it
possible to leverage this information to pull up NOT IN subqueries.
Note that this patch does not get rid of restriction_is_always_true
and restriction_is_always_false. Removing them would prevent us from
reducing some IS [NOT] NULL quals that we were previously able to
reduce, because (a) the self-join elimination may introduce new IS NOT
NULL quals after constant folding, and (b) if some outer joins are
converted to inner joins, previously irreducible NullTest quals may
become reducible.
Author: Richard Guo <guofenglinux@gmail.com>
Reviewed-by: Robert Haas <robertmhaas@gmail.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/CAMbWs4-bFJ1At4btk5wqbezdu8PLtQ3zv-aiaY3ry9Ymm=jgFQ@mail.gmail.com M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/sql/postgres_fdw.sql
M src/backend/optimizer/plan/initsplan.c
M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/plan/subselect.c
M src/backend/optimizer/prep/prepjointree.c
M src/backend/optimizer/util/clauses.c
M src/backend/optimizer/util/inherit.c
M src/backend/optimizer/util/plancat.c
M src/include/nodes/pathnodes.h
M src/include/optimizer/optimizer.h
M src/include/optimizer/plancat.h
M src/test/regress/expected/generated_virtual.out
M src/test/regress/expected/join.out
M src/test/regress/expected/predicate.out
M src/test/regress/sql/predicate.sql
M src/tools/pgindent/typedefs.list
Centralize collection of catalog info needed early in the planner
commit : 904f6a593a06649f77597ab9a72ef97c21e39a93
author : Richard Guo <rguo@postgresql.org>
date : Tue, 22 Jul 2025 11:20:40 +0900
committer: Richard Guo <rguo@postgresql.org>
date : Tue, 22 Jul 2025 11:20:40 +0900 There are several pieces of catalog information that need to be
retrieved for a relation during the early stage of planning. These
include relhassubclass, which is used to clear the inh flag if the
relation has no children, as well as a column's attgenerated and
default value, which are needed to expand virtual generated columns.
More such information may be required in the future.
Currently, these pieces of catalog data are collected in multiple
places, resulting in repeated table_open/table_close calls for each
relation in the rangetable. This patch centralizes the collection of
all required early-stage catalog information into a single loop over
the rangetable, allowing each relation to be opened and closed only
once.
Author: Richard Guo <guofenglinux@gmail.com>
Reviewed-by: Robert Haas <robertmhaas@gmail.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/CAMbWs4-bFJ1At4btk5wqbezdu8PLtQ3zv-aiaY3ry9Ymm=jgFQ@mail.gmail.com M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/plan/subselect.c
M src/backend/optimizer/prep/prepjointree.c
M src/include/optimizer/prep.h
Expand virtual generated columns before sublink pull-up
commit : e0d05295268e3811e6743403cb779f21d1662426
author : Richard Guo <rguo@postgresql.org>
date : Tue, 22 Jul 2025 11:19:17 +0900
committer: Richard Guo <rguo@postgresql.org>
date : Tue, 22 Jul 2025 11:19:17 +0900 Currently, we expand virtual generated columns after we have pulled up
any SubLinks within the query's quals. This ensures that the virtual
generated column references within SubLinks that should be transformed
into joins are correctly expanded. This approach works well and has
posed no issues.
In an upcoming patch, we plan to centralize the collection of catalog
information needed early in the planner. This will help avoid
repeated table_open/table_close calls for relations in the rangetable.
Since this information is required during sublink pull-up, we are
moving the expansion of virtual generated columns to occur beforehand.
To achieve this, if any EXISTS SubLinks can be pulled up, their
rangetables are processed just before pulling them up.
Author: Richard Guo <guofenglinux@gmail.com>
Reviewed-by: Robert Haas <robertmhaas@gmail.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/CAMbWs4-bFJ1At4btk5wqbezdu8PLtQ3zv-aiaY3ry9Ymm=jgFQ@mail.gmail.com M src/backend/optimizer/plan/planner.c
M src/backend/optimizer/plan/subselect.c
M src/backend/optimizer/prep/prepjointree.c
M src/include/optimizer/prep.h
M src/test/regress/expected/generated_virtual.out
M src/test/regress/sql/generated_virtual.sql
Update comment for ReplicationSlot.last_saved_restart_lsn
commit : 0810fbb02dbe70b8a7a7bcc51580827b8bbddbdc
author : Alexander Korotkov <akorotkov@postgresql.org>
date : Mon, 21 Jul 2025 15:07:34 +0300
committer: Alexander Korotkov <akorotkov@postgresql.org>
date : Mon, 21 Jul 2025 15:07:34 +0300 Document that restart_lsn can go backwards and explain why this could happen.
Discussion: https://postgr.es/m/1d12d2-67235980-35-19a406a0%4063439497
Discussion: https://postgr.es/m/CAPpHfdvuyMrUg0Vs5jPfwLOo1M9B-GP5j_My9URnBX0B%3DnrHKw%40mail.gmail.com
Author: Hayato Kuroda <kuroda.hayato@fujitsu.com>
Co-authored-by: Amit Kapila <amit.kapila16@gmail.com>
Reviewed-by: Vignesh C <vignesh21@gmail.com>
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>
Reviewed-by: Alexander Korotkov <aekorotkov@gmail.com> M src/include/replication/slot.h
pg_dump: include comments on not-null constraints on domains, too
commit : da71717f0a7cf905a6a31ffd34552554922a0374
author : Álvaro Herrera <alvherre@kurilemu.de>
date : Mon, 21 Jul 2025 11:34:10 +0200
committer: Álvaro Herrera <alvherre@kurilemu.de>
date : Mon, 21 Jul 2025 11:34:10 +0200 Commit e5da0fe3c22b introduced catalog entries for not-null constraints
on domains; but because commit b0e96f311985 (the original work for
catalogued not-null constraints on tables) forgot to teach pg_dump to
process the comments for them, this one also forgot. Add that now.
We also need to teach repairDependencyLoop() about the new type of
constraints being possible for domains.
Backpatch-through: 17
Co-authored-by: jian he <jian.universality@gmail.com>
Co-authored-by: Álvaro Herrera <alvherre@kurilemu.de>
Reported-by: jian he <jian.universality@gmail.com>
Discussion: https://postgr.es/m/CACJufxF-0bqVR=j4jonS6N2Ka6hHUpFyu3_3TWKNhOW_4yFSSg@mail.gmail.com M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/pg_dump.h
M src/bin/pg_dump/pg_dump_sort.c
M src/bin/pg_dump/t/002_pg_dump.pl
doc: Document reopen of output file via SIGHUP in pg_recvlogical.
commit : cb937e48f01fa710d084694de8cc556223ba0967
author : Fujii Masao <fujii@postgresql.org>
date : Sun, 20 Jul 2025 11:58:31 +0900
committer: Fujii Masao <fujii@postgresql.org>
date : Sun, 20 Jul 2025 11:58:31 +0900 When pg_recvlogical receives a SIGHUP signal, it closes the current
output file and reopens a new one. This is useful since it allows us to
rotate the output file by renaming the current file and sending a SIGHUP.
This behavior was previously undocumented. This commit adds
the missing documentation.
Back-patch to all supported versions.
Author: Fujii Masao <masao.fujii@gmail.com>
Reviewed-by: Shinya Kato <shinya11.kato@gmail.com>
Discussion: https://postgr.es/m/0977fc4f-1523-4ecd-8a0e-391af4976367@oss.nttdata.com
Backpatch-through: 13 M doc/src/sgml/ref/pg_recvlogical.sgml
Mostly-cosmetic adjustments to estimate_multivariate_bucketsize().
commit : aadf7db66ef5a8a723eb3362e2c8b460738f1107
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Sat, 19 Jul 2025 14:23:02 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Sat, 19 Jul 2025 14:23:02 -0400 The only practical effect of these changes is to avoid a useless
list_copy() operation when there is a single hashclause. That's
never going to make any noticeable performance difference, but
the code is arguably clearer this way, especially if we take the
opportunity to add some comments so that readers don't have to
reverse-engineer the usage of these local variables. Also add
some braces for better/more consistent style.
Author: Tender Wang <tndrwang@gmail.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/CAHewXNnHBOO9NEa=NBDYOrwZL4oHu2NOcTYvqyNyWEswo8f5OQ@mail.gmail.com M src/backend/utils/adt/selfuncs.c
Reintroduce test 046_checkpoint_logical_slot
commit : cdf1f5a607330eaf21a8fc669cb65cd9135472ba
author : Alexander Korotkov <akorotkov@postgresql.org>
date : Sat, 19 Jul 2025 13:59:17 +0300
committer: Alexander Korotkov <akorotkov@postgresql.org>
date : Sat, 19 Jul 2025 13:59:17 +0300 This commit is only for HEAD and v18, where the test has been removed.
It also incorporates improvements below to stability and coverage of the
original test, which were already backpatched to v17.
- Add one pg_logical_emit_message() call to force the creation of a record
that spawns across two pages.
- Make the logic wait for the checkpoint completion.
Author: Alexander Korotkov <akorotkov@postgresql.org>
Co-authored-by: Hayato Kuroda <kuroda.hayato@fujitsu.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Backpatch-through: 18 M src/test/recovery/meson.build
A src/test/recovery/t/046_checkpoint_logical_slot.pl
Improve the stability of the recovery test 047_checkpoint_physical_slot
commit : ccd945159361981d4d1583d2eccf81ddddd63fa5
author : Alexander Korotkov <akorotkov@postgresql.org>
date : Sat, 19 Jul 2025 13:51:07 +0300
committer: Alexander Korotkov <akorotkov@postgresql.org>
date : Sat, 19 Jul 2025 13:51:07 +0300 Currently, the comments in 047_checkpoint_physical_slot. It shows an
incomplete intention to wait for checkpoint completion before performing
an immediate database stop. However, an immediate node stop can occur both
before and after checkpoint completion. Both cases should work correctly.
But we would like the test to be more stable and deterministic. This is why
this commit makes this test explicitly wait for the checkpoint completion
log message.
Discussion: https://postgr.es/m/CAPpHfdurV-j_e0pb%3DUFENAy3tyzxfF%2ByHveNDNQk2gM82WBU5A%40mail.gmail.com
Discussion: https://postgr.es/m/aHXLep3OaX_vRTNQ%40paquier.xyz
Author: Alexander Korotkov <akorotkov@postgresql.org>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Backpatch-through: 17 M src/test/recovery/t/047_checkpoint_physical_slot.pl
Fix infinite wait when reading a partially written WAL record
commit : d3917d8f13e725a3ae3be8a1c051e677ac6e3334
author : Alexander Korotkov <akorotkov@postgresql.org>
date : Sat, 19 Jul 2025 13:44:01 +0300
committer: Alexander Korotkov <akorotkov@postgresql.org>
date : Sat, 19 Jul 2025 13:44:01 +0300 If a crash occurs while writing a WAL record that spans multiple pages, the
recovery process marks the page with the XLP_FIRST_IS_OVERWRITE_CONTRECORD
flag. However, logical decoding currently attempts to read the full WAL
record based on its expected size before checking this flag, which can lead
to an infinite wait if the remaining data is never written (e.g., no activity
after crash).
This patch updates the logic first to read the page header and check for
the XLP_FIRST_IS_OVERWRITE_CONTRECORD flag before attempting to reconstruct
the full WAL record. If the flag is set, decoding correctly identifies
the record as incomplete and avoids waiting for WAL data that will never
arrive.
Discussion: https://postgr.es/m/CAAKRu_ZCOzQpEumLFgG_%2Biw3FTa%2BhJ4SRpxzaQBYxxM_ZAzWcA%40mail.gmail.com
Discussion: https://postgr.es/m/CALDaNm34m36PDHzsU_GdcNXU0gLTfFY5rzh9GSQv%3Dw6B%2BQVNRQ%40mail.gmail.com
Author: Vignesh C <vignesh21@gmail.com>
Reviewed-by: Hayato Kuroda <kuroda.hayato@fujitsu.com>
Reviewed-by: Dilip Kumar <dilipbalaut@gmail.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Reviewed-by: Alexander Korotkov <aekorotkov@gmail.com>
Backpatch-through: 13 M src/backend/access/transam/xlogreader.c
Check status of nodes after regression test run in 027_stream_regress
commit : 1e9b5140c44b447c203c764dcf366472b4bec500
author : Michael Paquier <michael@paquier.xyz>
date : Sat, 19 Jul 2025 15:03:14 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Sat, 19 Jul 2025 15:03:14 +0900 This commit improves the recovery TAP test 027_stream_regress so as
regression diffs are printed only if both the primary and the standby
are still alive after the main regression test suite finishes, relying
on d4c9195eff41 to do the job.
Particularly, a crash of the primary could scribble the contents
reported with mostly useless data, as the diffs would refer to query
that failed to run, not necessarily the cause of the crash.
Suggested-by: Andres Freund <andres@anarazel.de>
Author: Nazir Bilal Yavuz <byavuz81@gmail.com>
Discussion: https://postgr.es/m/CAN55FZ1D6KXvjSs7YGsDeadqCxNF3UUhjRAfforzzP0k-cE=bA@mail.gmail.com M src/test/recovery/t/027_stream_regress.pl
Add PostgreSQL::Test::Cluster::is_alive()
commit : d4c9195eff419dcad47d5c2137e31f790c32adde
author : Michael Paquier <michael@paquier.xyz>
date : Sat, 19 Jul 2025 14:38:52 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Sat, 19 Jul 2025 14:38:52 +0900 This new routine acts as a wrapper of pg_isready, that can be run on a
node to check its connection status. This will be used in a recovery
test in a follow-up commit.
Suggested-by: Andres Freund <andres@anarazel.de>
Author: Nazir Bilal Yavuz <byavuz81@gmail.com>
Discussion: https://postgr.es/m/CAN55FZ1D6KXvjSs7YGsDeadqCxNF3UUhjRAfforzzP0k-cE=bA@mail.gmail.com M src/test/perl/PostgreSQL/Test/Cluster.pm
Speed up byteain by not parsing traditional-style input twice.
commit : 3683af617044d271ab7486d43d06f9689ed4961d
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Fri, 18 Jul 2025 16:42:02 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Fri, 18 Jul 2025 16:42:02 -0400 Instead of laboriously computing the exact output length, use strlen
to get an upper bound cheaply. (This is still O(N) of course, but
the constant factor is a lot less.) This will typically result in
overallocating the output datum, but that's of little concern since
it's a short-lived allocation in just about all use-cases.
A simple microbenchmark showed about 40% speedup for long input
strings.
While here, make some cosmetic cleanups and add a test case that
covers the double-backslash code path in byteain and byteaout.
Author: Steven Niu <niushiji@gmail.com>
Reviewed-by: Kirill Reshke <reshkekirill@gmail.com>
Reviewed-by: Stepan Neretin <slpmcf@gmail.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/ca315729-140b-426e-81a6-6cd5cfe7ecc5@gmail.com M src/backend/utils/adt/bytea.c
M src/test/regress/expected/strings.out
M src/test/regress/sql/strings.sql
Remove unused variable in generate-lwlocknames.pl.
commit : 84409ed640568d8ccaaf1df1a41fb02f37d026ed
author : Nathan Bossart <nathan@postgresql.org>
date : Fri, 18 Jul 2025 11:27:19 -0500
committer: Nathan Bossart <nathan@postgresql.org>
date : Fri, 18 Jul 2025 11:27:19 -0500 Oversight in commit da952b415f.
Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Discussion: https://postgr.es/m/aHpOgwuFQfcFMZ/B%40ip-10-97-1-34.eu-west-3.compute.internal M src/backend/storage/lmgr/generate-lwlocknames.pl
pg_upgrade: Use COPY for large object metadata.
commit : 161a3e8b682ebb98ea0b9d5015d22990696b99ec
author : Nathan Bossart <nathan@postgresql.org>
date : Fri, 18 Jul 2025 10:59:46 -0500
committer: Nathan Bossart <nathan@postgresql.org>
date : Fri, 18 Jul 2025 10:59:46 -0500 Presently, pg_dump generates commands like
SELECT pg_catalog.lo_create('5432');
ALTER LARGE OBJECT 5432 OWNER TO alice;
GRANT SELECT ON LARGE OBJECT 5432 TO bob;
for each large object. This is particularly slow at restore time,
especially when there are tens or hundreds of millions of large
objects. From reports and personal experience, such slow restores
seem to be most painful when encountered during pg_upgrade. This
commit teaches pg_dump to instead dump pg_largeobject_metadata and
the corresponding pg_shdepend rows when in binary upgrade mode,
i.e., pg_dump now generates commands like
COPY pg_catalog.pg_largeobject_metadata (oid, lomowner, lomacl) FROM stdin;
5432 16384 {alice=rw/alice,bob=r/alice}
\.
COPY pg_catalog.pg_shdepend (dbid, classid, objid, objsubid, refclassid, refobjid, deptype) FROM stdin;
5 2613 5432 0 1260 16384 o
5 2613 5432 0 1260 16385 a
\.
Testing indicates the COPY approach can be significantly faster.
To do any better, we'd probably need to find a way to copy/link
pg_largeobject_metadata's files during pg_upgrade, which would be
limited to upgrades from >= v16 (since commit 7b378237aa changed
the storage format for aclitem, which is used for
pg_largeobject_metadata.lomacl).
Note that this change only applies to binary upgrade mode (i.e.,
dumps initiated by pg_upgrade) since it inserts rows directly into
catalogs. Also, this optimization can only be used for upgrades
from >= v12 because pg_largeobject_metadata was created WITH OIDS
in older versions, which prevents pg_dump from handling
pg_largeobject_metadata.oid properly. With some extra effort, it
might be possible to support upgrades from older versions, but the
added complexity didn't seem worth it to support versions that will
have been out-of-support for nearly 3 years by the time this change
is released.
Experienced hackers may remember that prior to v12, pg_upgrade
copied/linked pg_largeobject_metadata's files (see commit
12a53c732c). Besides the aforementioned storage format issues,
this approach failed to transfer the relevant pg_shdepend rows, and
pg_dump still had to generate an lo_create() command per large
object so that creating the dependent comments and security labels
worked. We could perhaps adopt a hybrid approach for upgrades from
v16 and newer (i.e., generate lo_create() commands for each large
object, copy/link pg_largeobject_metadata's files, and COPY the
relevant pg_shdepend rows), but further testing is needed.
Reported-by: Hannu Krosing <hannuk@google.com>
Suggested-by: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Hannu Krosing <hannuk@google.com>
Reviewed-by: Nitin Motiani <nitinmotiani@google.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/CAMT0RQSS-6qLH%2BzYsOeUbAYhop3wmQTkNmQpo5--QRDUR%2BqYmQ%40mail.gmail.com M src/bin/pg_dump/pg_backup_archiver.c
M src/bin/pg_dump/pg_dump.c
M src/bin/pg_dump/t/002_pg_dump.pl
Fix a typo in the deparseArrayCoerceExpr() header comment
commit : 4c5159a2d8c01e6f08ce20a51bb2dcaa9c8be526
author : Alexander Korotkov <akorotkov@postgresql.org>
date : Fri, 18 Jul 2025 18:40:07 +0300
committer: Alexander Korotkov <akorotkov@postgresql.org>
date : Fri, 18 Jul 2025 18:40:07 +0300 Discussion: https://postgr.es/m/CAHewXNn%3D_ykCtcTw5SCfZ-eVr4m%2BCuc804rGeMsKuj%3DD4xpL4w%40mail.gmail.com
Author: Tender Wang <tndrwang@gmail.com> M contrib/postgres_fdw/deparse.c
Fix concurrent update trigger issues with MERGE in a CTE.
commit : 5022ff250eeba2367fb4e74fed8ee65bcddb6c99
author : Dean Rasheed <dean.a.rasheed@gmail.com>
date : Fri, 18 Jul 2025 09:55:43 +0100
committer: Dean Rasheed <dean.a.rasheed@gmail.com>
date : Fri, 18 Jul 2025 09:55:43 +0100 If a MERGE inside a CTE attempts an UPDATE or DELETE on a table with
BEFORE ROW triggers, and a concurrent UPDATE or DELETE happens, the
merge code would fail (crashing in the case of an UPDATE action, and
potentially executing the wrong action for a DELETE action).
This is the same issue that 9321c79c86 attempted to fix, except now
for a MERGE inside a CTE. As noted in 9321c79c86, what needs to happen
is for the trigger code to exit early, returning the TM_Result and
TM_FailureData information to the merge code, if a concurrent
modification is detected, rather than attempting to do an EPQ
recheck. The merge code will then do its own rechecking, and rescan
the action list, potentially executing a different action in light of
the concurrent update. In particular, the trigger code must never call
ExecGetUpdateNewTuple() for MERGE, since that is bound to fail because
MERGE has its own per-action projection information.
Commit 9321c79c86 did this using estate->es_plannedstmt->commandType
in the trigger code to detect that a MERGE was being executed, which
is fine for a plain MERGE command, but does not work for a MERGE
inside a CTE. Fix by passing that information to the trigger code as
an additional parameter passed to ExecBRUpdateTriggers() and
ExecBRDeleteTriggers().
Back-patch as far as v17 only, since MERGE cannot appear inside a CTE
prior to that. Additionally, take care to preserve the trigger ABI in
v17 (though not in v18, which is still in beta).
Bug: #18986
Reported-by: Yaroslav Syrytsia <me@ys.lc>
Author: Dean Rasheed <dean.a.rasheed@gmail.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://postgr.es/m/18986-e7a8aac3d339fa47@postgresql.org
Backpatch-through: 17 M src/backend/commands/trigger.c
M src/backend/executor/execReplication.c
M src/backend/executor/nodeModifyTable.c
M src/include/commands/trigger.h
M src/test/isolation/expected/merge-match-recheck.out
M src/test/isolation/specs/merge-match-recheck.spec
Support for deparsing of ArrayCoerceExpr node in contrib/postgres_fdw
commit : 62c3b4cd9ddc6d3066e3f6e43b68fd00c620d9ad
author : Alexander Korotkov <akorotkov@postgresql.org>
date : Fri, 18 Jul 2025 10:52:05 +0300
committer: Alexander Korotkov <akorotkov@postgresql.org>
date : Fri, 18 Jul 2025 10:52:05 +0300 When using a prepared statement to select data from a PostgreSQL foreign
table (postgres_fdw) with the "field = ANY($1)" expression, the operation
is not pushed down when an implicit type case is applied, and a generic plan
is used. This commit resolves the issue by supporting the push-down of
ArrayCoerceExpr, which is used in this case. The support is quite
straightforward and similar to other nods, such as RelabelType.
Discussion: https://postgr.es/m/4f0cea802476d23c6e799512ffd17aff%40postgrespro.ru
Author: Alexander Pyhalov <a.pyhalov@postgrespro.ru>
Reviewed-by: Maxim Orlov <orlovmg@gmail.com>
Reviewed-by: Alexander Korotkov <aekorotkov@gmail.com> M contrib/postgres_fdw/deparse.c
M contrib/postgres_fdw/expected/postgres_fdw.out
M contrib/postgres_fdw/sql/postgres_fdw.sql
Add a test harness for the binary heap code.
commit : b597ae6cc128b17038d461c5aa426d42f9cc33f9
author : Nathan Bossart <nathan@postgresql.org>
date : Thu, 17 Jul 2025 16:32:10 -0500
committer: Nathan Bossart <nathan@postgresql.org>
date : Thu, 17 Jul 2025 16:32:10 -0500 binaryheap is heavily used and already has decent test coverage,
but it lacks dedicated tests for its correctness. This commit
changes that.
Author: Aleksander Alekseev <aleksander@tigerdata.com>
Discussion: https://postgr.es/m/CAJ7c6TMwp%2Bmb8MMoi%3DSMVMso2hYecoVu2Pwf2EOkesq0MiSKxw%40mail.gmail.com M src/test/modules/Makefile
M src/test/modules/meson.build
A src/test/modules/test_binaryheap/.gitignore
A src/test/modules/test_binaryheap/Makefile
A src/test/modules/test_binaryheap/expected/test_binaryheap.out
A src/test/modules/test_binaryheap/meson.build
A src/test/modules/test_binaryheap/sql/test_binaryheap.sql
A src/test/modules/test_binaryheap/test_binaryheap–1.0.sql
A src/test/modules/test_binaryheap/test_binaryheap.c
A src/test/modules/test_binaryheap/test_binaryheap.control
Fix PQport to never return NULL unless the connection is NULL.
commit : daf9bdc47d11822da8a1269bd73fb23258b24f80
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Thu, 17 Jul 2025 12:46:38 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Thu, 17 Jul 2025 12:46:38 -0400 This is the documented behavior, and it worked that way before
v10. However, addition of the connhost[] array created cases
where conn->connhost[conn->whichhost].port is NULL. The rest
of libpq is careful to substitute DEF_PGPORT[_STR] for a null
or empty port string, but we failed to do so here, leading to
possibly returning NULL. As of v18 that causes psql's \conninfo
command to segfault. Older psql versions avoid that, but it's
pretty likely that other clients have trouble with this,
so we'd better back-patch the fix.
In stable branches, just revert to our historical behavior of
returning an empty string when there was no user-given port
specification. However, it seems substantially more useful and
indeed more correct to hand back DEF_PGPORT_STR in such cases,
so let's make v18 and master do that.
Author: Daniele Varrazzo <daniele.varrazzo@gmail.com>
Reviewed-by: Laurenz Albe <laurenz.albe@cybertec.at>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/CA+mi_8YTS8WPZPO0PAb2aaGLwHuQ0DEQRF0ZMnvWss4y9FwDYQ@mail.gmail.com
Backpatch-through: 13 M src/interfaces/libpq/fe-connect.c
M src/interfaces/libpq/libpq-int.h
Remove assertion from PortalRunMulti
commit : b8926a5b4bb82e3c56855185da4106d24d26154c
author : Álvaro Herrera <alvherre@kurilemu.de>
date : Thu, 17 Jul 2025 17:40:22 +0200
committer: Álvaro Herrera <alvherre@kurilemu.de>
date : Thu, 17 Jul 2025 17:40:22 +0200 We have an assertion to ensure that a command tag has been assigned by
the time we're done executing, but if we happen to execute a command
with no queries, the assertion would fail. Per discussion, rather than
contort things to get a tag assigned, just remove the assertion.
Oversight in 2f9661311b83. That commit also retained a comment that
explained logic that had been adjacent to it but diffused into various
places, leaving none apt to keep part of the comment. Remove that part,
and rewrite what remains for extra clarity.
Bug: #18984
Backpatch-through: 13
Reported-by: Aleksander Alekseev <aleksander@tigerdata.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Michaël Paquier <michael@paquier.xyz>
Discussion: https://postgr.es/m/18984-0f4778a6599ac3ae@postgresql.org M src/backend/tcop/pquery.c
doc: Add note about how to use pg_overexplain.
commit : 26cc96d4521acb598ddcd886bd64653452c7e887
author : Nathan Bossart <nathan@postgresql.org>
date : Thu, 17 Jul 2025 10:25:59 -0500
committer: Nathan Bossart <nathan@postgresql.org>
date : Thu, 17 Jul 2025 10:25:59 -0500 This commit adds a note to the pg_overexplain page that describes
how to use it (LOAD, session_preload_libraries, or
shared_preload_libraries). The new text is mostly lifted from the
auto_explain page. We should probably consider centralizing this
information in the future.
While at it, add a missing "module" to the opening sentence.
Reviewed-by: "David G. Johnston" <david.g.johnston@gmail.com>
Reviewed-by: Robert Treat <rob@xzilla.net>
Reviewed-by: Dean Rasheed <dean.a.rasheed@gmail.com>
Discussion: https://postgr.es/m/aHVWKM8l8kLlZzgv%40nathan
Backpatch-through: 18 M doc/src/sgml/pgoverexplain.sgml
Remove duplicate line
commit : afa5c365ec5ad978878e5d26c536d8f865abf1ae
author : Amit Langote <amitlan@postgresql.org>
date : Thu, 17 Jul 2025 14:31:27 +0900
committer: Amit Langote <amitlan@postgresql.org>
date : Thu, 17 Jul 2025 14:31:27 +0900 In 231b7d670b21, while copy-pasting some code into
ExecEvalJsonCoercionFinish(), I (amitlan) accidentally introduced
a duplicate line. Remove it.
Reported-by: Jian He <jian.universality@gmail.com>
Discussion: https://postgr.es/m/CACJufxHcf=BpmRAJcjgfjOUfV76MwKnyz1x3ErXsWL26EAFmng@mail.gmail.com M src/backend/executor/execExprInterp.c
Split regression tests for TOAST compression methods into two files
commit : 74a3fc36f3141677a94d1f6fbfaee4cb3896a35a
author : Michael Paquier <michael@paquier.xyz>
date : Thu, 17 Jul 2025 14:08:55 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Thu, 17 Jul 2025 14:08:55 +0900 The regression tests for TOAST compression methods are split into two
independent files: one specific to LZ4 and interactions between two
different TOAST compression methods, now called compression_lz4, and a
second one for the "core" cases where only pglz is required.
This saves 300 lines in diffs coming from the alternate output of
compression.sql, required for builds where lz4 is not available. The
new test is skipped if the build does not support LZ4 compression,
relying on an \if and the values reported in pg_settings for the GUC
default_toast_compression, "lz4" being available only under USE_LZ4.
Another benefit of this split is that this facilitates the addition of
more compression methods for TOAST, which are under discussion.
Note the trick added for the tests of the GUC default_toast_compression,
where VERBOSITY = terse is used to avoid the HINT printing the lists of
values available in the GUC, which are environment-dependent. This
makes compression.sql independent of the availability of LZ4.
The code coverage of toast_compression.c is slightly improved, increased
from 89% to 91%, with one new case covered in lz4_compress_datum() for
incompressible data.
Author: Nikhil Kumar Veldanda <veldanda.nikhilkumar17@gmail.com>
Co-authored-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://postgr.es/m/aDlcU-ym9KfMj9sG@paquier.xyz M src/test/regress/expected/compression.out
D src/test/regress/expected/compression_1.out
A src/test/regress/expected/compression_lz4.out
A src/test/regress/expected/compression_lz4_1.out
M src/test/regress/parallel_schedule
M src/test/regress/sql/compression.sql
A src/test/regress/sql/compression_lz4.sql
Fix inconsistent LWLock tranche names for MultiXact*
commit : a493e741d32b7580abe4d0dcc444fcedd8feec6e
author : Michael Paquier <michael@paquier.xyz>
date : Thu, 17 Jul 2025 09:30:26 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Thu, 17 Jul 2025 09:30:26 +0900 The terms used in wait_event_names.txt and lwlock.c were inconsistent
for MultiXactOffsetSLRU and MultiXactMemberSLRU, which could cause joins
between pg_wait_events and pg_stat_activity to fail. lwlock.c is
adjusted in this commit to what the historical name of the event has
always been, and what is documented.
Oversight in 53c2a97a9266. 08b9b9e043bb has fixed a similar
inconsistency some time ago.
Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Reviewed-by: Álvaro Herrera <alvherre@kurilemu.de>
Discussion: https://postgr.es/m/aHdxN0D0hKXzHFQG@ip-10-97-1-34.eu-west-3.compute.internal
Backpatch-through: 17 M src/backend/storage/lmgr/lwlock.c
doc: Add example file for COPY
commit : f6ffbeda00e08c4c8ac8cf72173f84157491bfde
author : Daniel Gustafsson <dgustafsson@postgresql.org>
date : Thu, 17 Jul 2025 00:21:18 +0200
committer: Daniel Gustafsson <dgustafsson@postgresql.org>
date : Thu, 17 Jul 2025 00:21:18 +0200 The paragraph for introducing INSERT and COPY discussed how a file
could be used for bulk loading with COPY, without actually showing
what the file would look like. This adds a programlisting for the
file contents.
Backpatch to all supported branches since this example has lacked
the file contents since PostgreSQL 7.2.
Author: Daniel Gustafsson <daniel@yesql.se>
Reviewed-by: Fujii Masao <masao.fujii@oss.nttdata.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/158017814191.19852.15019251381150731439@wrigleys.postgresql.org
Backpatch-through: 13 M doc/src/sgml/query.sgml
Force LC_COLLATE to C in postmaster.
commit : 5e6e42e44fe10cab616b4fbe9725df03c987c90a
author : Jeff Davis <jdavis@postgresql.org>
date : Wed, 16 Jul 2025 14:13:18 -0700
committer: Jeff Davis <jdavis@postgresql.org>
date : Wed, 16 Jul 2025 14:13:18 -0700 Avoid dependence on setlocale().
strcoll(), etc., are not called directly; all collation-sensitive
calls should go through pg_locale.c and use the appropriate
provider. By setting LC_COLLATE to C, we avoid accidentally depending
on libc behavior when using a different provider.
No behavior change in the backend, but it's possible that some
extensions will be affected. Such extensions should be updated to use
the pg_locale_t APIs.
Discussion: https://postgr.es/m/9875f7f9-50f1-4b5d-86fc-ee8b03e8c162@eisentraut.org
Reviewed-by: Peter Eisentraut <peter@eisentraut.org> M doc/src/sgml/catalogs.sgml
M doc/src/sgml/charset.sgml
M doc/src/sgml/ref/create_database.sgml
M doc/src/sgml/ref/createdb.sgml
M src/backend/main/main.c
M src/backend/utils/init/postinit.c
Fix dumping of comments on invalid constraints on domains
commit : 0858f0f96ebb891c8960994f023ed5a17b758a38
author : Álvaro Herrera <alvherre@kurilemu.de>
date : Wed, 16 Jul 2025 19:22:53 +0200
committer: Álvaro Herrera <alvherre@kurilemu.de>
date : Wed, 16 Jul 2025 19:22:53 +0200 We skip dumping constraints together with domains if they are invalid
('separate') so that they appear after data -- but their comments were
dumped together with the domain definition, which in effect leads to the
comment being dumped when the constraint does not yet exist. Delay
them in the same way.
Oversight in 7eca575d1c28; backpatch all the way back.
Author: jian he <jian.universality@gmail.com>
Discussion: https://postgr.es/m/CACJufxF_C2pe6J_+nPr6C5jf5rQnbYP8XOKr4HM8yHZtp2aQqQ@mail.gmail.com M src/bin/pg_dump/pg_dump.c
M src/test/regress/expected/constraints.out
M src/test/regress/sql/constraints.sql
nbtree: Use only one notnullkey ScanKeyData.
commit : 4c8ad67a98b5d84c1ca00a26d53d08f2d2b881aa
author : Peter Geoghegan <pg@bowt.ie>
date : Wed, 16 Jul 2025 13:05:44 -0400
committer: Peter Geoghegan <pg@bowt.ie>
date : Wed, 16 Jul 2025 13:05:44 -0400 _bt_first need only store one ScanKeyData struct on the stack for the
purposes of building an IS NOT NULL key based on an implied NOT NULL
constraint. We don't need INDEX_MAX_KEYS-many ScanKeyData structs.
This saves us a little over 2KB in stack space. It's possible that this
has some performance benefit. It also seems simpler and more direct.
It isn't possible for more than a single index attribute to need its own
implied IS NOT NULL key: the first such attribute/IS NOT NULL key always
makes _bt_first stop adding additional boundary keys to startKeys[].
Using INDEX_MAX_KEYS-many ScanKeyData entries was (at best) misleading.
Author: Peter Geoghegan <pg@bowt.ie>
Reviewed-By: Mircea Cadariu <cadariu.mircea@gmail.com>
Discussion: https://postgr.es/m/CAH2-Wzm=1kJMSZhhTLoM5BPbwQNWxUj-ynOEh=89ptDZAVgauw@mail.gmail.com M src/backend/access/nbtree/nbtsearch.c
pg_dumpall: Skip global objects with --statistics-only or --no-schema.
commit : 48c2c7b4b45b3bb696d566f4f425fccdd871532f
author : Jeff Davis <jdavis@postgresql.org>
date : Wed, 16 Jul 2025 09:57:12 -0700
committer: Jeff Davis <jdavis@postgresql.org>
date : Wed, 16 Jul 2025 09:57:12 -0700 Previously, pg_dumpall would still dump global objects such as roles
and tablespaces even when --statistics-only or --no-schema was specified.
Since these global objects are treated as schema-level data, they should
be skipped in these cases.
This commit fixes the issue by ensuring that global objects are not
dumped when either --statistics-only or --no-schema is used.
Author: Fujii Masao <masao.fujii@oss.nttdata.com>
Reviewed-by: Corey Huinker <corey.huinker@gmail.com>
Discussion: https://postgr.es/m/08129593-6f3c-4fb9-94b7-5aa2eefb99b0@oss.nttdata.com
Backpatch-through: 18 M src/bin/pg_dump/pg_dumpall.c
psql: Fix note on project naming in output of \copyright.
commit : ecc5161a0bd3cba8dda7ece98e0848856b97b7a1
author : Nathan Bossart <nathan@postgresql.org>
date : Wed, 16 Jul 2025 11:50:34 -0500
committer: Nathan Bossart <nathan@postgresql.org>
date : Wed, 16 Jul 2025 11:50:34 -0500 This adjusts the wording to match the changes in commits
5987553fde, a233a603ba, and pgweb commit 2d764dbc08.
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>
Discussion: https://postgr.es/m/aHVo791guQR6uqwT%40nathan
Backpatch-through: 13 M src/bin/psql/help.c
Refactor non-supported compression error message in toast_compression.c
commit : 1dbe6f76677c26096518998fdc72dab771a98913
author : Michael Paquier <michael@paquier.xyz>
date : Wed, 16 Jul 2025 11:59:22 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Wed, 16 Jul 2025 11:59:22 +0900 This code used a NO_LZ4_SUPPORT() macro to issue an error in the code
paths where LZ4 [de]compression is attempted but the build does not
support it. This commit refactors the code to use a more flexible error
message so as it can be used for other compression methods, where the
method is given in input of macro.
Extracted from a larger patch by the same author.
Author: Nikhil Kumar Veldanda <veldanda.nikhilkumar17@gmail.com>
Reviewed-by: Kirill Reshke <reshkekirill@gmail.com>
Discussion: https://postgr.es/m/CAFAfj_HX84EK4hyRYw50AOHOcdVi-+FFwAAPo7JHx4aShCvunQ@mail.gmail.com M src/backend/access/common/toast_compression.c
pgoutput: Initialize missing default for "origin" parameter.
commit : b8341ae856f239c6d84c738e516267e890969d8a
author : Fujii Masao <fujii@postgresql.org>
date : Wed, 16 Jul 2025 10:31:51 +0900
committer: Fujii Masao <fujii@postgresql.org>
date : Wed, 16 Jul 2025 10:31:51 +0900 The pgoutput plugin initializes optional parameters like "binary" with
default values at the start of processing. However, the "origin"
parameter was previously missed and left without explicit initialization.
Although the PGOutputData struct, which holds these settings,
is zero-initialized at allocation (resulting in publish_no_origin field
for "origin" parameter being false by default), this default was not
set explicitly, unlike other parameters.
This commit adds explicit initialization of the "origin" parameter to
ensure consistency and clarity in how defaults are handled.
Author: Fujii Masao <masao.fujii@gmail.com>
Reviewed-by: Euler Taveira <euler@eulerto.com>
Discussion: https://postgr.es/m/d2790f10-238d-4cb5-a743-d9d2a9dd900f@oss.nttdata.com M src/backend/replication/pgoutput/pgoutput.c
doc: Document default values for pgoutput options in protocol.sgml.
commit : d8425811b681ea5ba48a36235de5e1332e92685c
author : Fujii Masao <fujii@postgresql.org>
date : Wed, 16 Jul 2025 08:51:04 +0900
committer: Fujii Masao <fujii@postgresql.org>
date : Wed, 16 Jul 2025 08:51:04 +0900 The pgoutput plugin options are described in the logical streaming
replication protocol documentation, but their default values were
previously not mentioned. This made it less convenient for users,
for example, when specifying those options to use pg_recvlogical
with pgoutput plugin.
This commit adds the explanations of the default values for pgoutput
options to improve clarity and usability.
Author: Fujii Masao <masao.fujii@gmail.com>
Reviewed-by: Euler Taveira <euler@eulerto.com>
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>
Discussion: https://postgr.es/m/d2790f10-238d-4cb5-a743-d9d2a9dd900f@oss.nttdata.com M doc/src/sgml/protocol.sgml
doc: Fix confusing description of streaming option in START_REPLICATION.
commit : 09fcc652fefdb58e9cb729e8a604607d8805140c
author : Fujii Masao <fujii@postgresql.org>
date : Wed, 16 Jul 2025 08:32:52 +0900
committer: Fujii Masao <fujii@postgresql.org>
date : Wed, 16 Jul 2025 08:32:52 +0900 Previously, the documentation described the streaming option as a boolean,
which is outdated since it's no longer a boolean as of protocol version 4.
This could confuse users.
This commit updates the description to remove the "boolean" reference and
clearly list the valid values for the streaming option.
Back-patch to v16, where the streaming option changed to a non-boolean.
Author: Euler Taveira <euler@eulerto.com>
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>
Discussion: https://postgr.es/m/8d21fb98-5c25-4dee-8387-e5a62b01ea7d@app.fastmail.com
Backpatch-through: 16 M doc/src/sgml/protocol.sgml
doc: Clarify that total_vacuum_time excludes VACUUM FULL.
commit : 7c3b591af3d83520789cf80a74624125357c6918
author : Fujii Masao <fujii@postgresql.org>
date : Wed, 16 Jul 2025 08:03:36 +0900
committer: Fujii Masao <fujii@postgresql.org>
date : Wed, 16 Jul 2025 08:03:36 +0900 The last_vacuum and vacuum_count fields in pg_stat_all_tables already
state that they do not include VACUUM FULL. However, total_vacuum_time,
which also excludes VACUUM FULL, did not mention this. This could
mislead users into thinking VACUUM FULL time is included.
To address this, this commit updates the documentation for
pg_stat_all_tables to explicitly state that total_vacuum_time does not
count VACUUM FULL.
Back-patched to v18, where total_vacuum_time was introduced.
Additionally, this commit clarifies that n_ins_since_vacuum also
excludes VACUUM FULL. Although n_ins_since_vacuum was added in v13,
we are not back-patching this change to stable branches, as it is
a documentation improvement, not a bug fix.
Author: Fujii Masao <masao.fujii@gmail.com>
Reviewed-by: Robert Treat <rob@xzilla.net>
Reviewed-by: David G. Johnston <david.g.johnston@gmail.com>
Reviewed-by: Laurenz Albe <laurenz.albe@cybertec.at>
Discussion: https://postgr.es/m/2ac375d1-591b-4f1b-a2af-f24335567866@oss.nttdata.com
Backpatch-through: 18 M doc/src/sgml/monitoring.sgml
Doc: clarify description of regexp fields in pg_ident.conf.
commit : 5fe55a0fe40e801c77d8b2541caaaca49e67a75f
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Tue, 15 Jul 2025 18:53:00 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Tue, 15 Jul 2025 18:53:00 -0400 The grammar was a little shaky and confusing here, so word-smith it
a bit. Also, adjust the comments in pg_ident.conf.sample to use the
same terminology as the SGML docs, in particular "DATABASE-USERNAME"
not "PG-USERNAME".
Back-patch appropriate subsets. I did not risk changing
pg_ident.conf.sample in released branches, but it still seems OK
to change it in v18.
Reported-by: Alexey Shishkin <alexey.shishkin@enterprisedb.com>
Author: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: David G. Johnston <david.g.johnston@gmail.com>
Discussion: https://postgr.es/m/175206279327.3157504.12519088928605422253@wrigleys.postgresql.org
Backpatch-through: 13 M doc/src/sgml/client-auth.sgml
M src/backend/libpq/pg_ident.conf.sample
Clarify the ra != rb case in compareJsonbContainers().
commit : 2a3a3964328a0b6b0cb278ae6cb595772586d654
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Tue, 15 Jul 2025 18:21:12 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Tue, 15 Jul 2025 18:21:12 -0400 It's impossible to reach this case with either ra or rb being
WJB_DONE, because our earlier checks that the structure and
length of the inputs match should guarantee that we reach their
ends simultaneously. However, the comment completely fails to
explain this, and the Asserts don't cover it either. The comment
is pretty obscure anyway, so rewrite it, and extend the Asserts
to reject WJB_DONE.
This is only cosmetic, so no need for back-patch.
Author: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/0c623e8a204187b87b4736792398eaf1@postgrespro.ru M src/backend/utils/adt/jsonb_util.c
Silence uninitialized-value warnings in compareJsonbContainers().
commit : aad1617b76aef034a27f2a52903702dc5435c422
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Tue, 15 Jul 2025 18:11:18 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Tue, 15 Jul 2025 18:11:18 -0400 Because not every path through JsonbIteratorNext() sets val->type,
some compilers complain that compareJsonbContainers() is comparing
possibly-uninitialized values. The paths that don't set it return
WJB_DONE, WJB_END_ARRAY, or WJB_END_OBJECT, so it's clear by
manual inspection that the "(ra == rb)" code path is safe, and
indeed we aren't seeing warnings about that. But the (ra != rb)
case is much less obviously safe. In Assert-enabled builds it
seems that the asserts rejecting WJB_END_ARRAY and WJB_END_OBJECT
persuade gcc 15.x not to warn, which makes little sense because
it's impossible to believe that the compiler can prove of its
own accord that ra/rb aren't WJB_DONE here. (In fact they never
will be, so the code isn't wrong, but why is there no warning?)
Without Asserts, the appearance of warnings is quite unsurprising.
We discussed fixing this by converting those two Asserts into
pg_assume, but that seems not very satisfactory when it's so unclear
why the compiler is or isn't warning: the warning could easily
reappear with some other compiler version. Let's fix it in a less
magical, more future-proof way by changing JsonbIteratorNext()
so that it always does set val->type. The cost of that should be
pretty negligible, and it makes the function's API spec less squishy.
Reported-by: Erik Rijkers <er@xs4all.nl>
Author: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Andres Freund <andres@anarazel.de>
Discussion: https://postgr.es/m/988bf1bc-3f1f-99f3-bf98-222f1cd9dc5e@xs4all.nl
Discussion: https://postgr.es/m/0c623e8a204187b87b4736792398eaf1@postgrespro.ru
Backpatch-through: 13 M src/backend/utils/adt/jsonb_util.c
Doc: clarify description of current-date/time functions.
commit : 8ffd9ac3b206c0a93f9a16e0341c9f7850d26483
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Tue, 15 Jul 2025 16:35:42 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Tue, 15 Jul 2025 16:35:42 -0400 Minor wordsmithing of the func.sgml paragraph describing
statement_timestamp() and allied functions: don't switch between
"statement" and "command" when those are being used to mean about
the same thing.
Also, add some text to protocol.sgml describing the perhaps-surprising
behavior these functions have in a multi-statement Query message.
Reported-by: P M <petermittere@gmail.com>
Author: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Laurenz Albe <laurenz.albe@cybertec.at>
Reviewed-by: David G. Johnston <david.g.johnston@gmail.com>
Discussion: https://postgr.es/m/175223006802.3157505.14764328206246105568@wrigleys.postgresql.org
Backpatch-through: 13 M doc/src/sgml/func.sgml
M doc/src/sgml/protocol.sgml
psql: Fix tab-completion after GRANT/REVOKE on LARGE OBJECT and FOREIGN SERVER.
commit : ff0bcb248e6ef337902cb26266606c1ab4ea4048
author : Fujii Masao <fujii@postgresql.org>
date : Tue, 15 Jul 2025 18:51:17 +0900
committer: Fujii Masao <fujii@postgresql.org>
date : Tue, 15 Jul 2025 18:51:17 +0900 Previously, when pressing Tab after GRANT or REVOKE ... ON LARGE OBJECT
or ON FOREIGN SERVER, TO or FROM was incorrectly suggested by psql's
tab-completion. This was not appropriate, as those clauses are not valid
at that point.
This commit fixes the issue by preventing TO and FROM from being offered
immediately after those specific GRANT/REVOKE statements.
Author: Yugo Nagata <nagata@sraoss.co.jp>
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>
Discussion: https://postgr.es/m/20250408122857.b2b06dde4e6a08290af02336@sraoss.co.jp M src/bin/psql/tab-complete.in.c
Fix comments in index.c
commit : 006fc975a2b984249283e953900ac0ee814c5d6b
author : Michael Paquier <michael@paquier.xyz>
date : Tue, 15 Jul 2025 16:05:59 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Tue, 15 Jul 2025 16:05:59 +0900 This comment paragraph referred to text_eq(), but the name of the
function in charge of "text" comparisons is called texteq().
Author: Jian He <jian.universality@gmail.com>
Discussion: https://postgr.es/m/CACJufxHL--XNcCCO1LgKsygzYGiVHZMfTcAxOSG8+ezxWtjddw@mail.gmail.com M src/backend/catalog/index.c
amcheck: Improve error message for partitioned index target.
commit : 88a658a42e1b3e6b1a6d4e8322d731ddc3fe9b97
author : Fujii Masao <fujii@postgresql.org>
date : Mon, 14 Jul 2025 20:01:06 +0900
committer: Fujii Masao <fujii@postgresql.org>
date : Mon, 14 Jul 2025 20:01:06 +0900 Previously, amcheck could produce misleading error message when
a partitioned index was passed to functions like bt_index_check().
For example, bt_index_check() with a partitioned btree index produced:
ERROR: expected "btree" index as targets for verification
DETAIL: Relation ... is a btree index.
Reporting "expected btree index as targets" even when the specified
index was a btree was confusing. In this case, the function should fail
since the partitioned index specified is not valid target. This commit
improves the error reporting to better reflect this actual issue. Now,
bt_index_check() with a partitioned index, the error message is:
ERROR: expected index as targets for verification
DETAIL: This operation is not supported for partitioned indexes.
This commit also applies the following minor changes:
- Simplifies index_checkable() by using get_am_name() to retrieve
the access method name.
- Changes index_checkable() from extern to static, as it is only used
in verify_common.c.
- Updates the error code for invalid indexes to
ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE,
aligning with usage in similar modules like pgstattuple.
Author: Masahiro Ikeda <ikedamsh@oss.nttdata.com>
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>
Discussion: https://postgr.es/m/8829854bbfc8635ddecd0846bb72dfda@oss.nttdata.com M contrib/amcheck/expected/check_btree.out
M contrib/amcheck/sql/check_btree.sql
M contrib/amcheck/verify_common.c
M contrib/amcheck/verify_common.h
psql: Add variable SERVICEFILE
commit : 6b1c4d326b064bf0eaedccb08a7fcca5db5d9629
author : Michael Paquier <michael@paquier.xyz>
date : Mon, 14 Jul 2025 09:08:46 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Mon, 14 Jul 2025 09:08:46 +0900 This new psql variable can be used to check which service file has been
used for a connection. Like other variables, this can be set in a
PROMPT or reported by an \echo, like these commands:
\echo :SERVICEFILE
\set PROMPT1 '=(%:SERVICEFILE:)%# '
This relies on commits 092f3c63efc6 and fef6da9e9c87 to retrieve this
information from the connection's PQconninfoOption.
Author: Ryo Kanbayashi <kanbayashi.dev@gmail.com>
Discussion: https://postgr.es/m/CAKkG4_nCjx3a_F3gyXHSPWxD8Sd8URaM89wey7fG_9g7KBkOCQ@mail.gmail.com M doc/src/sgml/ref/psql-ref.sgml
M src/bin/psql/command.c
In username-map substitution, cope with more than one \1.
commit : 3c4e26a62c31ebe296e3aedb13ac51a7a35103bd
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Sun, 13 Jul 2025 13:52:32 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Sun, 13 Jul 2025 13:52:32 -0400 If the system-name field of a pg_ident.conf line is a regex
containing capturing parentheses, you can write \1 in the
user-name field to represent the captured part of the system
name. But what happens if you write \1 more than once?
The only reasonable expectation IMO is that each \1 gets
replaced, but presently our code replaces only the first.
Fix that.
Also, improve the tests for this feature to exercise cases
where a non-empty string needs to be substituted for \1.
The previous testing didn't inspire much faith that it
was verifying correct operation of the substitution code.
Given the lack of field complaints about this, I don't
feel a need to back-patch.
Reported-by: David G. Johnston <david.g.johnston@gmail.com>
Author: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/CAKFQuwZu6kZ8ZPvJ3pWXig+6UX4nTVK-hdL_ZS3fSdps=RJQQQ@mail.gmail.com M src/backend/libpq/hba.c
M src/test/authentication/t/003_peer.pl
libpq: Add "servicefile" connection option
commit : 092f3c63efc6a6ce235cfbed45bd05b739de8540
author : Michael Paquier <michael@paquier.xyz>
date : Sun, 13 Jul 2025 16:52:19 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Sun, 13 Jul 2025 16:52:19 +0900 This commit adds the possibility to specify a service file in a
connection string, using a new option called "servicefile". The parsing
of the service file happens so as things are done in this order of
priority:
- The servicefile connection option.
- Environment variable PGSERVICEFILE.
- Default path, depending on the HOME environment.
Note that in the last default case, we need to fill in "servicefile" for
the connection's PQconninfoOption to let clients know which service file
has been used for the connection. Some TAP tests are added, with a few
tweaks required for Windows when using URIs or connection option values,
for the location paths.
Author: Torsten Förtsch <tfoertsch123@gmail.com>
Co-authored-by: Ryo Kanbayashi <kanbayashi.dev@gmail.com>
Discussion: https://postgr.es/m/CAKkG4_nCjx3a_F3gyXHSPWxD8Sd8URaM89wey7fG_9g7KBkOCQ@mail.gmail.com M doc/src/sgml/libpq.sgml
M src/interfaces/libpq/fe-connect.c
M src/interfaces/libpq/libpq-int.h
M src/interfaces/libpq/t/006_service.pl
Remove XLogCtl->ckptFullXid.
commit : 8893c3ab3661eb397e68a0ace17c680d1e488360
author : Nathan Bossart <nathan@postgresql.org>
date : Sat, 12 Jul 2025 14:34:57 -0500
committer: Nathan Bossart <nathan@postgresql.org>
date : Sat, 12 Jul 2025 14:34:57 -0500 A few code paths set this variable, but its value is never used.
Oversight in commit 2fc7af5e96.
Reviewed-by: Aleksander Alekseev <aleksander@tigerdata.com>
Discussion: https://postgr.es/m/aHFyE1bs9YR93dQ1%40nathan M src/backend/access/transam/xlog.c
Replace float8 with int in date2isoweek() and date2isoyear().
commit : 84ce2587075c9418deda6a2f04b9768e375ebe43
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Sat, 12 Jul 2025 11:50:35 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Sat, 12 Jul 2025 11:50:35 -0400 The values of the "result" variables in these functions are
always integers; using a float8 variable accomplishes nothing
except to incur useless conversions to and from float. While
that wastes a few nanoseconds, these functions aren't all that
time-critical. But it seems worth fixing to remove possible
reader confusion.
Also, in the case of date2isoyear(), "result" is a very poorly
chosen variable name because it is *not* the function's result.
Rename it to "week", and do the same in date2isoweek() for
consistency.
Since this is mostly cosmetic, there seems little need
for back-patch.
Author: Sergey Fukanchik <s.fukanchik@postgrespro.ru>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/6323a-68726500-1-7def9d00@137821581 M src/backend/utils/adt/timestamp.c
Remove long-unused TransactionIdIsActive()
commit : f2c87ac04e73511a19dc36343f102eed3332573c
author : Andres Freund <andres@anarazel.de>
date : Sat, 12 Jul 2025 11:00:44 -0400
committer: Andres Freund <andres@anarazel.de>
date : Sat, 12 Jul 2025 11:00:44 -0400 TransactionIdIsActive() has not been used since bb38fb0d43c, in 2014. There
are no known uses in extensions either and it's hard to see valid uses for
it. Therefore remove TransactionIdIsActive().
Discussion: https://postgr.es/m/odgftbtwp5oq7cxjgf4kjkmyq7ypoftmqy7eqa7w3awnouzot6@hrwnl5tdqrgu M src/backend/storage/ipc/procarray.c
M src/include/storage/procarray.h
aio: Fix configuration reload in IO workers.
commit : b8e1f2d96bb99ad3528d035861bd311b9f8eb5a9
author : Thomas Munro <tmunro@postgresql.org>
date : Sat, 12 Jul 2025 16:20:11 +1200
committer: Thomas Munro <tmunro@postgresql.org>
date : Sat, 12 Jul 2025 16:20:11 +1200 method_worker.c installed SignalHandlerForConfigReload, but it failed to
actually process reload requests. That hasn't yet produced any concrete
problem reports in terms of GUC changes it should have cared about in
v18, but it was inconsistent.
It did cause problems for a couple of patches in development that need
IO workers to react to ALTER SYSTEM + pg_reload_conf(). Fix extracted
from one of those patches.
Back-patch to 18.
Reported-by: Dmitry Dolgov <9erthalion6@gmail.com>
Discussion: https://postgr.es/m/sh5uqe4a4aqo5zkkpfy5fobe2rg2zzouctdjz7kou4t74c66ql%40yzpkxb7pgoxf M src/backend/storage/aio/method_worker.c
aio: Remove obsolete IO worker ID references.
commit : 177c1f05933890e0da82841bddf1ae4d1e085612
author : Thomas Munro <tmunro@postgresql.org>
date : Sat, 12 Jul 2025 13:47:59 +1200
committer: Thomas Munro <tmunro@postgresql.org>
date : Sat, 12 Jul 2025 13:47:59 +1200 In an ancient ancestor of this code, the postmaster assigned IDs to IO
workers. Now it tracks them in an unordered array and doesn't know
their IDs, so it might be confusing to readers that it still referred to
their indexes as IDs.
No change in behavior, just variable name and error message cleanup.
Back-patch to 18.
Discussion: https://postgr.es/m/CA%2BhUKG%2BwbaZZ9Nwc_bTopm4f-7vDmCwLk80uKDHj9mq%2BUp0E%2Bg%40mail.gmail.com M src/backend/postmaster/postmaster.c
aio: Regularize IO worker internal naming.
commit : 01d618bcd782b7984a4289fef25867c681f3ebbf
author : Thomas Munro <tmunro@postgresql.org>
date : Sat, 12 Jul 2025 13:43:27 +1200
committer: Thomas Munro <tmunro@postgresql.org>
date : Sat, 12 Jul 2025 13:43:27 +1200 Adopt PgAioXXX convention for pgaio module type names. Rename a
function that didn't use a pgaio_worker_ submodule prefix. Rename the
internal submit function's arguments to match the indirectly relevant
function pointer declaration and nearby examples. Rename the array of
handle IDs in PgAioSubmissionQueue to sqes, a term of art seen in the
systems it emulates, also clarifying that they're not IO handle
pointers as the old name might imply.
No change in behavior, just type, variable and function name cleanup.
Back-patch to 18.
Discussion: https://postgr.es/m/CA%2BhUKG%2BwbaZZ9Nwc_bTopm4f-7vDmCwLk80uKDHj9mq%2BUp0E%2Bg%40mail.gmail.com M src/backend/storage/aio/method_worker.c
M src/tools/pgindent/typedefs.list
Fix stale idle flag when IO workers exit.
commit : 40e105042a4bec83ad8bc39e54edde2caf68d6a8
author : Thomas Munro <tmunro@postgresql.org>
date : Sat, 12 Jul 2025 11:18:05 +1200
committer: Thomas Munro <tmunro@postgresql.org>
date : Sat, 12 Jul 2025 11:18:05 +1200 Otherwise we could choose a worker that has exited and crash while
trying to wake it up.
Back-patch to 18.
Reported-by: Tomas Vondra <tomas@vondra.me>
Reported-by: Andres Freund <andres@anarazel.de>
Discussion: https://postgr.es/m/t5aqjhkj6xdkido535pds7fk5z4finoxra4zypefjqnlieevbg%40357aaf6u525j M src/backend/storage/aio/method_worker.c
Fix inconsistent quoting of role names in ACLs.
commit : 64840e46243a5f672b9e2fcb8d93c63daec4bc9a
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Fri, 11 Jul 2025 18:50:13 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Fri, 11 Jul 2025 18:50:13 -0400 getid() and putid(), which parse and deparse role names within ACL
input/output, applied isalnum() to see if a character within a role
name requires quoting. They did this even for non-ASCII characters,
which is problematic because the results would depend on encoding,
locale, and perhaps even platform. So it's possible that putid()
could elect not to quote some string that, later in some other
environment, getid() will decide is not a valid identifier, causing
dump/reload or similar failures.
To fix this in a way that won't risk interoperability problems
with unpatched versions, make getid() treat any non-ASCII as a
legitimate identifier character (hence not requiring quotes),
while making putid() treat any non-ASCII as requiring quoting.
We could remove the resulting excess quoting once we feel that
no unpatched servers remain in the wild, but that'll be years.
A lesser problem is that getid() did the wrong thing with an input
consisting of just two double quotes (""). That has to represent an
empty string, but getid() read it as a single double quote instead.
The case cannot arise in the normal course of events, since we don't
allow empty-string role names. But let's fix it while we're here.
Although we've not heard field reports of problems with non-ASCII
role names, there's clearly a hazard there, so back-patch to all
supported versions.
Reported-by: Peter Eisentraut <peter@eisentraut.org>
Author: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/3792884.1751492172@sss.pgh.pa.us
Backpatch-through: 13 M src/backend/utils/adt/acl.c
M src/test/regress/expected/privileges.out
M src/test/regress/sql/privileges.sql
oauth: Run Autoconf tests with correct compiler flags
commit : 990571a08b66c76be85b077ddcba419fd4524952
author : Jacob Champion <jchampion@postgresql.org>
date : Fri, 11 Jul 2025 10:06:41 -0700
committer: Jacob Champion <jchampion@postgresql.org>
date : Fri, 11 Jul 2025 10:06:41 -0700 Commit b0635bfda split off the CPPFLAGS/LDFLAGS/LDLIBS for libcurl into
their own separate Makefile variables, but I neglected to move the
existing AC_CHECKs for Curl into a place where they would make use of
those variables. They instead tested the system libcurl, which 1) is
unhelpful if a different Curl is being used for the build and 2) will
fail the build entirely if no system libcurl exists. Correct the order
of operations here.
Reported-by: Ivan Kush <ivan.kush@tantorlabs.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Ivan Kush <ivan.kush@tantorlabs.com>
Discussion: https://postgr.es/m/8a611028-51a1-408c-b592-832e2e6e1fc9%40tantorlabs.com
Backpatch-through: 18 M config/programs.m4
M configure
Add FLUSH_UNLOGGED option to CHECKPOINT command.
commit : 8d33fbacbac93ed70757ea47cd8a4b4fae61528a
author : Nathan Bossart <nathan@postgresql.org>
date : Fri, 11 Jul 2025 11:51:25 -0500
committer: Nathan Bossart <nathan@postgresql.org>
date : Fri, 11 Jul 2025 11:51:25 -0500 This option, which is disabled by default, can be used to request
the checkpoint also flush dirty buffers of unlogged relations. As
with the MODE option, the server may consolidate the options for
concurrently requested checkpoints. For example, if one session
uses (FLUSH_UNLOGGED FALSE) and another uses (FLUSH_UNLOGGED TRUE),
the server may perform one checkpoint with FLUSH_UNLOGGED enabled.
Author: Christoph Berg <myon@debian.org>
Reviewed-by: Laurenz Albe <laurenz.albe@cybertec.at>
Reviewed-by: Fujii Masao <masao.fujii@oss.nttdata.com>
Reviewed-by: Dilip Kumar <dilipbalaut@gmail.com>
Discussion: https://postgr.es/m/aDnaKTEf-0dLiEfz%40msg.df7cb.de M doc/src/sgml/ref/checkpoint.sgml
M src/backend/postmaster/checkpointer.c
M src/bin/psql/tab-complete.in.c
M src/test/regress/expected/stats.out
M src/test/regress/sql/stats.sql
Add MODE option to CHECKPOINT command.
commit : 2f698d7f4b7b4c49c3649b2fcc063eb66f9d2e6c
author : Nathan Bossart <nathan@postgresql.org>
date : Fri, 11 Jul 2025 11:51:25 -0500
committer: Nathan Bossart <nathan@postgresql.org>
date : Fri, 11 Jul 2025 11:51:25 -0500 This option may be set to FAST (the default) to request the
checkpoint be completed as fast as possible, or SPREAD to request
the checkpoint be spread over a longer interval (based on the
checkpoint-related configuration parameters). Note that the server
may consolidate the options for concurrently requested checkpoints.
For example, if one session requests a "fast" checkpoint and
another requests a "spread" checkpoint, the server may perform one
"fast" checkpoint.
Author: Christoph Berg <myon@debian.org>
Reviewed-by: Andres Freund <andres@anarazel.de>
Reviewed-by: Fujii Masao <masao.fujii@oss.nttdata.com>
Reviewed-by: Laurenz Albe <laurenz.albe@cybertec.at>
Reviewed-by: Dilip Kumar <dilipbalaut@gmail.com>
Discussion: https://postgr.es/m/aDnaKTEf-0dLiEfz%40msg.df7cb.de M doc/src/sgml/ref/checkpoint.sgml
M src/backend/postmaster/checkpointer.c
M src/bin/psql/tab-complete.in.c
M src/test/regress/expected/stats.out
M src/test/regress/sql/stats.sql
Add option list to CHECKPOINT command.
commit : a4f126516e688736bfed332b44a0c221b8dc118a
author : Nathan Bossart <nathan@postgresql.org>
date : Fri, 11 Jul 2025 11:51:25 -0500
committer: Nathan Bossart <nathan@postgresql.org>
date : Fri, 11 Jul 2025 11:51:25 -0500 This commit adds the boilerplate code for supporting a list of
options in CHECKPOINT commands. No actual options are supported
yet, but follow-up commits will add support for MODE and
FLUSH_UNLOGGED. While at it, this commit refactors the code for
executing CHECKPOINT commands to its own function since it's about
to become significantly larger.
Author: Christoph Berg <myon@debian.org>
Reviewed-by: Fujii Masao <masao.fujii@oss.nttdata.com>
Discussion: https://postgr.es/m/aDnaKTEf-0dLiEfz%40msg.df7cb.de M doc/src/sgml/ref/checkpoint.sgml
M src/backend/parser/gram.y
M src/backend/postmaster/checkpointer.c
M src/backend/tcop/utility.c
M src/bin/psql/tab-complete.in.c
M src/include/nodes/parsenodes.h
M src/include/postmaster/bgwriter.h
M src/test/regress/expected/stats.out
M src/test/regress/sql/stats.sql
Rename CHECKPOINT_IMMEDIATE to CHECKPOINT_FAST.
commit : bb938e2c3c7a955090f8b68b5bf75d064f6a36a0
author : Nathan Bossart <nathan@postgresql.org>
date : Fri, 11 Jul 2025 11:51:25 -0500
committer: Nathan Bossart <nathan@postgresql.org>
date : Fri, 11 Jul 2025 11:51:25 -0500 The new name more accurately reflects the effects of this flag on a
requested checkpoint. Checkpoint-related log messages (i.e., those
controlled by the log_checkpoints configuration parameter) will now
say "fast" instead of "immediate", too. Likewise, references to
"immediate" checkpoints in the documentation have been updated to
say "fast". This is preparatory work for a follow-up commit that
will add a MODE option to the CHECKPOINT command.
Author: Christoph Berg <myon@debian.org>
Discussion: https://postgr.es/m/aDnaKTEf-0dLiEfz%40msg.df7cb.de M doc/src/sgml/backup.sgml
M doc/src/sgml/func.sgml
M doc/src/sgml/ref/checkpoint.sgml
M doc/src/sgml/ref/pg_basebackup.sgml
M src/backend/access/transam/xlog.c
M src/backend/commands/dbcommands.c
M src/backend/commands/tablespace.c
M src/backend/postmaster/checkpointer.c
M src/backend/storage/buffer/bufmgr.c
M src/backend/tcop/utility.c
M src/include/access/xlog.h
M src/test/recovery/t/041_checkpoint_at_promote.pl
Rename CHECKPOINT_FLUSH_ALL to CHECKPOINT_FLUSH_UNLOGGED.
commit : cd8324cc89a9f95bef9593b11507ebf2b79de72a
author : Nathan Bossart <nathan@postgresql.org>
date : Fri, 11 Jul 2025 11:51:25 -0500
committer: Nathan Bossart <nathan@postgresql.org>
date : Fri, 11 Jul 2025 11:51:25 -0500 The new name more accurately relects the effects of this flag on a
requested checkpoint. Checkpoint-related log messages (i.e., those
controlled by the log_checkpoints configuration parameter) will now
say "flush-unlogged" instead of "flush-all", too. This is
preparatory work for a follow-up commit that will add a
FLUSH_UNLOGGED option to the CHECKPOINT command.
Author: Christoph Berg <myon@debian.org>
Discussion: https://postgr.es/m/aDnaKTEf-0dLiEfz%40msg.df7cb.de M src/backend/access/transam/xlog.c
M src/backend/commands/dbcommands.c
M src/backend/storage/buffer/bufmgr.c
M src/include/access/xlog.h
Force LC_NUMERIC to C while running TAP tests.
commit : f25792c541e559070d8e816f82cce01eb4f55ab8
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Fri, 11 Jul 2025 12:49:07 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Fri, 11 Jul 2025 12:49:07 -0400 We already forced LC_MESSAGES to C in order to get consistent
message output, but that isn't enough to stabilize messages
that include %f or similar formatting.
I'm a bit surprised that this hasn't come up before. Perhaps
we ought to back-patch this change, but I'll refrain for now.
Reported-by: Bernd Helmle <mailings@oopsware.de>
Author: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/6f024eaa7885eddf5e0eb4ba1d095fbc7146519b.camel@oopsware.de M src/test/perl/PostgreSQL/Test/Utils.pm
Fix the handling of two GUCs during upgrade.
commit : 72e6c08fea7cf59f5166e138aab927ad87570aa4
author : Amit Kapila <akapila@postgresql.org>
date : Fri, 11 Jul 2025 10:46:43 +0530
committer: Amit Kapila <akapila@postgresql.org>
date : Fri, 11 Jul 2025 10:46:43 +0530 Previously, the check_hook functions for max_slot_wal_keep_size and
idle_replication_slot_timeout would incorrectly raise an ERROR for values
set in postgresql.conf during upgrade, even though those values were not
actively used in the upgrade process.
To prevent logical slot invalidation during upgrade, we used to set
special values for these GUCs. Now, instead of relying on those values, we
directly prevent WAL removal and logical slot invalidation caused by
max_slot_wal_keep_size and idle_replication_slot_timeout.
Note: PostgreSQL 17 does not include the idle_replication_slot_timeout
GUC, so related changes were not backported.
BUG #18979
Reported-by: jorsol <jorsol@gmail.com>
Author: Dilip Kumar <dilipbalaut@gmail.com>
Reviewed by: vignesh C <vignesh21@gmail.com>
Reviewed by: Alvaro Herrera <alvherre@alvh.no-ip.org>
Backpatch-through: 17, where it was introduced
Discussion: https://postgr.es/m/219561.1751826409@sss.pgh.pa.us
Discussion: https://postgr.es/m/18979-a1b7fdbb7cd181c6@postgresql.org M src/backend/access/transam/xlog.c
M src/backend/replication/slot.c
M src/backend/utils/misc/guc_tables.c
M src/bin/pg_upgrade/server.c
M src/include/utils/guc_hooks.h
Doc: fix outdated protocol version.
commit : 4cff01c4a3472ecd2a53f957f13ab20a2970db4c
author : Tatsuo Ishii <ishii@postgresql.org>
date : Fri, 11 Jul 2025 10:34:57 +0900
committer: Tatsuo Ishii <ishii@postgresql.org>
date : Fri, 11 Jul 2025 10:34:57 +0900 In the description of StartupMessage, the protocol version was left
3.0. Instead of just updating it, this commit removes the hard coded
protocol version and shows the numbers as an example. This makes that
the part of the doc does not need to be updated when the version is
changed in the future.
Author: Jelte Fennema-Nio <postgres@jeltef.nl>
Reviewed-by: Tatsuo Ishii <ishii@postgresql.org>
Reviewed-by: Aleksander Alekseev <aleksander@timescale.com>
Discussion: https://postgr.es/m/20250626.155608.568829483879866256.ishii%40postgresql.org M doc/src/sgml/protocol.sgml
doc: Clarify meaning of "idle" in idle_replication_slot_timeout.
commit : 110e6dcaa6595cf71be00808e3df0087d1d2b208
author : Fujii Masao <fujii@postgresql.org>
date : Fri, 11 Jul 2025 08:44:32 +0900
committer: Fujii Masao <fujii@postgresql.org>
date : Fri, 11 Jul 2025 08:44:32 +0900 This commit updates the documentation to clarify that "idle" in
idle_replication_slot_timeout means the replication slot is inactive,
that is, not currently used by any replication connection.
Without this clarification, "idle" could be misinterpreted to mean
that the slot is not advancing or that no data is being streamed,
even if a connection exists.
Back-patch to v18 where idle_replication_slot_timeout was added.
Author: Laurenz Albe <laurenz.albe@cybertec.at>
Reviewed-by: David G. Johnston <david.g.johnston@gmail.com>
Reviewed-by: Gunnar Morling <gunnar.morling@googlemail.com>
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>
Discussion: https://postgr.es/m/CADGJaX_0+FTguWpNSpgVWYQP_7MhoO0D8=cp4XozSQgaZ40Odw@mail.gmail.com
Backpatch-through: 18 M doc/src/sgml/config.sgml
M doc/src/sgml/system-views.sgml
M src/backend/replication/slot.c
Change unit of idle_replication_slot_timeout to seconds.
commit : 05dedf43d380edc98546c381e76a9d907fd19bed
author : Fujii Masao <fujii@postgresql.org>
date : Fri, 11 Jul 2025 08:39:24 +0900
committer: Fujii Masao <fujii@postgresql.org>
date : Fri, 11 Jul 2025 08:39:24 +0900 Previously, the idle_replication_slot_timeout parameter used minutes
as its unit, based on the assumption that values would typically exceed
one minute in production environments. However, this caused unexpected
behavior: specifying a value below 30 seconds would round down to 0,
effectively disabling the timeout. This could be surprising to users.
To allow finer-grained control and avoid such confusion, this commit changes
the unit of idle_replication_slot_timeout to seconds. Larger values can
still be specified easily using standard time suffixes, for example,
'24h' for 24 hours.
Back-patch to v18 where idle_replication_slot_timeout was added.
Reported-by: Gunnar Morling <gunnar.morling@googlemail.com>
Author: Fujii Masao <masao.fujii@gmail.com>
Reviewed-by: Laurenz Albe <laurenz.albe@cybertec.at>
Reviewed-by: David G. Johnston <david.g.johnston@gmail.com>
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>
Reviewed-by: Hayato Kuroda <kuroda.hayato@fujitsu.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/CADGJaX_0+FTguWpNSpgVWYQP_7MhoO0D8=cp4XozSQgaZ40Odw@mail.gmail.com
Backpatch-through: 18 M doc/src/sgml/config.sgml
M src/backend/replication/slot.c
M src/backend/utils/misc/guc_tables.c
M src/backend/utils/misc/postgresql.conf.sample
M src/include/replication/slot.h
Fix sslkeylogfile error handling logging
commit : a6c0bf93031dac8701b8d6c1093230dc5caf190d
author : Daniel Gustafsson <dgustafsson@postgresql.org>
date : Thu, 10 Jul 2025 23:26:51 +0200
committer: Daniel Gustafsson <dgustafsson@postgresql.org>
date : Thu, 10 Jul 2025 23:26:51 +0200 When sslkeylogfile has been set but the file fails to open in an
otherwise successful connection, the log entry added to the conn
object is never printed. Instead print the error on stderr for
increased visibility. This is a debugging tool so using stderr
for logging is appropriate. Also while there, remove the umask
call in the callback as it's not useful.
Issues noted by Peter Eisentraut in post-commit review, backpatch
down to 18 when support for sslkeylogfile was added
Author: Daniel Gustafsson <daniel@yesql.se>
Reported-by: Peter Eisentraut <peter@eisentraut.org>
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Discussion: https://postgr.es/m/70450bee-cfaa-48ce-8980-fc7efcfebb03@eisentraut.org
Backpatch-through: 18 M src/interfaces/libpq/fe-secure-openssl.c
M src/test/ssl/t/001_ssltests.pl
pg_dump: Fix object-type sort priority for large objects.
commit : fb6c860bbd1f798dc637c8aa8972570b84f01ad2
author : Nathan Bossart <nathan@postgresql.org>
date : Thu, 10 Jul 2025 15:52:41 -0500
committer: Nathan Bossart <nathan@postgresql.org>
date : Thu, 10 Jul 2025 15:52:41 -0500 Commit a45c78e328 moved large object metadata from SECTION_PRE_DATA
to SECTION_DATA but neglected to move PRIO_LARGE_OBJECT in
dbObjectTypePriorities accordingly. While this hasn't produced any
known live bugs, it causes problems for a proposed patch that
optimizes upgrades with many large objects. Fixing the priority
might also make the topological sort step marginally faster by
reducing the number of ordering violations that have to be fixed.
Reviewed-by: Nitin Motiani <nitinmotiani@google.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/aBkQLSkx1zUJ-LwJ%40nathan
Discussion: https://postgr.es/m/aG_5DBCjdDX6KAoD%40nathan
Backpatch-through: 17 M src/bin/pg_dump/pg_dump_sort.c
btree_gist: Merge the last two versions into version 1.8
commit : b41c4308460500f2888aff9f844458915cae1798
author : Michael Paquier <michael@paquier.xyz>
date : Thu, 10 Jul 2025 12:23:04 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Thu, 10 Jul 2025 12:23:04 +0900 During the development cycle of v18, btree_gist has been bumped once to
1.8 for the addition of translate_cmptype support functions (originally
7406ab623fee, renamed in 32edf732e8dc). 1.9 has added sortsupport
functions (e4309f73f698).
There is no need for two version bumps in a module for a single major
release of PostgreSQL. This commit unifies both upgrades to a single
SQL script, downgrading btree_gist to 1.8.
Author: Paul A. Jungwirth <pj@illuminatedcomputing.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/13c61807-f702-4afe-9a8d-795e2fd40923@illuminatedcomputing.com
Backpatch-through: 18 M contrib/btree_gist/Makefile
M contrib/btree_gist/btree_gist–1.7–1.8.sql
D contrib/btree_gist/btree_gist–1.8–1.9.sql
M contrib/btree_gist/btree_gist.control
M contrib/btree_gist/meson.build
injection_points: Add injection_points_list()
commit : 4eca711bc991954613261b7a314b1e8f5963815c
author : Michael Paquier <michael@paquier.xyz>
date : Thu, 10 Jul 2025 10:01:10 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Thu, 10 Jul 2025 10:01:10 +0900 This function can be used to retrieve the information about all the
injection points attached to a cluster, providing coverage for
InjectionPointList() introduced in 7b2eb72b1b8c.
The original proposal turned around a system function, but that would
not be backpatchable to stable branches. It was also a bit weird to
have a system function that fails depending on if the build allows
injection points or not.
Reviewed-by: Aleksander Alekseev <aleksander@timescale.com>
Reviewed-by: Rahila Syed <rahilasyed90@gmail.com>
Discussion: https://postgr.es/m/Z_xYkA21KyLEHvWR@paquier.xyz M src/test/modules/injection_points/expected/injection_points.out
M src/test/modules/injection_points/injection_points–1.0.sql
M src/test/modules/injection_points/injection_points.c
M src/test/modules/injection_points/sql/injection_points.sql
Use pg_assume() to avoid compiler warning below exec_set_found()
commit : 48a23f6eae710d2c5c29f38e66d76e7919117e4d
author : Andres Freund <andres@anarazel.de>
date : Wed, 9 Jul 2025 18:38:05 -0400
committer: Andres Freund <andres@anarazel.de>
date : Wed, 9 Jul 2025 18:38:05 -0400 The warning, visible when building with -O3 and a recent-ish gcc, is due to
gcc not realizing that found is a byvalue type and therefore will never be
interpreted as a varlena type.
Discussion: https://postgr.es/m/3prdb6hkep3duglhsujrn52bkvnlkvhc54fzvph2emrsm4vodl@77yy6j4hkemb
Discussion: https://postgr.es/m/20230316172818.x6375uvheom3ibt2%40awork3.anarazel.de
Discussion: https://postgr.es/m/20240207203138.sknifhlppdtgtxnk%40awork3.anarazel.de M src/pl/plpgsql/src/pl_exec.c
Add pg_assume(expr) macro
commit : d65eb5b1b84e9104144b6b07b526bc73e819d6d7
author : Andres Freund <andres@anarazel.de>
date : Wed, 9 Jul 2025 18:38:05 -0400
committer: Andres Freund <andres@anarazel.de>
date : Wed, 9 Jul 2025 18:38:05 -0400 This macro can be used to avoid compiler warnings, particularly when using -O3
and not using assertions, and to get the compiler to generate better code.
A subsequent commit introduces a first user.
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/3prdb6hkep3duglhsujrn52bkvnlkvhc54fzvph2emrsm4vodl@77yy6j4hkemb
Discussion: https://postgr.es/m/20230316172818.x6375uvheom3ibt2%40awork3.anarazel.de
Discussion: https://postgr.es/m/20240207203138.sknifhlppdtgtxnk%40awork3.anarazel.de M src/include/c.h
Link libpq with libdl if the platform needs that.
commit : 4df477153a6b9339acafbf4162fd8fa3f33e89d2
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Wed, 9 Jul 2025 14:21:00 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Wed, 9 Jul 2025 14:21:00 -0400 Since b0635bfda, libpq uses dlopen() and related functions. On some
platforms these are not supplied by libc, but by a separate library
libdl, in which case we need to make sure that that dependency is
known to the linker. Meson seems to take care of that automatically,
but the Makefile didn't cater for it.
Author: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/1328170.1752082586@sss.pgh.pa.us
Backpatch-through: 18 M src/interfaces/libpq/Makefile
Change wchar2char() and char2wchar() to accept a locale_t.
commit : 53cd0b71ee2e99c611a38ce58636a04d5dde4cc1
author : Jeff Davis <jdavis@postgresql.org>
date : Wed, 9 Jul 2025 08:45:34 -0700
committer: Jeff Davis <jdavis@postgresql.org>
date : Wed, 9 Jul 2025 08:45:34 -0700 These are libc-specific functions, so should require a locale_t rather
than a pg_locale_t (which could use another provider).
Discussion: https://postgr.es/m/a8666c391dfcabe79868d95f7160eac533ace718.camel%40j-davis.com M src/backend/tsearch/ts_locale.c
M src/backend/tsearch/wparser_def.c
M src/backend/utils/adt/pg_locale_libc.c
M src/include/utils/pg_locale.h
Minor tweaks for pg_test_timing.
commit : 9dcc7641444f6a99269b446ee3a45a080b6ceea3
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Wed, 9 Jul 2025 11:26:53 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Wed, 9 Jul 2025 11:26:53 -0400 Increase the size of the "direct" histogram to 10K elements,
so that we can precisely track loop times up to 10 microseconds.
(Going further than that seems pretty uninteresting, even for
very old and slow machines.)
Relabel "Per loop time" as "Average loop time" for clarity.
Pre-zero the histogram arrays to make sure that they are loaded
into processor cache and any copy-on-write overhead has happened
before we enter the timing loop. Also use unlikely() to keep
the compiler from thinking that the clock-went-backwards case
is part of the hot loop. Neither of these hacks made a lot of
difference on my own machine, but they seem like they might help
on some platforms.
Discussion: https://postgr.es/m/be0339cc-1ae1-4892-9445-8e6d8995a44d@eisentraut.org M doc/src/sgml/ref/pgtesttiming.sgml
M src/bin/pg_test_timing/pg_test_timing.c
Introduce pg_dsm_registry_allocations view.
commit : 167ed8082f40ee1f3f4cd18cf02bd6d17df57dab
author : Nathan Bossart <nathan@postgresql.org>
date : Wed, 9 Jul 2025 09:17:56 -0500
committer: Nathan Bossart <nathan@postgresql.org>
date : Wed, 9 Jul 2025 09:17:56 -0500 This commit adds a new system view that provides information about
entries in the dynamic shared memory (DSM) registry. Specifically,
it returns the name, type, and size of each entry. Note that since
we cannot discover the size of dynamic shared memory areas (DSAs)
and hash tables backed by DSAs (dshashes) without first attaching
to them, the size column is left as NULL for those.
Bumps catversion.
Author: Florents Tselai <florents.tselai@gmail.com>
Reviewed-by: Sungwoo Chang <swchangdev@gmail.com>
Discussion: https://postgr.es/m/4D445D3E-81C5-4135-95BB-D414204A0AB4%40gmail.com M doc/src/sgml/system-views.sgml
M src/backend/catalog/system_views.sql
M src/backend/storage/ipc/dsm_registry.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_proc.dat
M src/test/modules/test_dsm_registry/expected/test_dsm_registry.out
M src/test/modules/test_dsm_registry/sql/test_dsm_registry.sql
M src/test/regress/expected/privileges.out
M src/test/regress/expected/rules.out
M src/test/regress/sql/privileges.sql
Fix tab-completion for COPY and \copy options.
commit : f5a987c0e5f6bbf0cc0420228dc57e7aae4d7e8f
author : Masahiko Sawada <msawada@postgresql.org>
date : Wed, 9 Jul 2025 05:45:34 -0700
committer: Masahiko Sawada <msawada@postgresql.org>
date : Wed, 9 Jul 2025 05:45:34 -0700 Commit c273d9d8ce4 reworked tab-completion of COPY and \copy in psql
and added support for completing options within WITH clauses. However,
the same COPY options were suggested for both COPY TO and COPY FROM
commands, even though some options are only valid for one or the
other.
This commit separates the COPY options for COPY FROM and COPY TO
commands to provide more accurate auto-completion suggestions.
Back-patch to v14 where tab-completion for COPY and \copy options
within WITH clauses was first supported.
Author: Atsushi Torikoshi <torikoshia@oss.nttdata.com>
Reviewed-by: Yugo Nagata <nagata@sraoss.co.jp>
Discussion: https://postgr.es/m/079e7a2c801f252ae8d522b772790ed7@oss.nttdata.com
Backpatch-through: 14 M src/bin/psql/tab-complete.in.c
psql: Improve psql tab completion for GRANT/REVOKE on large objects.
commit : 86c539c5af14f42ee274c03b5eeb3c97ee5b1ec1
author : Fujii Masao <fujii@postgresql.org>
date : Wed, 9 Jul 2025 20:33:50 +0900
committer: Fujii Masao <fujii@postgresql.org>
date : Wed, 9 Jul 2025 20:33:50 +0900 This commit enhances psql's tab completion to support TO/FROM
after "GRANT/REVOKE ... ON LARGE OBJECT ...". Additionally,
since "ALTER DEFAULT PRIVILEGES" now supports large objects,
tab completion is also updated for "GRANT/REVOKE ... ON LARGE OBJECTS"
with TO/FROM.
Author: Fujii Masao <masao.fujii@gmail.com>
Reviewed-by: Yugo Nagata <nagata@sraoss.co.jp>
Discussion: https://postgr.es/m/ade0ab29-777f-47f6-9d0d-1af67728a86e@oss.nttdata.com M src/bin/psql/tab-complete.in.c
Hide ICU C++ APIs from pg_locale.h
commit : ed26c4e25a444fcdd8a9120d4fe4b5a08d2b262b
author : John Naylor <john.naylor@postgresql.org>
date : Wed, 9 Jul 2025 14:20:22 +0700
committer: John Naylor <john.naylor@postgresql.org>
date : Wed, 9 Jul 2025 14:20:22 +0700 The cpluspluscheck script wraps our headers in `extern "C"`. This
disables name mangling, which is necessary for the C++ templates
in system ICU headers. cpluspluscheck thus fails when the build is
configured with ICU (the default). CI worked around this by disabling
ICU, but let's make it work so others can run the script.
We can specify we only want the C APIs by defining U_SHOW_CPLUSPLUS_API
to be 0 in pg_locale.h. Extensions that want the C++ APIs can include
ICU headers separately before including PostgreSQL headers.
ICU documentation:
https://github.com/unicode-org/icu/blob/main/docs/processes/release/tasks/healthy-code.md#test-icu4c-headers
Suggested-by: Andres Freund <andres@anarazel.de>
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Andres Freund <andres@anarazel.de>
Discussion: https://postgr.es/m/20220323002024.f2g6tivduzrktgfa%40alap3.anarazel.de
Discussion: https://postgr.es/m/CANWCAZbgiaz1_0-F4SD%2B%3D-e9onwAnQdBGJbhg94EqUu4Gb7WyA%40mail.gmail.com M .cirrus.tasks.yml
M src/include/utils/pg_locale.h
libpq: Add TAP test for nested service file
commit : df286a5b830ae8cc8aac4bd6c999ea4991f0b092
author : Michael Paquier <michael@paquier.xyz>
date : Wed, 9 Jul 2025 15:46:31 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Wed, 9 Jul 2025 15:46:31 +0900 This test corresponds to the case of a "service" defined in a service
file, that libpq is not able to support in parseServiceFile().
This has come up during the review of a patch to add more features in
this area, useful on its own. Piece extracted from a larger patch by
the same author.
Author: Ryo Kanbayashi <kanbayashi.dev@gmail.com>
Discussion: https://postgr.es/m/Zz2AE7NKKLIZTtEh@paquier.xyz M src/interfaces/libpq/t/006_service.pl
Doc: Improve logical replication failover documentation.
commit : 24f608625f9ab5632897d21e0dc27ebfea5d3661
author : Amit Kapila <akapila@postgresql.org>
date : Wed, 9 Jul 2025 09:44:27 +0530
committer: Amit Kapila <akapila@postgresql.org>
date : Wed, 9 Jul 2025 09:44:27 +0530 Clarified that the failover steps apply to a specific PostgreSQL subscriber
and added guidance for verifying replication slot synchronization during
planned failover. Additionally, corrected the standby query to avoid false
positives by checking invalidation_reason IS NULL instead of conflicting.
Author: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>
Author: Shveta Malik <shveta.malik@gmail.com>
Backpatch-through: 17, where it was introduced
Discussion: https://www.postgresql.org/message-id/CAExHW5uiZ-fF159=jwBwPMbjZeZDtmcTbN+hd4mrURLCg2uzJg@mail.gmail.com M doc/src/sgml/logical-replication.sgml
libpq: Remove PQservice()
commit : fef6da9e9c8790fa915942af2ada190c33fcf98c
author : Michael Paquier <michael@paquier.xyz>
date : Wed, 9 Jul 2025 12:46:13 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Wed, 9 Jul 2025 12:46:13 +0900 This routine has been introduced as a shortcut to be able to retrieve a
service name from an active connection, for psql. Per discussion, and
as it is only used by psql, let's remove it to not clutter the libpq API
more than necessary.
The logic in psql is replaced by lookups of PQconninfoOption for the
active connection, instead, updated each time the variables are synced
by psql, the prompt shortcut relying on the variable synced.
Reported-by: Noah Misch <noah@leadboat.com>
Discussion: https://postgr.es/m/20250706161319.c1.nmisch@google.com
Backpatch-through: 18 M doc/src/sgml/libpq.sgml
M src/bin/psql/command.c
M src/bin/psql/common.c
M src/bin/psql/common.h
M src/bin/psql/prompt.c
M src/interfaces/libpq/exports.txt
M src/interfaces/libpq/fe-connect.c
M src/interfaces/libpq/libpq-fe.h
Fix up misuse of "volatile" in contrib/xml2.
commit : 93001888d85c21a5b9ab1fe8dabfecb673fc007c
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Tue, 8 Jul 2025 17:00:34 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Tue, 8 Jul 2025 17:00:34 -0400 What we want in these places is "xmlChar *volatile ptr",
not "volatile xmlChar *ptr". The former means that the
pointer variable itself needs to be treated as volatile,
while the latter says that what it points to is volatile.
Since the point here is to ensure that the pointer variables
don't go crazy after a longjmp, it's the former semantics
that we need. The misplacement of "volatile" also led
to needing to cast away volatile in some places.
Also fix a number of places where variables that are assigned to
within a PG_TRY and then used after it were not initialized or
not marked as volatile. (A few buildfarm members were issuing
"may be used uninitialized" warnings about some of these variables,
which is what drew my attention to this area.) In most cases
these variables were being set as the last step within the PG_TRY
block, which might mean that we could get away without the "volatile"
marking. But doing that seems unsafe and is definitely not per our
coding conventions.
These problems seem to have come in with 732061150, so no need
for back-patch. M contrib/xml2/xpath.c
M contrib/xml2/xslt_proc.c
Fix low-probability memory leak in XMLSERIALIZE(... INDENT).
commit : e03c95287764158941d317972a332565729b6af2
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Tue, 8 Jul 2025 12:50:19 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Tue, 8 Jul 2025 12:50:19 -0400 xmltotext_with_options() did not consider the possibility that
pg_xml_init() could fail --- most likely due to OOM. If that
happened, the already-parsed xmlDoc structure would be leaked.
Oversight in commit 483bdb2af.
Bug: #18981
Author: Dmitry Kovalenko <d.kovalenko@postgrespro.ru>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/18981-9bc3c80f107ae925@postgresql.org
Backpatch-through: 16 M src/backend/utils/adt/xml.c
Fix a couple more places in docs for pg_lsn change
commit : aa39b4e35ac65d4c1672ba2a29707008a754ddf5
author : Álvaro Herrera <alvherre@kurilemu.de>
date : Tue, 8 Jul 2025 18:37:55 +0200
committer: Álvaro Herrera <alvherre@kurilemu.de>
date : Tue, 8 Jul 2025 18:37:55 +0200 Also, revert Unicode linestyle to ASCII.
Reported-by: Japin Li <japinli@hotmail.com>
Discussion: https://postgr.es/m/ME0P300MB04453A39931F95805C4205A8B64FA@ME0P300MB0445.AUSP300.PROD.OUTLOOK.COM M doc/src/sgml/datatype.sgml
M doc/src/sgml/func.sgml
M doc/src/sgml/pageinspect.sgml
Change pg_test_timing to measure in nanoseconds not microseconds.
commit : 0b096e379e6f9bd49d38020d880a7da337e570ad
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Tue, 8 Jul 2025 11:23:15 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Tue, 8 Jul 2025 11:23:15 -0400 Most of our platforms have better-than-microsecond timing resolution,
so the original definition of this program is getting less and less
useful. Make it report nanoseconds not microseconds. Also, add a
second output table that reports the exact observed timing durations,
up to a limit of 1024 ns; and be sure to report the largest observed
duration.
The documentation for this program included a lot of system-specific
details that now seem largely obsolete. Move all that text to the
PG wiki, where perhaps it will be easier to maintain and update.
Also, improve the TAP test so that it actually runs a short standard
run, allowing most of the code to be exercised; its coverage before
was abysmal.
Author: Hannu Krosing <hannuk@google.com>
Co-authored-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/be0339cc-1ae1-4892-9445-8e6d8995a44d@eisentraut.org M doc/src/sgml/ref/pgtesttiming.sgml
M src/bin/pg_test_timing/pg_test_timing.c
M src/bin/pg_test_timing/t/001_basic.pl
pg_walsummary: Improve stability of test checking statistics
commit : a27893df45ec5d8c657899202e9cf0b9a816fe2f
author : Michael Paquier <michael@paquier.xyz>
date : Tue, 8 Jul 2025 13:48:49 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Tue, 8 Jul 2025 13:48:49 +0900 Per buildfarm member culicidae, the query checking for stats reported by
the WAL summarizer related to WAL reads is proving to be unstable.
Instead of a one-time query, this commit replaces the logic with a
polling query checking for the WAL read stats, making the test more
reliable on machines that could be slow with the stats reports.
This test has been introduced in f4694e0f35b2, so backpatch down to v18.
Reported-by: Alexander Lakhin <exclusion@gmail.com>
Reviewed-by: Alexander Lakhin <exclusion@gmail.com>
Discussion: https://postgr.es/m/f35ba3db-fca7-4693-bc35-6db64488e4b1@gmail.com
Backpatch-through: 18 M src/bin/pg_walsummary/t/002_blocks.pl
aio: Combine io_uring memory mappings, if supported
commit : f54af9f2679d5987b4680e742ac9bd585260e620
author : Andres Freund <andres@anarazel.de>
date : Mon, 7 Jul 2025 21:03:16 -0400
committer: Andres Freund <andres@anarazel.de>
date : Mon, 7 Jul 2025 21:03:16 -0400 By default io_uring creates a shared memory mapping for each io_uring
instance, leading to a large number of memory mappings. Unfortunately a large
number of memory mappings slows things down, backend exit is particularly
affected. To address that, newer kernels (6.5) support using user-provided
memory for the memory. By putting the relevant memory into shared memory we
don't need any additional mappings.
On a system with a new enough kernel and liburing, there is no discernible
overhead when doing a pgbench -S -C anymore.
Reported-by: MARK CALLAGHAN <mdcallag@gmail.com>
Reviewed-by: "Burd, Greg" <greg@burd.me>
Reviewed-by: Jim Nasby <jnasby@upgrade.com>
Discussion: https://postgr.es/m/CAFbpF8OA44_UG+RYJcWH9WjF7E3GA6gka3gvH6nsrSnEe9H0NA@mail.gmail.com
Backpatch-through: 18 M configure
M configure.ac
M meson.build
M src/backend/storage/aio/method_io_uring.c
M src/include/pg_config.h.in
M src/tools/pgindent/typedefs.list
Consider explicit incremental sort for Append and MergeAppend
commit : 55a780e9476a753354a6db887e92125c7886ca6d
author : Richard Guo <rguo@postgresql.org>
date : Tue, 8 Jul 2025 10:21:44 +0900
committer: Richard Guo <rguo@postgresql.org>
date : Tue, 8 Jul 2025 10:21:44 +0900 For an ordered Append or MergeAppend, we need to inject an explicit
sort into any subpath that is not already well enough ordered.
Currently, only explicit full sorts are considered; incremental sorts
are not yet taken into account.
In this patch, for subpaths of an ordered Append or MergeAppend, we
choose to use explicit incremental sort if it is enabled and there are
presorted keys.
The rationale is based on the assumption that incremental sort is
always faster than full sort when there are presorted keys, a premise
that has been applied in various parts of the code. In addition, the
current cost model tends to favor incremental sort as being cheaper
than full sort in the presence of presorted keys, making it reasonable
not to consider full sort in such cases.
No backpatch as this could result in plan changes.
Author: Richard Guo <guofenglinux@gmail.com>
Reviewed-by: Andrei Lepikhov <lepihov@gmail.com>
Reviewed-by: Robert Haas <robertmhaas@gmail.com>
Discussion: https://postgr.es/m/CAMbWs4_V7a2enTR+T3pOY_YZ-FU8ZsFYym2swOz4jNMqmSgyuw@mail.gmail.com M src/backend/optimizer/path/costsize.c
M src/backend/optimizer/plan/createplan.c
M src/backend/optimizer/util/pathnode.c
M src/include/optimizer/cost.h
M src/test/regress/expected/incremental_sort.out
M src/test/regress/expected/inherit.out
M src/test/regress/sql/incremental_sort.sql
oauth: Fix kqueue detection on OpenBSD
commit : 7376e6085468054328a66e8c10c007bdaaf88f91
author : Jacob Champion <jchampion@postgresql.org>
date : Mon, 7 Jul 2025 13:41:55 -0700
committer: Jacob Champion <jchampion@postgresql.org>
date : Mon, 7 Jul 2025 13:41:55 -0700 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 <sys/event.h> can't be
compiled without including prerequisite headers, so -Dlibcurl=enabled
failed on that platform. Switch to has_header() to fix this.
Note that reviewers expressed concern about the difference between our
Autoconf feature tests (which compile headers) and our Meson feature
tests (which do not). I'm not opposed to aligning the two, but I want to
avoid making bigger changes as part of this fix.
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/flat/CAOYmi+kdR218ke2zu74oTJvzYJcqV1MN5=mGAPqZQuc79HMSVA@mail.gmail.com
Backpatch-through: 18 M meson.build
Adapt pg_upgrade test to pg_lsn output format difference
commit : 3adcf9fbd8ba9c07edb3ef5168a259fb12e6e3a6
author : Álvaro Herrera <alvherre@kurilemu.de>
date : Mon, 7 Jul 2025 22:38:12 +0200
committer: Álvaro Herrera <alvherre@kurilemu.de>
date : Mon, 7 Jul 2025 22:38:12 +0200 Commit 2633dae2e487 added some zero padding to various LSNs output
routines so that the low word is always 8 hex digits long, for easy
human consumption. This included the pg_lsn datatype, which breaks the
pg_upgrade test when it compares the pg_dump output of an older version.
Silence this problem by setting the pg_lsn columns to NULL before the
upgrade.
Discussion: https://postgr.es/m/202507071504.xm2r26u7lmzr@alvherre.pgsql M src/test/perl/PostgreSQL/Test/AdjustUpgrade.pm
Restore the ability to run pl/pgsql expression queries in parallel.
commit : 87b05fdc73e84d6b0bf0e03efad95c99c203cd1f
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Mon, 7 Jul 2025 14:33:20 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Mon, 7 Jul 2025 14:33:20 -0400 pl/pgsql's notion of an "expression" is very broad, encompassing
any SQL SELECT query that returns a single column and no more than
one row. So there are cases, for example evaluation of an aggregate
function, where the query involves significant work and it'd be useful
to run it with parallel workers. This used to be possible, but
commits 3eea7a0c9 et al unintentionally disabled it.
The simplest fix is to make exec_eval_expr() pass maxtuples = 0
rather than 2 to exec_run_select(). This avoids the new rule that
we will never use parallelism when a nonzero "count" limit is passed
to ExecutorRun(). (Note that the pre-3eea7a0c9 behavior was indeed
unsafe, so reverting that rule is not in the cards.) The reason
for passing 2 before was that exec_eval_expr() will throw an error
if it gets more than one returned row, so we figured that as soon
as we have two rows we know that will happen and we might as well
stop running the query. That choice was cost-free when it was made;
but disabling parallelism is far from cost-free, so now passing 2
amounts to optimizing a failure case at the expense of useful cases.
An expression query that can return more than one row is certainly
broken. People might now need to wait a bit longer to discover such
breakage; but hopefully few will use enormously expensive cases as
their first test of new pl/pgsql logic.
Author: Dipesh Dhameliya <dipeshdhameliya125@gmail.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/CABgZEgdfbnq9t6xXJnmXbChNTcWFjeM_6nuig41tm327gYi2ig@mail.gmail.com
Backpatch-through: 13 M src/pl/plpgsql/src/pl_exec.c
Refactor some repetitive SLRU code
commit : c61678551699610d658edb0ae838d2541688caba
author : Álvaro Herrera <alvherre@kurilemu.de>
date : Mon, 7 Jul 2025 16:49:19 +0200
committer: Álvaro Herrera <alvherre@kurilemu.de>
date : Mon, 7 Jul 2025 16:49:19 +0200 Functions to bootstrap and zero pages in various SLRU callers were
fairly duplicative. We can slash almost two hundred lines with a couple
of simple helpers:
- SimpleLruZeroAndWritePage: Does the equivalent of SimpleLruZeroPage
followed by flushing the page to disk
- XLogSimpleInsertInt64: Does a XLogBeginInsert followed by XLogInsert
of a trivial record whose data is just an int64.
Author: Evgeny Voropaev <evgeny.voropaev@tantorlabs.com>
Reviewed by: Álvaro Herrera <alvherre@kurilemu.de>
Reviewed by: Andrey Borodin <x4mmm@yandex-team.ru>
Reviewed by: Aleksander Alekseev <aleksander@timescale.com>
Discussion: https://www.postgresql.org/message-id/flat/97820ce8-a1cd-407f-a02b-47368fadb14b%40tantorlabs.com M src/backend/access/transam/clog.c
M src/backend/access/transam/commit_ts.c
M src/backend/access/transam/multixact.c
M src/backend/access/transam/slru.c
M src/backend/access/transam/subtrans.c
M src/backend/access/transam/xloginsert.c
M src/include/access/slru.h
M src/include/access/xloginsert.h
Standardize LSN formatting by zero padding
commit : 2633dae2e4876a9b7cb90ba025e930a553e5107f
author : Álvaro Herrera <alvherre@kurilemu.de>
date : Mon, 7 Jul 2025 13:57:43 +0200
committer: Álvaro Herrera <alvherre@kurilemu.de>
date : Mon, 7 Jul 2025 13:57:43 +0200 This commit standardizes the output format for LSNs to ensure consistent
representation across various tools and messages. Previously, LSNs were
inconsistently printed as `%X/%X` in some contexts, while others used
zero-padding. This often led to confusion when comparing.
To address this, the LSN format is now uniformly set to `%X/%08X`,
ensuring the lower 32-bit part is always zero-padded to eight
hexadecimal digits.
Author: Japin Li <japinli@hotmail.com>
Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com>
Reviewed-by: Álvaro Herrera <alvherre@kurilemu.de>
Discussion: https://postgr.es/m/ME0P300MB0445CA53CA0E4B8C1879AF84B641A@ME0P300MB0445.AUSP300.PROD.OUTLOOK.COM M contrib/amcheck/verify_nbtree.c
M contrib/pageinspect/expected/gist.out
M contrib/pageinspect/expected/page.out
M contrib/pageinspect/rawpage.c
M contrib/pg_walinspect/expected/pg_walinspect.out
M contrib/pg_walinspect/pg_walinspect.c
M doc/src/sgml/catalogs.sgml
M doc/src/sgml/logical-replication.sgml
M doc/src/sgml/logicaldecoding.sgml
M doc/src/sgml/pageinspect.sgml
M doc/src/sgml/pglogicalinspect.sgml
M doc/src/sgml/pgwalinspect.sgml
M doc/src/sgml/test-decoding.sgml
M src/backend/access/rmgrdesc/replorigindesc.c
M src/backend/access/rmgrdesc/xactdesc.c
M src/backend/access/rmgrdesc/xlogdesc.c
M src/backend/access/transam/timeline.c
M src/backend/access/transam/twophase.c
M src/backend/access/transam/xlog.c
M src/backend/access/transam/xlogbackup.c
M src/backend/access/transam/xlogprefetcher.c
M src/backend/access/transam/xlogreader.c
M src/backend/access/transam/xlogrecovery.c
M src/backend/access/transam/xlogutils.c
M src/backend/backup/backup_manifest.c
M src/backend/backup/basebackup_copy.c
M src/backend/backup/basebackup_incremental.c
M src/backend/commands/subscriptioncmds.c
M src/backend/postmaster/walsummarizer.c
M src/backend/replication/libpqwalreceiver/libpqwalreceiver.c
M src/backend/replication/logical/logical.c
M src/backend/replication/logical/origin.c
M src/backend/replication/logical/slotsync.c
M src/backend/replication/logical/snapbuild.c
M src/backend/replication/logical/tablesync.c
M src/backend/replication/logical/worker.c
M src/backend/replication/repl_gram.y
M src/backend/replication/repl_scanner.l
M src/backend/replication/slot.c
M src/backend/replication/slotfuncs.c
M src/backend/replication/syncrep.c
M src/backend/replication/walreceiver.c
M src/backend/replication/walsender.c
M src/backend/storage/ipc/standby.c
M src/backend/utils/adt/pg_lsn.c
M src/bin/pg_basebackup/pg_basebackup.c
M src/bin/pg_basebackup/pg_createsubscriber.c
M src/bin/pg_basebackup/pg_receivewal.c
M src/bin/pg_basebackup/pg_recvlogical.c
M src/bin/pg_basebackup/receivelog.c
M src/bin/pg_basebackup/streamutil.c
M src/bin/pg_combinebackup/backup_label.c
M src/bin/pg_combinebackup/pg_combinebackup.c
M src/bin/pg_combinebackup/write_manifest.c
M src/bin/pg_controldata/pg_controldata.c
M src/bin/pg_rewind/libpq_source.c
M src/bin/pg_rewind/parsexlog.c
M src/bin/pg_rewind/pg_rewind.c
M src/bin/pg_rewind/timeline.c
M src/bin/pg_verifybackup/pg_verifybackup.c
M src/bin/pg_waldump/pg_waldump.c
M src/common/parse_manifest.c
M src/include/access/xlogdefs.h
M src/test/recovery/t/016_min_consistency.pl
M src/test/regress/expected/numeric.out
M src/test/regress/expected/pg_lsn.out
M src/test/regress/expected/subscription.out
Integrate FullTransactionIds deeper into two-phase code
commit : 62a17a92833d1eaa60d8ea372663290942a1e8eb
author : Michael Paquier <michael@paquier.xyz>
date : Mon, 7 Jul 2025 12:50:40 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Mon, 7 Jul 2025 12:50:40 +0900 This refactoring is a follow-up of the work done in 5a1dfde8334b, that
has switched 2PC file names to use FullTransactionIds when written on
disk. This will help with the integration of a follow-up solution
related to the handling of two-phase files during recovery, to address
older defects while reading these from disk after a crash.
This change is useful in itself as it reduces the need to build the
file names from epoch numbers and TransactionIds, because we can use
directly FullTransactionIds from which the 2PC file names are guessed.
So this avoids a lot of back-and-forth between the FullTransactionIds
retrieved from the file names and how these are passed around in the
internal 2PC logic.
Note that the core of the change is the use of a FullTransactionId
instead of a TransactionId in GlobalTransactionData, that tracks 2PC
file information in shared memory. The change in TwoPhaseCallback makes
this commit unfit for stable branches.
Noah has contributed a good chunk of this patch. I have spent some time
on it as well while working on the issues with two-phase state files and
recovery.
Author: Noah Misch <noah@leadboat.com>
Co-Authored-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://postgr.es/m/Z5sd5O9JO7NYNK-C@paquier.xyz
Discussion: https://postgr.es/m/20250116205254.65.nmisch@google.com M src/backend/access/transam/multixact.c
M src/backend/access/transam/twophase.c
M src/backend/access/transam/xact.c
M src/backend/storage/lmgr/lock.c
M src/backend/storage/lmgr/predicate.c
M src/backend/utils/activity/pgstat_relation.c
M src/include/access/multixact.h
M src/include/access/twophase.h
M src/include/access/twophase_rmgr.h
M src/include/pgstat.h
M src/include/storage/lock.h
M src/include/storage/predicate.h
Fix incompatibility with libxml2 >= 2.14
commit : 8aa54aa7eefbf738999ae855d9192bc57756201e
author : Michael Paquier <michael@paquier.xyz>
date : Mon, 7 Jul 2025 08:53:57 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Mon, 7 Jul 2025 08:53:57 +0900 libxml2 has deprecated the members of xmlBuffer, and it is recommended
to access them with dedicated routines. We have only one case in the
tree where this shows an impact: xml2/xpath.c where "content" was
getting directly accessed. The rest of the code looked fine, checking
the PostgreSQL code with libxml2 close to the top of its "2.14" branch.
xmlBufferContent() exists since year 2000 based on a check of the
upstream libxml2 tree, so let's switch to it.
Like 400928b83bd2, backpatch all the way down as this can have an impact
on all the branches already released once newer versions of libxml2 get
more popular.
Reported-by: Walid Ibrahim <walidib@amazon.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/aGdSdcR4QTjEHX6s@paquier.xyz
Backpatch-through: 13 M contrib/xml2/xpath.c
postgres_fdw: Add Assert to estimate_path_cost_size().
commit : 21c9756db6458f859e6579a6754c78154321cb39
author : Etsuro Fujita <efujita@postgresql.org>
date : Sun, 6 Jul 2025 17:15:00 +0900
committer: Etsuro Fujita <efujita@postgresql.org>
date : Sun, 6 Jul 2025 17:15:00 +0900 When estimating the cost/size of a pre-sorted path for a given upper
relation using local stats, this function dereferences the passed-in
PgFdwPathExtraData pointer without checking that it is not NULL. But
that is not a bug as the pointer is guaranteed to be non-NULL in that
case; to avoid confusion, add an Assert to ensure that it is not NULL
before dereferencing it.
Reported-by: Ranier Vilela <ranier.vf@gmail.com>
Author: Etsuro Fujita <etsuro.fujita@gmail.com>
Reviewed-by: Ranier Vilela <ranier.vf@gmail.com>
Discussion: https://postgr.es/m/CAEudQArgiALbV1akQpeZOgim7XP05n%3DbDP1%3DTcOYLA43nRX_vA%40mail.gmail.com M contrib/postgres_fdw/postgres_fdw.c
Fix new pg_upgrade query not to rely on regnamespace
commit : 144ad723a4484927266a316d1c9550d56745ff67
author : Álvaro Herrera <alvherre@kurilemu.de>
date : Fri, 4 Jul 2025 21:30:05 +0200
committer: Álvaro Herrera <alvherre@kurilemu.de>
date : Fri, 4 Jul 2025 21:30:05 +0200 That was invented in 9.5, and pg_upgrade claims to support back to 9.0.
But we don't need that with a simple query change, tested by Tom Lane.
Discussion: https://postgr.es/m/202507041645.afjl5rssvrgu@alvherre.pgsql M src/bin/pg_upgrade/check.c
pg_upgrade: Add missing newline in error message
commit : 90a85fce5e9b9ea63ec7e1b3001e0f39d4c8b7d4
author : Álvaro Herrera <alvherre@kurilemu.de>
date : Fri, 4 Jul 2025 18:31:35 +0200
committer: Álvaro Herrera <alvherre@kurilemu.de>
date : Fri, 4 Jul 2025 18:31:35 +0200 Minor oversight in 347758b12063 M src/bin/pg_upgrade/check.c
pg_upgrade: check for inconsistencies in not-null constraints w/inheritance
commit : f295494d338c452617f966d4d1f13a726cd72661
author : Álvaro Herrera <alvherre@kurilemu.de>
date : Fri, 4 Jul 2025 18:05:43 +0200
committer: Álvaro Herrera <alvherre@kurilemu.de>
date : Fri, 4 Jul 2025 18:05:43 +0200 With tables defined like this,
CREATE TABLE ip (id int PRIMARY KEY);
CREATE TABLE ic (id int) INHERITS (ip);
ALTER TABLE ic ALTER id DROP NOT NULL;
pg_upgrade fails during the schema restore phase due to this error:
ERROR: column "id" in child table must be marked NOT NULL
This can only be fixed by marking the child column as NOT NULL before
the upgrade, which could take an arbitrary amount of time (because ic's
data must be scanned). Have pg_upgrade's check mode warn if that
condition is found, so that users know what to adjust before running the
upgrade for real.
Author: Ali Akbar <the.apaan@gmail.com>
Reviewed-by: Justin Pryzby <pryzby@telsasoft.com>
Backpatch-through: 13
Discussion: https://postgr.es/m/CACQjQLoMsE+1pyLe98pi0KvPG2jQQ94LWJ+PTiLgVRK4B=i_jg@mail.gmail.com M src/bin/pg_upgrade/check.c
amcheck: Remove unused IndexCheckableCallback typedef.
commit : d64d68fddf9802dea4cc5be8a491937c3aefefa0
author : Fujii Masao <fujii@postgresql.org>
date : Fri, 4 Jul 2025 23:25:40 +0900
committer: Fujii Masao <fujii@postgresql.org>
date : Fri, 4 Jul 2025 23:25:40 +0900 Commit d70b17636dd introduced the IndexCheckableCallback typedef for
a callback function, but it was never used. This commit removes
the unused typedef to clean up dead code.
Author: Fujii Masao <masao.fujii@gmail.com>
Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Discussion: https://postgr.es/m/e1ea4e14-3b21-4e01-a5f2-0686883265df@oss.nttdata.com M contrib/amcheck/verify_common.h
Disable commit timestamps during bootstrap
commit : 5a6c39b6df3313e5c2d3aed714a56f5a5c6be3f2
author : Michael Paquier <michael@paquier.xyz>
date : Fri, 4 Jul 2025 15:09:24 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Fri, 4 Jul 2025 15:09:24 +0900 Attempting to use commit timestamps during bootstrapping leads to an
assertion failure, that can be reached for example with an initdb -c
that enables track_commit_timestamp. It makes little sense to register
a commit timestamp for a BootstrapTransactionId, so let's disable the
activation of the module in this case.
This problem has been independently reported once by each author of this
commit. Each author has proposed basically the same patch, relying on
IsBootstrapProcessingMode() to skip the use of commit_ts during
bootstrap. The test addition is a suggestion by me, and is applied down
to v16.
Author: Hayato Kuroda <kuroda.hayato@fujitsu.com>
Author: Andy Fan <zhihuifan1213@163.com>
Reviewed-by: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Reviewed-by: Fujii Masao <masao.fujii@oss.nttdata.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://postgr.es/m/OSCPR01MB14966FF9E4C4145F37B937E52F5102@OSCPR01MB14966.jpnprd01.prod.outlook.com
Discussion: https://postgr.es/m/87plejmnpy.fsf@163.com
Backpatch-through: 13 M src/backend/access/transam/commit_ts.c
M src/test/modules/commit_ts/t/001_base.pl
Speed up truncation of temporary relations.
commit : 78ebda66bf2683d42b853660757aaf16268ee3b7
author : Fujii Masao <fujii@postgresql.org>
date : Fri, 4 Jul 2025 09:03:58 +0900
committer: Fujii Masao <fujii@postgresql.org>
date : Fri, 4 Jul 2025 09:03:58 +0900 Previously, truncating a temporary relation required scanning the entire
local buffer pool once per relation fork to invalidate buffers. This could
be slow, especially with a large local buffers, as the scan was repeated
multiple times.
A similar issue with regular tables (shared buffers) was addressed in
commit 6d05086c0a7 by scanning the buffer pool only once for all forks.
This commit applies the same optimization to temporary relations,
improving truncation performance.
Author: Daniil Davydov <3danissimo@gmail.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>
Reviewed-by: Dilip Kumar <dilipbalaut@gmail.com>
Reviewed-by: Maxim Orlov <orlovmg@gmail.com>
Discussion: https://postgr.es/m/CAJDiXggNqsJOH7C5co4jA8nDk8vw-=sokyh5s1_TENWnC6Ofcg@mail.gmail.com M src/backend/storage/buffer/bufmgr.c
M src/backend/storage/buffer/localbuf.c
M src/include/storage/buf_internals.h
Simplify COALESCE() with one surviving argument.
commit : 931766aaec58b2ce09c82203456877e0b05e1271
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Thu, 3 Jul 2025 17:39:53 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Thu, 3 Jul 2025 17:39:53 -0400 If, after removal of useless null-constant arguments, a CoalesceExpr
has exactly one remaining argument, we can just take that argument as
the result, without bothering to wrap a new CoalesceExpr around it.
This isn't likely to produce any great improvement in runtime per se,
but it can lead to better plans since the planner no longer has to
treat the expression as non-strict.
However, there were a few regression test cases that intentionally
wrote COALESCE(x) as a shorthand way of creating a non-strict
subexpression. To avoid ruining the intent of those tests, write
COALESCE(x,x) instead. (If anyone ever proposes de-duplicating
COALESCE arguments, we'll need another iteration of this arms race.
But it seems pretty unlikely that such an optimization would be
worthwhile.)
Author: Maksim Milyutin <maksim.milyutin@tantorlabs.ru>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/8e8573c3-1411-448d-877e-53258b7b2be0@tantorlabs.ru M src/backend/optimizer/util/clauses.c
M src/test/regress/expected/join.out
M src/test/regress/expected/subselect.out
M src/test/regress/sql/join.sql
M src/test/regress/sql/subselect.sql
Add more cross-type comparisons to contrib/btree_gin.
commit : fc896821c4448038c5cc678c1aff7349ee850b23
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Thu, 3 Jul 2025 16:30:38 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Thu, 3 Jul 2025 16:30:38 -0400 Using the just-added infrastructure, extend btree_gin to support
cross-type operators in its other opclasses. All of the cross-type
comparison operators supported by the core btree opclasses for
these datatypes are now available for btree_gin indexes as well.
Author: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Arseniy Mukhin <arseniy.mukhin.dev@gmail.com>
Discussion: https://postgr.es/m/262624.1738460652@sss.pgh.pa.us M contrib/btree_gin/btree_gin–1.3–1.4.sql
M contrib/btree_gin/btree_gin.c
M contrib/btree_gin/expected/date.out
M contrib/btree_gin/expected/float4.out
M contrib/btree_gin/expected/float8.out
M contrib/btree_gin/expected/name.out
M contrib/btree_gin/expected/text.out
M contrib/btree_gin/expected/timestamp.out
M contrib/btree_gin/expected/timestamptz.out
M contrib/btree_gin/sql/date.sql
M contrib/btree_gin/sql/float4.sql
M contrib/btree_gin/sql/float8.sql
M contrib/btree_gin/sql/name.sql
M contrib/btree_gin/sql/text.sql
M contrib/btree_gin/sql/timestamp.sql
M contrib/btree_gin/sql/timestamptz.sql
Add cross-type comparisons to contrib/btree_gin.
commit : e2b64fcef35f70f96fa92db56fbfa9ac2da136c7
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Thu, 3 Jul 2025 16:24:31 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Thu, 3 Jul 2025 16:24:31 -0400 Extend the infrastructure in btree_gin.c to permit cross-type
operators, and add the code to support them for the int2, int4,
and int8 opclasses. (To keep this patch digestible, I left
the other datatypes for a separate patch.) This improves the
usability of btree_gin indexes by allowing them to support the
same set of queries that a regular btree index does.
Author: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Arseniy Mukhin <arseniy.mukhin.dev@gmail.com>
Discussion: https://postgr.es/m/262624.1738460652@sss.pgh.pa.us M contrib/btree_gin/Makefile
A contrib/btree_gin/btree_gin–1.3–1.4.sql
M contrib/btree_gin/btree_gin.c
M contrib/btree_gin/btree_gin.control
M contrib/btree_gin/expected/int2.out
M contrib/btree_gin/expected/int4.out
M contrib/btree_gin/expected/int8.out
M contrib/btree_gin/meson.build
M contrib/btree_gin/sql/int2.sql
M contrib/btree_gin/sql/int4.sql
M contrib/btree_gin/sql/int8.sql
M doc/src/sgml/gin.sgml
M src/tools/pgindent/typedefs.list
Break out xxx2yyy_opt_overflow APIs for more datetime conversions.
commit : 0059bbe1ecaa5f7f19a8b3aae059f352c02e1d88
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Thu, 3 Jul 2025 16:17:08 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Thu, 3 Jul 2025 16:17:08 -0400 Previous commits invented timestamp2timestamptz_opt_overflow,
date2timestamp_opt_overflow, and date2timestamptz_opt_overflow
functions to perform non-error-throwing conversions between
datetime types. This patch completes the set by adding
timestamp2date_opt_overflow, timestamptz2date_opt_overflow,
and timestamptz2timestamp_opt_overflow.
In addition, adjust timestamp2timestamptz_opt_overflow so that it
doesn't throw error if timestamp2tm fails, but treats that as an
overflow case. The situation probably can't arise except with an
invalid timestamp value, and I can't think of a way that that would
happen except data corruption. However, it's pretty silly to have a
function whose entire reason for existence is to not throw errors for
out-of-range inputs nonetheless throw an error for out-of-range input.
The new APIs are not used in this patch, but will be needed in
upcoming btree_gin changes.
Author: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Arseniy Mukhin <arseniy.mukhin.dev@gmail.com>
Discussion: https://postgr.es/m/262624.1738460652@sss.pgh.pa.us M src/backend/utils/adt/date.c
M src/backend/utils/adt/timestamp.c
M src/include/utils/date.h
M src/include/utils/timestamp.h
Obtain required table lock during cross-table updates, redux.
commit : a10f21e6ce549705f194b8fdb28e685403e7579d
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Thu, 3 Jul 2025 13:46:07 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Thu, 3 Jul 2025 13:46:07 -0400 Commits 8319e5cb5 et al missed the fact that ATPostAlterTypeCleanup
contains three calls to ATPostAlterTypeParse, and the other two
also need protection against passing a relid that we don't yet
have lock on. Add similar logic to those code paths, and add
some test cases demonstrating the need for it.
In v18 and master, the test cases demonstrate that there's a
behavioral discrepancy between stored generated columns and virtual
generated columns: we disallow changing the expression of a stored
column if it's used in any composite-type columns, but not that of
a virtual column. Since the expression isn't actually relevant to
either sort of composite-type usage, this prohibition seems
unnecessary; but changing it is a matter for separate discussion.
For now we are just documenting the existing behavior.
Reported-by: jian he <jian.universality@gmail.com>
Author: jian he <jian.universality@gmail.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: CACJufxGKJtGNRRSXfwMW9SqVOPEMdP17BJ7DsBf=tNsv9pWU9g@mail.gmail.com
Backpatch-through: 13 M src/backend/commands/tablecmds.c
M src/test/regress/expected/alter_table.out
M src/test/regress/expected/generated_stored.out
M src/test/regress/expected/generated_virtual.out
M src/test/regress/sql/alter_table.sql
M src/test/regress/sql/generated_stored.sql
M src/test/regress/sql/generated_virtual.sql
Add tab-completion for ALTER TABLE not-nulls
commit : a604affaded028b6bfba024127931289c2b756c2
author : Álvaro Herrera <alvherre@kurilemu.de>
date : Thu, 3 Jul 2025 16:54:36 +0200
committer: Álvaro Herrera <alvherre@kurilemu.de>
date : Thu, 3 Jul 2025 16:54:36 +0200 The command is: ALTER TABLE x ADD [CONSTRAINT y] NOT NULL z
This syntax was added in 18, but I got pushback for getting commit
dbf42b84ac7b in 18 (also tab-completion for new syntax) after the
feature freeze, so I'll put this in master only for now.
Author: Álvaro Herrera <alvherre@kurilemu.de>
Reported-by: Fujii Masao <masao.fujii@oss.nttdata.com>
Reviewed-by: Fujii Masao <masao.fujii@oss.nttdata.com>
Reviewed-by: Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>
Discussion: https://postgr.es/m/d4f14c6b-086b-463c-b15f-01c7c9728eab@oss.nttdata.com
Discussion: https://postgr.es/m/202505111448.bwbfomrymq4b@alvherre.pgsql M src/bin/psql/tab-complete.in.c
Remove leftover dead code from commit_ts.h.
commit : c84698ceaea8a08b1d11d527ce9530a98b156799
author : Fujii Masao <fujii@postgresql.org>
date : Thu, 3 Jul 2025 23:39:45 +0900
committer: Fujii Masao <fujii@postgresql.org>
date : Thu, 3 Jul 2025 23:39:45 +0900 Commit 08aa89b3262 removed the COMMIT_TS_SETTS WAL record,
leaving xl_commit_ts_set and SizeOfCommitTsSet unused. However,
it missed removing these definitions. This commit cleans up
the leftover code.
Since this is a cleanup rather than a bug fix, it is applied only to
the master branch.
Author: Andy Fan <zhihuifan1213@163.com>
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>
Discussion: https://postgr.es/m/87ecuzmkqf.fsf@163.com M src/include/access/commit_ts.h
Fix broken XML
commit : 81a2625eb2e4608ba6ca41b2bf548dce8d81ced7
author : Álvaro Herrera <alvherre@kurilemu.de>
date : Thu, 3 Jul 2025 16:23:22 +0200
committer: Álvaro Herrera <alvherre@kurilemu.de>
date : Thu, 3 Jul 2025 16:23:22 +0200 I messed this up in commit 87251e114967.
Per buildfarm member alabio, via Daniel Gustafsson.
Discussion: https://postgr.es/m/B94D82D1-7AF4-4412-AC02-82EAA6154957@yesql.se M doc/src/sgml/ref/create_trigger.sgml
doc: Update outdated descriptions of wal_status in pg_replication_slots.
commit : ff3007c66dc6213fcdaea9a996865bbd943e3e82
author : Fujii Masao <fujii@postgresql.org>
date : Thu, 3 Jul 2025 23:07:23 +0900
committer: Fujii Masao <fujii@postgresql.org>
date : Thu, 3 Jul 2025 23:07:23 +0900 The documentation for pg_replication_slots previously mentioned only
max_slot_wal_keep_size as a condition under which the wal_status column
could show unreserved or lost. However, since commit be87200,
replication slots can also be invalidated due to horizon or wal_level,
and since commit ac0e33136ab, idle_replication_slot_timeout can also
trigger this state.
This commit updates the description of the wal_status column to
reflect that max_slot_wal_keep_size is not the only cause of the lost state.
Back-patched to v16, where the additional invalidation cases were introduced.
Author: Fujii Masao <masao.fujii@gmail.com>
Reviewed-by: Hayato Kuroda <kuroda.hayato@fujitsu.com>
Reviewed-by: Nisha Moond <nisha.moond412@gmail.com>
Discussion: https://postgr.es/m/78b34e84-2195-4f28-a151-5d204a382fdd@oss.nttdata.com
Backpatch-through: 16 M doc/src/sgml/system-views.sgml
Prevent creation of duplicate not-null constraints for domains
commit : 647cffd2f3210818f3882a1ea40cfbe0a4ea8fd7
author : Álvaro Herrera <alvherre@kurilemu.de>
date : Thu, 3 Jul 2025 11:46:12 +0200
committer: Álvaro Herrera <alvherre@kurilemu.de>
date : Thu, 3 Jul 2025 11:46:12 +0200 This was previously harmless, but now that we create pg_constraint rows
for those, duplicates are not welcome anymore.
Backpatch to 18.
Co-authored-by: jian he <jian.universality@gmail.com>
Co-authored-by: Álvaro Herrera <alvherre@kurilemu.de>
Discussion: https://postgr.es/m/CACJufxFSC0mcQ82bSk58sO-WJY4P-o4N6RD2M0D=DD_u_6EzdQ@mail.gmail.com M src/backend/commands/typecmds.c
M src/test/regress/expected/domain.out
M src/test/regress/sql/domain.sql
Fix bogus grammar for a CREATE CONSTRAINT TRIGGER error
commit : 87251e114967d668c8f90ed9fb8c8a8834c2d288
author : Álvaro Herrera <alvherre@kurilemu.de>
date : Thu, 3 Jul 2025 11:25:39 +0200
committer: Álvaro Herrera <alvherre@kurilemu.de>
date : Thu, 3 Jul 2025 11:25:39 +0200 If certain constraint characteristic clauses (NO INHERIT, NOT VALID, NOT
ENFORCED) are given to CREATE CONSTRAINT TRIGGER, the resulting error
message is
ERROR: TRIGGER constraints cannot be marked NO INHERIT
which is a bit silly, because these aren't "constraints of type
TRIGGER". Hardcode a better error message to prevent it. This is a
cosmetic fix for quite a fringe problem with no known complaints from
users, so no backpatch.
While at it, silently accept ENFORCED if given.
Author: Amul Sul <sulamul@gmail.com>
Reviewed-by: jian he <jian.universality@gmail.com>
Reviewed-by: Fujii Masao <masao.fujii@oss.nttdata.com>
Reviewed-by: Álvaro Herrera <alvherre@kurilemu.de>
Discussion: https://postgr.es/m/CAAJ_b97hd-jMTS7AjgU6TDBCzDx_KyuKxG+K-DtYmOieg+giyQ@mail.gmail.com
Discussion: https://postgr.es/m/CACJufxHSp2puxP=q8ZtUGL1F+heapnzqFBZy5ZNGUjUgwjBqTQ@mail.gmail.com M doc/src/sgml/ref/create_trigger.sgml
M src/backend/parser/gram.y
M src/test/regress/expected/triggers.out
M src/test/regress/sql/triggers.sql
Refactor subtype field of AlterDomainStmt
commit : 8ec04c8577a1aa3aac4b77b2747dde30c8f9c8c6
author : Michael Paquier <michael@paquier.xyz>
date : Thu, 3 Jul 2025 16:34:28 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Thu, 3 Jul 2025 16:34:28 +0900 AlterDomainStmt.subtype used characters for its subtypes of commands,
SET|DROP DEFAULT|NOT NULL and ADD|DROP|VALIDATE CONSTRAINT, which were
hardcoded in a couple of places of the code. The code is improved by
using an enum instead, with the same character values as the original
code.
Note that the field was documented in parsenodes.h and that it forgot to
mention 'V' (VALIDATE CONSTRAINT).
Author: Quan Zongliang <quanzongliang@yeah.net>
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Reviewed-by: wenhui qiu <qiuwenhuifx@gmail.com>
Reviewed-by: Tender Wang <tndrwang@gmail.com>
Discussion: https://postgr.es/m/41ff310b-16bd-44b9-a3ef-97e20f14b709@yeah.net M src/backend/commands/tablecmds.c
M src/backend/parser/gram.y
M src/backend/tcop/utility.c
M src/include/nodes/parsenodes.h
M src/tools/pgindent/typedefs.list
doc: Remove incorrect note about wal_status in pg_replication_slots.
commit : 170673a22f28bd6a1d3fa56e23cd74dcbcb60c17
author : Fujii Masao <fujii@postgresql.org>
date : Thu, 3 Jul 2025 16:03:19 +0900
committer: Fujii Masao <fujii@postgresql.org>
date : Thu, 3 Jul 2025 16:03:19 +0900 The documentation previously stated that the wal_status column is NULL
if restart_lsn is NULL in the pg_replication_slots view. This is incorrect,
and wal_status can be "lost" even when restart_lsn is NULL.
This commit removes the incorrect description.
Back-patched to all supported versions.
Author: Fujii Masao <masao.fujii@gmail.com>
Reviewed-by: Nisha Moond <nisha.moond412@gmail.com>
Discussion: https://postgr.es/m/c9d23cdc-b5dd-455a-8ee9-f1f24d701d89@oss.nttdata.com
Backpatch-through: 13 M doc/src/sgml/system-views.sgml
Support multi-line headers in COPY FROM command.
commit : bc2f348e87c02de63647dbe290d64ff088880dbe
author : Fujii Masao <fujii@postgresql.org>
date : Thu, 3 Jul 2025 15:27:26 +0900
committer: Fujii Masao <fujii@postgresql.org>
date : Thu, 3 Jul 2025 15:27:26 +0900 The COPY FROM command now accepts a non-negative integer for the HEADER option,
allowing multiple header lines to be skipped. This is useful when the input
contains multi-line headers that should be ignored during data import.
Author: Shinya Kato <shinya11.kato@gmail.com>
Co-authored-by: Fujii Masao <masao.fujii@gmail.com>
Reviewed-by: Yugo Nagata <nagata@sraoss.co.jp>
Discussion: https://postgr.es/m/CAOzEurRPxfzbxqeOPF_AGnAUOYf=Wk0we+1LQomPNUNtyZGBZw@mail.gmail.com M doc/src/sgml/ref/copy.sgml
M src/backend/commands/copy.c
M src/backend/commands/copyfromparse.c
M src/backend/commands/copyto.c
M src/include/commands/copy.h
M src/test/regress/expected/copy.out
M src/test/regress/expected/copy2.out
M src/test/regress/sql/copy.sql
M src/test/regress/sql/copy2.sql
M src/tools/pgindent/typedefs.list
Improve checks for GUC recovery_target_timeline
commit : fd7d7b719137b5c427681a50c0a0ac2d745b68bd
author : Michael Paquier <michael@paquier.xyz>
date : Thu, 3 Jul 2025 11:14:20 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Thu, 3 Jul 2025 11:14:20 +0900 Currently check_recovery_target_timeline() converts any value that is
not "current", "latest", or a valid integer to 0. So, for example, the
following configuration added to postgresql.conf followed by a startup:
recovery_target_timeline = 'bogus'
recovery_target_timeline = '9999999999'
... results in the following error patterns:
FATAL: 22023: recovery target timeline 0 does not exist
FATAL: 22023: recovery target timeline 1410065407 does not exist
This is confusing, because the server does not reflect the intention of
the user, and just reports incorrect data unrelated to the GUC.
The origin of the problem is that we do not perform a range check in the
GUC value passed-in for recovery_target_timeline. This commit improves
the situation by using strtou64() and by providing stricter range
checks. Some test cases are added for the cases of an incorrect, an
upper-bound and a lower-bound timeline value, checking the sanity of the
reports based on the contents of the server logs.
Author: David Steele <david@pgmasters.net>
Discussion: https://postgr.es/m/e5d472c7-e9be-4710-8dc4-ebe721b62cea@pgbackrest.org M src/backend/access/transam/xlogrecovery.c
M src/test/recovery/t/003_recovery_targets.pl
Enable use of Memoize for ANTI joins
commit : 0da29e4cb161f78a5ef534b3fb4467756a422e25
author : Richard Guo <rguo@postgresql.org>
date : Thu, 3 Jul 2025 10:57:26 +0900
committer: Richard Guo <rguo@postgresql.org>
date : Thu, 3 Jul 2025 10:57:26 +0900 Currently, we do not support Memoize for SEMI and ANTI joins because
nested loop SEMI/ANTI joins do not scan the inner relation to
completion, which prevents Memoize from marking the cache entry as
complete. One might argue that we could mark the cache entry as
complete after fetching the first inner tuple, but that would not be
safe: if the first inner tuple and the current outer tuple do not
satisfy the join clauses, a second inner tuple matching the parameters
would find the cache entry already marked as complete.
However, if the inner side is provably unique, this issue doesn't
arise, since there would be no second matching tuple. That said, this
doesn't help in the case of SEMI joins, because a SEMI join with a
provably unique inner side would already have been reduced to an inner
join by reduce_unique_semijoins.
Therefore, in this patch, we check whether the inner relation is
provably unique for ANTI joins and enable the use of Memoize in such
cases.
Author: Richard Guo <guofenglinux@gmail.com>
Reviewed-by: wenhui qiu <qiuwenhuifx@gmail.com>
Reviewed-by: Andrei Lepikhov <lepihov@gmail.com>
Discussion: https://postgr.es/m/CAMbWs48FdLiMNrmJL-g6mDvoQVt0yNyJAqMkv4e2Pk-5GKCZLA@mail.gmail.com M src/backend/optimizer/path/joinpath.c
M src/test/regress/expected/memoize.out
M src/test/regress/sql/memoize.sql
Add InjectionPointList() to retrieve list of injection points
commit : 7b2eb72b1b8ce4279e42848a3978e781ae239355
author : Michael Paquier <michael@paquier.xyz>
date : Thu, 3 Jul 2025 08:41:25 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Thu, 3 Jul 2025 08:41:25 +0900 This routine has come as a useful piece to be able to know the list of
injection points currently attached in a system. One area would be to
use it in a set-returning function, or just let out-of-core code play
with it.
This hides the internals of the shared memory array lookup holding the
information about the injection points (point name, library and function
name), allocating the result in a palloc'd List consumable by the
caller.
Reviewed-by: Jeff Davis <pgsql@j-davis.com>
Reviewed-by: Hayato Kuroda <kuroda.hayato@fujitsu.com>
Reviewed-by: Rahila Syed <rahilasyed90@gmail.com>
Discussion: https://postgr.es/m/Z_xYkA21KyLEHvWR@paquier.xyz
Discussion: https://postgr.es/m/aBG2rPwl3GE7m1-Q@paquier.xyz M src/backend/utils/misc/injection_point.c
M src/include/utils/injection_point.h
M src/tools/pgindent/typedefs.list
Correctly copy the target host identification in PQcancelCreate.
commit : fe05430ace8e0b3c945cf581564458a5983a07b6
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Wed, 2 Jul 2025 15:47:59 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Wed, 2 Jul 2025 15:47:59 -0400 PQcancelCreate failed to copy struct pg_conn_host's "type" field,
instead leaving it zero (a/k/a CHT_HOST_NAME). This seemingly
has no great ill effects if it should have been CHT_UNIX_SOCKET
instead, but if it should have been CHT_HOST_ADDRESS then a
null-pointer dereference will occur when the cancelConn is used.
Bug: #18974
Reported-by: Maxim Boguk <maxim.boguk@gmail.com>
Author: Sergei Kornilov <sk@zsrv.org>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/18974-575f02b2168b36b3@postgresql.org
Backpatch-through: 17 M src/interfaces/libpq/fe-cancel.c
Fix cross-version upgrade test breakage from commit fe07100e82.
commit : 0c2b7174c362d3092eb7eabf0117a8d47c64ce0e
author : Nathan Bossart <nathan@postgresql.org>
date : Wed, 2 Jul 2025 13:26:33 -0500
committer: Nathan Bossart <nathan@postgresql.org>
date : Wed, 2 Jul 2025 13:26:33 -0500 In commit fe07100e82, I renamed a couple of functions in
test_dsm_registry to make it clear what they are testing. However,
the buildfarm's cross-version upgrade tests run pg_upgrade with the
test modules installed, so this caused errors like:
ERROR: could not find function "get_val_in_shmem" in file ".../test_dsm_registry.so"
To fix, revert those renames. I could probably get away with only
un-renaming the C symbols, but I figured I'd avoid introducing
function name mismatches. Also, AFAICT the buildfarm's
cross-version upgrade tests do not run the test module tests
post-upgrade, else we'll need to properly version the extension.
Per buildfarm member crake.
Discussion: https://postgr.es/m/aGVuYUNW23tStUYs%40nathan M src/test/modules/test_dsm_registry/expected/test_dsm_registry.out
M src/test/modules/test_dsm_registry/sql/test_dsm_registry.sql
M src/test/modules/test_dsm_registry/test_dsm_registry–1.0.sql
M src/test/modules/test_dsm_registry/test_dsm_registry.c
Make more use of RELATION_IS_OTHER_TEMP().
commit : bb109382ef403a4827caacf2978e82f46593600c
author : Nathan Bossart <nathan@postgresql.org>
date : Wed, 2 Jul 2025 12:32:19 -0500
committer: Nathan Bossart <nathan@postgresql.org>
date : Wed, 2 Jul 2025 12:32:19 -0500 A few places were open-coding it instead of using this handy macro.
Author: Junwang Zhao <zhjwpku@gmail.com>
Reviewed-by: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>
Discussion: https://postgr.es/m/CAEG8a3LjTGJcOcxQx-SUOGoxstG4XuCWLH0ATJKKt_aBTE5K8w%40mail.gmail.com M src/backend/commands/tablecmds.c
Add GetNamedDSA() and GetNamedDSHash().
commit : fe07100e82b096d3c848cace790d4b4daf0c4131
author : Nathan Bossart <nathan@postgresql.org>
date : Wed, 2 Jul 2025 11:50:52 -0500
committer: Nathan Bossart <nathan@postgresql.org>
date : Wed, 2 Jul 2025 11:50:52 -0500 Presently, the dynamic shared memory (DSM) registry only provides
GetNamedDSMSegment(), which allocates a fixed-size segment. To use
the DSM registry for more sophisticated things like dynamic shared
memory areas (DSAs) or a hash table backed by a DSA (dshash), users
need to create a DSM segment that stores various handles and LWLock
tranche IDs and to write fairly complicated initialization code.
Furthermore, there is likely little variation in this
initialization code between libraries.
This commit introduces functions that simplify allocating a DSA or
dshash within the DSM registry. These functions are very similar
to GetNamedDSMSegment(). Notable differences include the lack of
an initialization callback parameter and the prohibition of calling
the functions more than once for a given entry in each backend
(which should be trivially avoidable in most circumstances). While
at it, this commit bumps the maximum DSM registry entry name length
from 63 bytes to 127 bytes.
Also note that even though one could presumably detach/destroy the
DSAs and dshashes created in the registry, such use-cases are not
yet well-supported, if for no other reason than the associated DSM
registry entries cannot be removed. Adding such support is left as
a future exercise.
The test_dsm_registry test module contains tests for the new
functions and also serves as a complete usage example.
Reviewed-by: Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>
Reviewed-by: Sami Imseih <samimseih@gmail.com>
Reviewed-by: Florents Tselai <florents.tselai@gmail.com>
Reviewed-by: Rahila Syed <rahilasyed90@gmail.com>
Discussion: https://postgr.es/m/aEC8HGy2tRQjZg_8%40nathan M src/backend/storage/ipc/dsm_registry.c
M src/backend/utils/mmgr/dsa.c
M src/include/storage/dsm_registry.h
M src/include/utils/dsa.h
M src/test/modules/test_dsm_registry/expected/test_dsm_registry.out
M src/test/modules/test_dsm_registry/sql/test_dsm_registry.sql
M src/test/modules/test_dsm_registry/test_dsm_registry–1.0.sql
M src/test/modules/test_dsm_registry/test_dsm_registry.c
M src/tools/pgindent/typedefs.list
Update obsolete row compare preprocessing comments.
commit : 9ca30a0b04d751c58d4efa0a2b3073cb285b1bd2
author : Peter Geoghegan <pg@bowt.ie>
date : Wed, 2 Jul 2025 12:36:35 -0400
committer: Peter Geoghegan <pg@bowt.ie>
date : Wed, 2 Jul 2025 12:36:35 -0400 Restore nbtree preprocessing comments describing how we mark nbtree row
compare members required to how they were prior to 2016 bugfix commit
a298a1e0.
Oversight in commit bd3f59fd, which made nbtree preprocessing revert to
the original 2006 rules, but neglected to revert these comments.
Backpatch-through: 18 M src/backend/access/nbtree/nbtpreprocesskeys.c
Allow width_bucket()'s "operand" input to be NaN.
commit : 7374b3a53635cb031b4d1bedfd80531409f54693
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Wed, 2 Jul 2025 11:34:40 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Wed, 2 Jul 2025 11:34:40 -0400 The array-based variant of width_bucket() has always accepted NaN
inputs, treating them as equal but larger than any non-NaN,
as we do in ordinary comparisons. But up to now, the four-argument
variants threw errors for a NaN operand. This is inconsistent
and unnecessary, since we can perfectly well regard NaN as falling
after the last bucket.
We do still throw error for NaN or infinity histogram-bound inputs,
since there's no way to compute sensible bucket boundaries.
Arguably this is a bug fix, but given the lack of field complaints
I'm content to fix it in master.
Author: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Dean Rasheed <dean.a.rasheed@gmail.com>
Discussion: https://postgr.es/m/2822872.1750540911@sss.pgh.pa.us M src/backend/utils/adt/float.c
M src/backend/utils/adt/numeric.c
M src/test/regress/expected/numeric.out
M src/test/regress/sql/numeric.sql
Fix error message for ALTER CONSTRAINT ... NOT VALID
commit : c989affb527d330898e92e6223e2218e702176ed
author : Álvaro Herrera <alvherre@kurilemu.de>
date : Wed, 2 Jul 2025 17:02:27 +0200
committer: Álvaro Herrera <alvherre@kurilemu.de>
date : Wed, 2 Jul 2025 17:02:27 +0200 Trying to alter a constraint so that it becomes NOT VALID results in an
error that assumes the constraint is a foreign key. This is potentially
wrong, so give a more generic error message.
While at it, give CREATE CONSTRAINT TRIGGER a better error message as
well.
Co-authored-by: jian he <jian.universality@gmail.com>
Co-authored-by: Fujii Masao <masao.fujii@oss.nttdata.com>
Co-authored-by: Álvaro Herrera <alvherre@kurilemu.de>
Co-authored-by: Amul Sul <sulamul@gmail.com>
Discussion: https://postgr.es/m/CACJufxHSp2puxP=q8ZtUGL1F+heapnzqFBZy5ZNGUjUgwjBqTQ@mail.gmail.com M src/backend/parser/gram.y
M src/test/regress/expected/constraints.out
M src/test/regress/expected/foreign_key.out
M src/test/regress/sql/constraints.sql
Make row compares robust during nbtree array scans.
commit : bd3f59fdb71721921bb0aca7e16d483f72e95779
author : Peter Geoghegan <pg@bowt.ie>
date : Wed, 2 Jul 2025 09:48:15 -0400
committer: Peter Geoghegan <pg@bowt.ie>
date : Wed, 2 Jul 2025 09:48:15 -0400 Recent nbtree bugfix commit 5f4d98d4 added a special case to the code
that sets up a page-level prefix of keys that are definitely satisfied
by every tuple on the page: whenever _bt_set_startikey reached a row
compare key, we'd refuse to apply the pstate.forcenonrequired behavior
in scans where that usually happens (scans with a higher-order array
key). That hack made the scan avoid essentially the same infinite
cycling behavior that also affected nbtree scans with redundant keys
(keys that preprocessing could not eliminate) prior to commit f09816a0.
There are now serious doubts about this row compare workaround.
Testing has shown that a scan with a row compare key and an array key
could still read the same leaf page twice (without the scan's direction
changing), which isn't supposed to be possible following the SAOP
enhancements added by Postgres 17 commit 5bf748b8. Also, we still
allowed a required row compare key to be used with forcenonrequired mode
when its header key happened to be beyond the pstate.ikey set by
_bt_set_startikey, which was complicated and brittle.
The underlying problem was that row compares had inconsistent rules
around how scans start (which keys can be used for initial positioning
purposes) and how scans end (which keys can set continuescan=false).
Quals with redundant keys that could not be eliminated by preprocessing
also had that same quality to them prior to today's bugfix f09816a0. It
now seems prudent to bring row compare keys in line with the new charter
for required keys, by making the start and end rules symmetric.
This commit fixes two points of disagreement between _bt_first and
_bt_check_rowcompare. Firstly, _bt_check_rowcompare was capable of
ending the scan at the point where it needed to compare an ISNULL-marked
row compare member that came immediately after a required row compare
member. _bt_first now has symmetric handling for NULL row compares.
Secondly, _bt_first had its own ideas about which keys were safe to use
for initial positioning purposes. It could use fewer or more keys than
_bt_check_rowcompare. _bt_first now uses the same requiredness markings
as _bt_check_rowcompare for this.
Now that _bt_first and _bt_check_rowcompare agree on how to start and
end scans, we can get rid of the forcenonrequired special case, without
any risk of infinite cycling. This approach also makes row compare keys
behave more like regular scalar keys, particularly within _bt_first.
Fixing these inconsistencies necessitates dealing with a related issue
with the way that row compares were marked required by preprocessing: we
didn't mark any lower-order row members required following 2016 bugfix
commit a298a1e0. That approach was over broad. The bug in question was
actually an oversight in how _bt_check_rowcompare dealt with tuple NULL
values that failed to satisfy a scan key marked required in the opposite
scan direction (it was a bug in 2011 commits 6980f817 and 882368e8, not
a bug in 2006 commit 3a0a16cb). Go back to marking row compare members
as required using the original 2006 rules, and fix the 2016 bug in a
more principled way: by limiting use of the "set continuescan=false with
a key required in the opposite scan direction upon encountering a NULL
tuple value" optimization to the first/most significant row member key.
While it isn't safe to use an implied IS NOT NULL qualifier to end the
scan when it comes from a required lower-order row compare member key,
it _is_ generally safe for such a required member key to end the scan --
provided the key is marked required in the _current_ scan direction.
This fixes what was arguably an oversight in either commit 5f4d98d4 or
commit 8a510275. It is a direct follow-up to today's commit f09816a0.
Author: Peter Geoghegan <pg@bowt.ie>
Reviewed-By: Heikki Linnakangas <heikki.linnakangas@iki.fi>
Discussion: https://postgr.es/m/CAH2-Wz=pcijHL_mA0_TJ5LiTB28QpQ0cGtT-ccFV=KzuunNDDQ@mail.gmail.com
Backpatch-through: 18 M src/backend/access/nbtree/nbtpreprocesskeys.c
M src/backend/access/nbtree/nbtsearch.c
M src/backend/access/nbtree/nbtutils.c
M src/test/regress/expected/btree_index.out
M src/test/regress/sql/btree_index.sql
Make handling of redundant nbtree keys more robust.
commit : f09816a0a7c138751b76ba3676adb75c94be2ab0
author : Peter Geoghegan <pg@bowt.ie>
date : Wed, 2 Jul 2025 09:40:49 -0400
committer: Peter Geoghegan <pg@bowt.ie>
date : Wed, 2 Jul 2025 09:40:49 -0400 nbtree preprocessing's handling of redundant (and contradictory) keys
created problems for scans with = arrays. It was just about possible
for a scan with an = array key and one or more redundant keys (keys that
preprocessing could not eliminate due an incomplete opfamily and a
cross-type key) to get stuck. Testing has shown that infinite cycling
where the scan never manages to make forward progress was possible.
This could happen when the scan's arrays were reset in _bt_readpage's
forcenonrequired=true path (added by bugfix commit 5f4d98d4) when the
arrays weren't at least advanced up to the same point that they were in
at the start of the _bt_readpage call. Earlier redundant keys prevented
the finaltup call to _bt_advance_array_keys from reaching lower-order
keys that needed to be used to sufficiently advance the scan's arrays.
To fix, make preprocessing leave the scan's keys in a state that is as
close as possible to how it'll usually leave them (in the common case
where there's no redundant keys that preprocessing failed to eliminate).
Now nbtree preprocessing _reliably_ leaves behind at most one required
>/>= key per index column, and at most one required </<= key per index
column. Columns that have one or more = keys that are eligible to be
marked required (based on the traditional rules) prioritize the = keys
over redundant inequality keys; they'll _reliably_ be left with only one
of the = keys as the index column's only required key.
Keys that are not marked required (whether due to the new preprocessing
step running or for some other reason) are relocated to the end of the
so->keyData[] array as needed. That way they'll always be evaluated
after the scan's required keys, and so cannot prevent code in places
like _bt_advance_array_keys and _bt_first from reaching a required key.
Also teach _bt_first to decide which initial positioning keys to use
based on the same requiredness markings that have long been used by
_bt_checkkeys/_bt_advance_array_keys. This is a necessary condition for
reliably avoiding infinite cycling. _bt_advance_array_keys expects to
be able to reason about what'll happen in the next _bt_first call should
it start another primitive index scan, by evaluating inequality keys
that were marked required in the opposite-to-scan scan direction only.
Now everybody (_bt_first, _bt_checkkeys, and _bt_advance_array_keys)
will always agree on which exact key will be used on each index column
to start and/or end the scan (except when row compare keys are involved,
which have similar problems not addressed by this commit).
An upcoming commit will finish off the work started by this commit by
harmonizing how _bt_first, _bt_checkkeys, and _bt_advance_array_keys
apply row compare keys to start and end scans.
This fixes what was arguably an oversight in either commit 5f4d98d4 or
commit 8a510275.
Author: Peter Geoghegan <pg@bowt.ie>
Reviewed-By: Heikki Linnakangas <heikki.linnakangas@iki.fi>
Discussion: https://postgr.es/m/CAH2-Wz=ds4M+3NXMgwxYxqU8MULaLf696_v5g=9WNmWL2=Uo2A@mail.gmail.com
Backpatch-through: 18 M src/backend/access/nbtree/nbtpreprocesskeys.c
M src/backend/access/nbtree/nbtsearch.c
M src/backend/access/nbtree/nbtutils.c
doc: pg_buffercache documentation wordsmithing
commit : 8eede2c7200fba0eae40a19ca78939fd0dc0ec5b
author : Daniel Gustafsson <dgustafsson@postgresql.org>
date : Wed, 2 Jul 2025 11:42:36 +0200
committer: Daniel Gustafsson <dgustafsson@postgresql.org>
date : Wed, 2 Jul 2025 11:42:36 +0200 A words seemed to have gone missing in the leading paragraphs.
Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Co-authored-by: Daniel Gustafsson <daniel@yesql.se>
Discussion: https://postgr.es/m/aGTQYZz9L0bjlzVL@ip-10-97-1-34.eu-west-3.compute.internal
Backpatch-through: 18 M doc/src/sgml/pgbuffercache.sgml
meson: Increase minimum version to 0.57.2
commit : f039c2244110a55e966e8538b6be8bf83458a0fb
author : Peter Eisentraut <peter@eisentraut.org>
date : Wed, 2 Jul 2025 11:14:53 +0200
committer: Peter Eisentraut <peter@eisentraut.org>
date : Wed, 2 Jul 2025 11:14:53 +0200 The previous minimum was to maintain support for Python 3.5, but we
now require Python 3.6 anyway (commit 45363fca637), so that reason is
obsolete. A small raise to Meson 0.57 allows getting rid of a fair
amount of version conditionals and silences some future-deprecated
warnings.
With the version bump, the following deprecation warnings appeared and
are fixed:
WARNING: Project targets '>=0.57' but uses feature deprecated since '0.55.0': ExternalProgram.path. use ExternalProgram.full_path() instead
WARNING: Project targets '>=0.57' but uses feature deprecated since '0.56.0': meson.build_root. use meson.project_build_root() or meson.global_build_root() instead.
It turns out that meson 0.57.0 and 0.57.1 are buggy for our use, so
the minimum is actually set to 0.57.2. This is specific to this
version series; in the future we won't necessarily need to be this
precise.
Reviewed-by: Nazir Bilal Yavuz <byavuz81@gmail.com>
Reviewed-by: Andres Freund <andres@anarazel.de>
Discussion: https://www.postgresql.org/message-id/flat/42e13eb0-862a-441e-8d84-4f0fd5f6def0%40eisentraut.org M contrib/basebackup_to_shell/meson.build
M contrib/dblink/meson.build
M contrib/postgres_fdw/meson.build
M doc/src/sgml/installation.sgml
M meson.build
M src/backend/jit/llvm/meson.build
M src/bin/pg_basebackup/meson.build
M src/bin/pg_dump/meson.build
M src/bin/pg_verifybackup/meson.build
M src/include/nodes/meson.build
M src/include/pch/meson.build
M src/makefiles/meson.build
M src/pl/plperl/meson.build
M src/test/modules/injection_points/meson.build
M src/test/modules/oauth_validator/meson.build
M src/test/ssl/meson.build
Reformat some node comments
commit : de5aa15209397712dcfdeee2a72977b83374f276
author : Peter Eisentraut <peter@eisentraut.org>
date : Wed, 2 Jul 2025 09:41:08 +0200
committer: Peter Eisentraut <peter@eisentraut.org>
date : Wed, 2 Jul 2025 09:41:08 +0200 Use per-field comments for IndexInfo, instead of one big header
comment listing all the fields. This makes the relevant comments
easier to find, and it will also make it less likely that comments are
not updated when fields are added or removed, as has happened in the
past.
Author: Japin Li <japinli@hotmail.com>
Discussion: https://www.postgresql.org/message-id/flat/ME0P300MB04453E6C7EA635F0ECF41BFCB6832%40ME0P300MB0445.AUSP300.PROD.OUTLOOK.COM M src/include/nodes/execnodes.h
Fix missing FSM vacuum opportunities on tables without indexes.
commit : 3811ca3600a31f999e4709de4a9c64c789992e14
author : Masahiko Sawada <msawada@postgresql.org>
date : Tue, 1 Jul 2025 23:25:20 -0700
committer: Masahiko Sawada <msawada@postgresql.org>
date : Tue, 1 Jul 2025 23:25:20 -0700 Commit c120550edb86 optimized the vacuuming of relations without
indexes (a.k.a. one-pass strategy) by directly marking dead item IDs
as LP_UNUSED. However, the periodic FSM vacuum was still checking if
dead item IDs had been marked as LP_DEAD when attempting to vacuum the
FSM every VACUUM_FSM_EVERY_PAGES blocks. This condition was never met
due to the optimization, resulting in missed FSM vacuum
opportunities.
This commit modifies the periodic FSM vacuum condition to use the
number of tuples deleted during HOT pruning. This count includes items
marked as either LP_UNUSED or LP_REDIRECT, both of which are expected
to result in new free space to report.
Back-patch to v17 where the vacuum optimization for tables with no
indexes was introduced.
Reviewed-by: Melanie Plageman <melanieplageman@gmail.com>
Discussion: https://postgr.es/m/CAD21AoBL8m6B9GSzQfYxVaEgvD7-Kr3AJaS-hJPHC+avm-29zw@mail.gmail.com
Backpatch-through: 17 M src/backend/access/heap/vacuumlazy.c
Remove implicit cast from 'void *'
commit : 9adb58a3ccb5ad28e773684db33ffcb1ebbd5ef1
author : John Naylor <john.naylor@postgresql.org>
date : Wed, 2 Jul 2025 11:51:10 +0700
committer: John Naylor <john.naylor@postgresql.org>
date : Wed, 2 Jul 2025 11:51:10 +0700 Commit e2809e3a101 added code to a header which assigns a pointer
to void to a pointer to unsigned char. This causes build errors for
extensions written in C++. Fix by adding an explicit cast.
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/CANWCAZaCq9AHBuhs%3DMx7Gg_0Af9oRU7iAqr0itJCtfmsWwVmnQ%40mail.gmail.com
Backpatch-through: 18 M src/include/port/pg_crc32c.h
Fix bug in archive streamer with LZ4 decompression
commit : 3369a3b49b0bc0a4205062e45623af297240c8c6
author : Michael Paquier <michael@paquier.xyz>
date : Wed, 2 Jul 2025 13:48:36 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Wed, 2 Jul 2025 13:48:36 +0900 When decompressing some input data, the calculation for the initial
starting point and the initial size were incorrect, potentially leading
to failures when decompressing contents with LZ4. These initialization
points are fixed in this commit, bringing the logic closer to what
exists for gzip and zstd.
The contents of the compressed data is clear (for example backups taken
with LZ4 can still be decompressed with a "lz4" command), only the
decompression part reading the input data was impacted by this issue.
This code path impacts pg_basebackup and pg_verifybackup, which can use
the LZ4 decompression routines with an archive streamer, or any tools
that try to use the archive streamers in src/fe_utils/.
The issue is easier to reproduce with files that have a low-compression
rate, like ones filled with random data, for a size of at least 512kB,
but this could happen with anything as long as it is stored in a data
folder. Some tests are added based on this idea, with a file filled
with random bytes grabbed from the backend, written at the root of the
data folder. This is proving good enough to reproduce the original
problem.
Author: Mikhail Gribkov <youzhick@gmail.com>
Discussion: https://postgr.es/m/CAMEv5_uQS1Hg6KCaEP2JkrTBbZ-nXQhxomWrhYQvbdzR-zy-wA@mail.gmail.com
Backpatch-through: 15 M src/bin/pg_verifybackup/t/008_untar.pl
M src/bin/pg_verifybackup/t/010_client_untar.pl
M src/fe_utils/astreamer_lz4.c
Move code for the bytea data type from varlena.c to new bytea.c
commit : b45242fd30ffa6e1e7f490cc400ecbd966880f41
author : Michael Paquier <michael@paquier.xyz>
date : Wed, 2 Jul 2025 09:52:21 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Wed, 2 Jul 2025 09:52:21 +0900 This commit moves all the routines related to the bytea data type into
its own new file, called bytea.c, clearing some of the bloat in
varlena.c. This includes the routines for:
- Input, output, receive and send
- Comparison
- Casts to integer types
- bytea-specific functions
The internals of the routines moved here are unchanged, with one
exception. This comes with a twist in bytea_string_agg_transfn(), where
the call to makeStringAggState() is replaced by the internals of this
routine, still located in varlena.c. This simplifies the move to the
new file by not having to expose makeStringAggState().
Author: Aleksander Alekseev <aleksander@timescale.com>
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Discussion: https://postgr.es/m/CAJ7c6TMPVPJ5DL447zDz5ydctB8OmuviURtSwd=PHCRFEPDEAQ@mail.gmail.com M src/backend/utils/adt/Makefile
A src/backend/utils/adt/bytea.c
M src/backend/utils/adt/meson.build
M src/backend/utils/adt/varlena.c
Show sizes of FETCH queries as constants in pg_stat_statements
commit : bee23ea4ddc46198c95a4e73a83f453c09e04bf8
author : Michael Paquier <michael@paquier.xyz>
date : Wed, 2 Jul 2025 08:39:25 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Wed, 2 Jul 2025 08:39:25 +0900 Prior to this patch, every FETCH call would generate a unique queryId
with a different size specified. Depending on the workloads, this could
lead to a significant bloat in pg_stat_statements, as repeatedly calling
a specific cursor would result in a new queryId each time. For example,
FETCH 1 c1; and FETCH 2 c1; would produce different queryIds.
This patch improves the situation by normalizing the fetch size, so as
semantically similar statements generate the same queryId. As a result,
statements like the below, which differ syntactically but have the same
effect, will now share a single queryId:
FETCH FROM c1
FETCH NEXT c1
FETCH 1 c1
In order to do a normalization based on the keyword used in FETCH,
FetchStmt is tweaked with a new FetchDirectionKeywords. This matters
for "howMany", which could be set to a negative value depending on the
direction, and we want to normalize the queries with enough information
about the direction keywords provided, including RELATIVE, ABSOLUTE or
all the ALL variants.
Author: Sami Imseih <samimseih@gmail.com>
Discussion: https://postgr.es/m/CAA5RZ0tA6LbHCg2qSS+KuM850BZC_+ZgHV7Ug6BXw22TNyF+MA@mail.gmail.com M contrib/pg_stat_statements/expected/cursors.out
M contrib/pg_stat_statements/expected/level_tracking.out
M contrib/pg_stat_statements/expected/utility.out
M contrib/pg_stat_statements/sql/cursors.sql
M src/backend/parser/gram.y
M src/include/nodes/parsenodes.h
M src/tools/pgindent/typedefs.list
Update comment for IndexInfo.ii_NullsNotDistinct
commit : 184595836ba37e1d35cb8a4e9298dc0eed763746
author : Peter Eisentraut <peter@eisentraut.org>
date : Tue, 1 Jul 2025 22:15:26 +0200
committer: Peter Eisentraut <peter@eisentraut.org>
date : Tue, 1 Jul 2025 22:15:26 +0200 Commit 7a7b3e11e61 added the ii_NullsNotDistinct field, but the
comment was not updated.
Author: Japin Li <japinli@hotmail.com>
Reviewed-by: Richard Guo <guofenglinux@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/ME0P300MB04453E6C7EA635F0ECF41BFCB6832%40ME0P300MB0445.AUSP300.PROD.OUTLOOK.COM M src/include/nodes/execnodes.h
Add commit 9e345415bc to .git-blame-ignore-revs.
commit : aa268cbaade2e7c87addc2fabc7fc8a43310a440
author : Nathan Bossart <nathan@postgresql.org>
date : Tue, 1 Jul 2025 14:30:16 -0500
committer: Nathan Bossart <nathan@postgresql.org>
date : Tue, 1 Jul 2025 14:30:16 -0500 M .git-blame-ignore-revs
Make more use of binaryheap_empty() and binaryheap_size().
commit : 32bcf568cbc32ffc6d9be1b385d0f766720f7ebc
author : Nathan Bossart <nathan@postgresql.org>
date : Tue, 1 Jul 2025 14:19:07 -0500
committer: Nathan Bossart <nathan@postgresql.org>
date : Tue, 1 Jul 2025 14:19:07 -0500 A few places were accessing bh_size directly instead of via these
handy macros.
Author: Aleksander Alekseev <aleksander@timescale.com>
Discussion: https://postgr.es/m/CAJ7c6TPQMVL%2B028T4zuw9ZqL5Du9JavOLhBQLkJeK0RznYx_6w%40mail.gmail.com M src/backend/postmaster/pgarch.c
M src/backend/replication/logical/reorderbuffer.c
Document pg_get_multixact_members().
commit : e6115394d40c5d8789b23e5badb2a7679ddd5203
author : Nathan Bossart <nathan@postgresql.org>
date : Tue, 1 Jul 2025 13:54:38 -0500
committer: Nathan Bossart <nathan@postgresql.org>
date : Tue, 1 Jul 2025 13:54:38 -0500 Oversight in commit 0ac5ad5134.
Author: Sami Imseih <samimseih@gmail.com>
Co-authored-by: Álvaro Herrera <alvherre@kurilemu.de>
Reviewed-by: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>
Discussion: https://postgr.es/m/20150619215231.GT133018%40postgresql.org
Discussion: https://postgr.es/m/CAA5RZ0sjQDDwJfMRb%3DZ13nDLuRpF13ME2L_BdGxi0op8RKjmDg%40mail.gmail.com
Backpatch-through: 13 M doc/src/sgml/func.sgml
M doc/src/sgml/maintenance.sgml
Update comment for IndexInfo.ii_WithoutOverlaps
commit : 7a7b3e11e6190e414ccd6ad126bed915e8be16f1
author : Peter Eisentraut <peter@eisentraut.org>
date : Tue, 1 Jul 2025 20:37:24 +0200
committer: Peter Eisentraut <peter@eisentraut.org>
date : Tue, 1 Jul 2025 20:37:24 +0200 Commit fc0438b4e80 added the ii_WithoutOverlaps field, but the comment
was not updated.
Author: Japin Li <japinli@hotmail.com>
Reviewed-by: Richard Guo <guofenglinux@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/ME0P300MB04453E6C7EA635F0ECF41BFCB6832%40ME0P300MB0445.AUSP300.PROD.OUTLOOK.COM M src/include/nodes/execnodes.h
Fix outdated comment for IndexInfo
commit : 9e5fee822846763a9c04a60bd5076d6fe3248faf
author : Peter Eisentraut <peter@eisentraut.org>
date : Tue, 1 Jul 2025 20:12:36 +0200
committer: Peter Eisentraut <peter@eisentraut.org>
date : Tue, 1 Jul 2025 20:12:36 +0200 Commit 78416235713 removed the ii_OpclassOptions field, but the
comment was not updated.
Author: Japin Li <japinli@hotmail.com>
Reviewed-by: Richard Guo <guofenglinux@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/ME0P300MB04453E6C7EA635F0ECF41BFCB6832%40ME0P300MB0445.AUSP300.PROD.OUTLOOK.COM M src/include/nodes/execnodes.h
Improve code comment
commit : fff0d1edf567c412c9d78cb10e9b67ce78b8e0cb
author : Peter Eisentraut <peter@eisentraut.org>
date : Tue, 1 Jul 2025 18:42:07 +0200
committer: Peter Eisentraut <peter@eisentraut.org>
date : Tue, 1 Jul 2025 18:42:07 +0200 The previous wording was potentially confusing about the impact of the
OVERRIDING clause on generated columns. Reword slightly to avoid
that.
Reported-by: jian he <jian.universality@gmail.com>
Reviewed-by: Dean Rasheed <dean.a.rasheed@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/CACJufxFMBe0nPXOQZMLTH4Ry5Gyj4m%2B2Z05mRi9KB4hk8rGt9w%40mail.gmail.com M src/backend/rewrite/rewriteHandler.c
Make sure IOV_MAX is defined.
commit : 1fd772d192909a4f0e1ce88ebc72c8c43b81b025
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Tue, 1 Jul 2025 12:40:35 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Tue, 1 Jul 2025 12:40:35 -0400 We stopped defining IOV_MAX on non-Windows systems in 75357ab94, on
the assumption that every non-Windows system defines it in <limits.h>
as required by X/Open. GNU Hurd, however, doesn't follow that
standard either. Put back the old logic to assume 16 if it's
not defined.
Author: Michael Banck <mbanck@gmx.net>
Co-authored-by: Christoph Berg <myon@debian.org>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/6862e8d1.050a0220.194b8d.76fa@mx.google.com
Discussion: https://postgr.es/m/6846e0c3.df0a0220.39ef9b.c60e@mx.google.com
Backpatch-through: 16 M src/include/port/pg_iovec.h
Make safeguard against incorrect flags for fsync more portable.
commit : 29213636e6cddcb7b2c877bff8cb9ba470d392db
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Tue, 1 Jul 2025 12:08:20 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Tue, 1 Jul 2025 12:08:20 -0400 The existing code assumed that O_RDONLY is defined as 0, but this is
not required by POSIX and is not true on GNU Hurd. We can avoid
the assumption by relying on O_ACCMODE to mask the fcntl() result.
(Hopefully, all supported platforms define that.)
Author: Michael Banck <mbanck@gmx.net>
Co-authored-by: Samuel Thibault
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/6862e8d1.050a0220.194b8d.76fa@mx.google.com
Discussion: https://postgr.es/m/68480868.5d0a0220.1e214d.68a6@mx.google.com
Backpatch-through: 13 M src/backend/storage/file/fd.c
Remove provider field from pg_locale_t.
commit : 8af0d0ab01b406b8671ff4426acfe9b1d2af30d8
author : Jeff Davis <jdavis@postgresql.org>
date : Tue, 1 Jul 2025 07:42:44 -0700
committer: Jeff Davis <jdavis@postgresql.org>
date : Tue, 1 Jul 2025 07:42:44 -0700 The behavior of pg_locale_t is specified by methods, so a separate
provider field is no longer necessary.
Reviewed-by: Andreas Karlsson <andreas@proxel.se>
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Discussion: https://postgr.es/m/2830211e1b6e6a2e26d845780b03e125281ea17b.camel%40j-davis.com M src/backend/utils/adt/pg_locale_builtin.c
M src/backend/utils/adt/pg_locale_icu.c
M src/backend/utils/adt/pg_locale_libc.c
M src/include/utils/pg_locale.h
Control ctype behavior internally with a method table.
commit : 5a38104b364234615c780656a8b2424f96ed9efa
author : Jeff Davis <jdavis@postgresql.org>
date : Tue, 1 Jul 2025 07:42:39 -0700
committer: Jeff Davis <jdavis@postgresql.org>
date : Tue, 1 Jul 2025 07:42:39 -0700 Previously, pattern matching and case mapping behavior branched based
on the provider. Refactor to use a method table, which is less
error-prone.
This is also a step toward multiple provider versions, which we may
want to support in the future.
Reviewed-by: Andreas Karlsson <andreas@proxel.se>
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Discussion: https://postgr.es/m/2830211e1b6e6a2e26d845780b03e125281ea17b.camel%40j-davis.com M src/backend/regex/regc_pg_locale.c
M src/backend/utils/adt/like.c
M src/backend/utils/adt/like_support.c
M src/backend/utils/adt/pg_locale.c
M src/backend/utils/adt/pg_locale_builtin.c
M src/backend/utils/adt/pg_locale_icu.c
M src/backend/utils/adt/pg_locale_libc.c
M src/include/utils/pg_locale.h
M src/tools/pgindent/typedefs.list
Use pg_ascii_tolower()/pg_ascii_toupper() where appropriate.
commit : d81dcc8d6243054e3bde40c6fb2b2a0be4b19da6
author : Jeff Davis <jdavis@postgresql.org>
date : Tue, 1 Jul 2025 07:24:23 -0700
committer: Jeff Davis <jdavis@postgresql.org>
date : Tue, 1 Jul 2025 07:24:23 -0700 Avoids unnecessary dependence on setlocale(). No behavior change.
This commit reverts e1458f2f1b, which reverted some changes
unintentionally committed before the branch for 19.
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Discussion: https://postgr.es/m/a8666c391dfcabe79868d95f7160eac533ace718.camel@j-davis.com
Discussion: https://postgr.es/m/7efaaa645aa5df3771bb47b9c35df27e08f3520e.camel@j-davis.com M contrib/isn/isn.c
M contrib/spi/refint.c
M src/backend/commands/copyfromparse.c
M src/backend/utils/adt/inet_net_pton.c
Fix indentation in pg_numa code
commit : 9e345415bcd3c4358350b89edfd710469b8bfaf9
author : Tomas Vondra <tomas.vondra@postgresql.org>
date : Tue, 1 Jul 2025 15:20:26 +0200
committer: Tomas Vondra <tomas.vondra@postgresql.org>
date : Tue, 1 Jul 2025 15:20:26 +0200 Broken by commits 7fe2f67c7c9f, 81f287dc923f and bf1119d74a79. Backpatch
to 18, same as the offending commits.
Backpatch-through: 18 M src/include/port/pg_numa.h
M src/port/pg_numa.c
Add CHECK_FOR_INTERRUPTS into pg_numa_query_pages
commit : bf1119d74a79b68d9c9086e5d32d44fb294a1427
author : Tomas Vondra <tomas.vondra@postgresql.org>
date : Tue, 1 Jul 2025 12:58:35 +0200
committer: Tomas Vondra <tomas.vondra@postgresql.org>
date : Tue, 1 Jul 2025 12:58:35 +0200 Querying the NUMA status can be quite time consuming, especially with
large shared buffers. 8cc139bec34a called numa_move_pages() once, for
all buffers, and we had to wait for the syscall to complete.
But with the chunking, introduced by 7fe2f67c7c to work around a kernel
bug, we can do CHECK_FOR_INTERRUPTS() after each chunk, allowing users
to abort the execution.
Reviewed-by: Christoph Berg <myon@debian.org>
Reviewed-by: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Discussion: https://postgr.es/m/aEtDozLmtZddARdB@msg.df7cb.de
Backpatch-through: 18 M src/port/pg_numa.c
Silence valgrind about pg_numa_touch_mem_if_required
commit : 81f287dc923f565722f46b18d71969926bc3c64f
author : Tomas Vondra <tomas.vondra@postgresql.org>
date : Tue, 1 Jul 2025 12:32:23 +0200
committer: Tomas Vondra <tomas.vondra@postgresql.org>
date : Tue, 1 Jul 2025 12:32:23 +0200 When querying NUMA status of pages in shared memory, we need to touch
the memory first to get valid results. This may trigger valgrind
reports, because some of the memory (e.g. unpinned buffers) may be
marked as noaccess.
Solved by adding a valgrind suppresion. An alternative would be to
adjust the access/noaccess status before touching the memory, but that
seems far too invasive. It would require all those places to have
detailed knowledge of what the shared memory stores.
The pg_numa_touch_mem_if_required() macro is replaced with a function.
Macros are invisible to suppressions, so it'd have to suppress reports
for the caller - e.g. pg_get_shmem_allocations_numa(). So we'd suppress
reports for the whole function, and that seems to heavy-handed. It might
easily hide other valid issues.
Reviewed-by: Christoph Berg <myon@debian.org>
Reviewed-by: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Discussion: https://postgr.es/m/aEtDozLmtZddARdB@msg.df7cb.de
Backpatch-through: 18 M contrib/pg_buffercache/pg_buffercache_pages.c
M src/backend/storage/ipc/shmem.c
M src/include/port/pg_numa.h
M src/tools/valgrind.supp
amcheck: Improve confusing message
commit : 953050236ab2640055d79532981f958271a33292
author : Peter Eisentraut <peter@eisentraut.org>
date : Tue, 1 Jul 2025 12:24:17 +0200
committer: Peter Eisentraut <peter@eisentraut.org>
date : Tue, 1 Jul 2025 12:24:17 +0200 The way it was worded, the %u placeholder could be read as the table
OID. Rearrange slightly to avoid the possible confusion.
Reported-by: jian he <jian.universality@gmail.com>
Reviewed-by: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/CACJufxFx-25XQV%2Br23oku7ZnL958P30hyb9cFeYPv6wv7yzCCw%40mail.gmail.com M contrib/amcheck/verify_heapam.c
M src/bin/pg_amcheck/t/004_verify_heapam.pl
Limit the size of numa_move_pages requests
commit : 7fe2f67c7c9f27955df584eb79edd6ec2be7f9e4
author : Tomas Vondra <tomas.vondra@postgresql.org>
date : Tue, 1 Jul 2025 12:02:31 +0200
committer: Tomas Vondra <tomas.vondra@postgresql.org>
date : Tue, 1 Jul 2025 12:02:31 +0200 There's a kernel bug in do_pages_stat(), affecting systems combining
64-bit kernel and 32-bit user space. The function splits the request
into chunks of 16 pointers, but forgets the pointers are 32-bit when
advancing to the next chunk. Some of the pointers get skipped, and
memory after the array is interpreted as pointers. The result is that
the produced status of memory pages is mostly bogus.
Systems combining 64-bit and 32-bit environments like this might seem
rare, but that's not the case - all 32-bit Debian packages are built in
a 32-bit chroot on a system with a 64-bit kernel.
This is a long-standing kernel bug (since 2010), affecting pretty much
all kernels, so it'll take time until all systems get a fixed kernel.
Luckily, we can work around the issue by chunking the requests the same
way do_pages_stat() does, at least on affected systems. We don't know
what kernel a 32-bit build will run on, so all 32-bit builds use chunks
of 16 elements (the largest chunk before hitting the issue).
64-bit builds are not affected by this issue, and so could work without
the chunking. But chunking has other advantages, so we apply chunking
even for 64-bit builds, with chunks of 1024 elements.
Reported-by: Christoph Berg <myon@debian.org>
Author: Christoph Berg <myon@debian.org>
Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Discussion: https://postgr.es/m/aEtDozLmtZddARdB@msg.df7cb.de
Context: https://marc.info/?l=linux-mm&m=175077821909222&w=2
Backpatch-through: 18 M src/port/pg_numa.c
Fix typo in pg_publication.h.
commit : b5cd0ecd4d4fa89b716785f22e9f009624104d61
author : Amit Kapila <akapila@postgresql.org>
date : Tue, 1 Jul 2025 15:17:03 +0530
committer: Amit Kapila <akapila@postgresql.org>
date : Tue, 1 Jul 2025 15:17:03 +0530 Author: shveta malik <shveta.malik@gmail.com>
Discussion: https://postgr.es/m/CAJpy0uAyFN9o7vU_ZkZFv5-6ysXDNKNx_fC0gwLLKg=8==E3ow@mail.gmail.com M src/include/catalog/pg_publication.h
doc: TOAST not toast
commit : 83389838827b75dbdc9e4c251e2f57b23bfb2cff
author : Peter Eisentraut <peter@eisentraut.org>
date : Tue, 1 Jul 2025 10:19:52 +0200
committer: Peter Eisentraut <peter@eisentraut.org>
date : Tue, 1 Jul 2025 10:19:52 +0200 There are different capitializations of "TOAST" around the
documentation and code. This just changes a few places that were more
obviously inconsistent with similar phrases elsewhere.
Author: Peter Smith <peter.b.smith@fujitsu.com>
Discussion: https://www.postgresql.org/message-id/flat/CAHut+PtxXLJFhwJFvx+M=Ux8WGHU85XbT3nDqk-aAUS3E5ANCw@mail.gmail.com M doc/src/sgml/amcheck.sgml
M doc/src/sgml/bki.sgml
M doc/src/sgml/catalogs.sgml
M doc/src/sgml/logicaldecoding.sgml
M doc/src/sgml/ref/alter_table.sgml
M doc/src/sgml/ref/pg_amcheck.sgml
M doc/src/sgml/sepgsql.sgml
Enable MSVC conforming preprocessor
commit : 8fd9bb1d9654c59d40613232ad964e9a648e4202
author : Peter Eisentraut <peter@eisentraut.org>
date : Tue, 1 Jul 2025 09:36:33 +0200
committer: Peter Eisentraut <peter@eisentraut.org>
date : Tue, 1 Jul 2025 09:36:33 +0200 Switch MSVC to use the conforming preprocessor, using the
/Zc:preprocessor option.
This allows us to drop the alternative implementation of
VA_ARGS_NARGS() for the previous "traditional" preprocessor.
This also prepares the way for enabling C11 mode in the future, which
enables the conforming preprocessor by default.
This now requires Visual Studio 2019. The installation documentation
is adjusted accordingly.
Discussion: https://www.postgresql.org/message-id/flat/01a69441-af54-4822-891b-ca28e05b215a%40eisentraut.org M doc/src/sgml/installation.sgml
M meson.build
M src/include/c.h
xml2: Improve error handling of libxml2 calls
commit : 732061150b004385810e522f8629f5bf91d977b7
author : Michael Paquier <michael@paquier.xyz>
date : Tue, 1 Jul 2025 15:48:32 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Tue, 1 Jul 2025 15:48:32 +0900 The contrib module xml2/ has always been fuzzy with the cleanup of the
memory allocated by the calls internal to libxml2, even if there are
APIs in place giving a lot of control over the error behavior, all
located in the backend's xml.c.
The code paths fixed in the commit address multiple defects, while
sanitizing the code:
- In xpath.c, several allocations are done by libxml2 for
xpath_workspace, whose memory cleanup could go out of sight as it relied
on a single TRY/CATCH block done in pgxml_xpath(). workspace->res is
allocated by libxml2, and may finish by not being freed at all upon a
failure outside of a TRY area. This code is refactored so as the
TRY/CATCH block of pgxml_xpath() is moved one level higher to its
callers, which are responsible for cleaning up the contents of a
workspace on failure. cleanup_workspace() now requires a volatile
workspace, forcing as a rule that a TRY/CATCH block should be used.
- Several calls, like xmlStrdup(), xmlXPathNewContext(),
xmlXPathCtxtCompile(), etc. can return NULL on failures (for most of
them allocation failures. These forgot to check for failures, or missed
that pg_xml_error_occurred() should be called, to check if an error is
already on the stack.
- Some memory allocated by libxml2 calls was freed in an incorrect way,
"resstr" in xslt_process() being one example.
The class of errors fixed here are for problems that are unlikely going
to happen in practice, so no backpatch is done. The changes have
finished by being rather invasive, so it is perhaps not a bad thing to
be conservative and to keep these changes only on HEAD anyway.
Author: Michael Paquier <michael@paquier.xyz>
Reported-by: Karavaev Alexey <maralist86@mail.ru>
Reviewed-by: Jim Jones <jim.jones@uni-muenster.de>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/18943-2f2a04ab03904598@postgresql.org M contrib/xml2/xpath.c
M contrib/xml2/xslt_proc.c
Fix typos in comments
commit : c67989789cec3953effca4e01dff834abff9116a
author : Amit Langote <amitlan@postgresql.org>
date : Tue, 1 Jul 2025 13:13:48 +0900
committer: Amit Langote <amitlan@postgresql.org>
date : Tue, 1 Jul 2025 13:13:48 +0900 Commit 19d8e2308bc added enum values with the prefix TU_, but a few
comments still referred to TUUI_, which was used in development
versions of the patches committed as 19d8e2308bc.
Author: Yugo Nagata <nagata@sraoss.co.jp>
Discussion: https://postgr.es/m/20250701110216.8ac8a9e4c6f607f1d954f44a@sraoss.co.jp
Backpatch-through: 16 M src/backend/executor/execIndexing.c
Fix typo in system_views.sql's definition of pg_stat_activity
commit : a3df0d43d93789777fd06bb7ffa8cdc1f06d63c3
author : Michael Paquier <michael@paquier.xyz>
date : Tue, 1 Jul 2025 09:41:42 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Tue, 1 Jul 2025 09:41:42 +0900 backend_xmin used a lower-character 's' instead of the upper-character
'S' like the other attributes. This is harmless, but let's be
consistent.
Issue introduced in dd1a3bccca24.
Author: Daisuke Higuchi <higuchi.daisuke11@gmail.com>
Discussion: https://postgr.es/m/CAEVT6c8M39cqWje-df39wWr0KWcDgGKd5fMvQo84zvCXKoEL9Q@mail.gmail.com M src/backend/catalog/system_views.sql
Improve error handling of libxml2 calls in xml.c
commit : 2e947217474c15c7fd9011d1ab2b0d4657b3eae2
author : Michael Paquier <michael@paquier.xyz>
date : Tue, 1 Jul 2025 08:57:05 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Tue, 1 Jul 2025 08:57:05 +0900 This commit fixes some defects in the backend's xml.c, found upon
inspection of the internals of libxml2:
- xmlEncodeSpecialChars() can fail on malloc(), returning NULL back to
the caller. xmltext() assumed that this could never happen. Like other
code paths, a TRY/CATCH block is added there, covering also the fact
that cstring_to_text_with_len() could fail a memory allocation, where
the backend would miss to free the buffer allocated by
xmlEncodeSpecialChars().
- Some libxml2 routines called in xmlelement() can return NULL, like
xmlAddChildList() or xmlTextWriterStartElement(). Dedicated errors are
added for them.
- xml_xmlnodetoxmltype() missed that xmlXPathCastNodeToString() can fail
on an allocation failure. In this case, the call can just be moved to
the existing TRY/CATCH block.
All these code paths would cause the server to crash. As this is
unlikely a problem in practice, no backpatch is done. Jim and I have
caught these defects, not sure who has scored the most. The contrib
module xml2/ has similar defects, which will be addressed in a separate
change.
Reported-by: Jim Jones <jim.jones@uni-muenster.de>
Reviewed-by: Jim Jones <jim.jones@uni-muenster.de>
Discussion: https://postgr.es/m/aEEingzOta_S_Nu7@paquier.xyz M src/backend/utils/adt/xml.c
Improve error report for PL/pgSQL reserved word used as a field name.
commit : 0836683a8977cac07d8cbdd0462f8a3e7e32565f
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Mon, 30 Jun 2025 17:06:39 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Mon, 30 Jun 2025 17:06:39 -0400 The current code in resolve_column_ref (dating to commits 01f7d2990
and fe24d7816) believes that not finding a RECFIELD datum is a
can't-happen case, in consequence of which I didn't spend a whole lot
of time considering what to do if it did happen. But it turns out
that it *can* happen if the would-be field name is a fully-reserved
PL/pgSQL keyword. Change the error message to describe that
situation, and add a test case demonstrating it.
This might need further refinement if anyone can find other ways to
trigger a failure here; but without an example it's not clear what
other error to throw.
Author: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Pavel Stehule <pavel.stehule@gmail.com>
Discussion: https://postgr.es/m/2185258.1745617445@sss.pgh.pa.us M src/pl/plpgsql/src/expected/plpgsql_misc.out
M src/pl/plpgsql/src/pl_comp.c
M src/pl/plpgsql/src/sql/plpgsql_misc.sql
De-reserve keywords EXECUTE and STRICT in PL/pgSQL.
commit : 999f172ded2bae7efbd8bf1dd6f823095395493f
author : Tom Lane <tgl@sss.pgh.pa.us>
date : Mon, 30 Jun 2025 16:59:36 -0400
committer: Tom Lane <tgl@sss.pgh.pa.us>
date : Mon, 30 Jun 2025 16:59:36 -0400 On close inspection, there does not seem to be a strong reason
why these should be fully-reserved keywords. I guess they just
escaped consideration in previous attempts to minimize PL/pgSQL's
list of reserved words.
Author: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Pavel Stehule <pavel.stehule@gmail.com>
Discussion: https://postgr.es/m/2185258.1745617445@sss.pgh.pa.us M src/pl/plpgsql/src/expected/plpgsql_misc.out
M src/pl/plpgsql/src/pl_gram.y
M src/pl/plpgsql/src/pl_reserved_kwlist.h
M src/pl/plpgsql/src/pl_scanner.c
M src/pl/plpgsql/src/pl_unreserved_kwlist.h
M src/pl/plpgsql/src/sql/plpgsql_misc.sql
Add new OID alias type regdatabase.
commit : bd09f024a1bbdd7a7e2ca944595a9d4b6c90fb83
author : Nathan Bossart <nathan@postgresql.org>
date : Mon, 30 Jun 2025 15:38:54 -0500
committer: Nathan Bossart <nathan@postgresql.org>
date : Mon, 30 Jun 2025 15:38:54 -0500 This provides a convenient way to look up a database's OID. For
example, the query
SELECT * FROM pg_shdepend
WHERE dbid = (SELECT oid FROM pg_database
WHERE datname = current_database());
can now be simplified to
SELECT * FROM pg_shdepend
WHERE dbid = current_database()::regdatabase;
Like the regrole type, regdatabase has cluster-wide scope, so we
disallow regdatabase constants from appearing in stored
expressions.
Bumps catversion.
Author: Ian Lawrence Barwick <barwick@gmail.com>
Reviewed-by: Greg Sabino Mullane <htamfids@gmail.com>
Reviewed-by: Jian He <jian.universality@gmail.com>
Reviewed-by: Fabrízio de Royes Mello <fabriziomello@gmail.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/aBpjJhyHpM2LYcG0%40nathan M contrib/postgres_fdw/deparse.c
M doc/src/sgml/datatype.sgml
M doc/src/sgml/func.sgml
M doc/src/sgml/ref/pgupgrade.sgml
M src/backend/bootstrap/bootstrap.c
M src/backend/catalog/dependency.c
M src/backend/utils/adt/regproc.c
M src/backend/utils/adt/selfuncs.c
M src/backend/utils/cache/catcache.c
M src/bin/pg_upgrade/check.c
M src/include/catalog/catversion.h
M src/include/catalog/pg_cast.dat
M src/include/catalog/pg_proc.dat
M src/include/catalog/pg_type.dat
M src/test/regress/expected/regproc.out
M src/test/regress/expected/type_sanity.out
M src/test/regress/sql/regproc.sql
M src/test/regress/sql/type_sanity.sql
aio: Fix reference to outdated name
commit : f20a347e1a613cfc9053e7bc3d254608ae968386
author : Andres Freund <andres@anarazel.de>
date : Mon, 30 Jun 2025 10:20:14 -0400
committer: Andres Freund <andres@anarazel.de>
date : Mon, 30 Jun 2025 10:20:14 -0400 Reported-by: Antonin Houska <ah@cybertec.at>
Author: Antonin Houska <ah@cybertec.at>
Discussion: https://postgr.es/m/5250.1751266701@localhost
Backpatch-through: 18, where da7226993fd4 introduced this M src/include/storage/aio_types.h
Avoid uninitialized value error in TAP tests' Cluster->psql
commit : c3e28e9fd936b83dbb6dfb5003b6221d98f8469c
author : Andrew Dunstan <andrew@dunslane.net>
date : Mon, 30 Jun 2025 09:49:31 -0400
committer: Andrew Dunstan <andrew@dunslane.net>
date : Mon, 30 Jun 2025 09:49:31 -0400 If the method is called in scalar context and we didn't pass in a stderr
handle, one won't be created. However, some error paths assume that it
exists, so in this case create a dummy stderr to avoid the resulting
perl error.
Per gripe from Oleg Tselebrovskiy <o.tselebrovskiy@postgrespro.ru> and
adapted from his patch.
Discussion: https://postgr.es/m/378eac5de4b8ecb5be7bcdf2db9d2c4d@postgrespro.ru M src/test/perl/PostgreSQL/Test/Cluster.pm
pgflex: propagate environment to flex subprocess
commit : 40a96cd1484fdf3ab57e8cb7b09767ec7a7f73b1
author : Peter Eisentraut <peter@eisentraut.org>
date : Mon, 30 Jun 2025 12:23:33 +0200
committer: Peter Eisentraut <peter@eisentraut.org>
date : Mon, 30 Jun 2025 12:23:33 +0200 Python's subprocess.run docs say that if the env argument is not None,
it will be used "instead of the default behavior of inheriting the
current process’ environment". However, the environment should be
preserved, only adding FLEX_TMP_DIR to it.
Author: Javier Maestro <jjmaestro@ieee.org>
Discussion: https://www.postgresql.org/message-id/flat/CABvji06GUpmrTqqiCr6_F9vRL2-JUSVAh8ChgWa6k47FUCvYmA%40mail.gmail.com M src/tools/pgflex
Remove unused #include's in src/backend/utils/adt/*
commit : cc2ac0e6f99e4efc3ae5710010ff35e646990a60
author : Peter Eisentraut <peter@eisentraut.org>
date : Mon, 30 Jun 2025 12:00:00 +0200
committer: Peter Eisentraut <peter@eisentraut.org>
date : Mon, 30 Jun 2025 12:00:00 +0200 Author: Aleksander Alekseev <aleksander@timescale.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/CAJ7c6TOowVbR-0NEvvDm6a_mag18krR0XJ2FKrc9DHXj7hFRtQ%40mail.gmail.com M src/backend/utils/adt/network.c
M src/backend/utils/adt/network_spgist.c
M src/backend/utils/adt/pg_locale.c
M src/backend/utils/adt/pg_locale_builtin.c
M src/backend/utils/adt/ri_triggers.c
M src/backend/utils/adt/selfuncs.c
Fix whitespace
commit : a6a4641252ed166ba187d7fbe0504ddb5a5f0e33
author : Peter Eisentraut <peter@eisentraut.org>
date : Mon, 30 Jun 2025 11:38:18 +0200
committer: Peter Eisentraut <peter@eisentraut.org>
date : Mon, 30 Jun 2025 11:38:18 +0200 M src/tools/git_changelog
psql: Improve tab completion for COPY command.
commit : a4c10de9291291bce3dd2b81bd8b5f0b98649244
author : Fujii Masao <fujii@postgresql.org>
date : Mon, 30 Jun 2025 18:36:24 +0900
committer: Fujii Masao <fujii@postgresql.org>
date : Mon, 30 Jun 2025 18:36:24 +0900 Previously, tab completion for COPY only suggested plain tables
and partitioned tables, even though materialized views are also
valid for COPY TO (since commit 534874fac0b), and foreign tables
are valid for COPY FROM.
This commit enhances tab completion for COPY to also include
materialized views and foreign tables.
Views with INSTEAD OF INSERT triggers are supported with
COPY FROM but rarely used, so plain views are intentionally
excluded from completion.
Author: jian he <jian.universality@gmail.com>
Co-authored-by: Fujii Masao <masao.fujii@gmail.com>
Reviewed-by: Kirill Reshke <reshkekirill@gmail.com>
Reviewed-by: David G. Johnston <david.g.johnston@gmail.com>
Discussion: https://postgr.es/m/CACJufxFxnSkikp+GormAGHcMTX1YH2HRXW1+3dJM9w7yY9hdsg@mail.gmail.com M src/bin/psql/tab-complete.in.c
doc: explain pgstatindex fragmentation
commit : 960135114629bc89da0dd1d839541098c7e6401a
author : Peter Eisentraut <peter@eisentraut.org>
date : Mon, 30 Jun 2025 11:28:11 +0200
committer: Peter Eisentraut <peter@eisentraut.org>
date : Mon, 30 Jun 2025 11:28:11 +0200 It was quite hard to guess what leaf_fragmentation meant without looking
at pgstattuple's code. This patch aims to give to the user a better
idea of what it means.
Author: Frédéric Yhuel <frederic.yhuel@dalibo.com>
Author: Laurenz Albe <laurenz.albe@cybertec.at>
Reviewed-by: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>
Reviewed-by: Benoit Lobréau <benoit.lobreau@dalibo.com>
Discussion: https://postgr.es/m/bf110561-f774-4957-a890-bb6fab6804e0%40dalibo.com
Discussion: https://postgr.es/m/4c5dee3a-8381-4e0f-b882-d1bd950e8972@dalibo.com M doc/src/sgml/pgstattuple.sgml
pgbench: Use standard option handling test routines
commit : 3431e3e4aa3a33e8411f15e76c284cdd4c54ca28
author : Peter Eisentraut <peter@eisentraut.org>
date : Mon, 30 Jun 2025 10:45:08 +0200
committer: Peter Eisentraut <peter@eisentraut.org>
date : Mon, 30 Jun 2025 10:45:08 +0200 Run program_XXX tests instead of its own tests. This ensures
consistency with the test suites of other programs and enforces common
policies, such as help line length.
Author: Hayato Kuroda <kuroda.hayato@fujitsu.com>
Reviewed-by: Fujii Masao <masao.fujii@oss.nttdata.com>
Discussion: https://www.postgresql.org/message-id/flat/OSCPR01MB14966247015B7E3D8D340D022F56FA@OSCPR01MB14966.jpnprd01.prod.outlook.com M src/bin/pgbench/t/002_pgbench_no_server.pl
doc: Some copy-editing around prefix operators
commit : 2e640a0fa224e4233220252b360efd33c98b3e90
author : Peter Eisentraut <peter@eisentraut.org>
date : Mon, 30 Jun 2025 10:32:26 +0200
committer: Peter Eisentraut <peter@eisentraut.org>
date : Mon, 30 Jun 2025 10:32:26 +0200 When postfix operators where dropped in 1ed6b8956, the CREATE OPERATOR
docs were not updated to make the RIGHTARG argument mandatory in the
grammar.
While at it, make the RIGHTARG docs more concise. Also, the operator
docs were mentioning "infix" in the introduction, while using "binary"
everywhere else.
Author: Christoph Berg <myon@debian.org>
Discussion: https://www.postgresql.org/message-id/flat/aAtpbnQphv4LWAye@msg.df7cb.de M doc/src/sgml/ref/create_operator.sgml
M doc/src/sgml/xoper.sgml
doc: Fix typo in pg_sync_replication_slots documentation
commit : c5c4fbb4d482b87c2a6c90337f3b657b2d0002ca
author : Daniel Gustafsson <dgustafsson@postgresql.org>
date : Mon, 30 Jun 2025 10:12:31 +0200
committer: Daniel Gustafsson <dgustafsson@postgresql.org>
date : Mon, 30 Jun 2025 10:12:31 +0200 Commit 1546e17f9d0 accidentally misspelled additionally as
additionaly. Backpatch to v17 to match where the original
commit was backpatched.
Author: Daniel Gustafsson <daniel@yesql.se>
Backpatch-through: 17 M doc/src/sgml/func.sgml
Rationalize handling of VacuumParams
commit : 2252fcd4276cfeabae8786ab7c5a421dd674743e
author : Michael Paquier <michael@paquier.xyz>
date : Mon, 30 Jun 2025 15:42:50 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Mon, 30 Jun 2025 15:42:50 +0900 This commit refactors the vacuum routines that rely on VacuumParams,
adding const markers where necessary to force a new policy in the code.
This structure should not use a pointer as it may be used across
multiple relations, and its contents should never be updated.
vacuum_rel() stands as an exception as it touches the "index_cleanup"
and "truncate" options.
VacuumParams has been introduced in 0d831389749a, and 661643dedad9 has
fixed a bug impacting VACUUM operating on multiple relations. The
changes done in tableam.h break ABI compatibility, so this commit can
only happen on HEAD.
Author: Shihao Zhong <zhong950419@gmail.com>
Co-authored-by: Michael Paquier <michael@paquier.xyz>
Reviewed-by: Nathan Bossart <nathandbossart@gmail.com>
Reviewed-by: Junwang Zhao <zhjwpku@gmail.com>
Discussion: https://postgr.es/m/CAGRkXqTo+aK=GTy5pSc-9cy8H2F2TJvcrZ-zXEiNJj93np1UUw@mail.gmail.com M src/backend/access/heap/vacuumlazy.c
M src/backend/commands/analyze.c
M src/backend/commands/cluster.c
M src/backend/commands/vacuum.c
M src/backend/postmaster/autovacuum.c
M src/include/access/heapam.h
M src/include/access/tableam.h
M src/include/commands/vacuum.h
Align log_line_prefix in CI and TAP tests with pg_regress.c
commit : 5ba00e175a4eaefa4dc38ea14c667bbeb13af305
author : Michael Paquier <michael@paquier.xyz>
date : Mon, 30 Jun 2025 13:56:31 +0900
committer: Michael Paquier <michael@paquier.xyz>
date : Mon, 30 Jun 2025 13:56:31 +0900 log_line_prefix is changed to include "%b", the backend type in the TAP
test configuration. %v and %x are removed from the CI configuration,
with the format around %b changed.
The lack of backend type in postgresql.conf set by Cluster.pm for the
TAP test configuration was something that has been bugging me, beginning
the discussion that has led to this change. The change in the CI has
come up during the discussion, to become consistent with pg_regress.c,
%v and %x not being that useful to have.
Reviewed-by: Andres Freund <andres@anarazel.de>
Reviewed-by: Fujii Masao <masao.fujii@gmail.com>
Reviewed-by: Daniel Gustafsson <daniel@yesql.se>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/aC0VaIWAXLgXcHVP@paquier.xyz M src/test/perl/PostgreSQL/Test/Cluster.pm
M src/tools/ci/pg_ci_base.conf
Stamp HEAD as 19devel.
commit : 2652835d3efa003439ecc23d5fc3cf089c5952a6
author : Joe Conway <mail@joeconway.com>
date : Sun, 29 Jun 2025 22:28:10 -0400
committer: Joe Conway <mail@joeconway.com>
date : Sun, 29 Jun 2025 22:28:10 -0400 Let the hacking begin ... M configure
M configure.ac
M doc/src/sgml/filelist.sgml
D doc/src/sgml/release-18.sgml
A doc/src/sgml/release-19.sgml
M doc/src/sgml/release.sgml
M meson.build
M src/tools/git_changelog
M src/tools/version_stamp.pl