Thread: change username

change username

From
Bill Brandt
Date:
I have a user on my system whose username has recently changed.  The user
owns and is a non-owning user of multiple database.  I have tried a command
of the form:

update pg_user set usename='newname' where usesysid=###;

When I try this I get an error.  Does anyone know how to change this
information?  If I delete the user and recreate the user with the same uid
does that retain all the existing database permissions?

--
Bill Brandt
brandtwr@draaw.net                              http://www.draaw.net/

Re: [SQL] change username

From
jwieck@debis.com (Jan Wieck)
Date:
>
> I have a user on my system whose username has recently changed.  The user
> owns and is a non-owning user of multiple database.  I have tried a command
> of the form:
>
> update pg_user set usename='newname' where usesysid=###;
>
> When I try this I get an error.  Does anyone know how to change this
> information?  If I delete the user and recreate the user with the same uid
> does that retain all the existing database permissions?

    pg_user is a system view. Update pg_shadow instead.

    But what error do you get? The command should respond with
    "UPDATE 0" and do nothing!


Jan

--

#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me.                                  #
#======================================== jwieck@debis.com (Jan Wieck) #