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

Commitc9eeef2

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 parentd5eeb51 commitc9eeef2

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
@@ -288,9 +288,24 @@ CreateStatistics(CreateStatsStmt *stmt)
288288
Node*expr=selem->expr;
289289
Oidatttype;
290290
TypeCacheEntry*type;
291+
Bitmapset*attnums=NULL;
292+
intk;
291293

292294
Assert(expr!=NULL);
293295

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

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp