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

Commit6606107

Browse files
committed
Disallow extended statistics on system columns
Since introduction of extended statistics, we've disallowed referencesto system columns. So for example CREATE STATISTICS s ON ctid FROM t;would fail. But with extended statistics on expressions, it was possibleto work around this limitation quite easily CREATE STATISTICS s ON (ctid::text) FROM t;This is an oversight ina4d75c8, fixed by adding a simple check.Backpatch to PostgreSQL 14, where support for extended statistics onexpressions was introduced.Backpatch-through: 14Discussion:https://postgr.es/m/20210816013255.GS10479%40telsasoft.com
1 parent2a9a34c commit6606107

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

‎src/backend/commands/statscmds.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,9 +287,24 @@ CreateStatistics(CreateStatsStmt *stmt)
287287
Node*expr=selem->expr;
288288
Oidatttype;
289289
TypeCacheEntry*type;
290+
Bitmapset*attnums=NULL;
291+
intk;
290292

291293
Assert(expr!=NULL);
292294

295+
/* Disallow expressions referencing system attributes. */
296+
pull_varattnos(expr,1,&attnums);
297+
298+
k=-1;
299+
while ((k=bms_next_member(attnums,k)) >=0)
300+
{
301+
AttrNumberattnum=k+FirstLowInvalidHeapAttributeNumber;
302+
if (attnum <=0)
303+
ereport(ERROR,
304+
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
305+
errmsg("statistics creation on system columns is not supported")));
306+
}
307+
293308
/*
294309
* Disallow data types without a less-than operator.
295310
*

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp