1
0
mirror of https://github.com/postgres/postgres.git synced 2025-12-19 17:02:53 +03:00

CREATE STATISTICS: improve misleading error message

The previous change (commit f225473cba) was still not on target,
because it talked about relation kinds, which are not what is being
checked here.  Provide a more accurate message.

Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/CACJufxEZ48toGH0Em_6vdsT57Y3L8pLF=DZCQ_gCii6=C3MeXw@mail.gmail.com
This commit is contained in:
Peter Eisentraut
2025-09-15 11:38:58 +02:00
parent 755f01ad74
commit f9b41f3e1e
2 changed files with 8 additions and 16 deletions

View File

@@ -1880,8 +1880,7 @@ ProcessUtilitySlow(ParseState *pstate,
if (!IsA(rel, RangeVar))
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("cannot create statistics on the specified relation"),
errdetail("CREATE STATISTICS only supports tables, foreign tables and materialized views.")));
errmsg("CREATE STATISTICS only supports relation names in the FROM clause")));
/*
* CREATE STATISTICS will influence future execution plans