Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit5be8ce8

Browse files
committed
Fix lookup error in extended stats ownership check
When an ownership check on extended statistics object failed, the codewas calling aclcheck_error_type to report the failure, which is clearlywrong, resulting in cache lookup errors. Fix by calling aclcheck_error.This issue exists since the introduction of extended statistics, sobackpatch all the way back to PostgreSQL 10. It went unnoticed becausethere were no tests triggering the error, so add one.Reported-by: Mark DilgerBackpatch-through: 10, where extended stats were introducedDiscussion:https://postgr.es/m/1F238937-7CC2-4703-A1B1-6DC225B8978A%40enterprisedb.com
1 parent589be6f commit5be8ce8

File tree

3 files changed

+22
-1
lines changed

3 files changed

+22
-1
lines changed

‎src/backend/catalog/objectaddress.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2571,7 +2571,8 @@ check_object_ownership(Oid roleid, ObjectType objtype, ObjectAddress address,
25712571
break;
25722572
caseOBJECT_STATISTIC_EXT:
25732573
if (!pg_statistics_object_ownercheck(address.objectId,roleid))
2574-
aclcheck_error_type(ACLCHECK_NOT_OWNER,address.objectId);
2574+
aclcheck_error(ACLCHECK_NOT_OWNER,objtype,
2575+
NameListToString(castNode(List,object)));
25752576
break;
25762577
default:
25772578
elog(ERROR,"unrecognized object type: %d",

‎src/test/regress/expected/stats_ext.out

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,17 @@ DROP TABLE ext_stats_test;
6767
-- Ensure stats are dropped sanely, and test IF NOT EXISTS while at it
6868
CREATE TABLE ab1 (a INTEGER, b INTEGER, c INTEGER);
6969
CREATE STATISTICS IF NOT EXISTS ab1_a_b_stats ON a, b FROM ab1;
70+
COMMENT ON STATISTICS ab1_a_b_stats IS 'new comment';
71+
CREATE ROLE temp_role;
72+
SET SESSION AUTHORIZATION temp_role;
73+
COMMENT ON STATISTICS ab1_a_b_stats IS 'changed comment';
74+
ERROR: must be owner of statistics object ab1_a_b_stats
75+
DROP STATISTICS ab1_a_b_stats;
76+
ERROR: must be owner of statistics object ab1_a_b_stats
77+
ALTER STATISTICS ab1_a_b_stats RENAME TO ab1_a_b_stats_new;
78+
ERROR: must be owner of statistics object ab1_a_b_stats
79+
RESET SESSION AUTHORIZATION;
80+
DROP ROLE temp_role;
7081
CREATE STATISTICS IF NOT EXISTS ab1_a_b_stats ON a, b FROM ab1;
7182
NOTICE: statistics object "ab1_a_b_stats" already exists, skipping
7283
DROP STATISTICS ab1_a_b_stats;

‎src/test/regress/sql/stats_ext.sql

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,15 @@ DROP TABLE ext_stats_test;
4848
-- Ensure stats are dropped sanely, and test IF NOT EXISTS while at it
4949
CREATETABLEab1 (aINTEGER, bINTEGER, cINTEGER);
5050
CREATE STATISTICS IF NOT EXISTS ab1_a_b_statsON a, bFROM ab1;
51+
COMMENTON STATISTICS ab1_a_b_stats IS'new comment';
52+
CREATE ROLE temp_role;
53+
SET SESSION AUTHORIZATION temp_role;
54+
COMMENTON STATISTICS ab1_a_b_stats IS'changed comment';
55+
DROP STATISTICS ab1_a_b_stats;
56+
ALTER STATISTICS ab1_a_b_stats RENAME TO ab1_a_b_stats_new;
57+
RESET SESSION AUTHORIZATION;
58+
DROP ROLE temp_role;
59+
5160
CREATE STATISTICS IF NOT EXISTS ab1_a_b_statsON a, bFROM ab1;
5261
DROP STATISTICS ab1_a_b_stats;
5362

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp