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

Commit36a14af

Browse files
committed
Make some error strings more generic
It's undesirable to have SQL commands or configuration options in atranslatable error string, so take some of these out.
1 parent41da94f commit36a14af

File tree

3 files changed

+33
-12
lines changed

3 files changed

+33
-12
lines changed

‎src/backend/commands/collationcmds.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -250,19 +250,22 @@ DefineCollation(ParseState *pstate, List *names, List *parameters, bool if_not_e
250250
if (!collcollate)
251251
ereport(ERROR,
252252
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
253-
errmsg("parameter \"lc_collate\" must be specified")));
253+
errmsg("parameter \"%s\" must be specified",
254+
"lc_collate")));
254255

255256
if (!collctype)
256257
ereport(ERROR,
257258
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
258-
errmsg("parameter \"lc_ctype\" must be specified")));
259+
errmsg("parameter \"%s\" must be specified",
260+
"lc_ctype")));
259261
}
260262
elseif (collprovider==COLLPROVIDER_ICU)
261263
{
262264
if (!colliculocale)
263265
ereport(ERROR,
264266
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
265-
errmsg("parameter \"locale\" must be specified")));
267+
errmsg("parameter \"%s\" must be specified",
268+
"locale")));
266269

267270
/*
268271
* During binary upgrade, preserve the locale string. Otherwise,
@@ -416,7 +419,9 @@ AlterCollation(AlterCollationStmt *stmt)
416419
if (collOid==DEFAULT_COLLATION_OID)
417420
ereport(ERROR,
418421
(errmsg("cannot refresh version of default collation"),
419-
errhint("Use ALTER DATABASE ... REFRESH COLLATION VERSION instead.")));
422+
/* translator: %s is an SQL command */
423+
errhint("Use %s instead.",
424+
"ALTER DATABASE ... REFRESH COLLATION VERSION")));
420425

421426
if (!object_ownercheck(CollationRelationId,collOid,GetUserId()))
422427
aclcheck_error(ACLCHECK_NOT_OWNER,OBJECT_COLLATION,

‎src/backend/commands/tablecmds.c

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7996,15 +7996,19 @@ ATExecColumnDefault(Relation rel, const char *colName,
79967996
(errcode(ERRCODE_SYNTAX_ERROR),
79977997
errmsg("column \"%s\" of relation \"%s\" is an identity column",
79987998
colName, RelationGetRelationName(rel)),
7999-
newDefault ? 0 : errhint("Use ALTER TABLE ... ALTER COLUMN ... DROP IDENTITY instead.")));
7999+
/* translator: %s is an SQL ALTER command */
8000+
newDefault ? 0 : errhint("Use %s instead.",
8001+
"ALTER TABLE ... ALTER COLUMN ... DROP IDENTITY")));
80008002

80018003
if (TupleDescAttr(tupdesc, attnum - 1)->attgenerated)
80028004
ereport(ERROR,
80038005
(errcode(ERRCODE_SYNTAX_ERROR),
80048006
errmsg("column \"%s\" of relation \"%s\" is a generated column",
80058007
colName, RelationGetRelationName(rel)),
80068008
newDefault || TupleDescAttr(tupdesc, attnum - 1)->attgenerated != ATTRIBUTE_GENERATED_STORED ? 0 :
8007-
errhint("Use ALTER TABLE ... ALTER COLUMN ... DROP EXPRESSION instead.")));
8009+
/* translator: %s is an SQL ALTER command */
8010+
errhint("Use %s instead.",
8011+
"ALTER TABLE ... ALTER COLUMN ... DROP EXPRESSION")));
80088012

80098013
/*
80108014
* Remove any old default for the column. We use RESTRICT here for
@@ -14534,7 +14538,9 @@ ATExecChangeOwner(Oid relationOid, Oid newOwnerId, bool recursing, LOCKMODE lock
1453414538
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
1453514539
errmsg("\"%s\" is a composite type",
1453614540
NameStr(tuple_class->relname)),
14537-
errhint("Use ALTER TYPE instead.")));
14541+
/* translator: %s is an SQL ALTER command */
14542+
errhint("Use %s instead.",
14543+
"ALTER TYPE")));
1453814544
break;
1453914545
case RELKIND_TOASTVALUE:
1454014546
if (recursing)
@@ -17942,7 +17948,9 @@ RangeVarCallbackForAlterRelation(const RangeVar *rv, Oid relid, Oid oldrelid,
1794217948
ereport(ERROR,
1794317949
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
1794417950
errmsg("\"%s\" is a composite type", rv->relname),
17945-
errhint("Use ALTER TYPE instead.")));
17951+
/* translator: %s is an SQL ALTER command */
17952+
errhint("Use %s instead.",
17953+
"ALTER TYPE")));
1794617954

1794717955
/*
1794817956
* Don't allow ALTER TABLE .. SET SCHEMA on relations that can't be moved
@@ -17961,7 +17969,9 @@ RangeVarCallbackForAlterRelation(const RangeVar *rv, Oid relid, Oid oldrelid,
1796117969
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
1796217970
errmsg("cannot change schema of composite type \"%s\"",
1796317971
rv->relname),
17964-
errhint("Use ALTER TYPE instead.")));
17972+
/* translator: %s is an SQL ALTER command */
17973+
errhint("Use %s instead.",
17974+
"ALTER TYPE")));
1796517975
else if (relkind == RELKIND_TOASTVALUE)
1796617976
ereport(ERROR,
1796717977
(errcode(ERRCODE_WRONG_OBJECT_TYPE),

‎src/backend/commands/typecmds.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3633,7 +3633,9 @@ RenameType(RenameStmt *stmt)
36333633
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
36343634
errmsg("%s is a table's row type",
36353635
format_type_be(typeOid)),
3636-
errhint("Use ALTER TABLE instead.")));
3636+
/* translator: %s is an SQL ALTER command */
3637+
errhint("Use %s instead.",
3638+
"ALTER TABLE")));
36373639

36383640
/* don't allow direct alteration of array types, either */
36393641
if (IsTrueArrayType(typTup))
@@ -3714,7 +3716,9 @@ AlterTypeOwner(List *names, Oid newOwnerId, ObjectType objecttype)
37143716
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
37153717
errmsg("%s is a table's row type",
37163718
format_type_be(typeOid)),
3717-
errhint("Use ALTER TABLE instead.")));
3719+
/* translator: %s is an SQL ALTER command */
3720+
errhint("Use %s instead.",
3721+
"ALTER TABLE")));
37183722

37193723
/* don't allow direct alteration of array types, either */
37203724
if (IsTrueArrayType(typTup))
@@ -4005,7 +4009,9 @@ AlterTypeNamespaceInternal(Oid typeOid, Oid nspOid,
40054009
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
40064010
errmsg("%s is a table's row type",
40074011
format_type_be(typeOid)),
4008-
errhint("Use ALTER TABLE instead.")));
4012+
/* translator: %s is an SQL ALTER command */
4013+
errhint("Use %s instead.",
4014+
"ALTER TABLE")));
40094015

40104016
if (oldNspOid!=nspOid)
40114017
{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp