From: Tom Lane <tgl@sss.pgh.pa.us>
To: Alexander Lakhin <exclusion@gmail.com>
Cc: pgsql-bugs@lists.postgresql.org, Alvaro Herrera <alvherre@alvh.no-ip.org>
Cc: Peter Eisentraut <peter.eisentraut@enterprisedb.com>
Subject: Re: BUG #18449: Altering column type fails when an SQL routine depends on the column
Date: Thu, 02 May 2024 17:16:10 -0400
Message-ID: <2292717.1714684570@sss.pgh.pa.us> (raw)
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>
Alexander Lakhin <exclusion@gmail.com> 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-bugs@postgresql.org
Cc: tgl@sss.pgh.pa.us, exclusion@gmail.com, alvherre@alvh.no-ip.org, peter.eisentraut@enterprisedb.com
Subject: Re: BUG #18449: Altering column type fails when an SQL routine depends on the column
In-Reply-To: <2292717.1714684570@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox