From f9a7622483c30a45e04a700b6dc90b95ff366fba Mon Sep 17 00:00:00 2001 From: Álvaro Herrera Date: Fri, 29 Aug 2025 14:43:47 +0200 Subject: CREATE STATISTICS: improve misleading error message MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I think the error message for a different condition was inadvertently copied. This problem seems to have been introduced by commit a4d75c86bf15. Author: Álvaro Herrera Reported-by: jian he Reviewed-by: Tom Lane Backpatch-through: 14 Discussion: https://postgr.es/m/CACJufxEZ48toGH0Em_6vdsT57Y3L8pLF=DZCQ_gCii6=C3MeXw@mail.gmail.com --- src/backend/tcop/utility.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/backend/tcop/utility.c') diff --git a/src/backend/tcop/utility.c b/src/backend/tcop/utility.c index 6b0a8652622..b00705506df 100644 --- a/src/backend/tcop/utility.c +++ b/src/backend/tcop/utility.c @@ -1873,7 +1873,8 @@ ProcessUtilitySlow(ParseState *pstate, if (!IsA(rel, RangeVar)) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("only a single relation is allowed in CREATE STATISTICS"))); + errmsg("cannot create statistics on the specified relation"), + errdetail("CREATE STATISTICS only supports tables, foreign tables and materialized views."))); /* * CREATE STATISTICS will influence future execution plans -- cgit v1.2.3