Re: Column quoting in result set getters

From: Kris Jurka <books(at)ejurka(dot)com>
To: Manuel Sugawara <masm(at)fciencias(dot)unam(dot)mx>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Column quoting in result set getters
Date: 2004-06-07 07:47:57
Message-ID: Pine.BSO.4.56.0406070242210.29634@leary.csoft.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

On Wed, 2 Jun 2004, Manuel Sugawara wrote:

> When I try to get the value of a column by name, using quotes the
> driver throws an exception telling me that that column does not
> exists. The column name has accents:
>
> int val = res.getInt("\"última\"");
>
> Since quote_ident() quotes the names containing accents I think the
> driver should accept the quoted version as well or am I missing
> something? I'm using pg74.1jdbc3.jar.
>

I'm not sure what connection you are making between quote_ident and the
ResultSet methods, why should these act the same? It certainly is
possible to have column names with quotes, for example:

jurka=# create table quote ("""a""" int);
CREATE TABLE
jurka=# \d quote
Table "public.quote"
Column | Type | Modifiers
--------+---------+-----------
"a" | integer |

In this case ResultSet.getInt("\"a\"") would be correct, what are you
suggesting should be used in this case? ResultSet.getInt("\"\"\"a\"\"\"")

Kris Jurka

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Markus Schaber 2004-06-07 07:47:58 Re: Using a COPY...FROM through JDBC?
Previous Message Markus Schaber 2004-06-06 22:08:00 Re: Using a COPY...FROM through JDBC?