pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: "Tomás A. Rossi" <tomas@mecon.gov.ar>
To: Kris Jurka <books@ejurka.com>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: ResultSet.getInt problem
Date: Fri, 17 Feb 2006 17:07:05 -0300
Message-ID: <43F62CE9.2090500@mecon.gov.ar> (raw)
In-Reply-To: <Pine.BSO.4.63.0602171450550.13726@leary.csoft.net>
References: <43F5EBC9.30600@mecon.gov.ar>
	<Pine.BSO.4.63.0602171336040.20250@leary.csoft.net>
	<43F6269E.7090001@mecon.gov.ar>
	<Pine.BSO.4.63.0602171450550.13726@leary.csoft.net>

Kris Jurka escribió:

>
>
> On Fri, 17 Feb 2006, "Tomás A. Rossi" wrote:
>
>> "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"
>>
>> 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.
>>
>
> Previous driver was retrieving the first id, but the newer one is 
> retrieving the second id.  The behavior of duplicate names is 
> undefined and this change was part of a performance enhancement put in 
> to speed up searches by name.  You need to alias one of the columns to 
> a different name.
>
> SELECT o.id AS oid, m.id AS mid, ... FROM ...
>
> Then you may safely say getInt("oid").
>
> Kris Jurka

Thank you! Sorry for my ignorance about SQL and stuff, I'm a little 
newbie to databases.

Tom;



view thread (5+ messages)

Message-ID: <43F62CE9.2090500@mecon.gov.ar>
Permalink:  ../43F62CE9.2090500@mecon.gov.ar/
Also on:    postgresql.org/message-id/43F62CE9.2090500@mecon.gov.ar

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: tomas@mecon.gov.ar, books@ejurka.com
  Subject: Re: ResultSet.getInt problem
  In-Reply-To: <43F62CE9.2090500@mecon.gov.ar>
  References: <43F5EBC9.30600@mecon.gov.ar> <Pine.BSO.4.63.0602171336040.20250@leary.csoft.net> <43F6269E.7090001@mecon.gov.ar> <Pine.BSO.4.63.0602171450550.13726@leary.csoft.net> <43F62CE9.2090500@mecon.gov.ar>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox