Using ForeignScan::fs_server to find user mapping

Поиск
Список
Период
Сортировка
Искать

Using ForeignScan::fs_server to find user mapping

От:
Anton Ratundalov <a.ratundalov@postgrespro.ru>
Дата:
Hi hackers

In the postgresBeginForeignScan I see rather complex logic just before 
GetUserMapping call.

This is all about finding serverid.


     /*
      * Identify which user to do the remote access as.  This should 
match what
      * ExecCheckPermissions() does.
      */
     userid = OidIsValid(fsplan->checkAsUser) ? fsplan->checkAsUser : 
GetUserId();
     if (fsplan->scan.scanrelid > 0)
         rtindex = fsplan->scan.scanrelid;
     else
         rtindex = bms_next_member(fsplan->fs_base_relids, -1);
     rte = exec_rt_fetch(rtindex, estate);

     /* Get info about foreign table. */
     table = GetForeignTable(rte->relid);
     user = GetUserMapping(userid, table->serverid);


Seems like we have the required serverid in ForeignScan::fs_server already.

Why not to use it?


Best regards

Anton Ratundalov




FAQ