Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jO0m0-0000c5-Gw for pgsql-hackers@arkaria.postgresql.org; Mon, 13 Apr 2020 15:13:20 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jO0lz-0006mA-EV for pgsql-hackers@arkaria.postgresql.org; Mon, 13 Apr 2020 15:13:19 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jO0lz-0006kQ-7M for pgsql-hackers@lists.postgresql.org; Mon, 13 Apr 2020 15:13:19 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jO0lw-0005jH-VN for pgsql-hackers@postgresql.org; Mon, 13 Apr 2020 15:13:18 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id 03DFDF4B000990; Mon, 13 Apr 2020 11:13:15 -0400 From: Tom Lane To: Peter Eisentraut cc: pgsql-hackers Subject: Re: wrong relkind error messages In-reply-to: References: Comments: In-reply-to Peter Eisentraut message dated "Mon, 13 Apr 2020 15:54:48 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <988.1586790795.1@sss.pgh.pa.us> Date: Mon, 13 Apr 2020 11:13:15 -0400 Message-ID: <989.1586790795@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Peter Eisentraut writes: > I'm not a fan of error messages like > relation "%s" is not a table, foreign table, or materialized view Agreed, they're not great. > For example: > -ERROR: relation "ti" is not a table, foreign table, or materialized view > +ERROR: cannot define statistics for relation "ti" > +DETAIL: "ti" is an index. I see where you'e going, and it seems like a generally-better idea, but I feel like this phrasing is omitting some critical background information that users don't necessarily have. At the very least it's not stating clearly that the failure is *because* ti is an index. More generally, the whole concept that statistics can only be defined for certain kinds of relations has disappeared from view. I fear that users who're less deeply into Postgres hacking than we are might not have that concept at all, or at least it might not come to mind immediately when they get this message. Fixing this while avoiding your concern about proliferation of messages seems a bit difficult though. The best I can do after a couple minutes' thought is ERROR: cannot define statistics for relation "ti" DETAIL: "ti" is an index, and this operation is not supported for that kind of relation. which seems a little long and awkward. Another idea is ERROR: cannot define statistics for relation "ti" DETAIL: This operation is not supported for indexes. which still leaves implicit that "ti" is an index, but probably that's something the user can figure out. Maybe someone else can do better? regards, tom lane