pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alvaro Herrera <alvherre@2ndquadrant.com>
To: Pg Hackers <pgsql-hackers@lists.postgresql.org>
To: Tomas Vondra <tomas.vondra@2ndquadrant.com>
Subject: error messages in extended statistics
Date: Fri, 3 May 2019 11:44:04 -0400
Message-ID: <20190503154404.GA7478@alvherre.pgsql> (raw)

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/





view thread (8+ messages)  latest in thread

Message-ID: <20190503154404.GA7478@alvherre.pgsql>
Permalink:  ../20190503154404.GA7478@alvherre.pgsql/
Also on:    postgresql.org/message-id/20190503154404.GA7478@alvherre.pgsql

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-hackers@postgresql.org
  Cc: alvherre@2ndquadrant.com, tomas.vondra@2ndquadrant.com
  Subject: Re: error messages in extended statistics
  In-Reply-To: <20190503154404.GA7478@alvherre.pgsql>
  References: <20190503154404.GA7478@alvherre.pgsql>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox