Received: from magus.postgresql.org (magus.postgresql.org [87.238.57.229]) by mail.postgresql.org (Postfix) with ESMTP id D005C1B25E4E for ; Thu, 15 Mar 2012 20:33:41 -0300 (ADT) Received: from sd.tpf.co.jp ([210.161.239.34]) by magus.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1S8KAr-00083Y-9u for pgsql-odbc@postgresql.org; Thu, 15 Mar 2012 23:33:41 +0000 Received: (qmail 585 invoked by uid 512); 15 Mar 2012 23:33:20 -0000 X-Authentication: inoue was authenticated by sd.tpf.co.jp at 15 Mar 2012 23:33:20 -0000 Received: from unknown (HELO ?192.168.24.54?) (183.76.20.202) by sd.tpf.co.jp with SMTP; 15 Mar 2012 23:33:20 -0000 Message-ID: <4F627C3D.8070302@tpf.co.jp> Date: Fri, 16 Mar 2012 08:33:17 +0900 From: Hiroshi Inoue User-Agent: Mozilla/5.0 (Windows NT 6.0; rv:10.0.2) Gecko/20120216 Thunderbird/10.0.2 MIME-Version: 1.0 To: Alexandre - Aldeia Digital CC: "pgsql-odbc@postgresql.org" Subject: Re: Problem with Use Declare/Fetch References: <4F624C5D.1010809@aldeiadigital.com.br> In-Reply-To: <4F624C5D.1010809@aldeiadigital.com.br> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -1.9 (-) X-Archive-Number: 201203/17 X-Sequence-Number: 10798 Hi Alexandre, (2012/03/16 5:09), Alexandre - Aldeia Digital wrote: > Hi, > > Some time ago, We start to update our ODBC version. > We are using Post 9.0.4(UTF) and ODBC Unicode (psqlodbc_09_01_0100-1) > with use declare/fetch enable. > > One of my customeres have a routine thats reads from some tables and > inserts in anoter. Bellow, some statements: > > {snip} > > <192.168.1.160# 2012-03-15 16:09:09 BRT 3117>LOG: statement: > BEGIN;declare "P01303" cursor for SELECT PC33Codigo, PC33Emp08, > PC33FatArr, PC33QtdPte, PC33CodInd FROM PC33T WHERE PC33Emp08 = '17' and > PC33Codigo = E'DECLARE F ' ORDER BY PC33Emp08, PC33Codigo ;fetch 100 in > "P01303" > <192.168.1.160# 2012-03-15 16:09:09 BRT 3118>LOG: statement: close "P01303" > > <192.168.1.160# 2012-03-15 16:09:09 BRT 3119>LOG: statement: declare > "P01304" cursor for SELECT PC01CodEmp, PC01UsaCom, PC01TabRel FROM PC01T > WHERE PC01CodEmp = '17' ORDER BY PC01CodEmp ;fetch 100 in "P01304" > <192.168.1.160# 2012-03-15 16:09:09 BRT 3120>LOG: statement: close "P01304" > > ---- PROBLEM HERE --- > > <192.168.1.160# 2012-03-15 16:09:09 BRT 3121>LOG: statement: declare > "P01305" cursor for SELECT Pc13Item, PC13CodPed, PC13AnoPed, PC13Emp08P, > PC13VlrEst, PC13VrUnit, PC13Cor, PC13Codigo, PC13Emp08, PC13Produ, > PC13Linha FROM PC13T WHERE (PC13Emp08 = '17' and PC13Codigo >= E' ') AND > (PC13Linha >= '0' and PC13Linha <= '99999') AND (PC13CodPed = '0') AND > (PC13AnoPed = 0) AND (PC13Produ = E'S') AND (PC13Codigo <= E'zzzzz ') > ORDER BY PC13Emp08, PC13Codigo, PC13Cor, PC13AnoPed ;fetch 100 in "P01305" > > ---- PROBLEM HERE --- > > <192.168.1.160# 2012-03-15 16:09:09 BRT 3122>LOG: statement: declare > "P36492" cursor with hold for SELECT cf25item, cf25objeto, cf02login, > cf25conteu FROM CF25T WHERE cf02login = E'ADMINISTRADOR ' and cf25objeto > = E'PC0295PC0208 ' and cf25item = '1' ORDER BY cf02login, cf25objeto, > cf25item ;fetch 100 in "P36492" > <192.168.1.160# 2012-03-15 16:09:09 BRT 3123>LOG: statement: close "P36492" > > {snip} Could you send me directly the Mylog output? regards, Hiroshi Inoue > > The problem is in table PC13T, that have more than 100 tuples. The > cursor "P01305" was executed once, instead of loop until the end of > resultset. > The strange is that this cursor is not CLOSED anymore: > > postgres@vm002:~/data_90$ grep P01305 fetch_problem.log > > <192.168.1.160# 2012-03-15 16:09:09 BRT 3121>LOG: statement: declare > "P01305" cursor for SELECT Pc13Item, PC13CodPed, PC13AnoPed, PC13Emp08P, > PC13VlrEst, PC13VrUnit, PC13Cor, PC13Codigo, PC13Emp08, PC13Produ, > PC13Linha FROM PC13T WHERE (PC13Emp08 = '17' and PC13Codigo >= E' ') AND > (PC13Linha >= '0' and PC13Linha <= '99999') AND (PC13CodPed = '0') AND > (PC13AnoPed = 0) AND (PC13Produ = E'S') AND (PC13Codigo <= E'zzzzz ') > ORDER BY PC13Emp08, PC13Codigo, PC13Cor, PC13AnoPed ;fetch 100 in "P01305" > > postgres@vm002:~/data_90$ > > > Best regards, > > > Alexandre