Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1s2dn1-004iha-LQ for pgsql-bugs@arkaria.postgresql.org; Thu, 02 May 2024 21:16:27 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1s2dmy-003ZAi-1t for pgsql-bugs@arkaria.postgresql.org; Thu, 02 May 2024 21:16:24 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1s2dmx-003ZAZ-Pm for pgsql-bugs@lists.postgresql.org; Thu, 02 May 2024 21:16:24 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1s2dms-001EIj-3b for pgsql-bugs@lists.postgresql.org; Thu, 02 May 2024 21:16:24 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 442LGAne2292718; Thu, 2 May 2024 17:16:11 -0400 From: Tom Lane To: Alexander Lakhin cc: pgsql-bugs@lists.postgresql.org, Alvaro Herrera , Peter Eisentraut Subject: Re: BUG #18449: Altering column type fails when an SQL routine depends on the column In-reply-to: <95a01e66-0c92-2ff6-b243-849ddd11685d@gmail.com> References: <18449-f8248467aaa294d5@postgresql.org> <403599.1714268901@sss.pgh.pa.us> <548a47bc-87ae-b3df-c6a2-60b9966f808b@gmail.com> <1944626.1714572523@sss.pgh.pa.us> <95a01e66-0c92-2ff6-b243-849ddd11685d@gmail.com> Comments: In-reply-to Alexander Lakhin message dated "Thu, 02 May 2024 07:00:00 +0300" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2292716.1714684570.1@sss.pgh.pa.us> Date: Thu, 02 May 2024 17:16:10 -0400 Message-ID: <2292717.1714684570@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Alexander Lakhin writes: > 01.05.2024 17:08, Tom Lane wrote: >> It doesn't seem too awful to me to write the errmsg as >> errmsg("cannot alter type of a column used in a %s", >> get_object_class_descr(foundObject.classId)), > I agree, though by doing that we'll loose the ability to detect obviously > wrong dependencies, say, when a role depends on a table column (if > INTERNAL_ERRORs expected to be handled as something abnormal), > but ATExecAlterColumnType() is hardly an appropriate place for such > detection anyway. So I would sacrifice this ability to make this function > simpler now and in the future. I tried that, and it fell over on your example: regression=# ALTER TABLE t ALTER COLUMN a TYPE bigint; ERROR: unrecognized class ID: 6106 6106 is pg_publication_rel, and apparently get_object_class_descr's ambitions don't go far enough to include that. Perhaps that should be fixed, because if we have dependencies with that classId then eventually somebody is going to wish to print debugging messages about them. However, that's probably not a project to undertake right now with a release deadline looming. For today, I'll just do something exactly like 42b041243, except for publications. regards, tom lane