VersionDrift
Product

PostgreSQL 16.2 → 16.9

7 releases · 5 breaking changes · 16 security fixes · 6 advisories fixed

16security5breaking1deprecated29feature119fix

Vulnerabilities fixed by this upgrade

  • 3.1 CVE-2024-10977 Client use of server error message in PostgreSQL allows a server not trusted under current SSL or GSS settings to furnish arbitrary non-NUL bytes to the libpq application. For example, a man-in-th…
  • 4.2 CVE-2024-10978 Incorrect privilege assignment in PostgreSQL allows a less-privileged application user to view or change different rows from those intended. An attack requires the application to use SET ROLE, SET…
  • 8.8 CVE-2024-10979 Incorrect control of environment variables in PostgreSQL PL/Perl allows an unprivileged database user to change sensitive process environment variables (e.g. PATH). That often suffices to enable a…
  • 4.2 CVE-2024-10976 Incomplete tracking in PostgreSQL of tables with row security allows a reused query to view or change different rows from those intended. CVE-2023-2455 and CVE-2016-2193 fixed most interaction bet…
  • 8.8 CVE-2024-7348 Time-of-check Time-of-use (TOCTOU) race condition in pg_dump in PostgreSQL allows an object creator to execute arbitrary SQL functions as the user running pg_dump, which is often a superuser. The a…
  • 3.1 CVE-2024-4317 Missing authorization in PostgreSQL built-in views pg_stats_ext and pg_stats_ext_exprs allows an unprivileged database user to read most common values and other statistics from CREATE STATISTICS co…

Breaking changes

  • breaking Remove incorrect assertion in pgstat_report_stat() (Michael Paquier) in 16.9
  • breaking Fix cases where a logical replication slot's restart_lsn could go backwards (Masahiko Sawada) Previously, restarting logical replication could sometimes cause the slot's restart point to be recomputed as an older value than had previously been advertised in pg_replication_slots. This is bad, since… in 16.6
  • breaking Fix race condition in COMMIT PREPARED that resulted in orphaned 2PC files (wuchengwen) A concurrent PREPARE TRANSACTION could cause COMMIT PREPARED to not remove the on-disk two-phase state file for the completed transaction. There was no immediate ill effect, but a subsequent crash-and-recovery… in 16.5
  • breaking Avoid deadlock during removal of orphaned temporary tables (Mikhail Zhilin) If the session that creates a temporary table crashes without removing the table, autovacuum will eventually try to remove the orphaned table. However, an incoming session that's been assigned the same temporary namespace… in 16.3
  • breaking Fix incompatibility with LLVM 18 (Thomas Munro, Dmitry Dolgov) in 16.3

Security changes

  • security Avoid one-byte buffer overread when examining invalidly-encoded strings that are claimed to be in GB18030 encoding (Noah Misch, Andres Freund) While unlikely, a SIGSEGV crash could occur if an incomplete multibyte character appeared at the end of memory. This was possible both in the server and in… in 16.9
  • security Improve behavior of libpq's quoting functions (Andres Freund, Tom Lane) The changes made for CVE-2025-1094 had one serious oversight: PQescapeLiteral() and PQescapeIdentifier() failed to honor their string length parameter, instead always reading to the input string's trailing null. This resulted… in 16.8
  • security Harden PQescapeString and allied functions against invalidly-encoded input strings (Andres Freund, Noah Misch) Data-quoting functions supplied by libpq now fully check the encoding validity of their input. If invalid characters are detected, they report an error if possible. For the ones that lack… in 16.7
  • security Fix cases where an operator family member operator or support procedure could become a dangling reference (Tom Lane) In some cases a data type could be dropped while references to its OID still remain in pg_amop or pg_amproc. While that caused no immediate issues, an attempt to drop the owning… in 16.7
  • security Use SQL-standard function bodies in the declarations of contrib/earthdistance's SQL-language functions (Tom Lane, Ronan Dunklau) This change allows their references to contrib/cube to be resolved during extension creation, reducing the risk of search-path-based failures and possible attacks. In… in 16.7
  • security Restore functionality of ALTER {ROLE|DATABASE} SET role (Tom Lane, Noah Misch) The fix for CVE-2024-10978 accidentally caused settings for role to not be applied if they come from non-interactive sources, including previous ALTER {ROLE|DATABASE} commands and the PGOPTIONS environment variable. in 16.6
  • security Ensure cached plans are marked as dependent on the calling role when RLS applies to a non-top-level table reference (Nathan Bossart) If a CTE, subquery, sublink, security invoker view, or coercion projection in a query references a table with row-level security policies, we neglected to mark the… in 16.5
  • security Make libpq discard error messages received during SSL or GSS protocol negotiation (Jacob Champion) An error message received before encryption negotiation is completed might have been injected by a man-in-the-middle, rather than being real server output. Reporting it opens the door to various… in 16.5
  • security Fix unintended interactions between SET SESSION AUTHORIZATION and SET ROLE (Tom Lane) The SQL standard mandates that SET SESSION AUTHORIZATION have a side-effect of doing SET ROLE NONE. Our implementation of that was flawed, creating more interaction between the two settings than intended.… in 16.5
  • security Prevent trusted PL/Perl code from changing environment variables (Andrew Dunstan, Noah Misch) The ability to manipulate process environment variables such as PATH gives an attacker opportunities to execute arbitrary code. Therefore, “trusted” PLs must not offer the ability to do that. To fix… in 16.5
  • security Prevent unauthorized code execution during pg_dump (Masahiko Sawada) An attacker able to create and drop non-temporary objects could inject SQL code that would be executed by a concurrent pg_dump session with the privileges of the role running pg_dump (which is often a superuser). The attack… in 16.4
  • security Detect another integer overflow case while computing new array dimensions (Joseph Koshakow) Reject applying array dimensions [-2147483648:2147483647] to an empty array. This is closely related to CVE-2023-5869, but appears harmless since the array still ends up empty. in 16.4
  • security Restrict visibility of pg_stats_ext and pg_stats_ext_exprs entries to the table owner (Nathan Bossart) These views failed to hide statistics for expressions that involve columns the accessing user does not have permission to read. View columns such as most_common_vals might expose… in 16.3
  • security Find the SQL script fix-CVE-2024-4317.sql in the share directory of the PostgreSQL installation (typically located someplace like /usr/share/postgresql/). Be sure to use the script appropriate to your PostgreSQL major version. If you do not see this file, either your version is not vulnerable… in 16.3
  • security In each database of the cluster, run the fix-CVE-2024-4317.sql script as superuser. In psql this would look like \i /usr/share/postgresql/fix-CVE-2024-4317.sql (adjust the file path as appropriate). Any error probably indicates that you've used the wrong script version. It will not hurt to run the… in 16.3
  • security Do not forget to include the template0 and template1 databases, or the vulnerability will still exist in databases you create later. To fix template0, you'll need to temporarily make it accept connections. Do that with ALTER DATABASE template0 WITH ALLOW_CONNECTIONS true; and then after fixing… in 16.3

