Re: BUG #18449: Altering column type fails when an SQL routine depends on the column - Mailing list pgsql-bugs

From Alexander Lakhin
Subject Re: BUG #18449: Altering column type fails when an SQL routine depends on the column
Date
Msg-id 95a01e66-0c92-2ff6-b243-849ddd11685d@gmail.com
Whole thread Raw
In response to Re: BUG #18449: Altering column type fails when an SQL routine depends on the column  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: BUG #18449: Altering column type fails when an SQL routine depends on the column
List pgsql-bugs
01.05.2024 17:08, Tom Lane wrote:
> 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.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.

Best regards,
Alexander



pgsql-bugs by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: BUG #18433: Logical replication timeout
Next
From: Kostiantyn Tomakh
Date:
Subject: Re: BUG #18433: Logical replication timeout