Re: Set role dynamically from proc

2017-11-23 Thread Durumdara
Dear David! To know - your solution is working well! *EXECUTE format('SET ROLE %I', variablename); * Thank you! bw dd

Re: Set role dynamically from proc

2017-11-22 Thread David G. Johnston
On Wed, Nov 22, 2017 at 7:52 AM, Durumdara wrote: > Now the "set role" uses the "variable name", and not the "value of the > variable". > > This is what I don't like in this lang. I need to write a special variable > name to "force" to use it, and not other thing. > I don't know how to force the

Re: Set role dynamically from proc

2017-11-22 Thread Durumdara
Hello! I haven't got your mail, I see your answer only in the thread of web mailing list. > It seems that the user does not exist: The problem is based on that I want to set the role to the database owner from script. My team members many times logged as "postgres" or diff user, and forget to se

RE: Set role dynamically from proc

2017-11-22 Thread Charles Clavadetscher
Hello From: Durumdara [mailto:durumd...@gmail.com] Sent: Mittwoch, 22. November 2017 14:56 To: pgsql-gene...@postgresql.org Subject: Set role dynamically from proc Hello! May you know the way how to set role dynamically. DO $$ DECLARE act_dbowner varchar(100); BEGIN

Set role dynamically from proc

2017-11-22 Thread Durumdara
Hello! May you know the way how to set role dynamically. DO $$ DECLARE act_dbowner varchar(100); BEGIN SELECT u.usename into act_dbowner FROM pg_database d JOIN pg_user u ON (d.datdba = u.usesysid) WHERE d.datname = (SELECT current_database()); raise notice 'DB owner: %', act_dbowner; *set role