Re: The same prepared query yield "-1" the first six times and then "-1.0"

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Edoardo Panfili <edoardo(dot)panfili(at)iisgubbio(dot)edu(dot)it>
Cc: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: The same prepared query yield "-1" the first six times and then "-1.0"
Date: 2023-08-21 15:50:21
Message-ID: CAKFQuwZzVWzxpcbeJsS2ZSBCi1j310B+N=5v-9roObQaq2dVEQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, Aug 21, 2023 at 8:28 AM Edoardo Panfili <
edoardo(dot)panfili(at)iisgubbio(dot)edu(dot)it> wrote:

>
> dim1 real DEFAULT '-1' NOT NULL
>
> System.out.print("p: "+rs.getString("dim1")+"\n”);
>
> Can I do something to avoid this problem?
>

Use the type appropriate getter, not getString, to retrieve the value of
the underlying real typed column.

Otherwise, I agree this seems like a bug, probably in the JDBC driver,
though one pertains to style as opposed to semantics since both answers are
technically correct.

David J.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2023-08-21 16:00:53 Re: Why doesn't autovacuum/analyze run in due time after calling pg_stat_reset?
Previous Message Adrian Klaver 2023-08-21 15:45:06 Re: The same prepared query yield "-1" the first six times and then "-1.0"