Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Y36Bw-0002PI-FJ for pgsql-odbc@arkaria.postgresql.org; Mon, 22 Dec 2014 16:50:44 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1Y36Bv-0007EB-Ec for pgsql-odbc@arkaria.postgresql.org; Mon, 22 Dec 2014 16:50:43 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1Y36Bu-0007E5-Ud for pgsql-odbc@postgresql.org; Mon, 22 Dec 2014 16:50:43 +0000 Received: from smtp-outbound-1.vmware.com ([208.91.2.12]) by magus.postgresql.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1Y36Bq-0000d4-5s for pgsql-odbc@postgresql.org; Mon, 22 Dec 2014 16:50:41 +0000 Received: from sc9-mailhost2.vmware.com (sc9-mailhost2.vmware.com [10.113.161.72]) by smtp-outbound-1.vmware.com (Postfix) with ESMTP id BB3BD28644; Mon, 22 Dec 2014 08:50:32 -0800 (PST) Received: from EX13-CAS-008.vmware.com (EX13-CAS-008.vmware.com [10.113.191.58]) by sc9-mailhost2.vmware.com (Postfix) with ESMTP id B56F2B1409; Mon, 22 Dec 2014 08:50:32 -0800 (PST) Received: from EX13-MBX-024.vmware.com (10.113.191.44) by EX13-MBX-004.vmware.com (10.113.191.24) with Microsoft SMTP Server (TLS) id 15.0.913.22; Mon, 22 Dec 2014 08:50:32 -0800 Received: from [192.168.1.90] (10.113.160.246) by EX13-MBX-024.vmware.com (10.113.191.44) with Microsoft SMTP Server (TLS) id 15.0.913.22; Mon, 22 Dec 2014 08:50:16 -0800 Message-ID: <54984BB9.3050903@vmware.com> Date: Mon, 22 Dec 2014 18:50:01 +0200 From: Heikki Linnakangas Organization: VMware User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.3.0 MIME-Version: 1.0 To: Eric Hill , "pgsql-odbc@postgresql.org" Subject: Re: Windows driver sometimes returns connection string with two consecutive semicolons References: In-Reply-To: Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.113.160.246] X-ClientProxiedBy: EX13-CAS-013.vmware.com (10.113.191.65) To EX13-MBX-024.vmware.com (10.113.191.44) X-Pg-Spam-Score: -6.9 (------) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-odbc Precedence: bulk Sender: pgsql-odbc-owner@postgresql.org On 12/19/2014 11:37 PM, Eric Hill wrote: > Hey, > > We cache connection strings in our application so we can know if you already have a connection to a given database. We ran into this: > > Windows, Postgres driver version 9.03.03. > > When you use the ODBC administrator (which we invoke programmatically by passing the empty string as the third argument to SQLDriverConnect()) to connect to Postgres, driver 9.03.03, the connection string you get back (5th argument) has an extra semicolon after "C2=dd_", to wit: > > BI=0;C2=dd_;;CX=1c20502bb; > > However, if you call SQLDriverConnect() passing in that connection string with the extra semicolon as the third argument, a connection is made, and the connection string you get back in the 5th param does *not* have the extra semicolon: > > BI=0;C2=dd_;CX=1c20502bb; > > Yes, I can work around this, but why not stop spitting out the extra semicolon in the first case? Hmm. This seems to be because there's a trailing semicolon in the default ExtraSysTablePrefixes attribute, abbtreviated as C2. In other words, the semicolon is actually part of the "C2=dd_;" attribute. The trivial fix is to just remove it from ExtraSysTablePrefixes's default, which makes sense anyway. However, the code that forms the connection strings is nevertheless broken: if you actually try to put something with a semicolon in ExtraSysTablePrefixes, like "foo;bar", it will still do it wrong because it won't escape that. The code that forms and parses the connection strings is quite a mess. It needs a rewrite, but for now I have removed the semicolon from the default, which should fix your immediate problem. (Does anyone know why "dd_" is the default for extraSysTablePrefixes, anyway? I don't recognize that prefix. It's been like that forever...) - Heikki -- Sent via pgsql-odbc mailing list (pgsql-odbc@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-odbc