BUG #5249: PGUSER has to be set in the console for PSQL to authenticate

Started by Ashish Anandover 16 years ago3 messagesbugs
Jump to latest
#1Ashish Anand
Ashish.The.Dev@gmail.com

The following bug has been logged online:

Bug reference: 5249
Logged by: Ashis Anand
Email address: Ashish.The.Dev@Gmail.com
PostgreSQL version: 8.4.1 bld1400
Operating system: Windows & 32 bit
Description: PGUSER has to be set in the console for PSQL to
authenticate
Details:

Hi everyone,

My first bug.

version
-------------------------------------------------------------
PostgreSQL 8.4.1, compiled by Visual C++ build 1400, 32-bit
(1 row)

Problem Statement: PGUSER has to be set for PSQL to authenticate. If left
unset the connection to database fails with the error mentioned below.

STEPS:
1. Install PostgreSQL.
2. Start psql from start menu
3. create a role for the user 'foo' through the following statement
CREATE ROLE foo LOGIN CREATEDB CREATEROLE PASSWORD 'bar'
4. Create a database mydb
CREATE DATABASE mydb WITH OWNER = foo
5. Open your normal console where pguser is not set
6. Run: "psql mydb"
7. Enter the password as 'bar'

Actual output:
psql: FATAL: password authentication failed for user "foo"

Expected output:
psql (8.4.1)
WARNING: Console code page (437) differs from Windows code page (1252)
8-bit characters might not work correctly. See psql reference
page "Notes for Windows users" for details.
Type "help" for help.
mydb=>

8. Run: SET PGUSER=foo
9. Run: "psql mydb"
10. Enter the password as "bar"

Actual output:
psql (8.4.1)
WARNING: Console code page (437) differs from Windows code page (1252)
8-bit characters might not work correctly. See psql reference

If anything else is required, please let me know. But I guess this would
probably be a known bug.
page "Notes for Windows users" for details.
Type "help" for help.
mydb=>

#2Alvaro Herrera
alvherre@2ndquadrant.com
In reply to: Ashish Anand (#1)
Re: BUG #5249: PGUSER has to be set in the console for PSQL to authenticate

Ashis Anand escribi�:

Problem Statement: PGUSER has to be set for PSQL to authenticate. If left
unset the connection to database fails with the error mentioned below.

STEPS:
1. Install PostgreSQL.
2. Start psql from start menu
3. create a role for the user 'foo' through the following statement
CREATE ROLE foo LOGIN CREATEDB CREATEROLE PASSWORD 'bar'
4. Create a database mydb
CREATE DATABASE mydb WITH OWNER = foo
5. Open your normal console where pguser is not set
6. Run: "psql mydb"
7. Enter the password as 'bar'

Actual output:
psql: FATAL: password authentication failed for user "foo"

Hmm. Do you have a pgpass.conf file with a conflicting password for
user foo?

--
Alvaro Herrera http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.

#3Ashish Anand
Ashish.The.Dev@gmail.com
In reply to: Alvaro Herrera (#2)
Re: BUG #5249: PGUSER has to be set in the console for PSQL to authenticate

Yes, the file is there as of now and its contents are:
localhost:5432:*:postgres:bar

I am not sure if the file was there when it actually happened. But the repro
steps are complete in themselves and can be reproed on any fresh install of
ver 8.4.1.

Thanks,
Ashish.

On Sat, Dec 19, 2009 at 5:57 AM, Alvaro Herrera
<alvherre@commandprompt.com>wrote:

Show quoted text

Ashis Anand escribió:

Problem Statement: PGUSER has to be set for PSQL to authenticate. If left
unset the connection to database fails with the error mentioned below.

STEPS:
1. Install PostgreSQL.
2. Start psql from start menu
3. create a role for the user 'foo' through the following statement
CREATE ROLE foo LOGIN CREATEDB CREATEROLE PASSWORD 'bar'
4. Create a database mydb
CREATE DATABASE mydb WITH OWNER = foo
5. Open your normal console where pguser is not set
6. Run: "psql mydb"
7. Enter the password as 'bar'

Actual output:
psql: FATAL: password authentication failed for user "foo"

Hmm. Do you have a pgpass.conf file with a conflicting password for
user foo?

--
Alvaro Herrera
http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.