PostgreSQL 15.17 commit log

Stamp 15.17.

commit   : 3eb6f61958ac5027a18791a828a0c7a47accf211    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 23 Feb 2026 17:01:47 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Mon, 23 Feb 2026 17:01:47 -0500    

Click here for diff

M configure
M configure.ac

Translation updates

commit   : 7063b9e92b25caaa27c8cc4ec37ef85fe9e63cb7    
  
author   : Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 23 Feb 2026 14:03:47 +0100    
  
committer: Peter Eisentraut <peter@eisentraut.org>    
date     : Mon, 23 Feb 2026 14:03:47 +0100    

Click here for diff

Source-Git-URL: https://git.postgresql.org/git/pgtranslation/messages.git  
Source-Git-Hash: 6b4371ce13670e5660c8660b2984e780610b2a77  

M src/backend/po/de.po
M src/backend/po/ja.po
M src/backend/po/ru.po
M src/bin/pg_resetwal/po/fr.po
M src/bin/pg_rewind/po/ru.po
M src/bin/psql/po/fr.po
M src/pl/plpgsql/src/po/ru.po

Release notes for 18.3, 17.9, 16.13, 15.17, 14.22.

commit   : 8dc47ebb108396ba29049a28224e66298251b736    
  
author   : Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 22 Feb 2026 12:22:41 -0500    
  
committer: Tom Lane <tgl@sss.pgh.pa.us>    
date     : Sun, 22 Feb 2026 12:22:41 -0500    

Click here for diff

M doc/src/sgml/release-15.sgml

Fix test_valid_server_encoding helper function.

commit   : e3bfa4f589a8a7127824f48a5892166ae7ac0e24    
  
author   : Thomas Munro <tmunro@postgresql.org>    
date     : Tue, 17 Feb 2026 13:53:32 +1300    
  
committer: Thomas Munro <tmunro@postgresql.org>    
date     : Tue, 17 Feb 2026 13:53:32 +1300    

Click here for diff

Commit c67bef3f325 introduced this test helper function for use by  
src/test/regress/sql/encoding.sql, but its logic was incorrect.  It  
confused an encoding ID for a boolean so it gave the wrong results for  
some inputs, and also forgot the usual return macro.  The mistake didn't  
affect values actually used in the test, so there is no change in  
behavior.  
  
Also drop it and another missed function at the end of the test, for  
consistency.  
  
Backpatch-through: 14  
Author: Zsolt Parragi <zsolt.parragi@percona.com>  

M src/test/regress/expected/encoding.out
M src/test/regress/regress.c
M src/test/regress/sql/encoding.sql

Suppress new "may be used uninitialized" warning.

commit   : ec86152e02090d086caf170c77b3f559ce27e830    
  
author   : Noah Misch <noah@leadboat.com>    
date     : Mon, 16 Feb 2026 18:04:58 -0800    
  
committer: Noah Misch <noah@leadboat.com>    
date     : Mon, 16 Feb 2026 18:04:58 -0800    

Click here for diff

Various buildfarm members, having compilers like gcc 8.5 and 6.3, fail  
to deduce that text_substring() variable "E" is initialized if  
slice_size!=-1.  This suppression approach quiets gcc 8.5; I did not  
reproduce the warning elsewhere.  Back-patch to v14, like commit  
9f4fd119b2cbb9a41ec0c19a8d6ec9b59b92c125.  
  
Reported-by: Tom Lane <tgl@sss.pgh.pa.us>  
Discussion: https://postgr.es/m/1157953.1771266105@sss.pgh.pa.us  
Backpatch-through: 14  

M src/backend/utils/adt/varlena.c

hstore: Fix NULL pointer dereference with receive function

commit   : 63c05e03bcc5e927a3f3f2b283af6f38b9eeb0aa    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Tue, 17 Feb 2026 08:41:35 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Tue, 17 Feb 2026 08:41:35 +0900    

Click here for diff

The receive function of hstore was not able to handle correctly  
duplicate key values when a new duplicate links to a NULL value, where a  
pfree() could be attempted on a NULL pointer, crashing due to a pointer  
dereference.  
  
This problem would happen for a COPY BINARY, when stacking values like  
that:  
aa => 5  
aa => null  
  
The second key/value pair is discarded and pfree() calls are attempted  
on its key and its value, leading to a pointer dereference for the value  
part as the value is NULL.  The first key/value pair takes priority when  
a duplicate is found.  
  
