Commit bd5e8b62 authored by Tom Lane's avatar Tom Lane

Bring pg_nextoid()'s error messages into line with message style guide.

Noticed while reviewing nearby code.  Given all the disclaimers about
this not being meant as user-facing code, I wonder whether we should
make these non-translatable?  But in any case there's little excuse
for them not to be good English.
parent 9691aa72
...@@ -479,7 +479,7 @@ pg_nextoid(PG_FUNCTION_ARGS) ...@@ -479,7 +479,7 @@ pg_nextoid(PG_FUNCTION_ARGS)
if (!superuser()) if (!superuser())
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE), (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
errmsg("must be superuser to call pg_nextoid"))); errmsg("must be superuser to call pg_nextoid()")));
rel = table_open(reloid, RowExclusiveLock); rel = table_open(reloid, RowExclusiveLock);
idx = index_open(idxoid, RowExclusiveLock); idx = index_open(idxoid, RowExclusiveLock);
...@@ -487,21 +487,21 @@ pg_nextoid(PG_FUNCTION_ARGS) ...@@ -487,21 +487,21 @@ pg_nextoid(PG_FUNCTION_ARGS)
if (!IsSystemRelation(rel)) if (!IsSystemRelation(rel))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE), (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("pg_nextoid() can only be used on system relation"))); errmsg("pg_nextoid() can only be used on system catalogs")));
if (idx->rd_index->indrelid != RelationGetRelid(rel)) if (idx->rd_index->indrelid != RelationGetRelid(rel))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE), (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("index %s does not belong to table %s", errmsg("index \"%s\" does not belong to table \"%s\"",
RelationGetRelationName(idx), RelationGetRelationName(idx),
RelationGetRelationName(rel)))); RelationGetRelationName(rel))));
atttuple = SearchSysCacheAttName(reloid, NameStr(*attname)); atttuple = SearchSysCacheAttName(reloid, NameStr(*attname));
if (!HeapTupleIsValid(atttuple)) if (!HeapTupleIsValid(atttuple))
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE), (errcode(ERRCODE_UNDEFINED_COLUMN),
errmsg("attribute %s does not exists", errmsg("column \"%s\" of relation \"%s\" does not exist",
NameStr(*attname)))); NameStr(*attname), RelationGetRelationName(rel))));
attform = ((Form_pg_attribute) GETSTRUCT(atttuple)); attform = ((Form_pg_attribute) GETSTRUCT(atttuple));
attno = attform->attnum; attno = attform->attnum;
...@@ -509,14 +509,14 @@ pg_nextoid(PG_FUNCTION_ARGS) ...@@ -509,14 +509,14 @@ pg_nextoid(PG_FUNCTION_ARGS)
if (attform->atttypid != OIDOID) if (attform->atttypid != OIDOID)
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE), (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("attribute %s is not of type oid", errmsg("column \"%s\" is not of type oid",
NameStr(*attname)))); NameStr(*attname))));
if (IndexRelationGetNumberOfKeyAttributes(idx) != 1 || if (IndexRelationGetNumberOfKeyAttributes(idx) != 1 ||
idx->rd_index->indkey.values[0] != attno) idx->rd_index->indkey.values[0] != attno)
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE), (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("index %s is not the index for attribute %s", errmsg("index \"%s\" is not the index for column \"%s\"",
RelationGetRelationName(idx), RelationGetRelationName(idx),
NameStr(*attname)))); NameStr(*attname))));
......
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