Thread: username length character limits?
Please CC me: If I create the user 'web_user' with password 'password' I can connect using 'psql' just fine. If I create the user 'D1Khb2g5m7FGk_web_user' with password 'password' I CANNOT connect using 'psql', I get authentication error. ----------------------------- ANYONE have any ideas why? ----------------------------- PG_VERSION says it's 7.3. I don't know how to find out any more accurately the subversion of that.
I now have tried an equal length name, and it logs in fine: 't012345678901_web_user' with pword 'password' works fine. The problem below is consistent. I can drop and recrate the user, and it always cannot be logged into using that name. Ican successfully alter the user, so the system is finding it, I just can't authenticate into it. Dennis Gearon wrote: > Please CC me: > > If I create the user 'web_user' > with password 'password' > I can connect using 'psql' just fine. > > If I create the user 'D1Khb2g5m7FGk_web_user' > with password 'password' > I CANNOT connect using 'psql', I get authentication error. > > ----------------------------- > ANYONE have any ideas why? > ----------------------------- > > PG_VERSION says it's 7.3. I don't know how to find out any more > accurately the subversion of that. > > >
another name that does not work is 'H1q2W3e4R5_web_user'. It seems to not like many alternations between numbers and letters. Dennis Gearon wrote: > Please CC me: > > If I create the user 'web_user' > with password 'password' > I can connect using 'psql' just fine. > > If I create the user 'D1Khb2g5m7FGk_web_user' > with password 'password' > I CANNOT connect using 'psql', I get authentication error. > > ----------------------------- > ANYONE have any ideas why? > ----------------------------- > > PG_VERSION says it's 7.3. I don't know how to find out any more > accurately the subversion of that. > > >
tried it with two underscores and short name: H1q2W_web_user with only one underscore and a long name: H1q2W3e4R5t6Y7u8Iweb_user with only oneunderscore and a short name: H1q2Wweb_user with no underscore and a long name: H1q2W3e4R5t6Y7u8Iwebuser with no underschore and a short name: H1q2W3webuser -------------------------------------------------------------------- NONE OF THESE NAMES WORK AS USER NAMES WITH THE PASSWORD 'password'. -------------------------------------------------------------------- I have no idea why. Where does it say what is the legal: length characters character set (?) for user names? one underscore and a short name. Dennis Gearon wrote: > Please CC me: > > If I create the user 'web_user' > with password 'password' > I can connect using 'psql' just fine. > > If I create the user 'D1Khb2g5m7FGk_web_user' > with password 'password' > I CANNOT connect using 'psql', I get authentication error. > > ----------------------------- > ANYONE have any ideas why? > ----------------------------- > > PG_VERSION says it's 7.3. I don't know how to find out any more accurately the subversion of that. > > >
On Sat, 3 Jul 2004, Dennis Gearon wrote: > Please CC me: > > If I create the user 'web_user' > with password 'password' > I can connect using 'psql' just fine. > > If I create the user 'D1Khb2g5m7FGk_web_user' > with password 'password' > I CANNOT connect using 'psql', I get authentication error. Are you sure that you're not just running into a case problem with case folded names (non-quoted names from sql statements) versus non-case folded names (programs which treat their arguments as quoted like psql).
Dennis Gearon wrote: > another name that does not work is 'H1q2W3e4R5_web_user'. Sounds like a quoting problem. In the meantime, read this: http://www.fr.postgresql.org/docs/7.4/static/bug-reporting.html > > It seems to not like many alternations between numbers and letters. > > Dennis Gearon wrote: > > Please CC me: > > > > If I create the user 'web_user' > > with password 'password' > > I can connect using 'psql' just fine. > > > > If I create the user 'D1Khb2g5m7FGk_web_user' > > with password 'password' > > I CANNOT connect using 'psql', I get authentication error. > > > > ----------------------------- > > ANYONE have any ideas why? > > ----------------------------- > > > > PG_VERSION says it's 7.3. I don't know how to find out any more > > accurately the subversion of that.
Stephan Szabo wrote: > On Sat, 3 Jul 2004, Dennis Gearon wrote: > > >>Please CC me: >> >>If I create the user 'web_user' >>with password 'password' >>I can connect using 'psql' just fine. >> >>If I create the user 'D1Khb2g5m7FGk_web_user' >>with password 'password' >>I CANNOT connect using 'psql', I get authentication error. > > > Are you sure that you're not just running into a case problem > with case folded names (non-quoted names from sql statements) versus > non-case folded names (programs which treat their arguments as quoted like > psql). > I am putting the exact same string into both situations: A/ creating the username B/ trying to log in. If the database is not going to respect case in one, it shouldn't respect case in the other, right? Maybe because it's feeding the name to the MD5 library with case, but checking it without case later?
On Sat, 3 Jul 2004, Dennis Gearon wrote: > Stephan Szabo wrote: > > On Sat, 3 Jul 2004, Dennis Gearon wrote: > > > > > >>Please CC me: > >> > >>If I create the user 'web_user' > >>with password 'password' > >>I can connect using 'psql' just fine. > >> > >>If I create the user 'D1Khb2g5m7FGk_web_user' > >>with password 'password' > >>I CANNOT connect using 'psql', I get authentication error. > > > > > > Are you sure that you're not just running into a case problem > > with case folded names (non-quoted names from sql statements) versus > > non-case folded names (programs which treat their arguments as quoted like > > psql). > > > I am putting the exact same string into both situations: > > A/ creating the username How did you create the user. Did you use the shell script or a create user statement from inside a session in the database? > B/ trying to log in. > > If the database is not going to respect case in one, it shouldn't > respect case in the other, right? 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".
Stephan Szabo wrote: > > On Sat, 3 Jul 2004, Dennis Gearon wrote: > > >>Stephan Szabo wrote: >> >>>On Sat, 3 Jul 2004, Dennis Gearon wrote: >>> >>> >>> >>>>Please CC me: >>>> >>>>If I create the user 'web_user' >>>>with password 'password' >>>>I can connect using 'psql' just fine. >>>> >>>>If I create the user 'D1Khb2g5m7FGk_web_user' >>>>with password 'password' >>>>I CANNOT connect using 'psql', I get authentication error. >>> >>> >>>Are you sure that you're not just running into a case problem >>>with case folded names (non-quoted names from sql statements) versus >>>non-case folded names (programs which treat their arguments as quoted like >>>psql). >>> >> >>I am putting the exact same string into both situations: >> >> A/ creating the username > > > How did you create the user. Did you use the shell script or a create > user statement from inside a session in the database? > > >> B/ trying to log in. >> >>If the database is not going to respect case in one, it shouldn't >>respect case in the other, right? > > > 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 wasenterd) into the database, and validate it the same way.
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.
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. > > > ---------------------------(end of broadcast)--------------------------- > TIP 6: Have you searched our list archives? > > http://archives.postgresql.org > > So, if I >>WANT<< a user name with case: ((A)) Creating user in psql, it will respect case automatically? To OPEN psql using that user, I have to put it in double quotes? (to those new to postgres, the '#' means superuser is logged in) ------------------------------------------------------------------- database_name# create user CasedNameForUser with password 'password'; database_name#\q user/system_prompt> psql -U "CasedNameForUser" -d dbase -p port password: Congratulations statements .... dbase_name_as_prompt ###OR### ((B)) Creating user in psql, I will have to use double quotes? To OPEN psql using that user, , it will respect case automatically? (to those new to postgres, the '#' means superuser is logged in) ------------------------------------------------------------------- database_name# create user "CasedNameForUser" with password 'password'; database_name#\q user/system_prompt> psql -U CasedNameForUser -d dbase -p port password: Congratulations statements .... dbase_name_as_prompt and the converse, if I >>WANT<< a user name withOUT case: What then?
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")
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.