agora inbox for pgsql-committers@postgresql.org
help / color / mirror / Atom feedFrom: Noah Misch <noah@leadboat.com>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Preserve the owner of extended statistics rebuilt by ALTER TABLE
Date: Mon, 10 Aug 2026 13:41:30 +0000
Message-ID: <E1wtQFu-00000000yKB-45LG@gemulon.postgresql.org> (raw)
Preserve the owner of extended statistics rebuilt by ALTER TABLE.
When ALTER TABLE ... ALTER COLUMN TYPE (or any subcommand that rebuilds
them) drops and re-creates the extended statistics objects depending on
the altered column, the re-created objects were owned by the role running
ALTER TABLE rather than by the original owner of the statistics.
Remember each object's owner before dropping it, and restore it on
re-creation.
CreateStatistics()'s signature changes and CreateStatsStmt gains a field,
but no known third-party code calls the former or constructs the latter.
Author: Masahiko Sawada <sawada.mshk@gmail.com>
Reviewed-by: Noah Misch <noah@leadboat.com>
Backpatch-through: 14
Security: CVE-2026-6469
Branch
------
REL_15_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/fb6d1ca8d746dc1ca0e32890a50d7b93d2fbebae
Author: Masahiko Sawada <msawada@postgresql.org>
Modified Files
--------------
src/backend/commands/statscmds.c | 48 ++++++++++++++----------------
src/backend/commands/tablecmds.c | 52 ++++++++++++++++++++++++---------
src/backend/tcop/utility.c | 19 ++++++++++--
src/include/commands/defrem.h | 2 +-
src/include/nodes/parsenodes.h | 1 +
src/test/regress/expected/stats_ext.out | 29 ++++++++++++++++++
src/test/regress/sql/stats_ext.sql | 20 +++++++++++++
7 files changed, 129 insertions(+), 42 deletions(-)
view thread (6+ messages)
Message-ID: <E1wtQFu-00000000yKB-45LG@gemulon.postgresql.org>
Permalink: ../E1wtQFu-00000000yKB-45LG@gemulon.postgresql.org/
Also on: postgresql.org/message-id/E1wtQFu-00000000yKB-45LG@gemulon.postgresql.org
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-committers@postgresql.org
Cc: noah@leadboat.com, pgsql-committers@lists.postgresql.org
Subject: Re: pgsql: Preserve the owner of extended statistics rebuilt by ALTER TABLE
In-Reply-To: <E1wtQFu-00000000yKB-45LG@gemulon.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox