Re: oddity with ALTER ROLE/USER

From: Stephen Frost <sfrost(at)snowman(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Joe Conway <mail(at)joeconway(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgreSQL(dot)org>
Subject: Re: oddity with ALTER ROLE/USER
Date: 2019-02-23 14:06:42
Message-ID: 20190223140642.GK6197@tamriel.snowman.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Greetings,

* Tom Lane (tgl(at)sss(dot)pgh(dot)pa(dot)us) wrote:
> Joe Conway <mail(at)joeconway(dot)com> writes:
> > I noticed that ALTER ROLE/USER succeeds even when called without any
> > options:
>
> > postgres=# alter user foo;
> > ALTER ROLE
> > postgres=# alter role foo;
> > ALTER ROLE
> > postgres=# alter group foo;
> > ERROR: syntax error at or near ";"
> > LINE 1: alter group foo;
>
> > That seems odd, does nothing useful, and is inconsistent with, for
> > example, ALTER GROUP as shown above.
>
> > Proposed patch attached.
>
> If you want to make it act like alter group, why not make it act
> like alter group? That is, the way to fix this is to change the
> grammar so that AlterOptRoleList doesn't permit an expansion with
> zero list elements.
>
> Having said that, I can't get excited about changing this at all.
> Nobody will thank us for it, and someone might complain.

Is there no chance that someone's issueing such an ALTER ROLE foo;
statement and thinking it's actually doing something? I suppose it's
pretty unlikely, but we do complain in some cases where we've been asked
to do something and we end up not actually doing anything for various
reasons ("no privileges were granted..."), though that's only a warning.
Maybe that'd be useful to have here though? At least then we're making
it clear to the user that nothing is happening and we don't break
existing things.

Thanks!

Stephen

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2019-02-23 14:47:54 Re: FOP warnings about id attributes in title tags
Previous Message Magnus Hagander 2019-02-23 13:48:58 Re: Autovaccuum vs temp tables crash