Re: Roles with empty password (probably bug in libpq and in psql as well). - Mailing list pgsql-general

From Dmitriy Igrishin
Subject Re: Roles with empty password (probably bug in libpq and in psql as well).
Date
Msg-id CAAfz9KNvnzT7BD0DgzU3_2EhY1c-9r+4mB1=VsaLBz3Trtk4Rw@mail.gmail.com
Whole thread Raw
In response to Re: Roles with empty password (probably bug in libpq and in psql as well).  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Roles with empty password (probably bug in libpq and in psql as well).  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general


2012/7/24 Tom Lane <tgl@sss.pgh.pa.us>
Dmitriy Igrishin <dmitigr@gmail.com> writes:
> But it's impossible to pass empty (NULL) password to the backend

Please note that empty and null are not the same thing...
Yes, I know. But why the ALTER ROLE treats '' as NULL and
as the result all of values of pg_catalog.pg_authid.rolpassword are always
NULL even when the password in ALTER ROLE was specified as ''? :-)
That is the reason why I've considered empty and NULL as the same
thing :-)

> by using libpq, because connectOptions2() defined the
> fe-connect.c reads a password from the ~/.pgpass even when a password
> specified as an empty string literal ("").

I rather doubt that we'll change this, because it seems more likely
to break applications that rely on that behavior than to do anything
useful.  Surely nobody in their right mind uses an empty password.

(If anything, I'd be more inclined to make the backend treat an empty
password as an error than to try to make libpq safe for the case.
Even if we did change libpq, there are probably issues with empty
passwords in jdbc and who knows how many other places.)
Then it should be at least documented in the libpq's documentation that
explicitly specified empty password will force libpq to get it from the file?

                        regards, tom lane



--
// Dmitriy.


pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Odd corruption issue reported on dba.stackexchange.com, need advice
Next
From: Mark Wynter
Date:
Subject: Problem using a pl/pgsql function to populate a geometry column with x,y data