PostgreSQL 18.6 → 18.7
1 release · 0 breaking changes · 40 security fixes · 0 advisories fixed
40security0breaking0deprecated0feature0fix
Breaking changes
None in the release notes.
Security changes
- security Add defenses against problems caused by altering composite types concurrently with operations on data of those types (Heikki Linnakangas, Andres Freund, Nathan Bossart, Nikhil Sontakke) Operations such as ALTER TABLE ... ALTER COLUMN TYPE are hazardous because tuples of the older row layout may… in 18.7
- security Cope with concurrent rowtype changes in ExecEvalFieldStore[De]Form() (Tomas Vondra, Heikki Linnakangas) The PostgreSQL Project thanks OpenAI Codex Security, Bronson Yen, Mehmet Ince, Claude and Ada Logics for reporting this problem. (CVE-2026-116306) in 18.7
- security Guard against malicious alteration of a table while a statistics import function is running on it (Masahiko Sawada) Previously it was possible to store statistics that no longer match the table, leading to crashes or other problems later. The PostgreSQL Project thanks Mehmet Ince for reporting… in 18.7
- security Enforce view row visibility in INSERT ... ON CONFLICT (Peter Geoghegan, Zsolt Parragi) When applied to a view, INSERT ... ON CONFLICT DO UPDATE could update rows that should be hidden by the view's WHERE clause. Although it was documented, this behavior is surely unexpected, and it gives rise to… in 18.7
- security Align REASSIGN OWNED's caller-privilege checks with ALTER ... OWNER TO's checks (Zsolt Parragi) Since v16, giving an object to another role requires the ability to SET ROLE to that role. However, a role granted INHERIT TRUE, SET FALSE could bypass that via REASSIGN OWNED. A role granted INHERIT… in 18.7
- security Fix use-after-free in COPY FROM ON_ERROR reporting (Masahiko Sawada) An error report raised in COPY FROM could disclose server memory. The PostgreSQL Project thanks Jiyong Ahn, Claude and Ada Logics for reporting this problem. (CVE-2026-116310) in 18.7
- security Disallow closing a portal that is still being set up (Michael Paquier) This change forestalls various use-after-free issues. The PostgreSQL Project thanks Tomas Vondra for reporting this problem. (CVE-2026-116332) in 18.7
- security Forcibly close portals associated with transition tables at the end of the trigger function (Jeff Davis) This change avoids use-after-free hazards. The PostgreSQL Project thanks Peter Geoghegan for reporting this problem. (CVE-2026-120143) in 18.7
- security Fix race condition leading to use-after-free in shared tupledesc management (Robert Haas) The PostgreSQL Project thanks Peter Geoghegan for reporting this problem. (CVE-2026-116304) in 18.7
- security Fix use-after-free in pg_show_all_settings() (Masahiko Sawada) The PostgreSQL Project thanks Claude and Ada Logics for reporting this problem. (CVE-2026-120152) in 18.7
- security Fix use-after-free in expanded-record domain constraint checking (Tom Lane) The PostgreSQL Project thanks Claude and Ada Logics for reporting this problem. (CVE-2026-120150) in 18.7
- security Prevent memory corruption after a large allocation in a “generation” memory context is freed (Heikki Linnakangas) The PostgreSQL Project thanks Jayden Sarveshkumar for reporting this problem. (CVE-2026-116328) in 18.7
- security Fix buffer overrun in tsvector_delete() (Anthropic OSS program) With crafted input, tsvector_delete() could be induced to write more bytes than it had allocated for its result. The PostgreSQL Project thanks the Anthropic OSS program for reporting this problem. (CVE-2026-116315) in 18.7
- security Fix buffer overrun in ts_rank_cd() (Anthropic OSS program) With crafted input, ts_rank_cd() could be induced to write more bytes than it had allocated for its result. The PostgreSQL Project thanks the Anthropic OSS program for reporting this problem. (CVE-2026-116317) in 18.7
- security Prevent construction of invalid name values via element assignment (Tom Lane) array_set_element() could be abused to make the last byte of a name-type value nonzero. Subsequent uses of the value would then read past the end, resulting in crashes or disclosure of server memory. While at it,… in 18.7
- security Treat application of a leaky function to a CaseTestExpr or internal Param node as leaky (Tom Lane) A CaseTestExpr or internal Param represents the value of an expression somewhere else in the query. If that expression contains a Var then there is potential for information leakage. Therefore,… in 18.7
- security Don't generate an index-based plan for an aggregate whose input and output types don't match (Tom Lane) Previously, we'd blindly do this if the aggregate has a SORTOP option attached. The index-based plan will return the aggregate's input column, leading to type violations and potentially to… in 18.7
- security Delay processing of cancel request packets until it's safe to handle them (Michael Paquier) With luck and good timing, an attacker could induce the process receiving a cancel request packet to exit while holding a spinlock, thereby causing a database crash and restart. The PostgreSQL Project… in 18.7
- security Avoid inserting the wrong tuple into a trigger transition table in a MERGE that does an INSERT followed by an UPDATE (Heikki Linnakangas, Jacek Bylina, Jacob Robertson, Nigel Gott) The PostgreSQL Project thanks Jacek Bylina, Timothy Ball, Claude and Ada Logics for reporting this problem.… in 18.7
- security Check that commutator and negator operator pairs return the same data type (Tom Lane) Previously, substitution of a commutator or negator operator could lead to a type violation. This patch also cleans up some cases where one operator had a commutator/negator link to another, but the second… in 18.7
- security Prevent functions in index predicates and expressions from breaking REINDEX CONCURRENTLY by manipulating the indexes (Michael Paquier) The PostgreSQL Project thanks Florent Saudel for reporting this problem. (CVE-2026-116336) in 18.7
- security Prevent corrupting a newly-installed extension by renaming its target schema during CREATE EXTENSION or by installing it into a temporary schema (Noah Misch) With some ingenuity, an attacker could substitute objects of his creation for objects in the extension. The PostgreSQL Project thanks Noah… in 18.7
- security Reject more unsafe names in extension script substitutions (Nathan Bossart) We already rejected schema and owner names containing quotes, backslashes, and dollar signs, but names containing newlines, carriage returns, comment delimiters, or the substitution tokens themselves can still achieve SQL… in 18.7
- security Check EXECUTE privilege before calling cast functions within to_json() and other conversion-to-JSON code (Nathan Bossart, Anthropic OSS program) Typically such functions would have public EXECUTE privilege anyway, but this puts the behavior on par with normal execution of casts. The PostgreSQL… in 18.7
- security Check EXECUTE privilege before calling cast functions within foreign key enforcement checks (Nathan Bossart) Typically such functions would have public EXECUTE privilege anyway, but this puts the behavior on par with normal execution of casts. The PostgreSQL Project thanks Noah Misch for reporting… in 18.7
- security Prevent DROP OWNED BY from changing row-level security policies on tables that the current user does not own (Zsolt Parragi, Anthropic OSS program) Previously, an unprivileged role could remove itself from restrictive policies on tables it does not own. Instead issue a warning, as is already done… in 18.7
- security Disallow security-restricted operations from creating types in temporary schemas (Anthropic OSS program, Nathan Bossart) We already disallowed creating temporary tables in this context, but a type also presents a hazard of shadowing permanent objects and thus allowing privilege escalation. The… in 18.7
- security Avoid out-of-bounds accesses in FDW batch inserts (Nathan Bossart) The PostgreSQL Project thanks Sumedh Pathak and Sven Klemm for reporting this problem. (CVE-2026-120149) in 18.7
- security Avoid out-of-bounds reads in parallel btree scans with array keys (Nathan Bossart) The PostgreSQL Project thanks Claude and Ada Logics for reporting this problem. (CVE-2026-116333) in 18.7
- security Replace the type cache's in_progress_list mechanism with something simpler and safer (Robert Haas) The PostgreSQL Project thanks Peter Geoghegan for reporting this problem. (CVE-2026-120144) in 18.7
- security Refuse to create extended statistics on expressions of transient types (Masahiko Sawada) Disallow CREATE STATISTICS on expressions whose types would not be allowed as table column types, most notably anonymous record types. This prevents other sessions from misinterpreting the stored values. The… in 18.7
- security Reject system catalogs as logical replication targets (Masahiko Sawada) The PostgreSQL Project thanks Qian Zhang for reporting this problem. (CVE-2026-120145) in 18.7
- security Check ON CONFLICT target row against RLS policies before applying user quals (Peter Geoghegan, Zsolt Parragi) Previously, leaky qual expressions could see rows that RLS policies should forbid them from seeing. The PostgreSQL Project thanks Peter Geoghegan, Zsolt Parragi, Only see myself, the… in 18.7
- security Validate all connection options in replication subscriptions and contrib/dblink (Jacob Champion) Previously, these checks were applied inconsistently. The PostgreSQL Project thanks Andrey Krasichkov, Bashir Altawil, and Zsolt Parragi for reporting this problem. (CVE-2026-14661) in 18.7
- security Handle dropped columns safely while comparing row types (Peter Geoghegan) Previously, two row types that had dropped columns at the same position could be considered equal even if those columns were of different physical widths. That leads to problems when trying to deconstruct tuples of those… in 18.7
- security Disallow declaring SQL functions as returning type "any" (Peter Geoghegan) This allowed type violations. The PostgreSQL Project thanks Peter Geoghegan, Claude and Ada Logics for reporting this problem. (CVE-2026-18447) in 18.7
- security Harden more memory-size calculations against integer overflow (Álvaro Herrera) The PostgreSQL Project thanks Hillai Ben Sasson, Jayden Sarveshkumar, and Mehmet Ince for reporting this problem. (CVE-2026-120139) in 18.7
- security Fix type confusion in set-returning functions that return RECORD, when materialized in a query's target list (Melanie Plageman, Robert Haas) The same tuple descriptor was used across multiple calls, which is unsafe since the actual record type could vary. The PostgreSQL Project thanks Peter… in 18.7
- security Cope with concurrent rowtype changes in PL/pgSQL record field assignment (Tom Lane) The PostgreSQL Project thanks Claude and Ada Logics for reporting this problem. (CVE-2026-120151) in 18.7
- security Support “tied” Perl objects in PL/Perl and associated contrib modules (Andrey Rachitskiy) Up to now, if you passed a tied object to a PL/Perl operation, it would most likely get treated as undef, since we failed to perform Perl get magic on values we're passed. Tied hashes worked partially, in… in 18.7
Every release in between
securityAdd defenses against problems caused by altering composite types concurrently with operations on data of those types (Heikki Linnakangas, Andres Freund, Nathan Bossart, Nikhil Sontakke) Operations such as ALTER TABLE ... ALTER COLUMN TYPE are hazardous because tuples of the older row layout may…
securityCope with concurrent rowtype changes in ExecEvalFieldStore[De]Form() (Tomas Vondra, Heikki Linnakangas) The PostgreSQL Project thanks OpenAI Codex Security, Bronson Yen, Mehmet Ince, Claude and Ada Logics for reporting this problem. (CVE-2026-116306)
securityGuard against malicious alteration of a table while a statistics import function is running on it (Masahiko Sawada) Previously it was possible to store statistics that no longer match the table, leading to crashes or other problems later. The PostgreSQL Project thanks Mehmet Ince for reporting…
securityEnforce view row visibility in INSERT ... ON CONFLICT (Peter Geoghegan, Zsolt Parragi) When applied to a view, INSERT ... ON CONFLICT DO UPDATE could update rows that should be hidden by the view's WHERE clause. Although it was documented, this behavior is surely unexpected, and it gives rise to…
securityAlign REASSIGN OWNED's caller-privilege checks with ALTER ... OWNER TO's checks (Zsolt Parragi) Since v16, giving an object to another role requires the ability to SET ROLE to that role. However, a role granted INHERIT TRUE, SET FALSE could bypass that via REASSIGN OWNED. A role granted INHERIT…
securityFix use-after-free in COPY FROM ON_ERROR reporting (Masahiko Sawada) An error report raised in COPY FROM could disclose server memory. The PostgreSQL Project thanks Jiyong Ahn, Claude and Ada Logics for reporting this problem. (CVE-2026-116310)
securityDisallow closing a portal that is still being set up (Michael Paquier) This change forestalls various use-after-free issues. The PostgreSQL Project thanks Tomas Vondra for reporting this problem. (CVE-2026-116332)
securityForcibly close portals associated with transition tables at the end of the trigger function (Jeff Davis) This change avoids use-after-free hazards. The PostgreSQL Project thanks Peter Geoghegan for reporting this problem. (CVE-2026-120143)
securityFix race condition leading to use-after-free in shared tupledesc management (Robert Haas) The PostgreSQL Project thanks Peter Geoghegan for reporting this problem. (CVE-2026-116304)
securityFix use-after-free in pg_show_all_settings() (Masahiko Sawada) The PostgreSQL Project thanks Claude and Ada Logics for reporting this problem. (CVE-2026-120152)
securityFix use-after-free in expanded-record domain constraint checking (Tom Lane) The PostgreSQL Project thanks Claude and Ada Logics for reporting this problem. (CVE-2026-120150)
securityPrevent memory corruption after a large allocation in a “generation” memory context is freed (Heikki Linnakangas) The PostgreSQL Project thanks Jayden Sarveshkumar for reporting this problem. (CVE-2026-116328)
securityFix buffer overrun in tsvector_delete() (Anthropic OSS program) With crafted input, tsvector_delete() could be induced to write more bytes than it had allocated for its result. The PostgreSQL Project thanks the Anthropic OSS program for reporting this problem. (CVE-2026-116315)
securityFix buffer overrun in ts_rank_cd() (Anthropic OSS program) With crafted input, ts_rank_cd() could be induced to write more bytes than it had allocated for its result. The PostgreSQL Project thanks the Anthropic OSS program for reporting this problem. (CVE-2026-116317)
securityPrevent construction of invalid name values via element assignment (Tom Lane) array_set_element() could be abused to make the last byte of a name-type value nonzero. Subsequent uses of the value would then read past the end, resulting in crashes or disclosure of server memory. While at it,…
securityTreat application of a leaky function to a CaseTestExpr or internal Param node as leaky (Tom Lane) A CaseTestExpr or internal Param represents the value of an expression somewhere else in the query. If that expression contains a Var then there is potential for information leakage. Therefore,…
securityDon't generate an index-based plan for an aggregate whose input and output types don't match (Tom Lane) Previously, we'd blindly do this if the aggregate has a SORTOP option attached. The index-based plan will return the aggregate's input column, leading to type violations and potentially to…
securityDelay processing of cancel request packets until it's safe to handle them (Michael Paquier) With luck and good timing, an attacker could induce the process receiving a cancel request packet to exit while holding a spinlock, thereby causing a database crash and restart. The PostgreSQL Project…
securityAvoid inserting the wrong tuple into a trigger transition table in a MERGE that does an INSERT followed by an UPDATE (Heikki Linnakangas, Jacek Bylina, Jacob Robertson, Nigel Gott) The PostgreSQL Project thanks Jacek Bylina, Timothy Ball, Claude and Ada Logics for reporting this problem.…
securityCheck that commutator and negator operator pairs return the same data type (Tom Lane) Previously, substitution of a commutator or negator operator could lead to a type violation. This patch also cleans up some cases where one operator had a commutator/negator link to another, but the second…
securityPrevent functions in index predicates and expressions from breaking REINDEX CONCURRENTLY by manipulating the indexes (Michael Paquier) The PostgreSQL Project thanks Florent Saudel for reporting this problem. (CVE-2026-116336)
securityPrevent corrupting a newly-installed extension by renaming its target schema during CREATE EXTENSION or by installing it into a temporary schema (Noah Misch) With some ingenuity, an attacker could substitute objects of his creation for objects in the extension. The PostgreSQL Project thanks Noah…
securityReject more unsafe names in extension script substitutions (Nathan Bossart) We already rejected schema and owner names containing quotes, backslashes, and dollar signs, but names containing newlines, carriage returns, comment delimiters, or the substitution tokens themselves can still achieve SQL…
securityCheck EXECUTE privilege before calling cast functions within to_json() and other conversion-to-JSON code (Nathan Bossart, Anthropic OSS program) Typically such functions would have public EXECUTE privilege anyway, but this puts the behavior on par with normal execution of casts. The PostgreSQL…
securityCheck EXECUTE privilege before calling cast functions within foreign key enforcement checks (Nathan Bossart) Typically such functions would have public EXECUTE privilege anyway, but this puts the behavior on par with normal execution of casts. The PostgreSQL Project thanks Noah Misch for reporting…
securityPrevent DROP OWNED BY from changing row-level security policies on tables that the current user does not own (Zsolt Parragi, Anthropic OSS program) Previously, an unprivileged role could remove itself from restrictive policies on tables it does not own. Instead issue a warning, as is already done…
securityDisallow security-restricted operations from creating types in temporary schemas (Anthropic OSS program, Nathan Bossart) We already disallowed creating temporary tables in this context, but a type also presents a hazard of shadowing permanent objects and thus allowing privilege escalation. The…
securityAvoid out-of-bounds accesses in FDW batch inserts (Nathan Bossart) The PostgreSQL Project thanks Sumedh Pathak and Sven Klemm for reporting this problem. (CVE-2026-120149)
securityAvoid out-of-bounds reads in parallel btree scans with array keys (Nathan Bossart) The PostgreSQL Project thanks Claude and Ada Logics for reporting this problem. (CVE-2026-116333)
securityReplace the type cache's in_progress_list mechanism with something simpler and safer (Robert Haas) The PostgreSQL Project thanks Peter Geoghegan for reporting this problem. (CVE-2026-120144)
securityRefuse to create extended statistics on expressions of transient types (Masahiko Sawada) Disallow CREATE STATISTICS on expressions whose types would not be allowed as table column types, most notably anonymous record types. This prevents other sessions from misinterpreting the stored values. The…
securityReject system catalogs as logical replication targets (Masahiko Sawada) The PostgreSQL Project thanks Qian Zhang for reporting this problem. (CVE-2026-120145)
securityCheck ON CONFLICT target row against RLS policies before applying user quals (Peter Geoghegan, Zsolt Parragi) Previously, leaky qual expressions could see rows that RLS policies should forbid them from seeing. The PostgreSQL Project thanks Peter Geoghegan, Zsolt Parragi, Only see myself, the…
securityValidate all connection options in replication subscriptions and contrib/dblink (Jacob Champion) Previously, these checks were applied inconsistently. The PostgreSQL Project thanks Andrey Krasichkov, Bashir Altawil, and Zsolt Parragi for reporting this problem. (CVE-2026-14661)
securityHandle dropped columns safely while comparing row types (Peter Geoghegan) Previously, two row types that had dropped columns at the same position could be considered equal even if those columns were of different physical widths. That leads to problems when trying to deconstruct tuples of those…
securityDisallow declaring SQL functions as returning type "any" (Peter Geoghegan) This allowed type violations. The PostgreSQL Project thanks Peter Geoghegan, Claude and Ada Logics for reporting this problem. (CVE-2026-18447)
securityHarden more memory-size calculations against integer overflow (Álvaro Herrera) The PostgreSQL Project thanks Hillai Ben Sasson, Jayden Sarveshkumar, and Mehmet Ince for reporting this problem. (CVE-2026-120139)
securityFix type confusion in set-returning functions that return RECORD, when materialized in a query's target list (Melanie Plageman, Robert Haas) The same tuple descriptor was used across multiple calls, which is unsafe since the actual record type could vary. The PostgreSQL Project thanks Peter…
securityCope with concurrent rowtype changes in PL/pgSQL record field assignment (Tom Lane) The PostgreSQL Project thanks Claude and Ada Logics for reporting this problem. (CVE-2026-120151)
securitySupport “tied” Perl objects in PL/Perl and associated contrib modules (Andrey Rachitskiy) Up to now, if you passed a tied object to a PL/Perl operation, it would most likely get treated as undef, since we failed to perform Perl get magic on values we're passed. Tied hashes worked partially, in…
+160 more items in the release notes