1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-07 19:06:32 +03:00

Improve "user mapping not found" error message

Display the name of the foreign server for which the user mapping was
not found.

Author: Ian Lawrence Barwick <barwick@gmail.com>
Reviewed-by: Laurenz Albe <laurenz.albe@cybertec.at>
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Discussion: https://www.postgresql.org/message-id/flat/CAB8KJ=jFzNaeyFtLcTZNOc6fd1+F93pGVLFa-wyt31wn7VNxqQ@mail.gmail.com
This commit is contained in:
Peter Eisentraut
2023-11-30 05:33:55 +01:00
parent 3e36e48d8e
commit 7e5f517799
2 changed files with 8 additions and 4 deletions

View File

@@ -217,10 +217,14 @@ GetUserMapping(Oid userid, Oid serverid)
}
if (!HeapTupleIsValid(tp))
{
ForeignServer *server = GetForeignServer(serverid);
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT),
errmsg("user mapping not found for \"%s\"",
MappingUserName(userid))));
errmsg("user mapping not found for user \"%s\", server \"%s\"",
MappingUserName(userid), server->servername)));
}
um = (UserMapping *) palloc(sizeof(UserMapping));
um->umid = ((Form_pg_user_mapping) GETSTRUCT(tp))->oid;