Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1aB03q-0004xb-45 for pgsql-odbc@arkaria.postgresql.org; Mon, 21 Dec 2015 12:59:34 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1aB03p-0007Qi-Mw for pgsql-odbc@arkaria.postgresql.org; Mon, 21 Dec 2015 12:59:33 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1aB03o-0007OU-Vi for pgsql-odbc@postgresql.org; Mon, 21 Dec 2015 12:59:33 +0000 Received: from mail-pa0-x231.google.com ([2607:f8b0:400e:c03::231]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84) (envelope-from ) id 1aB03m-0006ps-Mh for pgsql-odbc@postgresql.org; Mon, 21 Dec 2015 12:59:31 +0000 Received: by mail-pa0-x231.google.com with SMTP id q3so79156841pav.3 for ; Mon, 21 Dec 2015 04:59:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:subject:to:references:cc:from:message-id:date:user-agent :mime-version:in-reply-to:content-type:content-transfer-encoding; bh=hmfRypUqvij5ld1NIzI6CvjXKC7r8yesSL5hncqF7TA=; b=KsDa2FVgp0a4H7hf1jIFlanl2z0736CUlwfoyJC2HA1J4kr2aB2/dwVCIs4XRQTJ60 eT9LcgmaCXf9tF3DOeQwdJlb+bvVV02o3RLYotwV7nCO738JclN5NPrbKf4uE9LM7voq PXnGW72DdD3F3p/RjOJ2p1BO+L5z88kX2C1XuTAts19gwPM3q3SuelOGWIQ6uErTg0qR 9lufx000q0dZjrfMQSVmfzHzsyFn+JnmmBu3Ap2sC3iVZrmj+6ufDZ3jFUTISyIl5tmE oRxFm3h1vqKyyujl6gx6+Rd1TECj2bM1peAqX3buEP3WqOuE3cs9X3ubi4PCtvhEigy+ 8oqg== X-Received: by 10.66.97.71 with SMTP id dy7mr27066255pab.8.1450702769843; Mon, 21 Dec 2015 04:59:29 -0800 (PST) Received: from [192.168.1.115] (dsl-hkibrasgw1-58c38f-82.dhcp.inet.fi. [88.195.143.82]) by smtp.gmail.com with ESMTPSA id p20sm34771067pfi.25.2015.12.21.04.59.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 21 Dec 2015 04:59:29 -0800 (PST) Subject: Re: SQL_DATA_AT_EXEC processing broken for large objects in nightly git To: "Inoue, Hiroshi" References: <561F954E.7020808@serena.com> <5639B85F.7030408@dream.email.ne.jp> <5639E621.1020505@iki.fi> <563A159A.5080104@dream.email.ne.jp> <5640892B.7060700@iki.fi> <5643255C.2060207@dream.email.ne.jp> <564A925B.9040809@dream.email.ne.jp> Cc: pgsql-odbc@postgresql.org From: Heikki Linnakangas Message-ID: <5677F791.10006@iki.fi> Date: Mon, 21 Dec 2015 14:58:57 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Icedove/38.4.0 MIME-Version: 1.0 In-Reply-To: <564A925B.9040809@dream.email.ne.jp> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -2.3 (--) 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 17/11/15 04:35, Inoue, Hiroshi wrote: > Hi Heikki, > > The attached patch seems to fix all but I don't understand > sqltype_to_bind_pgtype() well. > Comments? Ah, thanks, I see what the problem is now. I haven't looked at the extra-transaction part yet, but the rest looks good to me, so I committed my original patch and the sqltype_to_bind_pgtype() part of your patch. You must've figured this out already, but I'll summarize the issue for the sake of the archives: sqltype_to_bind_pgtype() was introduced in commit 1ccd04c70b8037b268eefcaae09ce131c8c33b59. Before that, query parameters were always sent to the server as 'unknown', and the server deduced the correct datatype. After that commit, we send a suitable PostgreSQL type OID to the server, depending on the SQL_* type code that application gave. For example, if you call SQLBindParameters(SQL_INTEGER), we send the query parameter to the server as 'int4'. That fixes cases like "SELECT '555' < ?", where it makes a big difference whether the server treats the parameter as text or integer. So when the application binds a parameter as SQL_LONGVARBINARY, we now send it to the server as 'bytea', if ByteaAsLongVarBinary=1, or as 'lo' otherwise. If you set ByteaAsLongVarBinary=1, the driver reports bytea fields as SQL_LONGVARBINARY, so it makes sense that we do the same in the other direction: when the application binds a parameter as SQL_LONGVARBINARY, send it as 'bytea' to the server. But unfortunately, it doesn't work if the column is in fact a large object. Your patch reverts the behaviour of SQL_LONGVARBINARY parameters back to sending them as 'unknown'. That seems reasonable. It would be nice to pass a datatype to the server, but there is no way to specify "bytea or a large object". If we choose either one, the other case will be wrong. Sending SQL_LONGVARBINARY parameters as 'unknown' should be OK in practice, there is not much danger for "SELECT '555' < ?" kind of ambiguity with binary parameters. - Heikki -- Sent via pgsql-odbc mailing list (pgsql-odbc@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-odbc