Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit7e5f517

Browse files
committed
Improve "user mapping not found" error message
Display the name of the foreign server for which the user mapping wasnot 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
1 parent3e36e48 commit7e5f517

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

‎contrib/postgres_fdw/expected/postgres_fdw.out

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2717,10 +2717,10 @@ ALTER FOREIGN TABLE ft4 OPTIONS (ADD use_remote_estimate 'true');
27172717
-- regress_view_owner_another, the view owner, though it fails as expected
27182718
-- due to the lack of a user mapping for that user.
27192719
EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM v4;
2720-
ERROR: user mapping not found for "regress_view_owner_another"
2720+
ERROR: user mapping not found foruser"regress_view_owner_another", server "loopback"
27212721
-- Likewise, but with the query under an UNION ALL
27222722
EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM (SELECT * FROM v4 UNION ALL SELECT * FROM v4);
2723-
ERROR: user mapping not found for "regress_view_owner_another"
2723+
ERROR: user mapping not found foruser"regress_view_owner_another", server "loopback"
27242724
-- Should not get that error once a user mapping is created
27252725
CREATE USER MAPPING FOR regress_view_owner_another SERVER loopback OPTIONS (password_required 'false');
27262726
EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM v4;

‎src/backend/foreign/foreign.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,10 +217,14 @@ GetUserMapping(Oid userid, Oid serverid)
217217
}
218218

219219
if (!HeapTupleIsValid(tp))
220+
{
221+
ForeignServer*server=GetForeignServer(serverid);
222+
220223
ereport(ERROR,
221224
(errcode(ERRCODE_UNDEFINED_OBJECT),
222-
errmsg("user mapping not found for \"%s\"",
223-
MappingUserName(userid))));
225+
errmsg("user mapping not found for user \"%s\", server \"%s\"",
226+
MappingUserName(userid),server->servername)));
227+
}
224228

225229
um= (UserMapping*)palloc(sizeof(UserMapping));
226230
um->umid= ((Form_pg_user_mapping)GETSTRUCT(tp))->oid;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp