mirror of
https://github.com/postgres/postgres.git
synced 2025-11-18 02:02:55 +03:00
Disallow modifying statistics on system columns.
Reported-by: Heikki Linnakangas Discussion: https://postgr.es/m/df3e1c41-4e6c-40ad-9636-98deefe488cd@iki.fi
This commit is contained in:
@@ -167,6 +167,13 @@ attribute_statistics_update(FunctionCallInfo fcinfo, int elevel)
|
||||
stats_check_required_arg(fcinfo, attarginfo, ATTNAME_ARG);
|
||||
attname = PG_GETARG_NAME(ATTNAME_ARG);
|
||||
attnum = get_attnum(reloid, NameStr(*attname));
|
||||
|
||||
if (attnum < 0)
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
||||
errmsg("cannot modify statistics on system column \"%s\"",
|
||||
NameStr(*attname))));
|
||||
|
||||
if (attnum == InvalidAttrNumber)
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_UNDEFINED_COLUMN),
|
||||
@@ -882,6 +889,13 @@ pg_clear_attribute_stats(PG_FUNCTION_ARGS)
|
||||
stats_check_required_arg(fcinfo, attarginfo, ATTNAME_ARG);
|
||||
attname = PG_GETARG_NAME(ATTNAME_ARG);
|
||||
attnum = get_attnum(reloid, NameStr(*attname));
|
||||
|
||||
if (attnum < 0)
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
||||
errmsg("cannot clear statistics on system column \"%s\"",
|
||||
NameStr(*attname))));
|
||||
|
||||
if (attnum == InvalidAttrNumber)
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_UNDEFINED_COLUMN),
|
||||
|
||||
Reference in New Issue
Block a user