Skip to content

Sync pg18.1 codes#1004

Merged
gaoxueyu merged 126 commits into
IvorySQL:IVORY_REL_5_STABLEfrom
yuanyl630:sync-pg18-1
Dec 8, 2025
Merged

Sync pg18.1 codes#1004
gaoxueyu merged 126 commits into
IvorySQL:IVORY_REL_5_STABLEfrom
yuanyl630:sync-pg18-1

Conversation

@yuanyl630
Copy link
Copy Markdown
Contributor

@yuanyl630 yuanyl630 commented Dec 4, 2025

Summary by CodeRabbit

  • New Features

    • Added an ABI-compatibility history baseline file to record approved incompatibilities.
  • Bug Fixes

    • Tightened privilege checks for prewarming and statistics operations.
    • Fixed memory leaks and improved robustness in several backend paths.
    • Improved replication lag tracking to handle overflow without data loss.
  • Documentation

    • Clarified startup-only parameter rules, units, and corrected doc markup.
  • Tests

    • Added regression tests for EPQ/foreign-table scenarios and composite-function behavior.
  • Chores

    • Bumped release to 18.1; refreshed CI images and updated translations.

✏️ Tip: You can customize this high-level summary in your review settings.

michaelpq and others added 30 commits November 28, 2025 17:42
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
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
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
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
... 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
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
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
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
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
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
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 be45be9 which added the groupDistinct
field, but I think much of the blame has to fall on c9d5298, 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
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
d99d58c 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
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
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
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
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
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
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
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
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
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
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
Issue found while browsing this area of the code, introduced and
copy-pasted around by 2258e76.

