X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id D10679DC89E for ; Fri, 17 Feb 2006 15:39:59 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 18551-02 for ; Fri, 17 Feb 2006 15:39:59 -0400 (AST) X-Greylist: delayed 04:11:02.320944 by SQLgrey- Received: from relay2.mecon.ar (relay2.mecon.gov.ar [168.101.16.11]) by postgresql.org (Postfix) with ESMTP id B8A8C9DC810 for ; Fri, 17 Feb 2006 15:39:55 -0400 (AST) Received: from racing.mecon.ar (racing.mecon.gov.ar [168.101.133.15]) by relay2.mecon.ar (8.12.11/8.12.11) with ESMTP id k1HJdoGi041494; Fri, 17 Feb 2006 16:39:51 -0300 (ART) (envelope-from tomas@mecon.gov.ar) Received: from racing.mecon.ar (meyosp.mecon.gov.ar [10.11.0.149]) by racing.mecon.ar (8.12.8p2/8.12.8) with ESMTP id k1HJdoq2089526; Fri, 17 Feb 2006 16:39:50 -0300 (ART) (envelope-from tomas@mecon.gov.ar) Received: from [10.11.1.31] (Jupiter.mecon.gov.ar [10.11.1.31]) by racing.mecon.ar (8.12.8p2/8.12.8) with ESMTP id k1HJdoXU089520; Fri, 17 Feb 2006 16:39:50 -0300 (ART) (envelope-from tomas@mecon.gov.ar) Message-ID: <43F6269E.7090001@mecon.gov.ar> Date: Fri, 17 Feb 2006 16:40:14 -0300 From: =?ISO-8859-1?Q?=22Tom=E1s_A=2E_Rossi=22?= User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: es-es, es MIME-Version: 1.0 To: Kris Jurka CC: pgsql-jdbc@postgresql.org Subject: Re: ResultSet.getInt problem References: <43F5EBC9.30600@mecon.gov.ar> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.479 required=5 tests=[DNS_FROM_RFC_ABUSE=0.479] X-Spam-Score: 0.479 X-Spam-Level: X-Archive-Number: 200602/138 X-Sequence-Number: 14735 Kris Jurka escribió: > > > On Fri, 17 Feb 2006, "Tomás A. Rossi" wrote: > >> ResultSet rs= con.select(query); >> while (rs.next()) { >> id= rs.getInt("id"); >> out.println(id); // prints 0 in every row!! >> name= rs.getString("name"); // ok >> ... >> >> Now if I change getInt("id") for the other overload getInt(1), it >> works fine! >> (it prints the correct id for every column) >> > > I'm not sure what's going wrong here. What do you get if you add some > additional debugging code along the lines of the following: > > ResultSetMetaData rsmd = rs.getMetaData(); > for (int i=1; i<=rsmd.getColumnCount(); i++) { > System.out.println("["+rsmd.getColumnName()+"]"); > } > > Kris Jurka The query formed is: "SELECT * FROM sso.organismos o LEFT OUTER JOIN motivos_bloqueos m ON( o.id_motivo_ultimo_bloqueo=m.id) WHERE no(o.baja_fisica) AND nombre ~* 'a' AND activo ORDER BY nombre" The table is: CREATE TABLE sso.organismos ( id serial NOT NULL, nombre text NOT NULL, dominio text NOT NULL, activo bool NOT NULL DEFAULT 't', fecha_ultima_baja timestamp, bloqueado bool NOT NULL DEFAULT 'f', cant_bloqueos_heredados int4, fecha_ultimo_bloqueo timestamp, detalle_ultimo_bloqueo text, id_motivo_ultimo_bloqueo int4, baja_fisica bool, descripcion text, CONSTRAINT organismos_pkey PRIMARY KEY (id), CONSTRAINT "$1" FOREIGN KEY (id_motivo_ultimo_bloqueo) REFERENCES sso.motivos_bloqueos (id) ON UPDATE NO ACTION ON DELETE NO ACTION DEFERRABLE INITIALLY DEFERRED, CONSTRAINT organismos_nombre_key UNIQUE (nombre) ) Your debug code printed: "[id] [nombre] [dominio] [activo] [fecha_ultima_baja] [bloqueado] [cant_bloqueos_heredados] [fecha_ultimo_bloqueo] [detalle_ultimo_bloqueo] [id_motivo_ultimo_bloqueo] [baja_fisica] [descripcion] [id] [motivo] [baja_fisica]" Seems that two columns has the same name (id) or something like that? How to workaround this? This didn't happen when using postgres 7.3 with driver 7.3. Thank you very much, Tom;