Re: ResultSet.getInt problem

From: "Tomás A(dot) Rossi" <tomas(at)mecon(dot)gov(dot)ar>
To: Kris Jurka <books(at)ejurka(dot)com>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: ResultSet.getInt problem
Date: 2006-02-17 20:07:05
Message-ID: 43F62CE9.2090500@mecon.gov.ar
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

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;

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Kris Jurka 2006-02-17 20:52:05 Re: 7.4 JDBC driver with 8.1 server?
Previous Message Tom Lane 2006-02-17 19:55:20 Re: 7.4 JDBC driver with 8.1 server?