Re: User got created with first letter capitalized

From: Keith <keith(at)keithf4(dot)com>
To: John Scalia <jayknowsunix(at)gmail(dot)com>
Cc: "pgsql-admin(at)postgresql(dot)org" <pgsql-admin(at)postgresql(dot)org>
Subject: Re: User got created with first letter capitalized
Date: 2016-07-25 15:56:36
Message-ID: CAHw75vuoaxc1JrDuJj+HwtYz1+1ZyqqYFHC_jBsxBZarpT+1zg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

On Mon, Jul 25, 2016 at 11:51 AM, John Scalia <jayknowsunix(at)gmail(dot)com>
wrote:

> I have a user who was inserted into the db by one of our automation
> scripts. His ID has the very first letter capitalized. The script reads
> the users from the appropriate Active Directory group and makes sure they
> exist in the database.
>
> For grins, let's say the user is good old Charley Brown and is called
> "Cbrown1" in Active Directory. If I look for him by rolname in either
> pg_authid or the pg_roles view, He shows as:
>
> rolname
> -----------
> Cbrown1
> (1 row)
>
> but when I try then to get rid of him using either "DROP ROLE cbrown1;" or
> "DROP ROLE Cbrown1;" I receive "ERROR: role "cbrown1" does not exist. Note
> that I get the error with the name in all lower case regardless of which
> way I specify him.
>
> Also, he does not show up using \du Cbrown1 or \du+ cbrown1, but does show
> if I enter \du without specifying his id.
>
> Anyone know what's going on with this?
> --
> Jay
>

Surround the role name with double-quotes. Otherwise postgres converts all
object names to lowercase.

DROP ROLE "Cbrown1";

Keith

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Jerry Sievers 2016-07-25 16:22:44 Re: Pg-Upgrade standbys via rsync... and avoid sending UNlogged data?
Previous Message John Scalia 2016-07-25 15:51:58 User got created with first letter capitalized