error messages in extended statistics
Alvaro Herrera <alvherre@2ndquadrant.com>
From: Alvaro Herrera <alvherre@2ndquadrant.com>
To: Pg Hackers <pgsql-hackers@lists.postgresql.org>, Tomas Vondra <tomas.vondra@2ndquadrant.com>
Date: 2019-05-03T15:44:04Z
Lists: pgsql-hackers
Hello
Error reporting in extended statistics is inconsistent -- many messages
that are ereport() in mvdistinct.c are elog() in the other modules. I
think what happened is that I changed them from elog to ereport when
committing mvdistinct, but Tomas and Simon didn't follow suit when
committing the other two modules. As a result, some messages that
should be essentially duplicates only show up once, because the elog()
ones are not marked translatable.
I think this should be cleaned up, while at the same time not giving too
much hassle for translators; for example, this message
dependencies.c: elog(ERROR, "invalid MVDependencies size %zd (expected at least %zd)",
should not only be turned into an ereport(), but also the MVDependencies
part turned into a %s. (Alternatively, we could decide I was wrong and
turn them all back into elogs, but I obviously vote against that.)
$ git grep 'elog\|errmsg' src/backend/statistics
dependencies.c: elog(ERROR, "cache lookup failed for ordering operator for type %u",
dependencies.c: elog(ERROR, "invalid MVDependencies size %zd (expected at least %zd)",
dependencies.c: elog(ERROR, "invalid dependency magic %d (expected %d)",
dependencies.c: elog(ERROR, "invalid dependency type %d (expected %d)",
dependencies.c: errmsg("invalid zero-length item array in MVDependencies")));
dependencies.c: elog(ERROR, "invalid dependencies size %zd (expected at least %zd)",
dependencies.c: elog(ERROR, "cache lookup failed for statistics object %u", mvoid);
dependencies.c: elog(ERROR,
dependencies.c: errmsg("cannot accept a value of type %s", "pg_dependencies")));
dependencies.c: errmsg("cannot accept a value of type %s", "pg_dependencies")));
extended_stats.c: errmsg("statistics object \"%s.%s\" could not be computed for relation \"%s.%s\"",
extended_stats.c: elog(ERROR, "unexpected statistics type requested: %d", type);
extended_stats.c: elog(ERROR, "stxkind is not a 1-D char array");
extended_stats.c: elog(ERROR, "cache lookup failed for statistics object %u", statOid);
mcv.c: elog(ERROR, "cache lookup failed for ordering operator for type %u",
mcv.c: elog(ERROR, "cache lookup failed for statistics object %u", mvoid);
mcv.c: elog(ERROR,
mcv.c: elog(ERROR, "invalid MCV size %zd (expected at least %zu)",
mcv.c: elog(ERROR, "invalid MCV magic %u (expected %u)",
mcv.c: elog(ERROR, "invalid MCV type %u (expected %u)",
mcv.c: elog(ERROR, "invalid zero-length dimension array in MCVList");
mcv.c: elog(ERROR, "invalid length (%d) dimension array in MCVList",
mcv.c: elog(ERROR, "invalid zero-length item array in MCVList");
mcv.c: elog(ERROR, "invalid length (%u) item array in MCVList",
mcv.c: elog(ERROR, "invalid MCV size %zd (expected %zu)",
mcv.c: elog(ERROR, "invalid MCV size %zd (expected %zu)",
mcv.c: errmsg("function returning record called in context "
mcv.c: errmsg("cannot accept a value of type %s", "pg_mcv_list")));
mcv.c: errmsg("cannot accept a value of type %s", "pg_mcv_list")));
mcv.c: elog(ERROR, "unknown clause type: %d", clause->type);
mvdistinct.c: elog(ERROR, "cache lookup failed for statistics object %u", mvoid);
mvdistinct.c: elog(ERROR,
mvdistinct.c: elog(ERROR, "invalid MVNDistinct size %zd (expected at least %zd)",
mvdistinct.c: errmsg("invalid ndistinct magic %08x (expected %08x)",
mvdistinct.c: errmsg("invalid ndistinct type %d (expected %d)",
mvdistinct.c: errmsg("invalid zero-length item array in MVNDistinct")));
mvdistinct.c: errmsg("invalid MVNDistinct size %zd (expected at least %zd)",
mvdistinct.c: errmsg("cannot accept a value of type %s", "pg_ndistinct")));
mvdistinct.c: errmsg("cannot accept a value of type %s", "pg_ndistinct")));
mvdistinct.c: elog(ERROR, "cache lookup failed for ordering operator for type %u",
--
Álvaro Herrera Developer, https://www.PostgreSQL.org/
Commits
-
Make error logging in extended statistics more consistent
- 39c9efc15646 10.9 landed
- 9c9a74cd3257 11.4 landed
- fe415ff10408 12.0 landed