Deprecations

  • deprecated In contrib/xml2, avoid use of library functions that have been deprecated in recent versions of libxml2 (Dmitry Koval) in 16.3

Every release in between

securityAvoid one-byte buffer overread when examining invalidly-encoded strings that are claimed to be in GB18030 encoding (Noah Misch, Andres Freund) While unlikely, a SIGSEGV crash could occur if an incomplete multibyte character appeared at the end of memory. This was possible both in the server and in…
otherHandle self-referential foreign keys on partitioned tables correctly (Álvaro Herrera) Creating or attaching partitions failed to make the required catalog entries for a foreign-key constraint, if the table referenced by the constraint was the same partitioned table. This resulted in failure to…
featureAvoid data loss when merging compressed BRIN summaries in brin_bloom_union() (Tomas Vondra) The code failed to account for decompression results not being identical to the input objects, which would result in failure to add some of the data to the merged summary, leading to missed rows in index…
fixFix unexpected “attribute has wrong type” errors in UPDATE, DELETE, and MERGE queries that use whole-row table references to views or functions in FROM (Tom Lane)
fixFix MERGE into a partitioned table with DO NOTHING actions (Tender Wang) Some cases failed with “unknown action in MERGE WHEN clause” errors.
otherPrevent failure in INSERT commands when the table has a GENERATED column of a domain data type and the domain's constraints disallow null values (Jian He) Constraint failure was reported even if the generation expression produced a perfectly okay result.
otherCorrectly process references to outer CTE names that appear within a WITH clause attached to an INSERT/UPDATE/DELETE/MERGE command that's inside WITH (Tom Lane) The parser failed to detect disallowed recursion cases, nor did it account for such references when sorting CTEs into a usable order.
otherDon't try to parallelize array_agg() when the argument is of an anonymous record type (Richard Guo, Tom Lane) The protocol for communicating with parallel workers doesn't support identifying the concrete record type that a worker is returning.
fixFix ARRAY(subquery) and ARRAY[expression, ...] constructs to produce sane results when the input is of type int2vector or oidvector (Tom Lane) This patch restores the behavior that existed before PostgreSQL 9.5: the result is of type int2vector[] or oidvector[].
fixFix possible erroneous reports of invalid affixes while parsing Ispell dictionaries (Jacob Brazeal)
fixFix ALTER TABLE ADD COLUMN to correctly handle the case of a domain type that has a default (Jian He, Tom Lane, Tender Wang) If a domain type has a default, adding a column of that type (without any explicit DEFAULT clause) failed to install the domain's default value in existing rows, instead…
otherRepair misbehavior when there are duplicate column names in a foreign key constraint's ON DELETE SET DEFAULT or SET NULL action (Tom Lane)
otherImprove the error message for disallowed attempts to alter the properties of a foreign key constraint (Álvaro Herrera)
otherAvoid error when resetting the relhassubclass flag of a temporary table that's marked ON COMMIT DELETE ROWS (Noah Misch)
featureAdd missing deparsing of the INDENT option of XMLSERIALIZE() (Jim Jones) Previously, views or rules using XMLSERIALIZE(... INDENT) were dumped without the INDENT clause, causing incorrect results after restore.
otherAvoid premature evaluation of the arguments of an aggregate function that has both FILTER and ORDER BY (or DISTINCT) options (David Rowley) If there is ORDER BY or DISTINCT, we consider pre-sorting the aggregate input values rather than doing the sort within the Agg plan node. But this is…
fixFix planner's failure to identify more than one hashable ScalarArrayOpExpr subexpression within a top-level expression (David Geier) This resulted in unnecessarily-inefficient execution of any additional subexpressions that could have been processed with a hash table (that is, IN, NOT IN, or = ANY…
otherDisable “skip fetch” optimization in bitmap heap scan (Matthias van de Meent) It turns out that this optimization can result in returning dead tuples when a concurrent vacuum marks a page all-visible.
fixFix performance issues in GIN index search startup when there are many search keys (Tom Lane, Vinod Sridharan) An indexable clause with many keys (for example, jsonbcol ?| array[...] with tens of thousands of array elements) took O(N2) time to start up, and was uncancelable for that interval too.
fixDetect missing support procedures in a BRIN index operator class, and report an error instead of crashing (Álvaro Herrera)
otherRespond to interrupts (such as query cancel) while waiting for asynchronous subplans of an Append plan node (Heikki Linnakangas) Previously, nothing would happen until one of the subplans becomes ready.
otherReport the I/O statistics of active WAL senders more frequently (Bertrand Drouvot) Previously, the pg_stat_io view failed to accumulate I/O performed by a WAL sender until that process exited. Now such I/O will be reported after at most one second's delay.
fixFix race condition in handling of synchronous_standby_names immediately after startup (Melnikov Maksim, Michael Paquier) For a short period after system startup, backends might fail to wait for synchronous commit even though synchronous_standby_names is enabled.
otherAvoid infinite loop if scram_iterations is set to INT_MAX (Kevin K Biju)
fixAvoid possible crashes due to double transformation of json_array()'s subquery (Tom Lane)
fixFix pg_strtof() to not crash with null endptr (Alexander Lakhin, Tom Lane)
fixFix crash after out-of-memory in certain GUC assignments (Daniel Gustafsson)
fixAvoid crash when a Snowball stemmer encounters an out-of-memory condition (Maksim Korotkov)
featurePrevent over-advancement of catalog xmin in “fast forward” mode of logical decoding (Zhijie Hou) This mistake could allow deleted catalog entries to be vacuumed away even though they were still potentially needed by the WAL-reading process.
featurePrevent incorrect reset of replication origin when an apply worker encounters an error but the error is caught and does not result in worker exit (Hayato Kuroda) This mistake could allow duplicate data to be applied.
fixFix wrong checkpoint details in error message about incorrect recovery timeline choice (David Steele) If the requested recovery timeline is not reachable, the reported checkpoint and timeline should be the values read from the backup_label, if there is one. This message previously reported values…
breakingRemove incorrect assertion in pgstat_report_stat() (Michael Paquier)
fixFix overly-strict assertion in gistFindCorrectParent() (Heikki Linnakangas)
fixFix rare assertion failure in standby servers when the primary is restarted (Heikki Linnakangas)
fixIn pg_amcheck and pg_upgrade, use the correct function to free allocations made by libpq (Michael Paquier, Ranier Vilela) These oversights could result in crashes in certain Windows build configurations, such as a debug build of libpq used by a non-debug build of the calling application.
featureAllow contrib/dblink queries to be interrupted by query cancel (Noah Misch) This change back-patches a v17-era fix. It prevents possible hangs in CREATE DATABASE and DROP DATABASE due to failure to detect deadlocks.
fixAvoid crashing with corrupt input data in contrib/pageinspect's heap_page_items() (Dmitry Kovalenko)
featurePrevent assertion failure in contrib/pg_freespacemap's pg_freespacemap() (Tender Wang) Applying pg_freespacemap() to a relation lacking storage (such as a view) caused an assertion failure, although there was no ill effect in non-assert builds. Add an error check to reject that case.
fixFix build failure on macOS 15.4 (Tom Lane, Peter Eisentraut) This macOS update broke our configuration probe for strchrnul().
featureUpdate time zone data files to tzdata release 2025b for DST law changes in Chile, plus historical corrections for Iran (Tom Lane) There is a new time zone America/Coyhaique for Chile's Aysén Region, to account for it changing to UTC-03 year-round and thus diverging from America/Santiago.
+8 more items in the release notes
16.8 Feb 20, 2025 Release notes ↗
securityImprove behavior of libpq's quoting functions (Andres Freund, Tom Lane) The changes made for CVE-2025-1094 had one serious oversight: PQescapeLiteral() and PQescapeIdentifier() failed to honor their string length parameter, instead always reading to the input string's trailing null. This resulted…
fixFix meson build system to correctly detect availability of the bsd_auth.h system header (Nazir Bilal Yavuz)
16.7 Feb 13, 2025 Release notes ↗
securityHarden PQescapeString and allied functions against invalidly-encoded input strings (Andres Freund, Noah Misch) Data-quoting functions supplied by libpq now fully check the encoding validity of their input. If invalid characters are detected, they report an error if possible. For the ones that lack…
otherExclude parallel workers from connection privilege checks and limits (Tom Lane) Do not check datallowconn, rolcanlogin, and ACL_CONNECT privileges when starting a parallel worker, instead assuming that it's enough for the leader process to have passed similar checks originally. This avoids, for…
fixFix possible re-use of stale results in window aggregates (David Rowley) A window aggregate with a “run condition” optimization and a pass-by-reference result type might incorrectly return the result from the previous partition instead of performing a fresh calculation.
otherKeep TransactionXmin in sync with MyProc->xmin (Heikki Linnakangas) This oversight could permit a process to try to access data that had already been vacuumed away. One known consequence is transient “could not access status of transaction” errors.
fixFix race condition that could cause failure to add a newly-inserted catalog entry to a catalog cache list (Heikki Linnakangas) This could result, for example, in failure to use a newly-created function within an existing session.
otherPrevent possible catalog corruption when a system catalog is vacuumed concurrently with an update (Noah Misch)
fixFix data corruption when relation truncation fails (Thomas Munro) The filesystem calls needed to perform relation truncation could fail, leaving inconsistent state on disk (for example, effectively reviving deleted data). We can't really prevent that, but we can recover by dint of making such…
fixPrevent checkpoints from starting during relation truncation (Robert Haas) This avoids a race condition wherein the modified file might not get fsync'd before completing the checkpoint, creating a risk of data corruption if the operating system crashes soon after.
otherAvoid possibly losing an update of pg_database.datfrozenxid when VACUUM runs concurrently with a REASSIGN OWNED that changes that database's owner (Kirill Reshke)
fixFix incorrect tg_updatedcols values passed to AFTER UPDATE triggers (Tom Lane) In some cases the tg_updatedcols bitmap could describe the set of columns updated by an earlier command in the same transaction, fooling the trigger into doing the wrong thing. Also, prevent memory bloat caused by…
fixFix detach of a partition that has its own foreign-key constraint referencing a partitioned table (Amul Sul) In common cases, foreign keys are defined on a partitioned table's top level; but if instead one is defined on a partition and references a partitioned table, and the referencing partition…
fixFix mis-processing of to_timestamp's FFn format codes (Tom Lane) An integer format code immediately preceding FFn would consume all available digits, leaving none for FFn.
otherWhen deparsing an XMLTABLE() expression, ensure that XML namespace names are double-quoted when necessary (Dean Rasheed)
otherInclude the ldapscheme option in pg_hba_file_rules() output (Laurenz Albe)
featureDon't merge UNION operations if their column collations aren't consistent (Tom Lane) Previously we ignored collations when deciding if it's safe to merge UNION steps into a single N-way UNION operation. This was arguably valid before the introduction of nondeterministic collations, but it's not…
otherPrevent “wrong varnullingrels” planner errors after pulling up a subquery that's underneath an outer join (Tom Lane)
otherIgnore nulling-relation marker bits when looking up statistics (Richard Guo) This oversight could lead to failure to use relevant statistics about expressions, or to “corrupt MVNDistinct entry” errors.
fixFix missed expression processing for partition pruning steps (Tom Lane) This oversight could lead to “unrecognized node type” errors, and perhaps other problems, in queries accessing partitioned tables.
featureAllow dshash tables to grow past 1GB (Matthias van de Meent) This avoids errors like “invalid DSA memory alloc request size”. The case can occur for example in transactions that process several million tables.
otherAvoid possible integer overflow in bringetbitmap() (James Hunter, Evgeniy Gorbanyov) Since the result is only used for statistical purposes, the effects of this error were mostly cosmetic.
otherEnsure that an already-set process latch doesn't prevent the postmaster from noticing socket events (Thomas Munro) An extremely heavy workload of backends launching workers and workers exiting could prevent the postmaster from responding to incoming client connections in a timely fashion.
otherPrevent streaming standby servers from looping infinitely when reading a WAL record that crosses pages (Kyotaro Horiguchi, Alexander Kukushkin) This would happen when the record's continuation is on a page that needs to be read from a different WAL source.
fixFix unintended promotion of FATAL errors to PANIC during early process startup (Noah Misch) This fixes some unlikely cases that would result in “PANIC: proc_exit() called in child process”.
securityFix cases where an operator family member operator or support procedure could become a dangling reference (Tom Lane) In some cases a data type could be dropped while references to its OID still remain in pg_amop or pg_amproc. While that caused no immediate issues, an attempt to drop the owning…
fixFix multiple memory leaks in logical decoding output (Vignesh C, Masahiko Sawada, Boyu Yang)
fixFix small memory leak when updating the application_name or cluster_name settings (Tofig Aliev)
fixFix unsafe order of operations during cache lookups (Noah Misch) The only known consequence was a usually-harmless “you don't own a lock of type ExclusiveLock” warning during GRANT TABLESPACE.
fixFix possible “failed to resolve name” failures when using JIT on older ARM platforms (Thomas Munro) This could occur as a consequence of inconsistency about the default setting of -moutline-atomics between gcc and clang. At least Debian and Ubuntu are known to ship gcc and clang compilers that…
fixFix assertion failure in WITH RECURSIVE ... UNION queries (David Rowley)
fixFix assertion failure at shutdown when writing out the statistics file (Michael Paquier)
fixFix PL/Tcl to compile with Tcl 9 (Peter Eisentraut)
fixFix psql to safely handle file path names that are encoded in SJIS (Tom Lane) Some two-byte characters in SJIS have a second byte that is equal to ASCII backslash (\). These characters were corrupted by path name normalization, preventing access to files whose names include such characters.
fixFix use of wrong version of pqsignal() in pgbench and psql (Fujii Masao, Tom Lane) This error could lead to misbehavior when using the -T option in pgbench or the \watch command in psql, due to interrupted system calls not being resumed as expected.
fixFix misexecution of some nested \if constructs in pgbench (Michail Nikolaev) An \if command appearing within a false (not-being-executed) \if branch was incorrectly treated the same as \elif.
fixFix possible crash in pg_dump with identity sequences attached to tables that are extension members (Tom Lane)
fixFix memory leak in pg_restore with zstd-compressed data (Tom Lane) The leak was per-decompression-operation, so would be most noticeable with a dump containing many tables or large objects.
fixFix pg_basebackup to correctly handle pg_wal.tar files exceeding 2GB on Windows (Davinder Singh, Thomas Munro)
securityUse SQL-standard function bodies in the declarations of contrib/earthdistance's SQL-language functions (Tom Lane, Ronan Dunklau) This change allows their references to contrib/cube to be resolved during extension creation, reducing the risk of search-path-based failures and possible attacks. In…
fixFix meson build system to support old OpenSSL libraries on Windows (Darek Slusarczyk) Add support for the legacy library names ssleay32 and libeay32.
fixFix meson configuration process to correctly detect OSSP's uuid.h header file under MSVC (Andrew Dunstan)
+15 more items in the release notes
16.6 Nov 21, 2024 Release notes ↗
otherRepair ABI break for extensions that work with struct ResultRelInfo (Tom Lane) Last week's minor releases unintentionally broke binary compatibility with timescaledb and several other extensions. Restore the affected structure to its previous size, so that such extensions need not be rebuilt.
securityRestore functionality of ALTER {ROLE|DATABASE} SET role (Tom Lane, Noah Misch) The fix for CVE-2024-10978 accidentally caused settings for role to not be applied if they come from non-interactive sources, including previous ALTER {ROLE|DATABASE} commands and the PGOPTIONS environment variable.
breakingFix cases where a logical replication slot's restart_lsn could go backwards (Masahiko Sawada) Previously, restarting logical replication could sometimes cause the slot's restart point to be recomputed as an older value than had previously been advertised in pg_replication_slots. This is bad, since…
otherAvoid deleting still-needed WAL files during pg_rewind (Polina Bungina, Alexander Kukushkin) Previously, in unlucky cases, it was possible for pg_rewind to remove important WAL files from the rewound demoted primary. In particular this happens if those files have been marked for archival (i.e.,…
fixFix race conditions associated with dropping shared statistics entries (Kyotaro Horiguchi, Michael Paquier) These bugs could lead to loss of statistics data, assertion failures, or “can only drop stats once” errors.
otherCount index scans in contrib/bloom indexes in the statistics views, such as the pg_stat_user_indexes.idx_scan counter (Masahiro Ikeda)
fixFix crash when checking to see if an index's opclass options have changed (Alexander Korotkov) Some forms of ALTER TABLE would fail if the table has an index with non-default operator class options.
fixAvoid assertion failure caused by disconnected NFA sub-graphs in regular expression parsing (Tom Lane) This bug does not appear to have any visible consequences in non-assert builds.
16.5 Nov 14, 2024 Release notes ↗
securityEnsure cached plans are marked as dependent on the calling role when RLS applies to a non-top-level table reference (Nathan Bossart) If a CTE, subquery, sublink, security invoker view, or coercion projection in a query references a table with row-level security policies, we neglected to mark the…
securityMake libpq discard error messages received during SSL or GSS protocol negotiation (Jacob Champion) An error message received before encryption negotiation is completed might have been injected by a man-in-the-middle, rather than being real server output. Reporting it opens the door to various…
securityFix unintended interactions between SET SESSION AUTHORIZATION and SET ROLE (Tom Lane) The SQL standard mandates that SET SESSION AUTHORIZATION have a side-effect of doing SET ROLE NONE. Our implementation of that was flawed, creating more interaction between the two settings than intended.…
securityPrevent trusted PL/Perl code from changing environment variables (Andrew Dunstan, Noah Misch) The ability to manipulate process environment variables such as PATH gives an attacker opportunities to execute arbitrary code. Therefore, “trusted” PLs must not offer the ability to do that. To fix…
fixFix updates of catalog state for foreign-key constraints when attaching or detaching table partitions (Jehan-Guillaume de Rorthais, Tender Wang, Álvaro Herrera) If the referenced table is partitioned, then different catalog entries are needed for a referencing table that is stand-alone versus one…
fixAvoid possible crashes and “could not open relation” errors in queries on a partitioned table occurring concurrently with a DETACH CONCURRENTLY and immediate drop of a partition (Álvaro Herrera, Kuntal Gosh)
otherDisallow ALTER TABLE ATTACH PARTITION if the table to be attached has a foreign key referencing the partitioned table (Álvaro Herrera) This arrangement is not supported, and other ways of creating it already fail.
otherDon't use partitionwise joins or grouping if the query's collation for the key column doesn't match the partition key's collation (Jian He, Webbo Han) Such plans could produce incorrect results.
fixFix possible “could not find pathkey item to sort” error when the output of a UNION ALL member query needs to be sorted, and the sort column is an expression (Andrei Lepikhov, Tom Lane)
fixFix performance regressions involving flattening of subqueries underneath outer joins that are later reduced to plain joins (Tom Lane) v16 failed to optimize some queries as well as prior versions had, because of overoptimistic simplification of query-pullup logic.
featureAllow cancellation of the second stage of index build for large hash indexes (Pavel Borisov)
fixFix assertion failure or confusing error message for COPY (query) TO ..., when the query is rewritten by a DO INSTEAD NOTIFY rule (Tender Wang, Tom Lane)
fixFix server crash when a json_objectagg() call contains a volatile function (Amit Langote)
fixFix checking of key uniqueness in JSON object constructors (Junwang Zhao, Tomas Vondra) When building an object larger than a kilobyte, it was possible to accept invalid input that includes duplicate object keys, or to falsely report that duplicate keys are present.
fixFix detection of skewed data during parallel hash join (Thomas Munro) After repartitioning the inner side of a hash join because one partition has accumulated too many tuples, we check to see if all the partition's tuples went into the same child partition, which suggests that they all have the…
featureDisallow locale names containing non-ASCII characters (Thomas Munro) This is only an issue on Windows, as such locale names are not used elsewhere. They are problematic because it's quite unclear what encoding such names are represented in (since the locale itself defines the encoding to use). In…
fixFix race condition in committing a serializable transaction (Heikki Linnakangas) Mis-processing of a recently committed transaction could lead to an assertion failure or a “could not access status of transaction” error.
breakingFix race condition in COMMIT PREPARED that resulted in orphaned 2PC files (wuchengwen) A concurrent PREPARE TRANSACTION could cause COMMIT PREPARED to not remove the on-disk two-phase state file for the completed transaction. There was no immediate ill effect, but a subsequent crash-and-recovery…
fixAvoid invalid memory accesses after skipping an invalid toast index during VACUUM FULL (Tender Wang) A list tracking yet-to-be-rebuilt indexes was not properly updated in this code path, risking assertion failures or crashes later on.
fixFix ways in which an “in place” catalog update could be lost (Noah Misch) Normal row updates write a new version of the row to preserve rollback-ability of the transaction. However, certain system catalog updates are intentionally non-transactional and are done with an in-place update of the row.…
otherReset catalog caches at end of recovery (Noah Misch) This prevents scenarios wherein an in-place catalog update could be lost due to using stale data from a catalog cache.
otherAvoid using parallel query while holding off interrupts (Francesco Degrassi, Noah Misch, Tom Lane) This situation cannot arise normally, but it can be reached with test scenarios such as using a SQL-language function as B-tree support (which would be far too slow for production usage). If it did…
featureReport the active query ID for statistics purposes at the start of processing of Bind and Execute protocol messages (Sami Imseih) This allows more of the work done in extended query protocol to be attributed to the correct query.
fixFix some whitespace issues in the result of XMLSERIALIZE(... INDENT) (Jim Jones) Fix failure to indent nodes separated by whitespace, and ensure that a trailing newline is not added.
fixFix mis-deparsing of ORDER BY lists when there is a name conflict (Tom Lane) If an ORDER BY item in SELECT is a bare identifier, the parser first seeks it as an output column name of the SELECT, for SQL92 compatibility. However, ruleutils.c expects the SQL99 interpretation where such a name is an…
fixFix “failed to find plan for subquery/CTE” errors in EXPLAIN (Richard Guo, Tom Lane) This case arose while trying to print references to fields of a RECORD-type output of a subquery when the subquery has been optimized out of the plan altogether (which is possible at least in the case that it has…
featureIgnore not-yet-defined Portals in the pg_cursors view (Tom Lane) It is possible for user-defined code that inspects this view to be called while a new cursor is being set up, and if that happens a null pointer dereference would ensue. Avoid the problem by defining the view to exclude…
fixFix incorrect output of the pg_stat_io view on 32-bit machines (Bertrand Drouvot) The stats_reset timestamp column contained garbage on such hardware.
featurePrevent mis-encoding of “trailing junk after numeric literal” error messages (Karina Litskevich) We do not allow identifiers to appear immediately following numeric literals (there must be some whitespace between). If a multibyte character immediately followed a numeric literal, the syntax error…
featureAllow adjusting the session_authorization and role settings in parallel workers (Tom Lane) Our code intends to allow modifiable server settings to be set by function SET clauses, but not otherwise within a parallel worker. SET clauses failed for these two settings, though.
fixFix behavior of stable functions called from a CALL statement's argument list, when the CALL is within a PL/pgSQL EXCEPTION block (Tom Lane) As with a similar fix in our previous quarterly releases, this case allowed such functions to be passed the wrong snapshot, causing them to see stale values…
fixFix “cache lookup failed for function” errors in edge cases in PL/pgSQL's CALL (Tom Lane)
fixFix thread safety of our fallback (non-OpenSSL) MD5 implementation on big-endian hardware (Heikki Linnakangas) Thread safety is not currently a concern in the server, but it is for libpq.
fixFix memory leak in psql during repeated use of \bind (Michael Paquier)
fixFix pg_dump's handling of identity sequences that have persistence different from their owning table's persistence (Tom Lane) Since v15, it's been possible to set an identity sequence to be LOGGED when its owning table is UNLOGGED or vice versa. However, pg_dump's method for recreating that…
featureAllow inspection of sequence relations in relevant functions of contrib/pageinspect and contrib/pgstattuple (Nathan Bossart, Ayush Vatsa) This had been allowed in the past, but it got broken during the introduction of non-default access methods for tables.
fixFix incorrect LLVM-generated code on ARM64 platforms (Thomas Munro, Anthonin Bonnefoy) When using JIT compilation on ARM platforms, the generated code could not support relocation distances exceeding 32 bits, allowing unlucky placement of generated code to cause server crashes on large-memory…
fixFix a few places that assumed that process start time (represented as a time_t) will fit into a long value (Max Johnson, Nathan Bossart) On platforms where long is 32 bits (notably Windows), this coding would fail after Y2038. Most of the failures appear only cosmetic, but notably pg_ctl start…
fixFix building with Strawberry Perl on Windows (Andrew Dunstan)
featureUpdate time zone data files to tzdata release 2024b (Tom Lane) This tzdata release changes the old System-V-compatibility zone names to duplicate the corresponding geographic zones; for example PST8PDT is now an alias for America/Los_Angeles. The main visible consequence is that for timestamps…
+14 more items in the release notes
securityPrevent unauthorized code execution during pg_dump (Masahiko Sawada) An attacker able to create and drop non-temporary objects could inject SQL code that would be executed by a concurrent pg_dump session with the privileges of the role running pg_dump (which is often a superuser). The attack…
otherAvoid incorrect results from Merge Right Anti Join plans (Richard Guo) If the inner relation is known to have unique join keys, the merge could misbehave when there are duplicated join keys in the outer relation.
otherPrevent infinite loop in VACUUM (Melanie Plageman) After a disconnected standby server with an old running transaction reconnected to the primary, it was possible for VACUUM on the primary to get confused about which tuples are removable, resulting in an infinite loop.
fixFix failure after attaching a table as a partition, if the table had previously had inheritance children (Álvaro Herrera)
fixFix ALTER TABLE DETACH PARTITION for cases involving inconsistent index-based constraints (Álvaro Herrera, Tender Wang) When a partitioned table has an index that is not associated with a constraint, but a partition has an equivalent index that is, then detaching the partition would misbehave,…
fixFix partition pruning setup during ALTER TABLE DETACH PARTITION CONCURRENTLY (Álvaro Herrera) The executor assumed that no partition could be detached between planning and execution of a query on a partitioned table. This is no longer true since the introduction of DETACH PARTITION's CONCURRENTLY…
otherCorrectly update a partitioned table's pg_class.reltuples field to zero after its last child partition is dropped (Noah Misch) The first ANALYZE on such a partitioned table must update relhassubclass as well, and that caused the reltuples update to be lost.
fixFix handling of polymorphic output arguments for procedures (Tom Lane) The SQL CALL statement did not resolve the correct data types for such arguments, leading to errors such as “cannot display a value of type anyelement”, or even outright crashes. (But CALL in PL/pgSQL worked correctly.)
fixFix behavior of stable functions called from a CALL statement's argument list (Tom Lane) If the CALL is within an atomic context (e.g. there's an outer transaction block), such functions were passed the wrong snapshot, causing them to see stale values of rows modified since the start of the outer…
fixFix input of ISO-8601 “extended” time format for types time and timetz (Tom Lane) Re-allow cases such as T12:34:56.
otherDetect integer overflow in money calculations (Joseph Koshakow) None of the arithmetic functions for the money type checked for overflow before, so they would silently give wrong answers for overflowing cases.
fixFix over-aggressive clamping of the scale argument in round(numeric) and trunc(numeric) (Dean Rasheed) These functions clamped their scale argument to +/-2000, but there are valid use-cases for it to be larger; the functions returned incorrect results in such cases. Instead clamp to the actual…
fixFix result for pg_size_pretty() when applied to the smallest possible bigint value (Joseph Koshakow)
otherPrevent pg_sequence_last_value() from failing on unlogged sequences on standby servers and on temporary sequences of other sessions (Nathan Bossart) Make it return NULL in these cases instead of throwing an error.
fixFix parsing of ignored operators in websearch_to_tsquery() (Tom Lane) Per the manual, punctuation in the input of websearch_to_tsquery() is ignored except for the special cases of dashes and quotes. However, parentheses and a few other characters appearing immediately before an or could cause or…
securityDetect another integer overflow case while computing new array dimensions (Joseph Koshakow) Reject applying array dimensions [-2147483648:2147483647] to an empty array. This is closely related to CVE-2023-5869, but appears harmless since the array still ends up empty.
fixFix unportable usage of strnxfrm() (Jeff Davis) Some code paths for non-deterministic collations could fail with errors like “pg_strnxfrm() returned unexpected result”.
featureDetect another case of a new catalog cache entry becoming stale while detoasting its fields (Noah Misch) An in-place update occurring while we expand out-of-line fields in a catalog tuple could be missed, leading to a catalog cache entry that lacks the in-place change but is not known to be stale.…
otherCorrectly check updatability of view columns targeted by INSERT ... DEFAULT (Tom Lane) If such a column is non-updatable, we should give an error reporting that. But the check was missed and then later code would report an unhelpful error such as “attribute number N not found in view targetlist”.
otherAvoid reporting an unhelpful internal error for incorrect recursive queries (Tom Lane) Rearrange the order of error checks so that we throw an on-point error when a WITH RECURSIVE query does not have a self-reference within the second arm of the UNION, but does have one self-reference in some…
otherLock owned sequences during ALTER TABLE SET LOGGED|UNLOGGED (Noah Misch) These commands change the persistence of a table's owned sequences along with the table, but they failed to acquire lock on the sequences while doing so. This could result in losing the effects of concurrent nextval() calls.
otherDon't throw an error if a queued AFTER trigger no longer exists (Tom Lane) It's possible for a transaction to execute an operation that queues a deferred AFTER trigger for later execution, and then to drop the trigger before that happens. Formerly this led to weird errors such as “could not find…
fixFix failure to remove pg_init_privs entries for column-level privileges when their table is dropped (Tom Lane) If an extension grants some column-level privileges on a table it creates, relevant catalog entries would remain behind after the extension is dropped. This was harmless until/unless the…
fixFix selection of an arbiter index for ON CONFLICT when the desired index has expressions or predicates (Tom Lane) If a query using ON CONFLICT accesses the target table through an updatable view, it could fail with “there is no unique or exclusion constraint matching the ON CONFLICT…
fixFix handling of extended statistics on expressions in CREATE TABLE LIKE STATISTICS (Tom Lane) The CREATE command failed to adjust column references in statistics expressions to the possibly-different column numbering of the new table. This resulted in invalid statistics objects that would cause…
fixFix failure to recalculate sub-queries generated from MIN() or MAX() aggregates (Tom Lane) In some cases the aggregate result computed at one row of the outer query could be re-used for later rows when it should not be. This has only been seen to happen when the outer query uses DISTINCT that is…
featureRe-forbid underscore in positional parameters (Erik Wienhold) As of v16 we allow integer literals to contain underscores. This change caused input such as $1_234 to be taken as a single token, but it did not work correctly. It seems better to revert to the original definition in which a parameter…
fixAvoid crashing when a JIT-inlined backend function throws an error (Tom Lane) The error state can include pointers into the dynamically loaded module holding the JIT-compiled code (for error location strings). In some code paths the module could get unloaded before the error report is processed,…
fixFix handling of subtransactions of prepared transactions when starting a hot standby server (Heikki Linnakangas) When starting a standby's replay at a shutdown checkpoint WAL record, transactions that had been prepared but not yet committed on the primary are correctly understood as being still in…
fixFix resource leakage in logical replication WAL sender (Hou Zhijie) The walsender process leaked memory when publishing changes to a partitioned table whose partitions have row types physically different from the partitioned table's.
featurePrevent leakage of reference counts for the shared memory block used for statistics (Anthonin Bonnefoy) A new backend process attaching to the statistics shared memory incremented its reference count, but failed to decrement the count when exiting. After 232 sessions had been created, the…
fixFix buffer overread in JSON parse error reports for incomplete byte sequences (Jacob Champion) It was possible to walk off the end of the input buffer by a few bytes when the last bytes comprise an incomplete multi-byte character. While usually harmless, in principle this could cause a crash.
fixFix PL/pgSQL's handling of integer ranges containing underscores (Erik Wienhold) As of v16 we allow integer literals to contain underscores, but PL/pgSQL failed to handle examples such as FOR i IN 1_001..1_003.
fixFix recursive RECORD-returning PL/Python functions (Tom Lane) If we recurse to a new call of the same function that passes a different column definition list (AS clause), it would fail because the inner call would overwrite the outer call's idea of what rowtype to return.
fixFix PL/Tcl's reporting of invalid list syntax in the result of a function returning tuple (Erik Wienhold, Tom Lane) Such a case could result in a crash, or in emission of misleading context information that actually refers to the previous Tcl error.
featureAllow contrib/pg_stat_statements to distinguish among utility statements appearing within SQL-language functions (Anthonin Bonnefoy) The SQL-language function executor failed to pass along the query ID that is computed for a utility (non SELECT/INSERT/UPDATE/DELETE/MERGE) statement.
featureIn contrib/postgres_fdw, do not send FETCH FIRST WITH TIES clauses to the remote server (Japin Li) The remote server might not implement this clause, or might interpret it differently than we would locally, so don't risk attempting remote execution.
fixAvoid clashing with system-provided <regex.h> headers (Thomas Munro) This fixes a compilation failure on macOS version 15 and up.
fixFix otherwise-harmless assertion failure in Memoize cost estimation (David Rowley)
fixFix otherwise-harmless assertion failures in REINDEX CONCURRENTLY applied to an SP-GiST index (Tom Lane)
+14 more items in the release notes
securityRestrict visibility of pg_stats_ext and pg_stats_ext_exprs entries to the table owner (Nathan Bossart) These views failed to hide statistics for expressions that involve columns the accessing user does not have permission to read. View columns such as most_common_vals might expose…
securityFind the SQL script fix-CVE-2024-4317.sql in the share directory of the PostgreSQL installation (typically located someplace like /usr/share/postgresql/). Be sure to use the script appropriate to your PostgreSQL major version. If you do not see this file, either your version is not vulnerable…
securityIn each database of the cluster, run the fix-CVE-2024-4317.sql script as superuser. In psql this would look like \i /usr/share/postgresql/fix-CVE-2024-4317.sql (adjust the file path as appropriate). Any error probably indicates that you've used the wrong script version. It will not hurt to run the…
securityDo not forget to include the template0 and template1 databases, or the vulnerability will still exist in databases you create later. To fix template0, you'll need to temporarily make it accept connections. Do that with ALTER DATABASE template0 WITH ALLOW_CONNECTIONS true; and then after fixing…
fixFix INSERT from multiple VALUES rows into a target column that is a domain over an array or composite type (Tom Lane) Such cases would either fail with surprising complaints about mismatched datatypes, or insert unexpected coercions that could lead to odd results.
otherRequire SELECT privilege on the target table for MERGE with a DO NOTHING clause (Álvaro Herrera) SELECT privilege would be required in all practical cases anyway, but require it even if the query reads no columns of the target table. This avoids an edge case in which MERGE would require no…
fixFix handling of self-modified tuples in MERGE (Dean Rasheed) Throw an error if a target row joins to more than one source row, as required by the SQL standard. (The previous coding could silently ignore this condition if a concurrent update was involved.) Also, throw a non-misleading error if a…
fixFix incorrect pruning of NULL partition when a table is partitioned on a boolean column and the query has a boolean IS NOT clause (David Rowley) A NULL value satisfies a clause such as boolcol IS NOT FALSE, so pruning away a partition containing NULLs yielded incorrect answers.
featureMake ALTER FOREIGN TABLE SET SCHEMA move any owned sequences into the new schema (Tom Lane) Moving a regular table to a new schema causes any sequences owned by the table to be moved to that schema too (along with indexes and constraints). This was overlooked for foreign tables, however.
featureMake ALTER TABLE ... ADD COLUMN create identity/serial sequences with the same persistence as their owning tables (Peter Eisentraut) CREATE UNLOGGED TABLE will make any owned sequences be unlogged too. ALTER TABLE missed that consideration, so that an added identity column would have a logged…
fixFix EXPLAIN's counting of heap pages accessed by a bitmap heap scan (Melanie Plageman) Previously, heap pages that contain no visible tuples were not counted; but it seems more consistent to count all pages returned by the bitmap index scan.
fixFix EXPLAIN's output for subplans in MERGE (Dean Rasheed) EXPLAIN would sometimes fail to properly display subplan Params referencing variables in other parts of the plan tree.
breakingAvoid deadlock during removal of orphaned temporary tables (Mikhail Zhilin) If the session that creates a temporary table crashes without removing the table, autovacuum will eventually try to remove the orphaned table. However, an incoming session that's been assigned the same temporary namespace…
fixFix updating of visibility map state in VACUUM with the DISABLE_PAGE_SKIPPING option (Heikki Linnakangas) Due to an oversight, this mode caused all heap pages to be dirtied, resulting in excess I/O. Also, visibility map bits that were incorrectly set would not get cleared.
fixFix buffer usage reporting for parallel vacuuming (Anthonin Bonnefoy) Buffer accesses performed by parallel workers were not getting counted in the statistics reported in VERBOSE mode.
fixFix “could not find pathkey item to sort” errors occurring while planning aggregate functions with ORDER BY or DISTINCT options (David Rowley) This is similar to a fix applied in 16.1, but it solves the problem for parallel plans.
fixAvoid use of already-freed data while planning partition-wise joins under GEQO (Tom Lane) This would typically end in a crash or unexpected error message.
fixFix incorrectly-reported statistics kind codes in “requested statistics kind X is not yet built” error messages (David Rowley)
fixFix confusion about the return rowtype of SQL-language procedures (Tom Lane) A procedure implemented in SQL language that returns a single composite-type column would cause an assertion failure or core dump.
featureAdd protective stack depth checks to some recursive functions (Egor Chindyaskin)
fixFix mis-rounding and overflow hazards in date_bin() (Moaaz Assali) In the case where the source timestamp is before the origin timestamp and their difference is already an exact multiple of the stride, the code incorrectly subtracted the stride anyway. Also, detect some integer-overflow cases that…
fixFix detection of old transaction IDs in XID status functions (Karina Litskevich) Transaction IDs more than 231 transactions in the past could be misidentified as recent, leading to misbehavior of pg_xact_status() or txid_status().
fixEnsure that a table's freespace map won't return a page that's past the end of the table (Ronan Dunklau) Because the freespace map isn't WAL-logged, this was possible in edge cases involving an OS crash, a replica promote, or a PITR restore. The result would be a “could not read block” error.
fixFix file descriptor leakage when an error is thrown while waiting in WaitEventSetWait (Etsuro Fujita)
featureAvoid corrupting exception stack if an FDW implements async append but doesn't configure any wait conditions for the Append plan node to wait for (Alexander Pyhalov)
fixEnsure that index-only scans on name columns return a fully-padded value (David Rowley) The value physically stored in the index is truncated, and previously a pointer to that value was returned to callers. This provoked complaints when testing under valgrind. In theory it could result in crashes,…
fixFix race condition that could lead to reporting an incorrect conflict cause when invalidating a replication slot (Bertrand Drouvot)
fixFix race condition in deciding whether a table sync operation is needed in logical replication (Vignesh C) An invalidation event arriving while a subscriber identifies which tables need to be synced would be forgotten about, so that any tables newly in need of syncing might not get processed in a…
fixFix crash with DSM allocations larger than 4GB (Heikki Linnakangas)
featureDisconnect if a new server session's client socket cannot be put into non-blocking mode (Heikki Linnakangas) It was once theoretically possible for us to operate with a socket that's in blocking mode; but that hasn't worked fully in a long time, so fail at connection start rather than misbehave…
fixFix inadequate error reporting with OpenSSL 3.0.0 and later (Heikki Linnakangas, Tom Lane) System-reported errors passed through by OpenSSL were reported with a numeric error code rather than anything readable.
fixFix thread-safety of error reporting for getaddrinfo() on Windows (Thomas Munro) A multi-threaded libpq client program could get an incorrect or corrupted error message after a network lookup failure.
featureAvoid concurrent calls to bindtextdomain() in libpq and ecpglib (Tom Lane) Although GNU gettext's implementation seems to be fine with concurrent calls, the version available on Windows is not.
fixFix crash in ecpg's preprocessor if the program tries to redefine a macro that was defined on the preprocessor command line (Tom Lane)
fixFix pg_dumpall so that role comments, if present, will be dumped regardless of the setting of --no-role-passwords (Daniel Gustafsson, Álvaro Herrera)
fixFix PL/pgSQL's parsing of single-line comments (---style comments) following expressions (Erik Wienhold, Tom Lane) This mistake caused parse errors if such a comment followed a WHEN expression in a PL/pgSQL CASE statement.
fixFix bugs in BRIN output functions (Tomas Vondra) These output functions are only used for displaying index entries in contrib/pageinspect, so the errors are of limited practical concern.
deprecatedIn contrib/xml2, avoid use of library functions that have been deprecated in recent versions of libxml2 (Dmitry Koval)
breakingFix incompatibility with LLVM 18 (Thomas Munro, Dmitry Dolgov)
featureAllow make check to work with the musl C library (Thomas Munro, Bruce Momjian, Tom Lane)
+20 more items in the release notes
See how far your stack has drifted from upstream. Release data from vendors’ own sources · feed under CC BY 4.0 · Code under AGPL-3.0 Settings Feed status