Backpatch-through: 15
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
Introduced by my (Álvaro's) commit 9e4f914, which was itself
backpatched to pg10, though only pg15 and up contain the problem
because of commit 9c08aea.

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
Commit 71f4c8c (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
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
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
Reported-By: Pavel Luzanov <p.luzanov@postgrespro.ru>
Discussion: https://postgr.es/m/175976566145.768.4645962241073007347@wrigleys.postgresql.org
Backpatch-through: 18
tglsfdc and others added 20 commits December 2, 2025 10:00
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
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
postgres_fdw supports EvalPlanQual testing by using the infrastructure
provided by the core with the RecheckForeignScan callback routine (cf.
commits 5fc4c26 and 385f337), but there has been no test coverage
for that, except that recent commit 12609fbac, which fixed an issue in
commit 385f337, 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
Commit 27cc7cd 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
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
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
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
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
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
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
As usual, the release notes for other branches will be made by cutting
these down, but put them up for community review first.

Also as usual for a .1 release, there are some entries here that
are not really relevant for v18 because they already appeared in 18.0.
Those'll be removed later.
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
Source-Git-URL: https://git.postgresql.org/git/pgtranslation/messages.git
Source-Git-Hash: 3de351860d82ccc17ca814f59f9013691d751125
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
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
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Dec 4, 2025

Walkthrough

Bumps project/version to 18.1 (IvorySQL 5.1) and adds ABI/history metadata. Wide-ranging edits: CI image/tooling updates, tests and docs, numerous backend fixes and refactors (statistics lookup/locking, GIN chunking, BRIN 64‑bit indices, JSON collation checks, replication/slot and WAL handling), logging helpers, and many PO/localization updates.

Changes

Cohort / File(s) Change Summary
Version & Build
configure.ac, configure, meson.build
Project/version bumped to 18.1 and IvorySQL to 5.1; Meson uuid/ossp dependency lookup adjusted; generated configure messages updated.
CI & Infrastructure
.cirrus.tasks.yml
CI images and runner names updated; core-dump env var and backtrace invocation added; ASAN/UBSAN, toolchain, perl and set -e adjustments.
Repo metadata
.abi-compliance-history, .git-blame-ignore-revs
New ABI compatibility history file added; new git-blame ignore entry appended.
Statistics & lookup path
src/backend/statistics/*, src/backend/statistics/stat_utils.c, src/backend/statistics/relation_stats.c, src/backend/statistics/attribute_stats.c
Replaced legacy relid lookup and privilege checks with RangeVarGetRelidExtended + RangeVarCallbackForStats; removed stats_lookup_relid; adjusted locking, relkind validation and index-parent handling.
pg_prewarm & tests
contrib/pg_prewarm/pg_prewarm.c, contrib/pg_prewarm/t/001_basic.pl
When target is an index, check privileges on parent table with proper locking and race guards; tests add test_user and index; cluster init gains auth_extra option.
GIN parallel build memory
src/backend/access/gin/gininsert.c
GinBuildState replaces bs_worker_id with bs_num_workers; ginFlushBuildState splits TID lists into memory-bounded chunks and calls CHECK_FOR_INTERRUPTS per chunk.
BRIN index scanning
src/backend/access/brin/brin.c
Use 64-bit variables for heap block/page indices to avoid wraparound on very large tables; casts added where needed.
pg_stat_statements dedup
contrib/pg_stat_statements/pg_stat_statements.c
Reworked duplicate-constant handling by marking duplicates (len = -1), adjusting location calculation, removing last_loc logic.
Index page stats
contrib/pgstattuple/pgstattuple.c
Added PageIsNew branches and adjusted page-read logic for btree/hash/gist to handle fully empty pages explicitly.
postgres_fdw tests
contrib/postgres_fdw/specs/eval_plan_qual.spec, contrib/postgres_fdw/meson.build, contrib/postgres_fdw/Makefile
New EvalPlanQual regression spec and test-suite integration/isolation options added.
COPY ... WHERE validation
src/backend/commands/copy.c
For COPY FROM ... WHERE, collect referenced attributes and error if any referenced column is a generated column.
CreateStatistics API & callers
src/backend/commands/statscmds.c, src/backend/commands/tablecmds.c, src/backend/tcop/utility.c
CreateStatistics signature gains bool check_rights; callers updated (including ATExecAddStatistics and ProcessUtility).
Partition-key extraction
src/backend/commands/tablecmds.c
ComputePartitionAttrs now uses pull_varattnos to collect all attributes from partition expressions and validates generated/system columns.
Replication slot validation refactor
src/backend/replication/slot.c
Added ReplicationSlotValidateNameInternal returning structured error data; public wrapper delegates and callers updated (GUC path uses internal validator). Also improved slot save cleanup and removed initial_* parameters in invalidation logic.
WAL install/reset & recovery
src/backend/access/transam/xlog.c, src/backend/access/transam/xlogrecovery.c
Made injection point unconditional; added ResetInstallXLogFileSegmentActive() and use it when switching sources; xlogrecovery conditionally shuts down WalRcv only if streaming.
Lag tracking overflow
src/backend/replication/walsender.c
Added overflow storage for lag samples; collisions save sample to overflow and mark read head -1; reader handles overflow state and resumes when appropriate.
Logical replication worker signals
src/backend/replication/logical/launcher.c, src/backend/replication/logical/applyparallelworker.c
Graceful stop signal switched from SIGINT to SIGUSR2 for parallel apply workers; comments updated.
Executor / EPQ / trigger result matching
src/backend/executor/execMain.c, src/backend/executor/execScan.c
ExecGetTriggerResultRel now ensures ResultRelInfo matches provided rootRelInfo; EvalPlanQual borrows parent partition_directory pointer and avoids double-free. Minor comment fixes.
B-tree row-compare refactor
src/backend/access/nbtree/nbtsearch.c, src/backend/access/nbtree/nbtutils.c
Row-compare helpers use header parameter, assertions tightened, pointer dereferences updated; some assertions removed.
Hash table sizing & overflow guards
src/backend/executor/nodeHash.c
ExecChooseHashTableSize reworked with explicit overflow guards, nbatch/nbuckets adjustments and safer termination; related adjustments in ExecHashIncreaseBatchSize.
Planner: grouping sets & HAVING
src/backend/optimizer/plan/planner.c
Expand groupingSets earlier; move HAVING→WHERE only when grouping sets exist and no empty grouping set; preprocess_grouping_sets assumes pre-expanded sets.
JSON collation propagation
src/backend/parser/parse_expr.c
transformJsonBehavior now receives JsonExpr* and propagates jsexpr->collation; DEFAULT handling enforces collation consistency with RETURNING context.
JIT/LLVM fixes
src/backend/jit/llvm/llvmjit_deform.c, src/backend/jit/llvm/llvmjit_expr.c
Use SExt for byval datum sign extension; allocate LLVMBasicBlockRef arrays with correct element size.
Stderr helper and logging
src/backend/utils/error/elog.c
Added vwrite_stderr(const char*, va_list); write_stderr delegates to it; platform-specific stderr handling centralized.
C locale fast-path
src/backend/utils/adt/pg_locale.c
Added static c_locale and fast return in pg_newlocale_from_collation for C_COLLATION_OID.
Autovacuum snapshot safety
src/backend/postmaster/autovacuum.c
PushActiveSnapshot/PopActiveSnapshot around per-work-item execution to avoid snapshot leakage on aborts.
Buffer eviction interruptability
src/backend/storage/buffer/bufmgr.c
Added CHECK_FOR_INTERRUPTS() in eviction loops to allow early cancellation.
Misc — docs, tests, PO, small fixes
many files under doc/src/sgml/*, contrib/*, src/bin/*, *.po
Release notes added (release-18.sgml), many documentation clarifications, localisation updates and message-format specifier migrations, small memory-leak frees, assert/comment tweaks, test expectation updates, and minor tool/utility fixes.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~75 minutes

Areas to focus during review:

  • src/backend/statistics/stat_utils.c — RangeVar callback, locking transitions, index-parent handling and error messages.
  • src/backend/replication/slot.c — new internal validator and error plumbing; removal of initial_* parameters in invalidation logic.
  • src/backend/access/gin/gininsert.c — bs_num_workers layout change and chunk sizing math (MaxAllocSize divisor and 2*bs_num_workers factor).
  • src/backend/executor/nodeHash.c — memory/batch adjustment loop, overflow/termination invariants.
  • src/backend/parser/parse_expr.c — transformJsonBehavior signature change and collation propagation correctness.
  • ABI/public impacts: GinBuildState layout, ResetInstallXLogFileSegmentActive addition, vwrite_stderr exposure — verify header exports/consumers.

Possibly related PRs

Suggested reviewers

  • jiaoshuntian
  • NotHimmel
  • OreoYang

Poem

🐇
"I hopped through BRIN's wide blocks late,
chunked GIN lists to mind the crate,
checked stats by name and guarded locks,
nudged WAL and slots to calmer walks.
Trixie skies and Sequoia trees—code bakes,
a rabbit cheers in tiny, joyful shakes."

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Sync pg18.1 codes' accurately describes the main objective of the PR, which is to synchronize PostgreSQL 18.1 code changes into the IvorySQL repository.
Docstring Coverage ✅ Passed Docstring coverage is 92.50% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e56c656 and 8907d96.

📒 Files selected for processing (1)
  • configure (9 hunks)
👮 Files not reviewed due to content moderation or server errors (1)
  • configure
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
  • GitHub Check: meson_build (ubuntu-latest)
  • GitHub Check: oracle_regression (ubuntu-latest)
  • GitHub Check: pg_regression (ubuntu-latest)
  • GitHub Check: build (ubuntu-latest)
  • GitHub Check: contrib_regression
  • GitHub Check: oracle_pg_regression (ubuntu-latest)

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 5

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/backend/commands/copy.c (1)

136-185: Skip system attributes before indexing TupleDesc to avoid undefined memory access

In the new loop over expr_attrs, pull_varattnos() can produce entries for system columns (e.g., tableoid with negative AttrNumber). The current code does not guard against negative attno values before calling:

TupleDescAttr(RelationGetDescr(rel), attno - 1)->attgenerated

With attno = -2 (tableoid), this computes a negative array index, reading memory before the attrs array, which is undefined behavior. A COPY ... FROM ... WHERE tableoid = ... clause triggers this path.

Generated columns are only defined for user attributes, so system attributes should be skipped:

            i = -1;
            while ((i = bms_next_member(expr_attrs, i)) >= 0)
            {
                AttrNumber  attno = i + FirstLowInvalidHeapAttributeNumber;

-               Assert(attno != 0);
+               /* Whole-row bit should already have been removed. */
+               Assert(attno != 0);
+
+               /* Ignore system attributes; generated columns are user columns only. */
+               if (attno <= 0)
+                   continue;

                /*
                 * Prohibit generated columns in the WHERE clause.  Stored
                 * generated columns are not yet computed when the filtering
                 * happens.  Virtual generated columns could probably work (we
                 * would need to expand them somewhere around here), but for
                 * now we keep them consistent with the stored variant.
                 */
                if (TupleDescAttr(RelationGetDescr(rel), attno - 1)->attgenerated)
                    ereport(ERROR,
                            errcode(ERRCODE_INVALID_COLUMN_REFERENCE),
                            errmsg("generated columns are not supported in COPY FROM WHERE conditions"),
                            errdetail("Column \"%s\" is a generated column.",
                                      get_attname(RelationGetRelid(rel), attno, false)));
            }
🧹 Nitpick comments (15)
src/backend/access/gin/gininsert.c (1)

139-177: Parallel GIN build chunking logic looks correct; consider tightening the contract for bs_num_workers

The new bs_num_workers field plus the ginFlushBuildState() chunking logic and its initialization in _gin_parallel_scan_and_build() are consistent:

  • bs_num_workers is set from ginshared->scantuplesortstates before any possible call to ginFlushBuildState(), and that value is strictly positive in the parallel-build path.
  • maxlen = MaxAllocSize / sizeof(ItemPointerData) / (2 * bs_num_workers) safely bounds per-chunk TID counts so that, even if each participant contributes up to two chunks per key, leader-side memory consumption for the merged TID lists stays within MaxAllocSize.
  • The chunking loop (offset/len) preserves monotone, non-duplicated TID order within and across chunks, so downstream merging in _gin_process_worker_data() and _gin_parallel_merge() (via GinBuffer* and _gin_build_tuple) still sees correctly ordered input.
  • Added CHECK_FOR_INTERRUPTS() inside the inner chunk loop is appropriate to keep long posting-list splits cancellable.

One small hardening you might consider is adding an assertion at the top of ginFlushBuildState():

Assert(buildstate->bs_num_workers > 0);

This documents the expectation that the function is only used in the parallel path and would catch any future accidental reuse from a serial code path before it could compute maxlen with an invalid divisor.

Also applies to: 482-545, 2023-2056

src/backend/access/nbtree/nbtutils.c (1)

62-64: Row-compare header handling and invariants are consistent across caller and callee

The change to pass a ScanKey header into _bt_check_rowcompare() and derive the first member with DatumGetPointer(header->sk_argument) matches how row-comparison keys are constructed. The added asserts (header has SK_ROW_HEADER, first member’s attno/strategy match the header, and later pointer comparisons against the first member) are all consistent with _bt_preprocess_keys and _bt_first’s setup and should only ever trip on genuinely malformed row-compare keys.

The updated internal logic still:

  • Uses member sk_flags/requiredness to decide when *continuescan can be cleared.
  • Treats truncated attributes and NULL tuple values with the same directional rules as scalar keys, with special-casing only for the first (most significant) row member as documented in the expanded comment block.

No functional regressions are apparent; the changes strengthen invariants and documentation.

If you want to trim a bit of repetition, consider caching the first-member pointer once, e.g. ScanKey first = (ScanKey) DatumGetPointer(header->sk_argument); and reusing first in the equality/assert tests instead of re-calling DatumGetPointer(...) each time. This is purely a readability micro-optimization.

Also applies to: 2914-2958, 2960-2968, 2991-2992, 3062-3063, 3100-3102

src/backend/parser/parse_expr.c (1)

5323-5363: New collation check for DEFAULT behavior expressions is sound but tightens semantics

The extended transformJsonBehavior() now:

  • Transforms the DEFAULT expression once, validates it (constant / pure non‑aggregate func/op, no Vars, no SRF), as before.
  • Derives targetcoll from jsexpr->collation and exprcoll from exprCollation(expr) (falling back to get_typcollation(exprType(expr)) when needed).
  • Raises ERRCODE_COLLATION_MISMATCH when both collations are valid and differ, with a clear detail string built via get_collation_name().

This enforces that a DEFAULT expression used in ON EMPTY/ON ERROR has a collation compatible with the enclosing JSON expression’s RETURNING type, which avoids subtle inconsistencies when mixing explicitly collated DEFAULTs with JSON results.

The subsequent coercion logic:

  • Still chooses runtime coercion for NULL/jsonb/boolean special cases.
  • Otherwise attempts a cast to returning->typid (using assignment-level for string targets) and retains the prior error behavior when no cast exists.
  • Preserves the existing behavior->expr update and behavior->coerce flagging.

Overall, this is a correctness-strengthening change with only new behavior being an early, well‑diagnosed error when DEFAULT uses an incompatible collation, which is acceptable for a minor-version sync.

Also applies to: 5380-5454

src/backend/replication/pgoutput/pgoutput.c (1)

450-472: Reset callback registration is sound; minor comment nuance

Allocating MemoryContextCallback in ctx->context and registering it there ensures the cleanup runs when the decoding context is reset or deleted, and the struct is freed with the context, so there’s no leak. Function pointer is set explicitly and arg is effectively NULL via palloc0, matching the direct call in pgoutput_shutdown.

Very small nit: the comment above pgoutput_memory_context_reset mentions “PGOutputData->context”, but the callback is actually registered on ctx->context (its parent). Behavior is correct; adjust wording only if you want to avoid future confusion.

src/backend/main/main.c (1)

485-518: UBSAN default-options helper is solid; consider guarding __has_attribute more defensively

The logic in __ubsan_default_options() and the use of disable_sanitizer_instrumentation to avoid recursive sanitizer callbacks are both sensible. To avoid potential preprocessor failures on compilers that don’t provide __has_attribute, it would be safer to wrap the attribute check like this:

-const char *__ubsan_default_options(void);
-
-#if __has_attribute(disable_sanitizer_instrumentation)
-__attribute__((disable_sanitizer_instrumentation))
-#endif
-const char *
-__ubsan_default_options(void)
+const char *__ubsan_default_options(void);
+
+#ifdef __has_attribute
+#if __has_attribute(disable_sanitizer_instrumentation)
+__attribute__((disable_sanitizer_instrumentation))
+#endif
+#endif
+const char *
+__ubsan_default_options(void)

This keeps the intent but avoids invoking __has_attribute where it’s not known.

src/bin/pg_archivecleanup/po/es.po (1)

11-19: Spanish pg_archivecleanup help text is accurate; minor ellipsis nit

  • Usage line and option descriptions (-b, -d, -n, -x) correctly reflect the English semantics, including the ARCHIVELOCATION / oldest-WAL parameters and the archive_cleanup_command examples.
  • All format strings remain literal text with no placeholders, so there are no formatting risks.

Minor optional polish: the usage line currently has "[OPCIÓN]...." (four dots); consider changing this to "[OPCIÓN]..." to mirror the English style.

Also applies to: 102-106, 116-146, 152-166

src/backend/statistics/attribute_stats.c (2)

140-198: RangeVarGetRelidExtended + stats callback wiring looks correct

The new locked_table variable and the RangeVarGetRelidExtended(makeRangeVar(...), ShareUpdateExclusiveLock, 0, RangeVarCallbackForStats, &locked_table) call are wired correctly: the callback sees an Oid * initialized to InvalidOid, handles heap/index locking and permission checks, and there’s no need to touch locked_table afterwards in this function.

If you want to reduce future “why is this variable never used?” questions, consider a brief comment near locked_table explaining that it’s intentionally only consumed by RangeVarCallbackForStats for lock management.

-	Oid			locked_table = InvalidOid;
+	/* Used by RangeVarCallbackForStats to manage heap locks when relation is an index. */
+	Oid			locked_table = InvalidOid;

915-942: pg_clear_attribute_stats adopts the same safe lookup/locking pattern

The locked_table variable and RangeVarGetRelidExtended(..., ShareUpdateExclusiveLock, 0, RangeVarCallbackForStats, &locked_table) usage here mirrors attribute_statistics_update() and correctly centralizes locking and privilege checks in RangeVarCallbackForStats. No additional cleanup of locked_table is required; heavyweight locks are intended to persist to end-of-transaction.

Optionally, you might mirror the same clarifying comment on locked_table here for consistency with the other function.

-	Oid			locked_table = InvalidOid;
+	/* Used by RangeVarCallbackForStats to manage heap locks when relation is an index. */
+	Oid			locked_table = InvalidOid;
src/backend/access/transam/xlogrecovery.c (1)

4772-4787: GUC validation for primary_slot_name now surfaces proper SQLSTATE and detail

Using ReplicationSlotValidateNameInternal() plus GUC_check_errcode, GUC_check_errdetail, and optional GUC_check_errhint produces better error reporting for invalid primary_slot_name values than the previous direct validation path. The check correctly skips empty and NULL values and returns false only on validation failure so GUC machinery can format the error.

If you ever tighten this further, consider documenting (in a comment) that the err_msg/err_hint strings are intentionally left to GUC’s error machinery and not freed here, to avoid someone accidentally adding a pfree() and causing use‑after‑free later.

src/bin/pg_basebackup/pg_createsubscriber.c (3)

986-997: Dry-run check of max_slot_wal_keep_size is useful, but consider applying to real runs too

Emitting a warning in dry-run mode when max_slot_wal_keep_size is not -1 gives users an early heads-up that required WAL for the new logical slots could be prematurely removed. That’s good preflight feedback. You might consider emitting the same warning in non–dry-run usage as well (still as a warning, not an error) so real executions get the same diagnostic.


1388-1394: Replication-slot creation logging is consistent with dry-run gating, but slightly redundant

The helper now logs “dry-run: would create the replication slot … on publisher” vs “creating the replication slot … on publisher” and still returns the LSN only when the slot is actually created. Combined with the existing pg_log_info("create replication slot \"%s\" on publisher", ...) in setup_publisher(), real runs now emit two messages per slot creation. That’s harmless but a bit noisy; you might want to drop one of them or adjust the outer message to only fire in dry-run mode.


1667-1673: Dry-run logging for publications, subscriptions, and replication progress is well-structured

Across create_publication, drop_publication, check_and_drop_publications, create_subscription, set_replication_progress, and enable_subscription, the new “dry-run: would …” messages consistently wrap the actual SQL execution in if (!dry_run) blocks. That gives a clear narrative of intended actions without changing real behavior. The cleanup paths still operate correctly (including when --clean=publications is used), and dry-run mode now provides a more complete preview of catalog changes on both publisher and subscriber.

If you find the volume of dry-run output too high during testing, you could consider grouping some of these into higher-level summaries (e.g., per database) while keeping detailed logs under --verbose.

Also applies to: 1714-1719, 1790-1797, 1827-1833, 1929-1935, 1979-1985

.cirrus.tasks.yml (1)

879-921: Duplicate always: keys in CompilerWarnings task should be consolidated

The CompilerWarnings task defines always: multiple times (for gcc, clang, mingw, docs, and header checks). YAML technically requires unique keys per mapping; many parsers treat later keys as overwriting earlier ones, which is what YAMLlint is flagging. Cirrus seems to accept this pattern, but it’s fragile and confusing.

You should consolidate these into a single always: mapping with all the *_script entries under it, e.g.:

always:
  gcc_warning_script: |
    ...
  gcc_a_warning_script: |
    ...
  clang_warning_script: |
    ...
  clang_a_warning_script: |
    ...
  mingw_cross_warning_script: |
    ...
  docs_build_script: |
    ...
  headers_headerscheck_script: |
    ...
  headers_cpluspluscheck_script: |
    ...

This will both satisfy YAML linters and make it clearer that all of these scripts are intended to run unconditionally.

Also applies to: 925-933, 940-943, 955-963

src/backend/statistics/stat_utils.c (1)

131-243: RangeVarCallbackForStats correctly resolves heap, enforces relkind/privileges, and avoids deadlocks

The new RangeVarCallbackForStats() follows the expected RangeVar callback pattern:

  • Tracks a locked_oid heap relation, unlocking it when relId changes between callback invocations.
  • Resolves index targets to their heap via IndexGetRelation() and uses get_rel_relkind() to distinguish table vs index relkinds.
  • Handles rare concurrency races (index dropped or replaced between lookups) with clear UNDEFINED_OBJECT errors rather than risking inconsistent locking.
  • Checks Form_pg_class for supported relkinds (plain/partitioned tables, matviews, foreign tables) and rejects others with errdetail_relkind_not_supported().
  • Disallows shared relations and then enforces either database ownership or ACL_MAINTAIN on the target relation via pg_class_aclcheck() and get_relkind_objtype().

The final “lock heap before index” step using ShareUpdateExclusiveLock only when table_oid != relId is in line with the usual heap‑before‑index ordering to avoid deadlocks. Overall this is a solid and correctly integrated replacement for the previous stats privilege helper.

If you ever touch this again, you could micro‑optimize by avoiding a second syscache lookup when table_oid == relId (reusing relkind information), but there’s no functional need to do so.

src/backend/replication/slot.c (1)

2732-2750: Minor: Memory not explicitly freed on validation failure.

When ReplicationSlotValidateNameInternal returns false, err_msg and err_hint are allocated via psprintf but not freed before returning. While the GUC check context is short-lived and cleans up automatically, explicit pfree calls would be more consistent with ReplicationSlotValidateName (lines 284-286).

 		if (!ReplicationSlotValidateNameInternal(name, &err_code, &err_msg,
 												 &err_hint))
 		{
 			GUC_check_errcode(err_code);
 			GUC_check_errdetail("%s", err_msg);
 			if (err_hint != NULL)
 				GUC_check_errhint("%s", err_hint);
+
+			pfree(err_msg);
+			if (err_hint != NULL)
+				pfree(err_hint);
 			return false;
 		}
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 873c2f8 and 1af273b.

⛔ Files ignored due to path filters (27)
  • contrib/pg_stat_statements/expected/squashing.out is excluded by !**/*.out
  • contrib/postgres_fdw/expected/eval_plan_qual.out is excluded by !**/*.out
  • contrib/sepgsql/expected/ddl.out is excluded by !**/*.out
  • src/oracle_test/regress/expected/alter_table.out is excluded by !**/*.out
  • src/oracle_test/regress/expected/collate.icu.utf8.out is excluded by !**/*.out
  • src/oracle_test/regress/expected/constraints.out is excluded by !**/*.out
  • src/oracle_test/regress/expected/foreign_key.out is excluded by !**/*.out
  • src/oracle_test/regress/expected/generated_stored.out is excluded by !**/*.out
  • src/oracle_test/regress/expected/generated_virtual.out is excluded by !**/*.out
  • src/oracle_test/regress/expected/groupingsets.out is excluded by !**/*.out
  • src/oracle_test/regress/expected/join.out is excluded by !**/*.out
  • src/oracle_test/regress/expected/partition_aggregate.out is excluded by !**/*.out
  • src/oracle_test/regress/expected/stats_ext.out is excluded by !**/*.out
  • src/oracle_test/regress/expected/stats_import.out is excluded by !**/*.out
  • src/test/isolation/expected/eval-plan-qual.out is excluded by !**/*.out
  • src/test/modules/unsafe_tests/expected/guc_privs.out is excluded by !**/*.out
  • src/test/regress/expected/alter_table.out is excluded by !**/*.out
  • src/test/regress/expected/collate.icu.utf8.out is excluded by !**/*.out
  • src/test/regress/expected/constraints.out is excluded by !**/*.out
  • src/test/regress/expected/foreign_key.out is excluded by !**/*.out
  • src/test/regress/expected/generated_stored.out is excluded by !**/*.out
  • src/test/regress/expected/generated_virtual.out is excluded by !**/*.out
  • src/test/regress/expected/groupingsets.out is excluded by !**/*.out
  • src/test/regress/expected/join.out is excluded by !**/*.out
  • src/test/regress/expected/partition_aggregate.out is excluded by !**/*.out
  • src/test/regress/expected/stats_ext.out is excluded by !**/*.out
  • src/test/regress/expected/stats_import.out is excluded by !**/*.out
📒 Files selected for processing (107)
  • .abi-compliance-history (1 hunks)
  • .cirrus.tasks.yml (32 hunks)
  • .git-blame-ignore-revs (1 hunks)
  • configure (8 hunks)
  • configure.ac (1 hunks)
  • contrib/pg_prewarm/pg_prewarm.c (4 hunks)
  • contrib/pg_prewarm/t/001_basic.pl (3 hunks)
  • contrib/pg_stat_statements/pg_stat_statements.c (2 hunks)
  • contrib/pg_stat_statements/sql/squashing.sql (2 hunks)
  • contrib/pgstattuple/pgstattuple.c (3 hunks)
  • contrib/postgres_fdw/.gitignore (1 hunks)
  • contrib/postgres_fdw/Makefile (1 hunks)
  • contrib/postgres_fdw/meson.build (1 hunks)
  • contrib/postgres_fdw/specs/eval_plan_qual.spec (1 hunks)
  • contrib/sepgsql/.gitignore (1 hunks)
  • doc/src/sgml/config.sgml (11 hunks)
  • doc/src/sgml/func.sgml (5 hunks)
  • doc/src/sgml/libpq.sgml (1 hunks)
  • doc/src/sgml/monitoring.sgml (1 hunks)
  • doc/src/sgml/protocol.sgml (1 hunks)
  • doc/src/sgml/ref/alter_table.sgml (1 hunks)
  • doc/src/sgml/ref/insert.sgml (1 hunks)
  • doc/src/sgml/ref/pg_combinebackup.sgml (1 hunks)
  • doc/src/sgml/release-18.sgml (1 hunks)
  • doc/src/sgml/sourcerepo.sgml (1 hunks)
  • meson.build (2 hunks)
  • src/backend/access/brin/brin.c (3 hunks)
  • src/backend/access/gin/gininsert.c (5 hunks)
  • src/backend/access/heap/vacuumlazy.c (1 hunks)
  • src/backend/access/nbtree/nbtsearch.c (4 hunks)
  • src/backend/access/nbtree/nbtutils.c (6 hunks)
  • src/backend/access/transam/multixact.c (1 hunks)
  • src/backend/access/transam/xlog.c (2 hunks)
  • src/backend/access/transam/xlogrecovery.c (3 hunks)
  • src/backend/access/transam/xlogstats.c (1 hunks)
  • src/backend/catalog/namespace.c (1 hunks)
  • src/backend/commands/copy.c (2 hunks)
  • src/backend/commands/dbcommands.c (1 hunks)
  • src/backend/commands/explain_state.c (2 hunks)
  • src/backend/commands/statscmds.c (2 hunks)
  • src/backend/commands/tablecmds.c (7 hunks)
  • src/backend/executor/execMain.c (5 hunks)
  • src/backend/executor/execScan.c (1 hunks)
  • src/backend/executor/nodeAgg.c (1 hunks)
  • src/backend/executor/nodeHash.c (2 hunks)
  • src/backend/jit/llvm/llvmjit_deform.c (1 hunks)
  • src/backend/jit/llvm/llvmjit_expr.c (1 hunks)
  • src/backend/main/main.c (1 hunks)
  • src/backend/nodes/nodeFuncs.c (1 hunks)
  • src/backend/optimizer/path/allpaths.c (2 hunks)
  • src/backend/optimizer/path/joinpath.c (2 hunks)
  • src/backend/optimizer/plan/analyzejoins.c (2 hunks)
  • src/backend/optimizer/plan/planner.c (6 hunks)
  • src/backend/optimizer/util/plancat.c (1 hunks)
  • src/backend/parser/analyze.c (1 hunks)
  • src/backend/parser/parse_expr.c (10 hunks)
  • src/backend/po/ko.po (1 hunks)
  • src/backend/postmaster/autovacuum.c (1 hunks)
  • src/backend/postmaster/interrupt.c (1 hunks)
  • src/backend/replication/logical/applyparallelworker.c (2 hunks)
  • src/backend/replication/logical/launcher.c (2 hunks)
  • src/backend/replication/pgoutput/pgoutput.c (5 hunks)
  • src/backend/replication/slot.c (11 hunks)
  • src/backend/replication/walsender.c (3 hunks)
  • src/backend/rewrite/rewriteManip.c (1 hunks)
  • src/backend/statistics/attribute_stats.c (5 hunks)
  • src/backend/statistics/relation_stats.c (2 hunks)
  • src/backend/statistics/stat_utils.c (4 hunks)
  • src/backend/storage/aio/aio.c (2 hunks)
  • src/backend/storage/buffer/bufmgr.c (2 hunks)
  • src/backend/storage/ipc/ipci.c (1 hunks)
  • src/backend/storage/ipc/shmem.c (1 hunks)
  • src/backend/storage/ipc/waiteventset.c (1 hunks)
  • src/backend/tcop/utility.c (1 hunks)
  • src/backend/utils/activity/generate-wait_event_types.pl (1 hunks)
  • src/backend/utils/activity/pgstat_backend.c (1 hunks)
  • src/backend/utils/adt/pg_locale.c (2 hunks)
  • src/backend/utils/adt/selfuncs.c (1 hunks)
  • src/backend/utils/error/elog.c (1 hunks)
  • src/backend/utils/mmgr/aset.c (1 hunks)
  • src/backend/utils/mmgr/freepage.c (2 hunks)
  • src/bin/initdb/po/es.po (1 hunks)
  • src/bin/pg_amcheck/po/es.po (1 hunks)
  • src/bin/pg_archivecleanup/po/es.po (5 hunks)
  • src/bin/pg_basebackup/pg_createsubscriber.c (13 hunks)
  • src/bin/pg_basebackup/po/de.po (6 hunks)
  • src/bin/pg_basebackup/po/es.po (8 hunks)
  • src/bin/pg_basebackup/po/fr.po (7 hunks)
  • src/bin/pg_basebackup/po/ja.po (7 hunks)
  • src/bin/pg_basebackup/po/ru.po (16 hunks)
  • src/bin/pg_basebackup/t/040_pg_createsubscriber.pl (2 hunks)
  • src/bin/pg_checksums/po/es.po (1 hunks)
  • src/bin/pg_combinebackup/pg_combinebackup.c (1 hunks)
  • src/bin/pg_combinebackup/po/es.po (11 hunks)
  • src/bin/pg_combinebackup/po/ru.po (9 hunks)
  • src/bin/pg_combinebackup/reconstruct.c (2 hunks)
  • src/bin/pg_config/po/es.po (1 hunks)
  • src/bin/pg_controldata/po/es.po (1 hunks)
  • src/bin/pg_ctl/po/es.po (1 hunks)
  • src/bin/pg_dump/compress_gzip.c (2 hunks)
  • src/bin/pg_dump/pg_dump.c (2 hunks)
  • src/bin/pg_dump/pg_dump_sort.c (1 hunks)
  • src/bin/pg_dump/po/es.po (17 hunks)
  • src/bin/pg_dump/po/ru.po (14 hunks)
  • src/bin/pg_dump/t/002_pg_dump.pl (1 hunks)
  • src/bin/pg_resetwal/po/es.po (1 hunks)
  • src/bin/pg_resetwal/po/ru.po (2 hunks)
⛔ Files not processed due to max files limit (42)
  • src/bin/pg_rewind/po/es.po
  • src/bin/pg_test_fsync/po/es.po
  • src/bin/pg_test_timing/po/es.po
  • src/bin/pg_upgrade/po/es.po
  • src/bin/pg_upgrade/po/ja.po
  • src/bin/pg_verifybackup/po/es.po
  • src/bin/pg_waldump/po/es.po
  • src/bin/pg_walsummary/po/es.po
  • src/bin/pgbench/pgbench.c
  • src/bin/pgbench/t/001_pgbench_with_server.pl
  • src/bin/psql/help.c
  • src/bin/psql/po/de.po
  • src/bin/psql/po/es.po
  • src/bin/psql/po/fr.po
  • src/bin/psql/po/ja.po
  • src/bin/psql/po/ru.po
  • src/bin/scripts/po/es.po
  • src/include/access/xlog.h
  • src/include/access/xlogdefs.h
  • src/include/access/xlogstats.h
  • src/include/commands/defrem.h
  • src/include/executor/execScan.h
  • src/include/lib/simplehash.h
  • src/include/miscadmin.h
  • src/include/pgstat.h
  • src/include/port/atomics/generic-gcc.h
  • src/include/replication/conflict.h
  • src/include/replication/slot.h
  • src/include/statistics/stat_utils.h
  • src/include/utils/elog.h
  • src/interfaces/ecpg/ecpglib/po/es.po
  • src/interfaces/ecpg/preproc/po/es.po
  • src/interfaces/libpq/fe-connect.c
  • src/interfaces/libpq/fe-exec.c
  • src/interfaces/libpq/fe-print.c
  • src/interfaces/libpq/fe-protocol3.c
  • src/interfaces/libpq/fe-secure-gssapi.c
  • src/interfaces/libpq/libpq-int.h
  • src/interfaces/libpq/po/es.po
  • src/interfaces/libpq/po/fr.po
  • src/interfaces/libpq/po/ja.po
  • src/interfaces/libpq/po/ru.po
👮 Files not reviewed due to content moderation or server errors (2)
  • configure
  • src/bin/pg_dump/pg_dump.c
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-09-02T10:43:25.257Z
Learnt from: syasirs
Repo: IvorySQL/IvorySQL PR: 858
File: src/Makefile.global.in:513-514
Timestamp: 2025-09-02T10:43:25.257Z
Learning: In IvorySQL Makefile.global.in, $(wildcard t/oracle/*.pl) is used instead of t/oracle/*.pl in Oracle TAP test discovery because the t/oracle directory is optional and may not exist in most builds. The wildcard function safely returns empty string when the directory is missing, preventing shell expansion errors.

Applied to files:

  • contrib/postgres_fdw/Makefile
🧬 Code graph analysis (21)
src/backend/commands/statscmds.c (3)
src/backend/catalog/aclchk.c (2)
  • object_aclcheck (4119-4123)
  • aclcheck_error (2861-3161)
src/backend/utils/init/miscinit.c (1)
  • GetUserId (519-524)
src/backend/utils/cache/lsyscache.c (1)
  • get_namespace_name (3848-3865)
src/backend/postmaster/autovacuum.c (1)
src/backend/utils/time/snapmgr.c (4)
  • PushActiveSnapshot (679-683)
  • GetTransactionSnapshot (270-345)
  • ActiveSnapshotSet (809-813)
  • PopActiveSnapshot (772-791)
contrib/pg_prewarm/pg_prewarm.c (4)
src/backend/utils/cache/lsyscache.c (1)
  • get_rel_relkind (2420-2437)
src/backend/catalog/index.c (1)
  • IndexGetRelation (3590-3610)
src/backend/storage/lmgr/lmgr.c (2)
  • LockRelationOid (107-140)
  • UnlockRelationOid (229-237)
src/backend/catalog/aclchk.c (1)
  • pg_class_aclcheck (4322-4326)
src/backend/statistics/relation_stats.c (3)
src/backend/statistics/stat_utils.c (1)
  • RangeVarCallbackForStats (130-243)
src/backend/catalog/namespace.c (1)
  • RangeVarGetRelidExtended (449-651)
src/backend/nodes/makefuncs.c (1)
  • makeRangeVar (473-487)
src/backend/replication/pgoutput/pgoutput.c (2)
src/backend/utils/hash/dynahash.c (1)
  • hash_destroy (865-882)
src/backend/utils/mmgr/mcxt.c (1)
  • MemoryContextRegisterResetCallback (567-578)
contrib/pgstattuple/pgstattuple.c (3)
src/include/storage/bufpage.h (3)
  • PageGetSpecialSize (317-321)
  • PageIsNew (234-238)
  • PageGetMaxOffsetNumber (372-381)
src/backend/storage/buffer/bufmgr.c (2)
  • ReadBufferExtended (805-829)
  • LockBuffer (5600-5619)
src/include/storage/bufmgr.h (1)
  • BufferGetPage (417-421)
src/backend/statistics/attribute_stats.c (3)
src/backend/catalog/namespace.c (1)
  • RangeVarGetRelidExtended (449-651)
src/backend/nodes/makefuncs.c (1)
  • makeRangeVar (473-487)
src/backend/statistics/stat_utils.c (1)
  • RangeVarCallbackForStats (130-243)
src/backend/commands/explain_state.c (1)
src/include/port/pg_bitutils.h (1)
  • pg_nextpower2_32 (188-202)
src/backend/access/transam/xlogrecovery.c (4)
src/backend/replication/walreceiverfuncs.c (1)
  • WalRcvStreaming (126-172)
src/backend/access/transam/xlog.c (2)
  • XLogShutdownWalRcv (9653-9658)
  • ResetInstallXLogFileSegmentActive (9670-9676)
src/backend/replication/slot.c (1)
  • ReplicationSlotValidateNameInternal (304-339)
src/backend/utils/misc/guc.c (1)
  • GUC_check_errcode (6801-6805)
src/backend/access/brin/brin.c (1)
src/backend/access/brin/brin_revmap.c (1)
  • brinGetTupleForHeapBlock (193-313)
src/backend/optimizer/plan/planner.c (1)
src/backend/parser/parse_agg.c (1)
  • expand_grouping_sets (1919-2005)
src/backend/commands/dbcommands.c (1)
src/backend/utils/mmgr/mcxt.c (1)
  • pfree (1527-1541)
src/backend/access/nbtree/nbtutils.c (1)
src/include/postgres.h (1)
  • DatumGetPointer (316-320)
src/backend/access/gin/gininsert.c (1)
src/backend/utils/sort/tuplesortvariants.c (1)
  • tuplesort_putgintuple (885-914)
src/backend/parser/parse_expr.c (2)
src/backend/utils/cache/lsyscache.c (2)
  • get_typcollation (3538-3555)
  • get_collation_name (1132-1149)
src/backend/nodes/nodeFuncs.c (1)
  • exprCollation (843-1090)
src/backend/statistics/stat_utils.c (6)
src/backend/utils/cache/lsyscache.c (1)
  • get_rel_relkind (2420-2437)
src/backend/catalog/index.c (1)
  • IndexGetRelation (3590-3610)
src/backend/utils/cache/syscache.c (2)
  • SearchSysCache1 (220-229)
  • ReleaseSysCache (268-272)
src/include/postgres.h (1)
  • ObjectIdGetDatum (256-260)
src/backend/catalog/aclchk.c (2)
  • object_ownercheck (4386-4452)
  • pg_class_aclcheck (4322-4326)
src/backend/catalog/objectaddress.c (1)
  • get_relkind_objtype (6318-6343)
src/backend/access/heap/vacuumlazy.c (1)
src/backend/commands/vacuumparallel.c (1)
  • parallel_vacuum_get_dead_items (466-471)
src/bin/pg_basebackup/pg_createsubscriber.c (1)
src/common/controldata_utils.c (1)
  • update_controlfile (188-283)
src/backend/tcop/utility.c (1)
src/backend/commands/statscmds.c (1)
  • CreateStatistics (61-626)
src/backend/replication/slot.c (2)
src/backend/utils/error/elog.c (3)
  • errcode (853-864)
  • errmsg_internal (1157-1173)
  • errhint_internal (1339-1354)
src/backend/utils/misc/guc.c (1)
  • GUC_check_errcode (6801-6805)
src/backend/commands/tablecmds.c (5)
src/backend/catalog/pg_constraint.c (1)
  • findNotNullConstraintAttnum (591-633)
src/include/access/htup_details.h (1)
  • GETSTRUCT (751-755)
src/backend/optimizer/util/var.c (1)
  • pull_varattnos (295-306)
src/include/access/tupdesc.h (1)
  • TupleDescAttr (160-166)
src/backend/utils/cache/lsyscache.c (1)
  • get_attname (924-945)
🪛 RuboCop (1.81.7)
contrib/postgres_fdw/specs/eval_plan_qual.spec

[fatal] 5-5: unexpected token tGVAR
(Using Ruby 2.7 parser; configure using TargetRubyVersion parameter, under AllCops)

(Lint/Syntax)


[fatal] 5-5: unexpected $' (Using Ruby 2.7 parser; configure using TargetRubyVersionparameter, underAllCops`)

(Lint/Syntax)

🪛 YAMLlint (1.37.1)
.cirrus.tasks.yml

[error] 923-923: duplication of key "always" in mapping

(key-duplicates)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
  • GitHub Check: oracle_pg_regression (ubuntu-latest)
  • GitHub Check: build (ubuntu-latest)
  • GitHub Check: meson_build (ubuntu-latest)
  • GitHub Check: pg_regression (ubuntu-latest)
  • GitHub Check: contrib_regression
  • GitHub Check: oracle_regression (ubuntu-latest)

Comment on lines +639 to 640
* Node that the function sends SIGUSR2 instead of SIGTERM to the parallel apply
* worker so that the worker exits cleanly.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Typo: "Node" should be "Note".

-* Node that the function sends SIGUSR2 instead of SIGTERM to the parallel apply
+* Note that the function sends SIGUSR2 instead of SIGTERM to the parallel apply
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
* Node that the function sends SIGUSR2 instead of SIGTERM to the parallel apply
* worker so that the worker exits cleanly.
* Note that the function sends SIGUSR2 instead of SIGTERM to the parallel apply
* worker so that the worker exits cleanly.
🤖 Prompt for AI Agents
In src/backend/replication/logical/launcher.c around lines 639-640, there's a
typo in the comment: change the word "Node" to "Note" so the sentence reads
"Note that the function sends SIGUSR2..." — update the comment text accordingly.

Comment on lines +1564 to 1567
#: pg_createsubscriber.c:740
#, c-format
msgid "could not obtain database OID: got %d rows, expected %d row"
msgstr "n'a pas pu obtenir l'OID de la base de données : %d lignes attendues, %d ligne reçue"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

French pg_createsubscriber messages: swapped row counts and incorrect concept

There are a few small but confusing semantic issues in these translations:

  1. Row-count messages invert “got” vs “expected”:

    • msgid "could not obtain database OID: got %d rows, expected %d row"
    • msgid "could not obtain subscription OID: got %d rows, expected %d row"

    The French msgstr for both phrases label the first %d as “lignes attendues” (expected) and the second as “ligne reçue” (received), but the C code passes the arguments as (got, expected). This reverses the meaning.

    Consider rephrasing so the first %d is clearly “reçues” and the second is “attendues”, without changing the placeholder order.

  2. Wrong concept for data directory:

    • msgid "no subscriber data directory specified"

    is currently translated as:

    • « aucune chaîne de connexion de l'abonné indiquée »

    which talks about a connection string, not a data directory path. That’s misleading for users trying to fix pg_createsubscriber invocation.

    Suggest aligning it with the original, e.g. referencing “répertoire de données de l'abonné”.

Also applies to: 1883-1887, 1963-1967

🤖 Prompt for AI Agents
In src/bin/pg_basebackup/po/fr.po around lines 1564 to 1567 (and similarly at
1883-1887 and 1963-1967), the French translations swap the semantic roles of the
two %d placeholders and mislabel one message about a data directory as a
connection string; update the msgstr for the "could not obtain ... got %d rows,
expected %d row" entries so the first %d is described as "reçues" (got) and the
second as "attendues" (expected) without changing placeholder order, and change
the msgstr for "no subscriber data directory specified" to reference "répertoire
de données de l'abonné" (or equivalent) instead of "chaîne de connexion".

Comment on lines +1939 to 1943
#: pg_createsubscriber.c:2228
#, c-format
msgid "subscription \"%s\" specified more than once for --subscription"
msgstr "--subscription に対してブスクリプション\"%s\"が複数回指定されました"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Fix a few Japanese translation issues (typos and wrong verb)

There are three small but user-visible problems in the updated ja.po:

  1. Wrong verb for stopping subscriber (Line ~2054):
  • msgid: stopping the subscriber
  • current msgstr: サブスクライバを起動しています (“starting the subscriber”)

This should say “停止しています”, not “起動しています”.

-msgstr "サブスクライバを起動しています"
+msgstr "サブスクライバを停止しています"
  1. Stray backtick in compression message (Line ~2255):
  • msgid: compression with %s is not yet supported
  • current msgstr: %sによる圧縮まだサポートされていません`

The backtick before 「まだ」 looks accidental.

-msgstr "%sによる圧縮`まだサポートされていません"
+msgstr "%sによる圧縮はまだサポートされていません"
  1. Typo in “subscription” (Line ~1939-1943):
  • msgid: subscription "%s" specified more than once for --subscription
  • current msgstr: --subscription に対してブスクリプション"%s"が複数回指定されました

「ブスクリプション」 should be 「サブスクリプション」.

-msgstr "--subscription に対してブスクリプション\"%s\"が複数回指定されました"
+msgstr "--subscription に対してサブスクリプション\"%s\"が複数回指定されました"

These are minor text fixes but worth correcting before release.

Also applies to: 2054-2058, 2251-2258

🤖 Prompt for AI Agents
In src/bin/pg_basebackup/po/ja.po around lines 1939-1943, 2054-2058 and
2251-2258: fix three translation problems — (1) at 1939-1943 replace the
misspelled 「ブスクリプション\"%s\"が複数回指定されました」 with 「サブスクリプション\"%s\"が複数回指定されました」, (2) at
2054-2058 change the incorrect verb phrase 「サブスクライバを起動しています」 to
「サブスクライバを停止しています」 for the msgid "stopping the subscriber", and (3) at 2251-2258
remove the stray backtick so the msgstr becomes a normal Japanese sentence like
「%sによる圧縮はまだサポートされていません」 (ensure spacing/quotes match project style).

Comment on lines +1670 to 1673
#: pg_createsubscriber.c:812
#, c-format
msgid "create replication slot \"%s\" on publisher"
msgstr "создаётся слот репликации \"%s\" на подписчике"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Russian: “publisher” vs “subscriber” mismatch in replication-slot message

The translation for:

  • msgid "create replication slot \"%s\" on publisher"

currently says it creates the slot “на подписчике” (on the subscriber), which reverses the role and can confuse users reading pg_createsubscriber output.

Consider adjusting the msgstr to something like:

-msgstr "создаётся слот репликации \"%s\" на подписчике"
+msgstr "создаётся слот репликации \"%s\" на стороне публикации"
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
#: pg_createsubscriber.c:812
#, c-format
msgid "create replication slot \"%s\" on publisher"
msgstr "создаётся слот репликации \"%s\" на подписчике"
#: pg_createsubscriber.c:812
#, c-format
msgid "create replication slot \"%s\" on publisher"
msgstr "создаётся слот репликации \"%s\" на стороне публикации"
🤖 Prompt for AI Agents
In src/bin/pg_basebackup/po/ru.po around lines 1670-1673, the Russian msgstr
incorrectly says the replication slot is created "на подписчике" (on the
subscriber) while the msgid says "on publisher"; update the msgstr to reflect
"publisher" (for example change it to "создаётся слот репликации \"%s\" на
издателе" or "создаётся слот репликации \"%s\" на сервере-издателе") so the
translated message matches the original meaning.

Comment on lines +1994 to +1998
#: pg_createsubscriber.c:1828
#, c-format
msgid "dry-run: would create subscription \"%s\" in database \"%s\""
msgstr "холостой запуск: будет удалена подписка \"%s\" в базе \"%s\""

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Russian: dry-run subscription message says “deleted” instead of “created”

For:

  • msgid "dry-run: would create subscription \"%s\" in database \"%s\""

the current translation:

  • «холостой запуск: будет удалена подписка …»

describes deletion, not creation, which is the opposite action.

Suggest correcting the verb to reflect creation, e.g.:

-msgstr "холостой запуск: будет удалена подписка \"%s\" в базе \"%s\""
+msgstr "холостой запуск: будет создана подписка \"%s\" в базе \"%s\""
🤖 Prompt for AI Agents
In src/bin/pg_basebackup/po/ru.po around lines 1994 to 1998, the msgstr for
msgid "dry-run: would create subscription \"%s\" in database \"%s\"" incorrectly
says deletion; change the Russian translation to indicate creation (e.g. use
«холостой запуск: будет создана подписка \"%s\" в базе \"%s\"») preserving the
c-format placeholders and surrounding quotes exactly.

Comment thread configure.ac
m4_pattern_forbid(^PGAC_)dnl to catch undefined macros

AC_INIT([PostgreSQL], [18.0], [pgsql-bugs@lists.postgresql.org], [], [https://www.postgresql.org/])
AC_INIT([PostgreSQL], [18.1], [pgsql-bugs@lists.postgresql.org], [], [https://www.postgresql.org/])
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you help to update the ivorysql_version to 5.1
on line 34

# IvorySQL version
PACKAGE_IVORYSQL_VERSION='5.1'

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

Comment thread meson.build
@gaoxueyu gaoxueyu merged commit e9d96a8 into IvorySQL:IVORY_REL_5_STABLE Dec 8, 2025
6 checks passed
@github-project-automation github-project-automation Bot moved this to Backlog in IvorySQL 5.1 Dec 17, 2025
@github-project-automation github-project-automation Bot moved this from Backlog to Done in IvorySQL 5.1 Dec 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.