Re: username length character limits? - Mailing list pgsql-general

From Dennis Gearon
Subject Re: username length character limits?
Date
Msg-id 40E7625C.8050108@fireserve.net
Whole thread Raw
In response to Re: username length character limits?  (Stephan Szabo <sszabo@megazone.bigpanda.com>)
List pgsql-general
Stephan Szabo wrote:

> On Sat, 3 Jul 2004, Dennis Gearon wrote:
>
>
>>Stephan Szabo wrote:
>>
>>
>>>On Sat, 3 Jul 2004, Dennis Gearon wrote:
>>>
>>>
>>>
>>>>Stephan Szabo wrote:
>>>>
>>>>
>>>>
>>>>>IIRC, psql (and the createuser shell script and such) treat it as if you
>>>>>had double quoted its argument because of the way shells handle quotes
>>>>>which would necessitate something like '"FOO"' to use a quoted uppercase
>>>>>name. So, if you say psql FOO -U BAR, you're saying log into database
>>>>>"FOO" as user "BAR".
>>>>>
>>>>>
>>>>
>>>>I created the user from inside of a psql session.
>>>>
>>>>And I cannot either connect from invoking a different psql session from the shell,
>>>>nor from PHP using it's compiled in c library for postgres.
>>>>
>>>>It seems it's another gotcha with this database. I wouldn't have thought
>>>>it would so difficult to insert upper(whatever was enterd) into the
>>>>database, and validate it the same way.
>>>
>>>
>>>Create user Foo and Create user "Foo" are creating users with different
>>>names. Since we want to allow both names to exist at the same time and for
>>>you to refer to either, there needs to be a mechanism for doing so.  I
>>>don't know about PHP, but as I said above, psql does not treat its
>>>arguments as normal identifiers (thus lowercasing them) because it was
>>>decided to be simpler for people to refer to either user.  For the former,
>>>it is foo and the latter Foo.
>>
>>So, if I >>WANT<< a user name with case:
>>
>>((B))
>>Creating user in psql, I will have to use double quotes?
>>To OPEN psql using that user, , it will respect case automatically?
>
>
> This one.  Note that using the createuser shell script does the quoting
> for you.
>
>
>>and the converse, if I >>WANT<< a user name withOUT case:
>>
>>What then?
>
>
> Then, you create it without double quotes and the name is converted to
> lower case.  If you're using an interface which takes the username given
> exactly (like psql) then you need to provide the lower case version of the
> name (as above, using foo to refer to the user Foo, while using Foo to
> refer to the user "Foo")
>
>
Thanks for clearing that up:
    usernames are converted to lower case when created,
    but psql will quote them and look for the case that is supplied
    while trying to login.

That's my take on it, and I'm putting it here for others to see, who will be coming in as newbies some day.

pgsql-general by date:

Previous
From: Stephan Szabo
Date:
Subject: Re: username length character limits?
Next
From: Rajesh Kumar Mallah
Date:
Subject: Re: alter table cascade does not give notice about dropped