Skip to content

Commit 8265769

Browse files
committed
message refinements
1 parent e24b4b2 commit 8265769

File tree

6 files changed

+65
-67
lines changed

6 files changed

+65
-67
lines changed

src/backend/catalog/heap.c

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.172 2001/08/09 18:28:16 petere Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.173 2001/08/10 15:49:39 petere Exp $
1212
*
1313
*
1414
* INTERFACE ROUTINES
@@ -202,8 +202,8 @@ heap_create(char *relname,
202202
*/
203203
if (relname && !allow_system_table_mods &&
204204
IsSystemRelationName(relname) && IsNormalProcessingMode())
205-
elog(ERROR, "Illegal class name '%s'"
206-
"\n\tThe 'pg_' name prefix is reserved for system catalogs",
205+
elog(ERROR, "invalid relation name \"%s\"; "
206+
"the 'pg_' name prefix is reserved for system catalogs",
207207
relname);
208208

209209
/*
@@ -356,8 +356,7 @@ CheckAttributeNames(TupleDesc tupdesc)
356356
if (strcmp(NameStr(SysAtt[j]->attname),
357357
NameStr(tupdesc->attrs[i]->attname)) == 0)
358358
{
359-
elog(ERROR, "Attribute '%s' has a name conflict"
360-
"\n\tName matches an existing system attribute",
359+
elog(ERROR, "name of column \"%s\" conflicts with an existing system column",
361360
NameStr(SysAtt[j]->attname));
362361
}
363362
}
@@ -379,7 +378,7 @@ CheckAttributeNames(TupleDesc tupdesc)
379378
if (strcmp(NameStr(tupdesc->attrs[j]->attname),
380379
NameStr(tupdesc->attrs[i]->attname)) == 0)
381380
{
382-
elog(ERROR, "Attribute '%s' is repeated",
381+
elog(ERROR, "column name \"%s\" is duplicated",
383382
NameStr(tupdesc->attrs[j]->attname));
384383
}
385384
}
@@ -713,8 +712,7 @@ heap_create_with_catalog(char *relname,
713712
*/
714713
Assert(IsNormalProcessingMode() || IsBootstrapProcessingMode());
715714
if (natts <= 0 || natts > MaxHeapAttributeNumber)
716-
elog(ERROR, "Number of attributes is out of range"
717-
"\n\tFrom 1 to %d attributes may be specified",
715+
elog(ERROR, "Number of columns is out of range (1 to %d)",
718716
MaxHeapAttributeNumber);
719717

720718
CheckAttributeNames(tupdesc);
@@ -1072,7 +1070,7 @@ heap_truncate(char *relname)
10721070
* anyway).
10731071
*/
10741072
if (IsTransactionBlock() && !rel->rd_myxactonly)
1075-
elog(ERROR, "TRUNCATE TABLE cannot run inside a BEGIN/END block");
1073+
elog(ERROR, "TRUNCATE TABLE cannot run inside a transaction block");
10761074

10771075
/*
10781076
* Release any buffers associated with this relation. If they're
@@ -1225,7 +1223,7 @@ DeleteTypeTuple(Relation rel)
12251223
heap_endscan(pg_type_scan);
12261224
heap_close(pg_type_desc, RowExclusiveLock);
12271225

1228-
elog(ERROR, "DeleteTypeTuple: att of type %s exists in relation %u",
1226+
elog(ERROR, "DeleteTypeTuple: column of type %s exists in relation %u",
12291227
RelationGetRelationName(rel), relid);
12301228
}
12311229
heap_endscan(pg_attribute_scan);
@@ -1638,15 +1636,15 @@ AddRelationRawConstraints(Relation rel,
16381636
* Make sure default expr does not refer to any vars.
16391637
*/
16401638
if (contain_var_clause(expr))
1641-
elog(ERROR, "Cannot use attribute(s) in DEFAULT clause");
1639+
elog(ERROR, "cannot use column references in DEFAULT clause");
16421640

16431641
/*
16441642
* No subplans or aggregates, either...
16451643
*/
16461644
if (contain_subplans(expr))
1647-
elog(ERROR, "Cannot use subselect in DEFAULT clause");
1645+
elog(ERROR, "cannot use subselects in DEFAULT clause");
16481646
if (contain_agg_clause(expr))
1649-
elog(ERROR, "Cannot use aggregate in DEFAULT clause");
1647+
elog(ERROR, "cannot use aggregate functions in DEFAULT clause");
16501648

16511649
/*
16521650
* Check that it will be possible to coerce the expression to the
@@ -1790,23 +1788,23 @@ AddRelationRawConstraints(Relation rel,
17901788
* Make sure it yields a boolean result.
17911789
*/
17921790
if (exprType(expr) != BOOLOID)
1793-
elog(ERROR, "CHECK '%s' does not yield boolean result",
1791+
elog(ERROR, "CHECK constraint expression '%s' does not yield boolean result",
17941792
ccname);
17951793

17961794
/*
17971795
* Make sure no outside relations are referred to.
17981796
*/
17991797
if (length(pstate->p_rtable) != 1)
1800-
elog(ERROR, "Only relation \"%s\" can be referenced in CHECK",
1798+
elog(ERROR, "Only relation \"%s\" can be referenced in CHECK constraint expression",
18011799
relname);
18021800

18031801
/*
18041802
* No subplans or aggregates, either...
18051803
*/
18061804
if (contain_subplans(expr))
1807-
elog(ERROR, "Cannot use subselect in CHECK clause");
1805+
elog(ERROR, "cannot use subselect in CHECK constraint expression");
18081806
if (contain_agg_clause(expr))
1809-
elog(ERROR, "Cannot use aggregate in CHECK clause");
1807+
elog(ERROR, "cannot use aggregate function in CHECK constraint expression");
18101808

18111809
/*
18121810
* Might as well try to reduce any constant expressions.

src/backend/catalog/index.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/catalog/index.c,v 1.157 2001/07/16 05:06:57 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/catalog/index.c,v 1.158 2001/08/10 15:49:39 petere Exp $
1212
*
1313
*
1414
* INTERFACE ROUTINES
@@ -111,13 +111,13 @@ GetHeapRelationOid(char *heapRelationName, char *indexRelationName, bool istemp)
111111

112112
if ((!istemp && OidIsValid(indoid)) ||
113113
(istemp && is_temp_rel_name(indexRelationName)))
114-
elog(ERROR, "Cannot create index: '%s' already exists",
114+
elog(ERROR, "index named \"%s\" already exists",
115115
indexRelationName);
116116

117117
heapoid = RelnameFindRelid(heapRelationName);
118118

119119
if (!OidIsValid(heapoid))
120-
elog(ERROR, "Cannot create index on '%s': relation does not exist",
120+
elog(ERROR, "cannot create index on non-existent relation \"%s\"",
121121
heapRelationName);
122122

123123
return heapoid;
@@ -237,7 +237,7 @@ ConstructTupleDescriptor(Relation heapRelation,
237237
* here we are indexing on a normal attribute (1...n)
238238
*/
239239
if (atnum > natts)
240-
elog(ERROR, "Cannot create index: attribute %d does not exist",
240+
elog(ERROR, "cannot create index: column %d does not exist",
241241
atnum);
242242

243243
from = heapTupDesc->attrs[AttrNumberGetAttrOffset(atnum)];
@@ -686,7 +686,7 @@ index_create(char *heapRelationName,
686686
*/
687687
if (indexInfo->ii_NumIndexAttrs < 1 ||
688688
indexInfo->ii_NumKeyAttrs < 1)
689-
elog(ERROR, "must index at least one attribute");
689+
elog(ERROR, "must index at least one column");
690690

691691
if (heapRelationName && !allow_system_table_mods &&
692692
IsSystemRelationName(heapRelationName) && IsNormalProcessingMode())
@@ -1856,7 +1856,7 @@ reindex_index(Oid indexId, bool force, bool inplace)
18561856
* of the index's physical file. Disallow it.
18571857
*/
18581858
if (IsTransactionBlock())
1859-
elog(ERROR, "REINDEX cannot run inside a BEGIN/END block");
1859+
elog(ERROR, "REINDEX cannot run inside a transaction block");
18601860

18611861
old = SetReindexProcessing(true);
18621862

src/backend/catalog/pg_aggregate.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/catalog/pg_aggregate.c,v 1.38 2001/03/22 03:59:20 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/catalog/pg_aggregate.c,v 1.39 2001/08/10 15:49:39 petere Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -72,10 +72,10 @@ AggregateCreate(char *aggName,
7272

7373
/* sanity checks */
7474
if (!aggName)
75-
elog(ERROR, "AggregateCreate: no aggregate name supplied");
75+
elog(ERROR, "no aggregate name supplied");
7676

7777
if (!aggtransfnName)
78-
elog(ERROR, "AggregateCreate: aggregate must have a transition function");
78+
elog(ERROR, "aggregate must have a transition function");
7979

8080
/*
8181
* Handle the aggregate's base type (input data type). This can be
@@ -88,7 +88,7 @@ AggregateCreate(char *aggName,
8888
if (!OidIsValid(basetype))
8989
{
9090
if (strcasecmp(aggbasetypeName, "ANY") != 0)
91-
elog(ERROR, "AggregateCreate: Type '%s' undefined",
91+
elog(ERROR, "data type %s does not exist",
9292
aggbasetypeName);
9393
basetype = InvalidOid;
9494
}
@@ -99,15 +99,15 @@ AggregateCreate(char *aggName,
9999
ObjectIdGetDatum(basetype),
100100
0, 0))
101101
elog(ERROR,
102-
"AggregateCreate: aggregate '%s' with base type '%s' already exists",
102+
"aggregate function \"%s\" with base type %s already exists",
103103
aggName, aggbasetypeName);
104104

105105
/* handle transtype */
106106
transtype = GetSysCacheOid(TYPENAME,
107107
PointerGetDatum(aggtranstypeName),
108108
0, 0, 0);
109109
if (!OidIsValid(transtype))
110-
elog(ERROR, "AggregateCreate: Type '%s' undefined",
110+
elog(ERROR, "data type %s does not exit",
111111
aggtranstypeName);
112112

113113
/* handle transfn */
@@ -130,7 +130,7 @@ AggregateCreate(char *aggName,
130130
Assert(OidIsValid(transfn));
131131
proc = (Form_pg_proc) GETSTRUCT(tup);
132132
if (proc->prorettype != transtype)
133-
elog(ERROR, "AggregateCreate: return type of '%s' is not '%s'",
133+
elog(ERROR, "return type of transition function %s is not %s",
134134
aggtransfnName, aggtranstypeName);
135135

136136
/*
@@ -143,7 +143,7 @@ AggregateCreate(char *aggName,
143143
{
144144
if (basetype != transtype &&
145145
!IS_BINARY_COMPATIBLE(basetype, transtype))
146-
elog(ERROR, "AggregateCreate: must not omit initval when transfn is strict and transtype is not compatible with input type");
146+
elog(ERROR, "must not omit initval when transfn is strict and transtype is not compatible with input type");
147147
}
148148
ReleaseSysCache(tup);
149149

src/backend/catalog/pg_operator.c

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/catalog/pg_operator.c,v 1.60 2001/07/15 22:48:17 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/catalog/pg_operator.c,v 1.61 2001/08/10 15:49:39 petere Exp $
1212
*
1313
* NOTES
1414
* these routines moved here from commands/define.c and somewhat cleaned up.
@@ -174,22 +174,22 @@ OperatorGet(char *operatorName,
174174
leftObjectId = TypeGet(leftTypeName, &leftDefined);
175175

176176
if (!OidIsValid(leftObjectId) || !leftDefined)
177-
elog(ERROR, "OperatorGet: left type \"%s\" does not exist",
178-
leftTypeName);
177+
elog(ERROR, "left type \"%s\" of operator %s does not exist",
178+
leftTypeName, operatorName);
179179
}
180180

181181
if (rightTypeName)
182182
{
183183
rightObjectId = TypeGet(rightTypeName, &rightDefined);
184184

185185
if (!OidIsValid(rightObjectId) || !rightDefined)
186-
elog(ERROR, "OperatorGet: right type \"%s\" does not exist",
187-
rightTypeName);
186+
elog(ERROR, "right type \"%s\" of operator %s does not exist",
187+
rightTypeName, operatorName);
188188
}
189189

190190
if (!((OidIsValid(leftObjectId) && leftDefined) ||
191191
(OidIsValid(rightObjectId) && rightDefined)))
192-
elog(ERROR, "OperatorGet: must have at least one argument type");
192+
elog(ERROR, "operator %s must have at least one operand type", operatorName);
193193

194194
/*
195195
* open the pg_operator relation
@@ -330,7 +330,7 @@ OperatorShellMake(char *operatorName,
330330

331331
if (!((OidIsValid(leftObjectId) && leftDefined) ||
332332
(OidIsValid(rightObjectId) && rightDefined)))
333-
elog(ERROR, "OperatorShellMake: no valid argument types??");
333+
elog(ERROR, "OperatorShellMake: the operand types are not valid");
334334

335335
/*
336336
* open pg_operator
@@ -494,7 +494,7 @@ OperatorDef(char *operatorName,
494494
leftTypeId = TypeGet(leftTypeName, &leftDefined);
495495

496496
if (!OidIsValid(leftTypeId) || !leftDefined)
497-
elog(ERROR, "OperatorDef: left type \"%s\" does not exist",
497+
elog(ERROR, "left type \"%s\" does not exist",
498498
leftTypeName);
499499
}
500500

@@ -503,13 +503,13 @@ OperatorDef(char *operatorName,
503503
rightTypeId = TypeGet(rightTypeName, &rightDefined);
504504

505505
if (!OidIsValid(rightTypeId) || !rightDefined)
506-
elog(ERROR, "OperatorDef: right type \"%s\" does not exist",
506+
elog(ERROR, "right type \"%s\" does not exist",
507507
rightTypeName);
508508
}
509509

510510
if (!((OidIsValid(leftTypeId) && leftDefined) ||
511511
(OidIsValid(rightTypeId) && rightDefined)))
512-
elog(ERROR, "OperatorDef: must have at least one argument type");
512+
elog(ERROR, "operator must have at least one operand type");
513513

514514
for (i = 0; i < Natts_pg_operator; ++i)
515515
{
@@ -717,7 +717,7 @@ OperatorDef(char *operatorName,
717717
*/
718718
if (j != 0)
719719
elog(ERROR,
720-
"OperatorDef: operator can't be its own negator or sort op");
720+
"operator cannot be its own negator or sort operator");
721721
selfCommutator = true;
722722
values[i++] = ObjectIdGetDatum(InvalidOid);
723723
}
@@ -772,7 +772,7 @@ OperatorDef(char *operatorName,
772772
simple_heap_update(pg_operator_desc, &tup->t_self, tup);
773773
}
774774
else
775-
elog(ERROR, "OperatorDef: no operator %u", operatorObjectId);
775+
elog(ERROR, "OperatorDef: operator %u not found", operatorObjectId);
776776

777777
heap_endscan(pg_operator_scan);
778778
}
@@ -1023,19 +1023,19 @@ OperatorCreate(char *operatorName,
10231023
char *rightSortName)
10241024
{
10251025
if (!leftTypeName && !rightTypeName)
1026-
elog(ERROR, "OperatorCreate: at least one of leftarg or rightarg must be defined");
1026+
elog(ERROR, "at least one of leftarg or rightarg must be specified");
10271027

10281028
if (!(leftTypeName && rightTypeName))
10291029
{
10301030
/* If it's not a binary op, these things mustn't be set: */
10311031
if (commutatorName)
1032-
elog(ERROR, "OperatorCreate: only binary operators can have commutators");
1032+
elog(ERROR, "only binary operators can have commutators");
10331033
if (joinName)
1034-
elog(ERROR, "OperatorCreate: only binary operators can have join selectivity");
1034+
elog(ERROR, "only binary operators can have join selectivity");
10351035
if (canHash)
1036-
elog(ERROR, "OperatorCreate: only binary operators can hash");
1036+
elog(ERROR, "only binary operators can hash");
10371037
if (leftSortName || rightSortName)
1038-
elog(ERROR, "OperatorCreate: only binary operators can have sort links");
1038+
elog(ERROR, "only binary operators can have sort links");
10391039
}
10401040

10411041
/*

0 commit comments

Comments
 (0)