Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1ZyW70-0000hg-OP for pgsql-odbc@arkaria.postgresql.org; Tue, 17 Nov 2015 02:35:14 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1ZyW70-0005q8-A4 for pgsql-odbc@arkaria.postgresql.org; Tue, 17 Nov 2015 02:35:14 +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 1ZyW6z-0005oi-IC for pgsql-odbc@postgresql.org; Tue, 17 Nov 2015 02:35:13 +0000 Received: from mail2.asahi-net.or.jp ([202.224.39.198]) by makus.postgresql.org with esmtp (Exim 4.84) (envelope-from ) id 1ZyW6v-0001Yl-PO for pgsql-odbc@postgresql.org; Tue, 17 Nov 2015 02:35:11 +0000 Received: from [192.168.1.13] (p8251-ipngn100104fukui.fukui.ocn.ne.jp [153.180.141.251]) by mail2.asahi-net.or.jp (Postfix) with ESMTP id B01BA62D5; Tue, 17 Nov 2015 11:35:07 +0900 (JST) Subject: Re: SQL_DATA_AT_EXEC processing broken for large objects in nightly git To: Heikki Linnakangas 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> Cc: pgsql-odbc@postgresql.org From: "Inoue, Hiroshi" Message-ID: <564A925B.9040809@dream.email.ne.jp> Date: Tue, 17 Nov 2015 11:35:07 +0900 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: <5643255C.2060207@dream.email.ne.jp> Content-Type: multipart/mixed; boundary="------------080603050407020903000008" X-Pg-Spam-Score: -2.6 (--) 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 This is a multi-part message in MIME format. --------------080603050407020903000008 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Hi Heikki, The attached patch seems to fix all but I don't understand sqltype_to_bind_pgtype() well. Comments? regards, Hiroshi Inoue On 2015/11/11 20:24, Inoue, Hiroshi wrote: > On 2015/11/09 20:53, Heikki Linnakangas wrote: >> On 11/04/2015 04:26 PM, Inoue, Hiroshi wrote: >>> >>> >>> On 2015/11/04 20:04, Heikki Linnakangas wrote: >>>> On 11/04/2015 09:48 AM, Inoue, Hiroshi wrote: >>>>> Hi, >>>>> To >>>>> I was able to reproduce it here. >>>>> Because I can't understand the current code at once, please give >>>>> me some >>>>> time >>>>> to solve the problem. >>>> >>>> I also started looking at this last week, and came up with a patch >>>> that I think fixes it, but I got distracted before completing it and >>>> replying here. So here's what I came up with... >>> >>> The solution seems to generate 2 transactions for 1 insertion. >> >> Hmm, you're right, although that doesn't seem to be a new issue. The >> 09.03.0400 driver does the same, see attached logs from >> log_statements=all. Would be nice to fix that, but it's a separate >> issue. > > Oh you are right. I will examine it. > >> >> >>> The insertion seems to be rejected when ByteaAsLongVarBinary=1. >> >> Oh. It works for me. How are you testing that? > > I define LO type and set ByteaAsLongVarBinary=1. > The failure is #ERROR: column "large_data" is of type LO but > expression is type "bytea" . > > regards, > Hiroshi Inoue > > > > --------------080603050407020903000008 Content-Type: text/x-diff; name="lobj.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="lobj.patch" diff --git a/convert.c b/convert.c index 8802e6e..6756276 100644 --- a/convert.c +++ b/convert.c @@ -4116,14 +4116,12 @@ inolog("ipara=%p paramType=%d %d proc_return=%d\n", ipara, ipara ? ipara->paramT } else if (!handling_large_object) { - CVT_APPEND_CHAR(qb, '?'); - return SQL_SUCCESS; + /* shouldn't happen */ + qb->errormsg = "unexpected NULL parameter value"; + qb->errornumber = STMT_EXEC_ERROR; + return SQL_ERROR; } - /* shouldn't happen */ - qb->errormsg = "unexpected NULL parameter value"; - qb->errornumber = STMT_EXEC_ERROR; - return SQL_ERROR; } /* replace DEFAULT with something we can use */ diff --git a/execute.c b/execute.c index 111230b..2e0977a 100644 --- a/execute.c +++ b/execute.c @@ -1340,17 +1340,6 @@ PGAPI_ParamData(HSTMT hstmt, if (estmt->lobj_fd >= 0) { odbc_lo_close(conn, estmt->lobj_fd); - - /* commit transaction if needed */ - if (!CC_cursor_count(conn) && CC_does_autocommit(conn)) - { - if (!CC_commit(conn)) - { - SC_set_error(stmt, STMT_EXEC_ERROR, "Could not commit (in-line) a transaction", func); - retval = SQL_ERROR; - goto cleanup; - } - } estmt->lobj_fd = -1; } diff --git a/pgtypes.c b/pgtypes.c index 167966f..b90e69b 100644 --- a/pgtypes.c +++ b/pgtypes.c @@ -1285,13 +1285,6 @@ sqltype_to_bind_pgtype(const ConnectionClass *conn, SQLSMALLINT fSqlType) pgType = PG_TYPE_INT4; break; - case SQL_LONGVARBINARY: - if (ci->bytea_as_longvarbinary) - pgType = PG_TYPE_BYTEA; - else - pgType = conn->lobj_type; - break; - case SQL_REAL: pgType = PG_TYPE_FLOAT4; break; --------------080603050407020903000008 Content-Type: text/plain Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 -- Sent via pgsql-odbc mailing list (pgsql-odbc@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-odbc --------------080603050407020903000008--