Per offline report.  
  
Reported-by: "Anemone" <vergissmeinnichtzh@gmail.com>  
Reported-by: "A1ex" <alex000young@gmail.com>  
Backpatch-through: 14  

M contrib/hstore/hstore_io.c

Don't reset 'latest_page_number' when replaying multixid truncation

commit   : 899de38d8f3b519e7fd5b2acf580d1c9282ee6f1    
  
author   : Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Mon, 16 Feb 2026 17:16:59 +0200    
  
committer: Heikki Linnakangas <heikki.linnakangas@iki.fi>    
date     : Mon, 16 Feb 2026 17:16:59 +0200    

Click here for diff

'latest_page_number' is set to the correct value, according to  
nextOffset, early at system startup. Contrary to the comment, it hence  
should be set up correctly by the time we get to WAL replay.  
  
This fixes a failure to replay WAL generated on older minor versions,  
before commit 789d65364c (18.2, 17.8, 16.12, 15.16, 14.21). The  
failure occurs after a truncation record has been replayed and looks  
like this:  
  
    FATAL:  could not access status of transaction 858112  
    DETAIL:  Could not read from file "pg_multixact/offsets/000D" at offset 24576: read too few bytes.  
    CONTEXT:  WAL redo at 3/2A3AB408 for MultiXact/CREATE_ID: 858111 offset 6695072 nmembers 5: 1048228 (sh) 1048271 (keysh) 1048316 (sh) 1048344 (keysh) 1048370 (sh)  
  
Reported-by: Sebastian Webber <sebastian@swebber.me>  
Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>  
Reviewed-by: Kirill Reshke <reshkekirill@gmail.com>  
Discussion: https://www.postgresql.org/message-id/20260214090150.GC2297@p46.dedyn.io;lightning.p46.dedyn.io  
Backpatch-through: 14-18  

M src/backend/access/transam/multixact.c
M src/include/access/slru.h

pgcrypto: Tweak error message for incorrect session key length

commit   : 0bc0fc789dcf3f60e571f9ce749c1168134de70d    
  
author   : Michael Paquier <michael@paquier.xyz>    
date     : Mon, 16 Feb 2026 12:18:33 +0900    
  
committer: Michael Paquier <michael@paquier.xyz>    
date     : Mon, 16 Feb 2026 12:18:33 +0900    

Click here for diff

The error message added in 379695d3cc70 referred to the public key being  
too long.  This is confusing as it is in fact the session key included  
in a PGP message which is too long.  This is harmless, but let's be  
precise about what is wrong.  
  
Per offline report.  
  
Reported-by: Zsolt Parragi <zsolt.parragi@percona.com>  
Backpatch-through: 14  

M contrib/pgcrypto/expected/pgp-pubkey-session.out
M contrib/pgcrypto/px.c

Fix SUBSTRING() for toasted multibyte characters.

commit   : a20eb248c51ad6741bbbb3b3bac103d5788bd4f5    
  
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    

Click here for diff

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   : 5b305ebcc9b56b053415997625c6425aa7b878b2    
  
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    

Click here for diff

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

Fix plpgsql's handling of "return simple_record_variable".

commit   : 254b15cbf1e91ca33620027ca016e67668a321c1    
  
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    

Click here for diff

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   : ebc53ca7b2ff339a9455ccdc368d39ebb39a0762    
  
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    

Click here for diff

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

Further stabilize a postgres_fdw test case.

commit   : c10535fbea022113e470726b929e47833bcb1626    
  
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    

Click here for diff

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

doc: Mention all SELECT privileges required by INSERT ... ON CONFLICT.

commit   : cfd790159d5e2301b3534c8d63d75e904d050f6b    
  
author   : Dean Rasheed <dean.a.rasheed@gmail.com>    
date     : Wed, 11 Feb 2026 10:53:01 +0000    
  
committer: Dean Rasheed <dean.a.rasheed@gmail.com>    
date     : Wed, 11 Feb 2026 10:53:01 +0000    

Click here for diff

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   : 24dc2f3cd90b3f028fe6db2ba16c2d59e1dfbda6    
  
author   : Dean Rasheed <dean.a.rasheed@gmail.com>    
date     : Wed, 11 Feb 2026 10:25:08 +0000    
  
committer: Dean Rasheed <dean.a.rasheed@gmail.com>    
date     : Wed, 11 Feb 2026 10:25:08 +0000    

Click here for diff

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