summaryrefslogtreecommitdiff
path: root/src/backend/foreign/foreign.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/foreign/foreign.c')
-rw-r--r--src/backend/foreign/foreign.c38
1 files changed, 10 insertions, 28 deletions
diff --git a/src/backend/foreign/foreign.c b/src/backend/foreign/foreign.c
index 633b9832e54..66f98f1c7ec 100644
--- a/src/backend/foreign/foreign.c
+++ b/src/backend/foreign/foreign.c
@@ -31,7 +31,8 @@
extern Datum pg_options_to_table(PG_FUNCTION_ARGS);
extern Datum postgresql_fdw_validator(PG_FUNCTION_ARGS);
-static HeapTuple find_user_mapping(Oid userid, Oid serverid, bool missing_ok);
+static HeapTuple find_user_mapping(Oid userid, Oid serverid);
+
/*
* GetForeignDataWrapper - look up the foreign-data wrapper by OID.
@@ -223,7 +224,7 @@ GetUserMapping(Oid userid, Oid serverid)
bool isnull;
UserMapping *um;
- tp = find_user_mapping(userid, serverid, false);
+ tp = find_user_mapping(userid, serverid);
um = (UserMapping *) palloc(sizeof(UserMapping));
um->umid = HeapTupleGetOid(tp);
@@ -250,23 +251,14 @@ GetUserMapping(Oid userid, Oid serverid)
*
* If no mapping is found for the supplied user, we also look for
* PUBLIC mappings (userid == InvalidOid).
- *
- * If missing_ok is true, the function returns InvalidOid when it does not find
- * required user mapping. Otherwise, find_user_mapping() throws error if it
- * does not find required user mapping.
*/
Oid
-GetUserMappingId(Oid userid, Oid serverid, bool missing_ok)
+GetUserMappingId(Oid userid, Oid serverid)
{
HeapTuple tp;
Oid umid;
- tp = find_user_mapping(userid, serverid, missing_ok);
-
- Assert(missing_ok || tp);
-
- if (!tp && missing_ok)
- return InvalidOid;
+ tp = find_user_mapping(userid, serverid);
/* Extract the Oid */
umid = HeapTupleGetOid(tp);
@@ -276,19 +268,14 @@ GetUserMappingId(Oid userid, Oid serverid, bool missing_ok)
return umid;
}
-
/*
* find_user_mapping - Guts of GetUserMapping family.
*
* If no mapping is found for the supplied user, we also look for
* PUBLIC mappings (userid == InvalidOid).
- *
- * If missing_ok is true, the function returns NULL, if it does not find
- * the required user mapping. Otherwise, it throws error if it does not
- * find the required user mapping.
*/
static HeapTuple
-find_user_mapping(Oid userid, Oid serverid, bool missing_ok)
+find_user_mapping(Oid userid, Oid serverid)
{
HeapTuple tp;
@@ -305,15 +292,10 @@ find_user_mapping(Oid userid, Oid serverid, bool missing_ok)
ObjectIdGetDatum(serverid));
if (!HeapTupleIsValid(tp))
- {
- if (missing_ok)
- return NULL;
- else
- ereport(ERROR,
- (errcode(ERRCODE_UNDEFINED_OBJECT),
- errmsg("user mapping not found for \"%s\"",
- MappingUserName(userid))));
- }
+ ereport(ERROR,
+ (errcode(ERRCODE_UNDEFINED_OBJECT),
+ errmsg("user mapping not found for \"%s\"",
+ MappingUserName(userid))));
return tp;
}