pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Adrien.Sales@gmail.com
To: pgsql-bugs@postgresql.org
Subject: BUG #13318: refresh materilaized view privileges
Date: Tue, 19 May 2015 21:07:27 +0000
Message-ID: <20150519210727.26514.22507@wrigleys.postgresql.org> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

The following bug has been logged on the website:

Bug reference:      13318
Logged by:          Adrien Sales
Email address:      Adrien.Sales@gmail.com
PostgreSQL version: 9.3.6
Operating system:   Linux, Windows
Description:        

Introduction : I don't think it's a bug but rather a Work As Designed
feature, indeed, it would be very useful to make it work the same way Oracle
does.

Description : A user (user_usr) needs to refresh a materialized view that he
does not own (the owner is user_adm). This user has all DML privileges on
user_adm schema but no DDL privileges.
On oracle, when we have the same need (for example for truncating a table),
we embed the sql in a stored procedure, grant execute privilege on the
procedure... and the job is done...but it does not work on PostgreSQL as it
does still complain that "ERROR:  must be owner of relation".

Please find deblow the script used to test :

psql -U user_adm test

create table titi(i integer);
insert into titi values (1);
insert into titi values (2);
insert into titi values (3);
insert into titi values (4);

select * from titi;

create materialized view vm_titi as select * from titi;

REFRESH MATERIALIZED VIEW vm_titi with data;

CREATE OR REPLACE FUNCTION refresh_astre()
RETURNS void
AS $$
BEGIN
REFRESH MATERIALIZED VIEW vm_titi with data;
RETURN;
END;
$$ LANGUAGE plpgsql;

select refresh_astre();

grant execute on function refresh_astre() to user_usr;

psql -U user_usr test

test=> select refresh_astre();
ERROR:  must be owner of relation vm_titi
CONTEXT:  SQL statement "REFRESH MATERIALIZED VIEW vm_titi with data" 
PL/pgSQL function refresh_astre() line 6 at EXECUTE statement


Any feedback would be appreciated on this behavior. The constraint is that
we don't want the user_usr user to own any objects, but only to use the
user_adm ones.
Thank you in advance for your help.

Best Regards,

Adrien







-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



view thread (2+ messages)  latest in thread

Message-ID: <20150519210727.26514.22507@wrigleys.postgresql.org>
Permalink:  ../20150519210727.26514.22507@wrigleys.postgresql.org/
Also on:    postgresql.org/message-id/20150519210727.26514.22507@wrigleys.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: Adrien.Sales@gmail.com
  Subject: Re: BUG #13318: refresh materilaized view privileges
  In-Reply-To: <20150519210727.26514.22507@wrigleys.postgresql.org>
  References: <20150519210727.26514.22507@wrigleys.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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