| From: | Noah Misch <noah(at)leadboat(dot)com> |
|---|---|
| To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
| Subject: | pgsql: Preserve the owner of extended statistics rebuilt by ALTER TABLE |
| Date: | 2026-08-10 13:41:24 |
| Message-ID: | E1wtQFo-00000000y8X-1uNY@gemulon.postgresql.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-committers |
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(dot)mshk(at)gmail(dot)com>
Reviewed-by: Noah Misch <noah(at)leadboat(dot)com>
Backpatch-through: 14
Security: CVE-2026-6469
Branch
------
REL_18_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/a1fa24127d6a24611e5ec8e5b00584b333a3a06c
Author: Masahiko Sawada <msawada(at)postgresql(dot)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(-)
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Noah Misch | 2026-08-10 13:41:25 | pgsql: Check for USAGE privilege on the composite type in ALTER TABLE O |
| Previous Message | Noah Misch | 2026-08-10 13:41:23 | pgsql: Save/restore more lexer state when skipping text due to \if. |