pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
User mapping: view over a foreign table
3+ messages / 2 participants
[nested] [flat]

* User mapping: view over a foreign table
@ 2019-07-17 21:24 Vladimir Ryabtsev <greatvovan@gmail.com>
  2019-07-17 21:24 ` Re: User mapping: view over a foreign table Vladimir Ryabtsev <greatvovan@gmail.com>
  2019-07-21 03:27 ` Re: User mapping: view over a foreign table Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 2 replies; 3+ messages in thread

From: Vladimir Ryabtsev @ 2019-07-17 21:24 UTC (permalink / raw)
  To: pgsql-bugs@lists.postgresql.org

Supposing I have a foreign table F and a view V that selects rows from F.

The owner of F is USER1.
The owner of V is USER2.
The currently logged user is "me".

When I query the foreign table F, the DBMS engine looks for USER MAPPING
for "me", regardless of who is the owner of the table.

When I query the view V, the engine searches the USER MAPPING for USER2 who
is the owner of the view.

This looks inconsistent and misleading. I wonder, are there any reasons
behind this design decision? Is it documented somewhere (I did not find it)?

Regards,
Vlad

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

* Re: User mapping: view over a foreign table
  2019-07-17 21:24 User mapping: view over a foreign table Vladimir Ryabtsev <greatvovan@gmail.com>
@ 2019-07-17 21:24 ` Vladimir Ryabtsev <greatvovan@gmail.com>
  1 sibling, 0 replies; 3+ messages in thread

From: Vladimir Ryabtsev @ 2019-07-17 21:24 UTC (permalink / raw)
  To: pgsql-bugs@lists.postgresql.org

My DB version(): PostgreSQL 10.3 (Ubuntu 10.3-1.pgdg14.04+1) on
x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 4.8.4-2ubuntu1~14.04.4) 4.8.4,
64-bit

ср, 17 июл. 2019 г. в 14:24, Vladimir Ryabtsev <greatvovan@gmail.com>:

> Supposing I have a foreign table F and a view V that selects rows from F.
>
> The owner of F is USER1.
> The owner of V is USER2.
> The currently logged user is "me".
>
> When I query the foreign table F, the DBMS engine looks for USER MAPPING
> for "me", regardless of who is the owner of the table.
>
> When I query the view V, the engine searches the USER MAPPING for USER2
> who is the owner of the view.
>
> This looks inconsistent and misleading. I wonder, are there any reasons
> behind this design decision? Is it documented somewhere (I did not find it)?
>
> Regards,
> Vlad
>

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

* Re: User mapping: view over a foreign table
  2019-07-17 21:24 User mapping: view over a foreign table Vladimir Ryabtsev <greatvovan@gmail.com>
@ 2019-07-21 03:27 ` Tom Lane <tgl@sss.pgh.pa.us>
  1 sibling, 0 replies; 3+ messages in thread

From: Tom Lane @ 2019-07-21 03:27 UTC (permalink / raw)
  To: Vladimir Ryabtsev <greatvovan@gmail.com>; +Cc: pgsql-bugs@lists.postgresql.org

Vladimir Ryabtsev <greatvovan@gmail.com> writes:
> Supposing I have a foreign table F and a view V that selects rows from F.
> The owner of F is USER1.
> The owner of V is USER2.
> The currently logged user is "me".

> When I query the foreign table F, the DBMS engine looks for USER MAPPING
> for "me", regardless of who is the owner of the table.

> When I query the view V, the engine searches the USER MAPPING for USER2 who
> is the owner of the view.

> This looks inconsistent and misleading.

AFAICS, it's exactly parallel to the handling of SQL permissions for
the foreign table.  If you query F directly, you must have SELECT
permissions on F (or whatever is appropriate for your query type).
If you query F via V, you must have SELECT on V and the owner of V
must have SELECT on F.

			regards, tom lane





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


end of thread, other threads:[~2019-07-21 03:27 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2019-07-17 21:24 User mapping: view over a foreign table Vladimir Ryabtsev <greatvovan@gmail.com>
2019-07-17 21:24 ` Vladimir Ryabtsev <greatvovan@gmail.com>
2019-07-21 03:27 ` 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