Received: from maia.hub.org (maia-1.hub.org [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 651A36325BE for ; Fri, 7 May 2010 09:25:21 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 20909-05 for ; Fri, 7 May 2010 12:25:06 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from dukecmmtar03.coxmail.com (dukecmmtar03.coxmail.com [68.99.120.44]) by mail.postgresql.org (Postfix) with ESMTP id B15696323D0 for ; Fri, 7 May 2010 09:25:13 -0300 (ADT) Received: from dukecmimpo02.coxmail.com ([68.99.120.135]) by dukecmmtar03.coxmail.com (InterMail vM.7.05.02.00 201-2174-114-20060621) with ESMTP id <20100507122512.OFOP29454.dukecmmtar03.coxmail.com@dukecmimpo02.coxmail.com>; Fri, 7 May 2010 08:25:12 -0400 Received: from Lorien.local ([98.172.21.99]) by dukecmimpo02.coxmail.com with bizsmtp id EcRB1e00C28G7zW01cRBTv; Fri, 07 May 2010 08:25:12 -0400 Message-ID: <4BE406A7.6000101@pnlassociates.com> Date: Fri, 07 May 2010 08:25:11 -0400 From: Paul Anderson User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.1.9) Gecko/20100317 Lightning/1.0b1 Thunderbird/3.0.4 MIME-Version: 1.0 To: pgsql-testers@postgresql.org CC: "Paul B. Anderson" Subject: Possible 9.0 bug Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.8 tagged_above=-10 required=5 tests=BAYES_00=-1.9, RCVD_IN_PSBL=2.7 X-Spam-Level: X-Archive-Number: 201005/11 X-Sequence-Number: 94 I have a small test case (shown below) that is not working under 9.0beta1 but works fine under 8.1. I have other code that is virtually identical to this that does not encounter the error. When I connect using empty string user id and password (and specifying ident in pg_hba) I get the following: ================ >testconnect Database connection failed: connection failed:-402:could not connect to database "mchs" on line 53 Could not connect to database: connection failed:-402:could not connect to database "mchs" on line 53 ================= When I put in non-empty user id and password, it is OK: >testconnect Connected to database OK Disconnected from database ================= This is my test case: ================= #include #include #include #define USERNAME "" #define PASSWORD "" #include int db_connect(char *); void db_disconnect(); int main(int argc, char *argv[]) { char message[81]; if (db_connect(message) != 0) { printf("Could not connect to database: %s\n", message); } else { printf("Connected to database OK\n"); db_disconnect(); } return 0; } int db_connect(char *message) { int result = 0; EXEC SQL BEGIN DECLARE SECTION; VARCHAR username[128]; VARCHAR password[32]; EXEC SQL END DECLARE SECTION; strcpy(username.arr,USERNAME); username.len = strlen(username.arr); strcpy(password.arr,PASSWORD); password.len = strlen(password.arr); EXEC SQL CONNECT TO mchs USER :username IDENTIFIED BY :password; if (sqlca.sqlcode == 0) { result = 0; } else { result = 1; sprintf(message,"connection failed:%d:%s\n", sqlca.sqlcode, sqlca.sqlerrm.sqlerrmc); printf("\nDatabase connection failed: %s\n", message); } return result; } void db_disconnect() { EXEC SQL ROLLBACK; EXEC SQL CONNECT RESET; printf("\nDisconnected from database\n"); }