Commit 70600bd6 authored by Thomas G. Lockhart's avatar Thomas G. Lockhart

Clean up error messages.

parent 681c587d
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.74 1999/02/13 23:14:55 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.75 1999/02/23 07:54:03 thomas Exp $
* *
* *
* INTERFACE ROUTINES * INTERFACE ROUTINES
...@@ -197,8 +197,8 @@ heap_create(char *relname, ...@@ -197,8 +197,8 @@ heap_create(char *relname,
if (relname && IsSystemRelationName(relname) && IsNormalProcessingMode()) if (relname && IsSystemRelationName(relname) && IsNormalProcessingMode())
{ {
elog(ERROR, elog(ERROR, "Illegal class name '%s'"
"Illegal class name: %s -- pg_ is reserved for system catalogs", "\n\tThe 'pg_' name prefix is reserved for system catalogs",
relname); relname);
} }
...@@ -427,15 +427,15 @@ CheckAttributeNames(TupleDesc tupdesc) ...@@ -427,15 +427,15 @@ CheckAttributeNames(TupleDesc tupdesc)
if (nameeq(&(HeapAtt[j]->attname), if (nameeq(&(HeapAtt[j]->attname),
&(tupdesc->attrs[i]->attname))) &(tupdesc->attrs[i]->attname)))
{ {
elog(ERROR, elog(ERROR, "Attribute '%s' has a name conflict"
"create: system attribute named \"%s\"", "\n\tName matches an existing system attribute",
HeapAtt[j]->attname.data); HeapAtt[j]->attname.data);
} }
} }
if (tupdesc->attrs[i]->atttypid == UNKNOWNOID) if (tupdesc->attrs[i]->atttypid == UNKNOWNOID)
{ {
elog(NOTICE, elog(NOTICE, "Attribute '%s' has an unknown type"
"create: attribute named \"%s\" has an unknown type", "\n\tRelation created; continue",
tupdesc->attrs[i]->attname.data); tupdesc->attrs[i]->attname.data);
} }
} }
...@@ -451,8 +451,7 @@ CheckAttributeNames(TupleDesc tupdesc) ...@@ -451,8 +451,7 @@ CheckAttributeNames(TupleDesc tupdesc)
if (nameeq(&(tupdesc->attrs[j]->attname), if (nameeq(&(tupdesc->attrs[j]->attname),
&(tupdesc->attrs[i]->attname))) &(tupdesc->attrs[i]->attname)))
{ {
elog(ERROR, elog(ERROR, "Attribute '%s' is repeated",
"create: repeated attribute \"%s\"",
tupdesc->attrs[j]->attname.data); tupdesc->attrs[j]->attname.data);
} }
} }
...@@ -774,7 +773,8 @@ heap_create_with_catalog(char *relname, ...@@ -774,7 +773,8 @@ heap_create_with_catalog(char *relname,
*/ */
Assert(IsNormalProcessingMode() || IsBootstrapProcessingMode()); Assert(IsNormalProcessingMode() || IsBootstrapProcessingMode());
if (natts == 0 || natts > MaxHeapAttributeNumber) if (natts == 0 || natts > MaxHeapAttributeNumber)
elog(ERROR, "amcreate: from 1 to %d attributes must be specified", elog(ERROR, "Number of attributes is out of range"
"\n\tFrom 1 to %d attributes may be specified",
MaxHeapAttributeNumber); MaxHeapAttributeNumber);
CheckAttributeNames(tupdesc); CheckAttributeNames(tupdesc);
...@@ -782,7 +782,7 @@ heap_create_with_catalog(char *relname, ...@@ -782,7 +782,7 @@ heap_create_with_catalog(char *relname,
/* temp tables can mask non-temp tables */ /* temp tables can mask non-temp tables */
if ((!istemp && RelnameFindRelid(relname)) || if ((!istemp && RelnameFindRelid(relname)) ||
(istemp && get_temp_rel_by_name(relname) != NULL)) (istemp && get_temp_rel_by_name(relname) != NULL))
elog(ERROR, "%s relation already exists", relname); elog(ERROR, "Relation '%s' already exists", relname);
/* invalidate cache so non-temp table is masked by temp */ /* invalidate cache so non-temp table is masked by temp */
if (istemp) if (istemp)
...@@ -951,7 +951,7 @@ RelationRemoveInheritance(Relation relation) ...@@ -951,7 +951,7 @@ RelationRemoveInheritance(Relation relation)
heap_endscan(scan); heap_endscan(scan);
heap_close(catalogRelation); heap_close(catalogRelation);
elog(ERROR, "relation <%d> inherits \"%s\"", elog(ERROR, "Relation '%d' inherits '%s'",
((Form_pg_inherits) GETSTRUCT(tuple))->inhrel, ((Form_pg_inherits) GETSTRUCT(tuple))->inhrel,
RelationGetRelationName(relation)); RelationGetRelationName(relation));
} }
...@@ -1054,7 +1054,7 @@ DeleteRelationTuple(Relation rel) ...@@ -1054,7 +1054,7 @@ DeleteRelationTuple(Relation rel)
if (!HeapTupleIsValid(tup)) if (!HeapTupleIsValid(tup))
{ {
heap_close(pg_class_desc); heap_close(pg_class_desc);
elog(ERROR, "DeleteRelationTuple: %s relation nonexistent", elog(ERROR, "Relation '%s' does not exist",
&rel->rd_rel->relname); &rel->rd_rel->relname);
} }
...@@ -1250,7 +1250,7 @@ heap_destroy_with_catalog(char *relname) ...@@ -1250,7 +1250,7 @@ heap_destroy_with_catalog(char *relname)
*/ */
rel = heap_openr(relname); rel = heap_openr(relname);
if (rel == NULL) if (rel == NULL)
elog(ERROR, "Relation %s Does Not Exist!", relname); elog(ERROR, "Relation '%s' does not exist", relname);
LockRelation(rel, AccessExclusiveLock); LockRelation(rel, AccessExclusiveLock);
rid = rel->rd_id; rid = rel->rd_id;
...@@ -1261,7 +1261,7 @@ heap_destroy_with_catalog(char *relname) ...@@ -1261,7 +1261,7 @@ heap_destroy_with_catalog(char *relname)
*/ */
/* allow temp of pg_class? Guess so. */ /* allow temp of pg_class? Guess so. */
if (!istemp && IsSystemRelationName(RelationGetRelationName(rel)->data)) if (!istemp && IsSystemRelationName(RelationGetRelationName(rel)->data))
elog(ERROR, "amdestroy: cannot destroy %s relation", elog(ERROR, "System relation '%s' cannot be destroyed",
&rel->rd_rel->relname); &rel->rd_rel->relname);
/* ---------------- /* ----------------
...@@ -1505,7 +1505,7 @@ start:; ...@@ -1505,7 +1505,7 @@ start:;
if (length(query->rtable) > 1 || if (length(query->rtable) > 1 ||
flatten_tlist(query->targetList) != NIL) flatten_tlist(query->targetList) != NIL)
elog(ERROR, "DEFAULT: cannot use attribute(s)"); elog(ERROR, "Cannot use attribute(s) in DEFAULT clause");
te = (TargetEntry *) lfirst(query->targetList); te = (TargetEntry *) lfirst(query->targetList);
resdom = te->resdom; resdom = te->resdom;
expr = te->expr; expr = te->expr;
...@@ -1585,7 +1585,7 @@ StoreRelCheck(Relation rel, ConstrCheck *check) ...@@ -1585,7 +1585,7 @@ StoreRelCheck(Relation rel, ConstrCheck *check)
query = (Query *) (queryTree_list->qtrees[0]); query = (Query *) (queryTree_list->qtrees[0]);
if (length(query->rtable) > 1) if (length(query->rtable) > 1)
elog(ERROR, "CHECK: only relation %.*s can be referenced", elog(ERROR, "Only relation '%.*s' can be referenced",
NAMEDATALEN, rel->rd_rel->relname.data); NAMEDATALEN, rel->rd_rel->relname.data);
plan = (Plan *) lfirst(planTree_list); plan = (Plan *) lfirst(planTree_list);
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/parse_relation.c,v 1.18 1999/02/21 03:49:03 scrappy Exp $ * $Header: /cvsroot/pgsql/src/backend/parser/parse_relation.c,v 1.19 1999/02/23 07:53:01 thomas Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -157,7 +157,7 @@ colnameRangeTableEntry(ParseState *pstate, char *colname) ...@@ -157,7 +157,7 @@ colnameRangeTableEntry(ParseState *pstate, char *colname)
{ {
if (!pstate->p_is_insert || if (!pstate->p_is_insert ||
rte != pstate->p_target_rangetblentry) rte != pstate->p_target_rangetblentry)
elog(ERROR, "Column %s is ambiguous", colname); elog(ERROR, "Column '%s' is ambiguous", colname);
} }
else else
rte_result = rte; rte_result = rte;
...@@ -198,7 +198,7 @@ addRangeTableEntry(ParseState *pstate, ...@@ -198,7 +198,7 @@ addRangeTableEntry(ParseState *pstate,
return (RangeTblEntry *) nth(rt_index - 1, pstate->p_rtable); return (RangeTblEntry *) nth(rt_index - 1, pstate->p_rtable);
} }
elog(ERROR, "Table name %s specified more than once", refname); elog(ERROR, "Table name '%s' specified more than once", refname);
} }
} }
...@@ -317,7 +317,7 @@ attnameAttNum(Relation rd, char *a) ...@@ -317,7 +317,7 @@ attnameAttNum(Relation rd, char *a)
return special_attr[i].code; return special_attr[i].code;
/* on failure */ /* on failure */
elog(ERROR, "Relation %s does not have attribute %s", elog(ERROR, "Relation '%s' does not have attribute '%s'",
RelationGetRelationName(rd), a); RelationGetRelationName(rd), a);
return 0; /* lint */ return 0; /* lint */
} }
...@@ -396,7 +396,7 @@ handleTargetColname(ParseState *pstate, char **resname, ...@@ -396,7 +396,7 @@ handleTargetColname(ParseState *pstate, char **resname,
pstate->p_insert_columns = lnext(pstate->p_insert_columns); pstate->p_insert_columns = lnext(pstate->p_insert_columns);
} }
else else
elog(ERROR, "insert: more expressions than target columns"); elog(ERROR, "INSERT has more expressions than target columns");
} }
if (pstate->p_is_insert || pstate->p_is_update) if (pstate->p_is_insert || pstate->p_is_update)
checkTargetTypes(pstate, *resname, refname, colname); checkTargetTypes(pstate, *resname, refname, colname);
...@@ -424,13 +424,13 @@ checkTargetTypes(ParseState *pstate, char *target_colname, ...@@ -424,13 +424,13 @@ checkTargetTypes(ParseState *pstate, char *target_colname,
{ {
rte = colnameRangeTableEntry(pstate, colname); rte = colnameRangeTableEntry(pstate, colname);
if (rte == (RangeTblEntry *) NULL) if (rte == (RangeTblEntry *) NULL)
elog(ERROR, "attribute %s not found", colname); elog(ERROR, "Attribute %s not found", colname);
refname = rte->refname; refname = rte->refname;
} }
/* /*
if (pstate->p_is_insert && rte == pstate->p_target_rangetblentry) if (pstate->p_is_insert && rte == pstate->p_target_rangetblentry)
elog(ERROR, "%s not available in this context", colname); elog(ERROR, "'%s' not available in this context", colname);
*/ */
resdomno_id = get_attnum(rte->relid, colname); resdomno_id = get_attnum(rte->relid, colname);
attrtype_id = get_atttype(rte->relid, resdomno_id); attrtype_id = get_atttype(rte->relid, resdomno_id);
...@@ -460,18 +460,18 @@ checkTargetTypes(ParseState *pstate, char *target_colname, ...@@ -460,18 +460,18 @@ checkTargetTypes(ParseState *pstate, char *target_colname,
} }
#else #else
if (attrtype_id != attrtype_target) if (attrtype_id != attrtype_target)
elog(ERROR, "Type of %s does not match target column %s", elog(ERROR, "Type of '%s' does not match target column '%s'",
colname, target_colname); colname, target_colname);
if (attrtype_id == BPCHAROID && if (attrtype_id == BPCHAROID &&
get_atttypmod(rte->relid, resdomno_id) != get_atttypmod(rte->relid, resdomno_id) !=
get_atttypmod(pstate->p_target_relation->rd_id, resdomno_target)) get_atttypmod(pstate->p_target_relation->rd_id, resdomno_target))
elog(ERROR, "Length of %s is not equal to the length of target column %s", elog(ERROR, "Length of '%s' is not equal to the length of target column '%s'",
colname, target_colname); colname, target_colname);
if (attrtype_id == VARCHAROID && if (attrtype_id == VARCHAROID &&
get_atttypmod(rte->relid, resdomno_id) > get_atttypmod(rte->relid, resdomno_id) >
get_atttypmod(pstate->p_target_relation->rd_id, resdomno_target)) get_atttypmod(pstate->p_target_relation->rd_id, resdomno_target))
elog(ERROR, "Length of %s is longer than length of target column %s", elog(ERROR, "Length of '%s' is longer than length of target column '%s'",
colname, target_colname); colname, target_colname);
#endif #endif
} }
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/parse_type.c,v 1.18 1998/11/27 19:52:14 vadim Exp $ * $Header: /cvsroot/pgsql/src/backend/parser/parse_type.c,v 1.19 1999/02/23 07:53:01 thomas Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -51,7 +51,7 @@ typeidTypeName(Oid id) ...@@ -51,7 +51,7 @@ typeidTypeName(Oid id)
ObjectIdGetDatum(id), ObjectIdGetDatum(id),
0, 0, 0))) 0, 0, 0)))
{ {
elog(ERROR, "type id lookup of %u failed", id); elog(ERROR, "Unable to locate type oid %u in catalog", id);
return NULL; return NULL;
} }
typetuple = (Form_pg_type) GETSTRUCT(tup); typetuple = (Form_pg_type) GETSTRUCT(tup);
...@@ -68,7 +68,7 @@ typeidType(Oid id) ...@@ -68,7 +68,7 @@ typeidType(Oid id)
ObjectIdGetDatum(id), ObjectIdGetDatum(id),
0, 0, 0))) 0, 0, 0)))
{ {
elog(ERROR, "type id lookup of %u failed", id); elog(ERROR, "Unable to locate type oid %u in catalog", id);
return NULL; return NULL;
} }
return (Type) tup; return (Type) tup;
...@@ -86,7 +86,7 @@ typenameType(char *s) ...@@ -86,7 +86,7 @@ typenameType(char *s)
if (!(tup = SearchSysCacheTuple(TYPNAME, if (!(tup = SearchSysCacheTuple(TYPNAME,
PointerGetDatum(s), PointerGetDatum(s),
0, 0, 0))) 0, 0, 0)))
elog(ERROR, "type name lookup of %s failed", s); elog(ERROR, "Unable to locate type name '%s' in catalog", s);
return (Type) tup; return (Type) tup;
} }
...@@ -217,7 +217,7 @@ typeidTypElem(Oid type_id) ...@@ -217,7 +217,7 @@ typeidTypElem(Oid type_id)
return type->typelem; return type->typelem;
} }
/* Given the attribute type of an array return the arrtribute type of /* Given the attribute type of an array return the attribute type of
an element of the array */ an element of the array */
Oid Oid
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment