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

Commit13bf801

Browse files
committed
Remove GetUserMappingId() and GetUserMappingById().
These functions were added in commitsfbe5a3f anda104a01,but commit45639a0 removed their only callers. Put the relatedcode in foreign.c back to the way it was in 9.5, to avoid pointlesscross-version diffs.Etsuro FujitaPatch: <d674a3f1-6b63-519c-ef3f-f3188ed6a178@lab.ntt.co.jp>
1 parentd70d119 commit13bf801

File tree

3 files changed

+17
-121
lines changed

3 files changed

+17
-121
lines changed

‎doc/src/sgml/fdwhandler.sgml

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1323,20 +1323,6 @@ GetForeignTable(Oid relid);
13231323

13241324
<para>
13251325
<programlisting>
1326-
UserMapping *
1327-
GetUserMappingById(Oid umid);
1328-
</programlisting>
1329-
1330-
This function returns the <structname>UserMapping</structname> object for
1331-
the given user mapping OID. The OID of a user mapping for a foreign scan
1332-
is available in the <structname>RelOptInfo</structname>.
1333-
If there is no mapping for the OID, this function will throw an error.
1334-
A <structname>UserMapping</structname> object contains properties of the
1335-
user mapping (see <filename>foreign/foreign.h</filename> for details).
1336-
</para>
1337-
1338-
<para>
1339-
<programlisting>
13401326
List *
13411327
GetForeignColumnOptions(Oid relid, AttrNumber attnum);
13421328
</programlisting>

‎src/backend/foreign/foreign.c

Lines changed: 17 additions & 105 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@
3131
externDatumpg_options_to_table(PG_FUNCTION_ARGS);
3232
externDatumpostgresql_fdw_validator(PG_FUNCTION_ARGS);
3333

34-
staticHeapTuplefind_user_mapping(Oiduserid,Oidserverid);
35-
3634

3735
/*
3836
* GetForeignDataWrapper -look up the foreign-data wrapper by OID.
@@ -161,54 +159,6 @@ GetForeignServerByName(const char *srvname, bool missing_ok)
161159
returnGetForeignServer(serverid);
162160
}
163161

164-
/*
165-
* GetUserMappingById - look up the user mapping by its OID.
166-
*/
167-
UserMapping*
168-
GetUserMappingById(Oidumid)
169-
{
170-
Datumdatum;
171-
HeapTupletp;
172-
boolisnull;
173-
UserMapping*um;
174-
175-
tp=SearchSysCache1(USERMAPPINGOID,ObjectIdGetDatum(umid));
176-
if (!HeapTupleIsValid(tp))
177-
elog(ERROR,"cache lookup failed for user mapping %u",umid);
178-
179-
um= (UserMapping*)palloc(sizeof(UserMapping));
180-
um->umid=umid;
181-
182-
/* Extract the umuser */
183-
datum=SysCacheGetAttr(USERMAPPINGOID,
184-
tp,
185-
Anum_pg_user_mapping_umuser,
186-
&isnull);
187-
Assert(!isnull);
188-
um->userid=DatumGetObjectId(datum);
189-
190-
/* Extract the umserver */
191-
datum=SysCacheGetAttr(USERMAPPINGOID,
192-
tp,
193-
Anum_pg_user_mapping_umserver,
194-
&isnull);
195-
Assert(!isnull);
196-
um->serverid=DatumGetObjectId(datum);
197-
198-
/* Extract the umoptions */
199-
datum=SysCacheGetAttr(USERMAPPINGOID,
200-
tp,
201-
Anum_pg_user_mapping_umoptions,
202-
&isnull);
203-
if (isnull)
204-
um->options=NIL;
205-
else
206-
um->options=untransformRelOptions(datum);
207-
208-
ReleaseSysCache(tp);
209-
210-
returnum;
211-
}
212162

213163
/*
214164
* GetUserMapping - look up the user mapping.
@@ -224,7 +174,23 @@ GetUserMapping(Oid userid, Oid serverid)
224174
boolisnull;
225175
UserMapping*um;
226176

227-
tp=find_user_mapping(userid,serverid);
177+
tp=SearchSysCache2(USERMAPPINGUSERSERVER,
178+
ObjectIdGetDatum(userid),
179+
ObjectIdGetDatum(serverid));
180+
181+
if (!HeapTupleIsValid(tp))
182+
{
183+
/* Not found for the specific user -- try PUBLIC */
184+
tp=SearchSysCache2(USERMAPPINGUSERSERVER,
185+
ObjectIdGetDatum(InvalidOid),
186+
ObjectIdGetDatum(serverid));
187+
}
188+
189+
if (!HeapTupleIsValid(tp))
190+
ereport(ERROR,
191+
(errcode(ERRCODE_UNDEFINED_OBJECT),
192+
errmsg("user mapping not found for \"%s\"",
193+
MappingUserName(userid))));
228194

229195
um= (UserMapping*)palloc(sizeof(UserMapping));
230196
um->umid=HeapTupleGetOid(tp);
@@ -246,60 +212,6 @@ GetUserMapping(Oid userid, Oid serverid)
246212
returnum;
247213
}
248214

249-
/*
250-
* GetUserMappingId - look up the user mapping, and return its OID
251-
*
252-
* If no mapping is found for the supplied user, we also look for
253-
* PUBLIC mappings (userid == InvalidOid).
254-
*/
255-
Oid
256-
GetUserMappingId(Oiduserid,Oidserverid)
257-
{
258-
HeapTupletp;
259-
Oidumid;
260-
261-
tp=find_user_mapping(userid,serverid);
262-
263-
/* Extract the Oid */
264-
umid=HeapTupleGetOid(tp);
265-
266-
ReleaseSysCache(tp);
267-
268-
returnumid;
269-
}
270-
271-
/*
272-
* find_user_mapping - Guts of GetUserMapping family.
273-
*
274-
* If no mapping is found for the supplied user, we also look for
275-
* PUBLIC mappings (userid == InvalidOid).
276-
*/
277-
staticHeapTuple
278-
find_user_mapping(Oiduserid,Oidserverid)
279-
{
280-
HeapTupletp;
281-
282-
tp=SearchSysCache2(USERMAPPINGUSERSERVER,
283-
ObjectIdGetDatum(userid),
284-
ObjectIdGetDatum(serverid));
285-
286-
if (HeapTupleIsValid(tp))
287-
returntp;
288-
289-
/* Not found for the specific user -- try PUBLIC */
290-
tp=SearchSysCache2(USERMAPPINGUSERSERVER,
291-
ObjectIdGetDatum(InvalidOid),
292-
ObjectIdGetDatum(serverid));
293-
294-
if (!HeapTupleIsValid(tp))
295-
ereport(ERROR,
296-
(errcode(ERRCODE_UNDEFINED_OBJECT),
297-
errmsg("user mapping not found for \"%s\"",
298-
MappingUserName(userid))));
299-
300-
returntp;
301-
}
302-
303215

304216
/*
305217
* GetForeignTable - look up the foreign table definition by relation oid.

‎src/include/foreign/foreign.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,6 @@ typedef struct ForeignTable
7272
externForeignServer*GetForeignServer(Oidserverid);
7373
externForeignServer*GetForeignServerByName(constchar*name,boolmissing_ok);
7474
externUserMapping*GetUserMapping(Oiduserid,Oidserverid);
75-
externOidGetUserMappingId(Oiduserid,Oidserverid);
76-
externUserMapping*GetUserMappingById(Oidumid);
7775
externForeignDataWrapper*GetForeignDataWrapper(Oidfdwid);
7876
externForeignDataWrapper*GetForeignDataWrapperByName(constchar*name,
7977
boolmissing_ok);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp