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 1jOVii-0004uv-HF for pgsql-hackers@arkaria.postgresql.org; Wed, 15 Apr 2020 00:16:00 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jOVig-00025J-BK for pgsql-hackers@arkaria.postgresql.org; Wed, 15 Apr 2020 00:15:58 +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 1jOVig-00025C-49 for pgsql-hackers@lists.postgresql.org; Wed, 15 Apr 2020 00:15:58 +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 1jOVid-0005Zn-SD for pgsql-hackers@postgresql.org; Wed, 15 Apr 2020 00:15:57 +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 03F0Frs1010406; Tue, 14 Apr 2020 20:15:53 -0400 From: Tom Lane To: Alvaro Herrera cc: Robert Haas , Peter Eisentraut , pgsql-hackers Subject: Re: wrong relkind error messages In-reply-to: <20200414230208.GA27948@alvherre.pgsql> References: <20200414230208.GA27948@alvherre.pgsql> Comments: In-reply-to Alvaro Herrera message dated "Tue, 14 Apr 2020 19:02:08 -0400" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <10404.1586909753.1@sss.pgh.pa.us> Date: Tue, 14 Apr 2020 20:15:53 -0400 Message-ID: <10405.1586909753@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Alvaro Herrera writes: > On 2020-Apr-13, Robert Haas wrote: >> + ereport(ERROR, >> + (errcode(ERRCODE_WRONG_OBJECT_TYPE), >> + errmsg("action cannot be performed on relation \"%s\"", >> + RelationGetRelationName(rel)), >> >> Super-vague. > Maybe, but note that the patch proposed to replace this current error > message: > ERROR: foo is not an index or foreign table > ... > so it's not like this is making things any worse; the error was already > super-vague. Yeah. I share Robert's feeling that "action" is not really desirable here, but I have to concur that this is an improvement on the existing text, which also fails to mention what command is being rejected. > This could be improved if we had stringification of ALTER TABLE > subcommand types: > ERROR: ALTER TABLE ... ADD COLUMN cannot be performed on "foo" In the meantime could we at least say "ALTER TABLE action cannot be performed"? The worst aspect of the existing text is that if an error comes out of a script with a lot of different commands, it doesn't give you any hint at all about which command failed. regards, tom lane