Re: SET ROLE and reserved roles

From: Stephen Frost <sfrost(at)snowman(dot)net>
To: Amit Langote <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: SET ROLE and reserved roles
Date: 2016-04-14 01:44:58
Message-ID: 20160414014458.GX10850@tamriel.snowman.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Amit,

* Amit Langote (Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp) wrote:
> On 2016/04/14 2:10, Stephen Frost wrote:
> >> Amit Langote <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp <javascript:;>> writes:
> >>> I observe this:
> >>
> >>> postgres=# SET ROLE TO NONE;
> >>> SET
> >>> postgres=# SET ROLE TO nonexistent;
> >>> ERROR: role "nonexistent" does not exist
> >>> postgres=# SET ROLE TO pg_signal_backend;
> >>> ERROR: invalid value for parameter "role": "pg_signal_backend"
> >>
> >>> Is that behavior deliberate? Might it be better to handle the case
> >>> specially much as setting to "none" works?
> >
> > I don't think it makes sense to say the role doesn't exist when it does, in
> > fact, exist.
>
> Sorry, I didn't mean to say that we should error with "<reserved-role>
> does not exist" on such SET ROLE attempts. Like Michael, I was a bit
> surprised to find that it output "invalid value for parameter".

No problem. I realized that when I read your email, but when I was
added to the CC (which results in the email showing up on my phone,
where I had been responding from earlier), I only saw the subset which
was quoted. Your comments make more sense now that I've caught up on
-hackers email.

> So, if consensus emerges that we should indeed disallow SET ROLE
> <reserved-role-spec>, I would +1 Michael's proposed GUC_check_err*()-based
> patch.

I've not looked it over carefully, but I generally agree with improving
the error messages.

Thanks!

Stephen

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2016-04-14 01:58:20 Re: Suspicious behaviour on applying XLOG_HEAP2_VISIBLE.
Previous Message Etsuro Fujita 2016-04-14 01:44:52 Re: Optimization for updating foreign tables in Postgres FDW