On Mon, Apr 30, 2018 at 2:50 AM, Michael Paquier <mich...@paquier.xyz> wrote: > On Sun, Apr 29, 2018 at 06:20:02PM -0700, Peter Geoghegan wrote: >> What about amcheck? I did change the example query in the docs to >> account for this, so anyone that generalizes from that won't have a >> problem, but it would be nice if it had a friendlier message. I didn't >> change amcheck to account for this myself because I thought it was >> possible that somebody else would want to use a more general solution. > > Perhaps it would help if an errhint is added which is written as "This > relation is a %s", where %s is a relkind converted to a translatable > string describing the kind? All those modules work on different objects > and have different goals and prospoectives, so it looks difficult to me > to come up with a sane API which is rather portable across modules.
That's probably going to cause some translation problems. The form of "a" that you need will vary: "a" vs. "an" in English, "un" vs. "una" in Spanish, etc. And it wouldn't be surprising if there are problems in some languages even if you make it "This relation is %s". There's a reason why the documentation advises against building up translatable strings from constituent parts. If we go this route, it's probably best to separately translate "This relation is a table.", "This relation is an index.", etc. However, backing up a minute, I don't think "relation \"%s\" is not a btree index" is such a terrible message. These modules are intended to be intended by people who Know What They Are Doing. If we do want to change the message, I submit that the only thing that makes it a little unclear is that a user might fail to realize that a partitioned index is not an index. But that could be fixed just by adding a separate message for that one case (index \"%s\" is partitioned) and sticking with the existing message for other cases. -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company