SV: Foreign tables, user mappings and privilege setup

From: Niels Jespersen <NJN(at)dst(dot)dk>
To: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>, "pgsql-general(at)lists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: SV: Foreign tables, user mappings and privilege setup
Date: 2020-09-22 10:22:58
Message-ID: bcbc4634847945bf9ff4378c339a60f0@dst.dk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

>>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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Josef Machytka 2020-09-22 10:46:20 Problems with PostgreSQL on Google compute engine
Previous Message Tom Lane 2020-09-21 18:11:00 Re: CRL reloading info - is it refreshed?