1
0
mirror of https://github.com/postgres/postgres.git synced 2025-12-21 05:21:08 +03:00

CREATE STATISTICS: improve misleading error message

I think the error message for a different condition was inadvertently
copied.

This problem seems to have been introduced by commit a4d75c86bf.

Author: Álvaro Herrera <alvherre@kurilemu.de>
Reported-by: jian he <jian.universality@gmail.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Backpatch-through: 14
Discussion: https://postgr.es/m/CACJufxEZ48toGH0Em_6vdsT57Y3L8pLF=DZCQ_gCii6=C3MeXw@mail.gmail.com
This commit is contained in:
Álvaro Herrera
2025-08-29 14:43:47 +02:00
parent d1073c3b4c
commit 3eea4dc2c7
3 changed files with 40 additions and 1 deletions

View File

@@ -1883,7 +1883,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