From: Paul Smith* <paul@pscs.co.uk>
To: pgsql-admin@lists.postgresql.org
Subject: Re: Update "usename" in pg_user
Date: Tue, 14 Nov 2023 13:05:15 +0000
Message-ID: <79d4ec67-40b2-427f-aa40-2588bacb4556@pscs.co.uk> (raw)
In-Reply-To: <PR3PR04MB73409EB3F2695DA61418F784D6B2A@PR3PR04MB7340.eurprd04.prod.outlook.com>
References: <PR3PR04MB73409EB3F2695DA61418F784D6B2A@PR3PR04MB7340.eurprd04.prod.outlook.com>
On 14/11/2023 12:56, Bernd Lentes wrote:
> Due to change of the LDAP server I need to modify the username now.
> From firstname.lastname to firstname.lastname@helmholtz-munich.de.
> I tried the following (just for one user to test it):
>
> update pg_user set usename = 'usename@helmholtz-munich.de' where usename = 'dorota.germann';
1) don't update system tables directly unless you absolutely must
ALTER USER <username> RENAME TO <new_username> is what you want
2) To use characters other than alphanumeric or _ then you need to use
double quotes
So:
ALTER USER dorota.germann RENAME TO "dorota.germann@helmholtz-munich.de";
should do the job
Paul
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 using the --to and --cc options:
reply via email
To: pgsql-admin@postgresql.org
Cc: paul@pscs.co.uk, pgsql-admin@lists.postgresql.org
Subject: Re: Update "usename" in pg_user
In-Reply-To: <79d4ec67-40b2-427f-aa40-2588bacb4556@pscs.co.uk>
* 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