Thread: Invalid password for \ and ' characters

Invalid password for \ and ' characters

From
"Andrus Moor"
Date:
If password set by pgadmin contains \ or ' character, it is not possible to
login to pgAdmin

PROBLEM WITH \ character is password

To reproduce

1. Create new login role in pgadmin
2. Enter \ to password field.
3. Select SQL tab

Observed:

CREATE ROLE test LOGIN PASSWORD '\\'

Expected

CREATE ROLE test LOGIN PASSWORD '\'

Postres does NOT require backslashes in password strings.
PgAdmin probably uses its qtString for password strings.
This causes invalid passwords to be set if password contains \ character.


PROBLEM WITH ' CHARACTER IN PASSWORD

To reproduce:

1. Using pgADMIN login role property dialog set pgAdmin login role password
to '
2. Re-open the connection to server.

Observed:

---------------------------
pgAdmin III
---------------------------
An error has occured:

Error connecting to the server: missing "=" after "''" in connection info 
string


Platform:

pgAdmin 1.4.0 on windows xp
PostgreSQL 8.1.0 on i686-pc-mingw32, compiled by GCC gcc.exe (GCC) 3.4.2 
(mingw-special)

Andrus Moor




Re: Invalid password for \ and ' characters

From
Andreas Pflug
Date:
Andrus Moor wrote:
> If password set by pgadmin contains \ or ' character, it is not possible to
> login to pgAdmin
> 
> PROBLEM WITH \ character is password
> 
> To reproduce
> 
> 1. Create new login role in pgadmin
> 2. Enter \ to password field.
> 3. Select SQL tab
> 
> Observed:
> 
> CREATE ROLE test LOGIN PASSWORD '\\'
> 
> Expected
> 
> CREATE ROLE test LOGIN PASSWORD '\'
> 
> Postres does NOT require backslashes in password strings.
> PgAdmin probably uses its qtString for password strings.

AFAIR Dave recently changed that. Please check the CHANGELOG and try a 
newer version.

Regards,
Andreas


Re: Invalid password for \ and ' characters

From
"Dave Page"
Date:

> -----Original Message-----
> From: pgadmin-support-owner@postgresql.org
> [mailto:pgadmin-support-owner@postgresql.org] On Behalf Of
> Andreas Pflug
> Sent: 19 March 2006 11:19
> To: Andrus Moor
> Cc: pgadmin-support@postgresql.org
> Subject: Re: [pgadmin-support] Invalid password for \ and ' characters
>
> Andrus Moor wrote:
> > If password set by pgadmin contains \ or ' character, it is
> not possible to
> > login to pgAdmin
> >
> > PROBLEM WITH \ character is password
> >
> > To reproduce
> >
> > 1. Create new login role in pgadmin
> > 2. Enter \ to password field.
> > 3. Select SQL tab
> >
> > Observed:
> >
> > CREATE ROLE test LOGIN PASSWORD '\\'
> >
> > Expected
> >
> > CREATE ROLE test LOGIN PASSWORD '\'
> >
> > Postres does NOT require backslashes in password strings.
> > PgAdmin probably uses its qtString for password strings.
>
> AFAIR Dave recently changed that. Please check the CHANGELOG
> and try a
> newer version.

Yes, I did, but that was for the logon code where the rules of libpq are
observed rather than SQL.

As per the example given, Andrus has it backwards. The password string
in PostgreSQL is just like any other string and will always require that
quotes and backslashes are escaped. Note in psql, how the prompt shows
the string is to be completed if a backslash is not quoted:

postgres=> alter role dpage with password '\';
postgres'>

Regards, Dave.