1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-28 23:42:10 +03:00

Fix more user-visible elog() calls.

Michael Paquier discovered that this could be triggered via SQL;
give a nicer message instead.

Patch by Michael Paquier, reviewed by Masahiko Sawada.

Discussion: http://postgr.es/m/CAB7nPqQtPg+LKKtzdKN26judHcvPZ0s1gNigzOT4j8CYuuuBYg@mail.gmail.com
This commit is contained in:
Robert Haas
2017-10-05 07:58:02 -04:00
parent 036166f26e
commit c097b271e8
3 changed files with 21 additions and 5 deletions

View File

@ -225,8 +225,10 @@ replorigin_by_name(char *roname, bool missing_ok)
ReleaseSysCache(tuple);
}
else if (!missing_ok)
elog(ERROR, "cache lookup failed for replication origin '%s'",
roname);
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT),
errmsg("replication origin \"%s\" does not exist",
roname)));
return roident;
}
@ -437,8 +439,10 @@ replorigin_by_oid(RepOriginId roident, bool missing_ok, char **roname)
*roname = NULL;
if (!missing_ok)
elog(ERROR, "cache lookup failed for replication origin with oid %u",
roident);
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT),
errmsg("replication origin with OID %u does not exist",
roident)));
return false;
}