Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit9a8b731

Browse files
committed
Clean up overly complex code for issuing some related error messages.
The original version was unreadable, and not mechanically checkableeither.
1 parent1174536 commit9a8b731

File tree

1 file changed

+26
-15
lines changed

1 file changed

+26
-15
lines changed

‎src/backend/commands/tablecmds.c

Lines changed: 26 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3944,23 +3944,34 @@ find_composite_type_dependencies(Oid typeOid, Relation origRelation,
39443944

39453945
if (rel->rd_rel->relkind==RELKIND_RELATION)
39463946
{
3947-
constchar*msg;
3948-
3949-
if (origTypeName
3950-
||origRelation->rd_rel->relkind==RELKIND_COMPOSITE_TYPE)
3951-
msg=gettext_noop("cannot alter type \"%s\" because column \"%s\".\"%s\" uses it");
3947+
if (origTypeName)
3948+
ereport(ERROR,
3949+
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
3950+
errmsg("cannot alter type \"%s\" because column \"%s\".\"%s\" uses it",
3951+
origTypeName,
3952+
RelationGetRelationName(rel),
3953+
NameStr(att->attname))));
3954+
elseif (origRelation->rd_rel->relkind==RELKIND_COMPOSITE_TYPE)
3955+
ereport(ERROR,
3956+
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
3957+
errmsg("cannot alter type \"%s\" because column \"%s\".\"%s\" uses it",
3958+
RelationGetRelationName(origRelation),
3959+
RelationGetRelationName(rel),
3960+
NameStr(att->attname))));
39523961
elseif (origRelation->rd_rel->relkind==RELKIND_FOREIGN_TABLE)
3953-
msg=gettext_noop("cannot alter foreign table \"%s\" because column \"%s\".\"%s\" uses its rowtype");
3962+
ereport(ERROR,
3963+
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
3964+
errmsg("cannot alter foreign table \"%s\" because column \"%s\".\"%s\" uses its rowtype",
3965+
RelationGetRelationName(origRelation),
3966+
RelationGetRelationName(rel),
3967+
NameStr(att->attname))));
39543968
else
3955-
msg=gettext_noop("cannot alter table \"%s\" because column \"%s\".\"%s\" uses its rowtype");
3956-
3957-
ereport(ERROR,
3958-
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
3959-
errmsg(msg,
3960-
origTypeName ?origTypeName
3961-
:RelationGetRelationName(origRelation),
3962-
RelationGetRelationName(rel),
3963-
NameStr(att->attname))));
3969+
ereport(ERROR,
3970+
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
3971+
errmsg("cannot alter table \"%s\" because column \"%s\".\"%s\" uses its rowtype",
3972+
RelationGetRelationName(origRelation),
3973+
RelationGetRelationName(rel),
3974+
NameStr(att->attname))));
39643975
}
39653976
elseif (OidIsValid(rel->rd_rel->reltype))
39663977
{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp