pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
SV: Foreign tables, user mappings and privilege setup
2+ messages / 2 participants
[nested] [flat]

* SV: Foreign tables, user mappings and privilege setup
@ 2020-09-22 10:22  Niels Jespersen <NJN@dst.dk>
  0 siblings, 1 reply; 2+ messages in thread

From: Niels Jespersen @ 2020-09-22 10:22 UTC (permalink / raw)
  To: Laurenz Albe <laurenz.albe@cybertec.at>; pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>

>>On Mon, 2020-09-21 at 08:21 +0000, Niels Jespersen wrote:
>> create user mapping for current_user server s... (user 'remoteuser', 
>> password 'remotepassword');
>> 
>> create foreign table t....   ( a int) server s... options (table_name 't_remote');
>> 
>> This works fine. Except only the user who created the user mapping can 
>> select from foreign table, even if other users have select privilege on the table. They will get a "user mapping not found for...".
>
>You have to create a user mapping for every user that is to access the foreign table.
>
>If several users should have the same credentials, use a group.

Thank you for replying. 

I can create a user mapping for a group (role). This works, but it is not enough to grant the role to the end user (that has inherit defined). The end user must explicitly use "set role" before accessing the foreign table.

Is this what Oracle Corporation would call "Intended Behavior"  ;=) ? 

Regards Niels




^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: SV: Foreign tables, user mappings and privilege setup
@ 2020-09-22 14:15  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Niels Jespersen <NJN@dst.dk>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2020-09-22 14:15 UTC (permalink / raw)
  To: Niels Jespersen <NJN@dst.dk>; +Cc: Laurenz Albe <laurenz.albe@cybertec.at>; pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>

Niels Jespersen <NJN@dst.dk> writes:
> I can create a user mapping for a group (role). This works, but it is not enough to grant the role to the end user (that has inherit defined). The end user must explicitly use "set role" before accessing the foreign table.

Seems right to me.  If the user is a member of two groups, each of which
has a mapping for that server, how could the server choose one?

			regards, tom lane





^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2020-09-22 14:15 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2020-09-22 10:22 SV: Foreign tables, user mappings and privilege setup Niels Jespersen <NJN@dst.dk>
2020-09-22 14:15 ` Tom Lane <tgl@sss.pgh.pa.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox