Re: BUG #18449: Altering column type fails when an SQL routine depends on the column
От | Alexander Lakhin |
---|---|
Тема | Re: BUG #18449: Altering column type fails when an SQL routine depends on the column |
Дата | |
Msg-id | 95a01e66-0c92-2ff6-b243-849ddd11685d@gmail.com обсуждение исходный текст |
Ответ на | Re: BUG #18449: Altering column type fails when an SQL routine depends on the column (Tom Lane <tgl@sss.pgh.pa.us>) |
Ответы |
Re: BUG #18449: Altering column type fails when an SQL routine depends on the column
|
Список | 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 по дате отправления: