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 1s2Adj-000cuv-K0 for pgsql-bugs@arkaria.postgresql.org; Wed, 01 May 2024 14:08:55 +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 1s2Adf-00Cp9g-Gq for pgsql-bugs@arkaria.postgresql.org; Wed, 01 May 2024 14:08:52 +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 1s2Adf-00Cp9Y-8T for pgsql-bugs@lists.postgresql.org; Wed, 01 May 2024 14:08:52 +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 1s2Adc-0011T7-VZ for pgsql-bugs@lists.postgresql.org; Wed, 01 May 2024 14:08:51 +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 441E8hCs1944627; Wed, 1 May 2024 10:08:43 -0400 From: Tom Lane To: Alexander Lakhin cc: pgsql-bugs@lists.postgresql.org, Peter Eisentraut Subject: Re: BUG #18449: Altering column type fails when an SQL routine depends on the column In-reply-to: <548a47bc-87ae-b3df-c6a2-60b9966f808b@gmail.com> References: <18449-f8248467aaa294d5@postgresql.org> <403599.1714268901@sss.pgh.pa.us> <548a47bc-87ae-b3df-c6a2-60b9966f808b@gmail.com> Comments: In-reply-to Alexander Lakhin message dated "Wed, 01 May 2024 16:00:00 +0300" MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <1944625.1714572523.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Wed, 01 May 2024 10:08:43 -0400 Message-ID: <1944626.1714572523@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Alexander Lakhin writes: > I've discovered one more case, presumably as hard as the other ones: > CREATE TABLE t(a int); > CREATE PUBLICATION p FOR TABLE t WHERE (a > 0); > ALTER TABLE t ALTER COLUMN a TYPE bigint; > fails with: > ERROR:=C2=A0 unexpected object depending on column: publication of table= t in publication p Hm. We could fix this by introducing another single-purpose error report, but I'm starting to think that that's failing to learn from experience. Who's to say that other column dependencies aren't possible, now or in the future? The only thing stopping us from treating the default: case as a normal ERRCODE_FEATURE_NOT_SUPPORTED error is that it might be hard to phrase the error message in a nice way. We already have a precedent for this being an acceptable errdetail: ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("cannot alter type of a column used in= a policy definition"), errdetail("%s depends on column \"%s\"", getObjectDescription(&foundObject, = false), colName))); 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.cla= ssid)), This'd fall foul of English a/an grammar rules for some object class names, so maybe we should phrase it a bit differently; but I'm sure translated messages commit worse grammar violations all the time. regards, tom lane