X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 8CC9752823 for ; Wed, 8 Jun 2005 14:32:26 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 95702-07 for ; Wed, 8 Jun 2005 17:32:17 +0000 (GMT) Received: from mir3-fs.mir3.com (mail.mir3.com [216.74.11.46]) by svr1.postgresql.org (Postfix) with ESMTP id 56D6A5280A for ; Wed, 8 Jun 2005 14:32:16 -0300 (ADT) Received: from archimedes.mirlogic.com ([172.16.2.68]) by mir3-fs.mir3.com with Microsoft SMTPSVC(5.0.2195.6713); Wed, 8 Jun 2005 10:34:45 -0700 Subject: Re: Num of returned ROWS From: Mark Lewis To: Fernando Hartmann Cc: pgsql-jdbc@postgresql.org In-Reply-To: References: <42A62275.2020900@opencloud.com> Content-Type: text/plain Organization: MIR3, Inc. Date: Wed, 08 Jun 2005 10:32:13 -0700 Message-Id: <1118251933.24149.48.camel@archimedes.mirlogic.com> Mime-Version: 1.0 X-Mailer: Evolution 2.0.2 (2.0.2-16) Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 08 Jun 2005 17:34:45.0078 (UTC) FILETIME=[5C3F8F60:01C56C50] X-Virus-Scanned: by amavisd-new at hub.org X-Archive-Number: 200506/39 X-Sequence-Number: 13001 executeUpdate() returns the number of rows affected. There are zero rows affected by a SELECT COUNT(*) FROM ... You'll need to use an executeQuery instead. -- Mark Lewis On Wed, 2005-06-08 at 08:38 -0300, Fernando Hartmann wrote: > Oliver Jowett wrote: > > Fernando Hartmann wrote: > > > > > >> I'm using Postgres 8.0.3 and JDBC build 311 (tried 400 too) and > >>using executeUpdate to send the following command to DB: > >> > >>set datestyle to ISO,DMY; > >>create table table1 as select F1, sum(F10) from table where F1 between > >>'1/1/2001' and '31/12/2004' group by F1; > >>select count(*) from table1 > >> > >> But the executeUpdate always return 0, even when the cont(*) return > >>a number other than 0. > >> > >> Any ideas ? > > > > > > The backend doesn't return the number of rows affected for a CREATE > > TABLE .. AS, so the driver can't give you a useful number. > > > > -O > > > > ---------------------------(end of broadcast)--------------------------- > > TIP 4: Don't 'kill -9' the postmaster > > > Ok, but and the last line ? The select count ? They don't return the > number of rows too! > > > ---------------------------(end of broadcast)--------------------------- > TIP 4: Don't 'kill -9' the postmaster