Re: case problem with moveToInsertRow() - 7.4dev drivers OK, 7.3 drivers not

From: "Roger Hand" <rhand(at)ragingnet(dot)com>
To: "Barry Lind" <blind(at)xythos(dot)com>
Cc: <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: case problem with moveToInsertRow() - 7.4dev drivers OK, 7.3 drivers not
Date: 2003-02-19 18:32:40
Message-ID: 1329118CFAAABD42BDF304DA2BABA58F0B7263@berkeley.corp.ragingnet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Any luck?

-----Original Message-----
From: Barry Lind [mailto:blind(at)xythos(dot)com]
Sent: Thursday, February 13, 2003 11:35 AM
To: Roger Hand
Subject: Re: [JDBC] case problem with moveToInsertRow() - 7.4dev drivers OK, 7.3 drivers not

Roger,

I will look at this more tonight. I need to find the fix in 7.4 that
made this work, and then see if this can be easily backported to 7.3
(which I expect it can be).

thanks,
--Barry

PS. You are correct on the timelines, that is why a backport of the fix
to 7.3 is the way to go.

Roger Hand wrote:
> Actually, I looked again at the jdbc page and the drivers I downloaded that work are "7.4dev" drivers (build 201).
>
> The latest 7.3 drivers (build 108) still had the problem.
>
> How unsafe would it be to use the 7.4 drivers with Postgres 7.3.x? At http://developer.postgresql.org/beta.php it says
> "Check back for v7.4's beta in a few months" so I'm guessing that 7.4 won't be out any time soon.
>
> -Roger
>
> -----Original Message-----
> From: pgsql-jdbc-owner(at)postgresql(dot)org
> [mailto:pgsql-jdbc-owner(at)postgresql(dot)org]On Behalf Of Roger Hand
> Sent: Wednesday, February 12, 2003 9:46 PM
> To: pgsql-jdbc(at)postgresql(dot)org
> Subject: Re: [JDBC] case problem with moveToInsertRow()
>
>
> I was using the "Latest Stable Drivers" (build 108), but when I tried
> the "Development Drivers" (build 201) the problem did indeed go away!
> Thanks for the tip!
>
> Any idea when this fix will make it into drivers judged to be "Latest
> Stable"?
>
> -Roger
>
> -----Original Message-----
> From: Barry Lind [mailto:blind(at)xythos(dot)com]
> Sent: Wednesday, February 12, 2003 6:07 PM
> To: Roger Hand
> Cc: pgsql-jdbc(at)postgresql(dot)org
> Subject: Re: [JDBC] case problem with moveToInsertRow()
>
>
> Roger,
>
> Try the latest build for 7.3 from jdbc.postgresql.org. It seems this
> issue is already fixed.
>
> thanks,
> --Barry
>
>
> Roger Hand wrote:
>
>>All my tablenames are lowercased in my Postgres db, but for legacy
>>reasons the SQL code typically uses mixed case.
>>
>>Select statements work fine with the mixed case, but
>
> moveToInsertRow()
>
>>fails with a 'No Primary Keys' exception unless I use the lowercase
>
> name
>
>>in the query.
>>
>>For select, both these statements work fine for the table 'phone':
>>SELECT * FROM Phone WHERE Phone = 244
>>SELECT * FROM phone WHERE phone = 244
>>
>>However, the code below bombs if the mixed case table name is
>
> specified:
>
>>
>>String SQL = "SELECT * FROM Phone WHERE 1 = 0"; // 'No Primary Keys'
>>exception
>>//String SQL = "SELECT * FROM phone WHERE 1 = 0"; // works
>>System.out.println(SQL);
>>Statement sqlStatement = null;
>>ResultSet RS = null;
>>try {
>> sqlStatement = Conn.createStatement(ResultSet.TYPE_FORWARD_ONLY,
>>ResultSet.CONCUR_UPDATABLE);
>> RS = sqlStatement.executeQuery(SQL);
>> boolean newRow = false;
>> if (RS != null) {
>> if (!RS.next()) {
>> newRow = true;
>> RS.moveToInsertRow(); // exception thrown here if mixed case
>>tablename given
>> }
>> RS.updateInt("areacode", 444);
>>
>> if (newRow)
>> RS.insertRow();
>> else
>> RS.updateRow();
>>
>> RS.close();
>> Conn.commit();
>> } // if (RS != null)
>>} catch (SQLException e) {System.out.println("SQLException " +
>>e.getMessage());
>>==========
>>table definition
>>==========
>>-- Table: public.phone
>>CREATE TABLE public.phone (
>> phone int8 DEFAULT nextval('"phone_phone_key"'::text) NOT NULL,
>> areacode varchar(10),
>> phonenumber varchar(30)
>> CONSTRAINT phone_pkey PRIMARY KEY (phone)
>>) WITH OIDS;
>>
>>I've traced it thru a little bit in the JDBC code, and it appears
>
> that
>
>>getPrimaryKeys() expects the table name param to be the same case as
>
> the
>
>>table.
>>
>>I am using Postgres 7.3.1, with JDBC drivers 2+ (build 108) with Java
>>1.3.1, and also the JDBC 3 driver with Java 1.4.1.
>>
>>-Roger
>
>
>
>
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo(at)postgresql(dot)org so that your
> message can get through to the mailing list cleanly
>
>
> ------------------------------------------------------------------------
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
> (send "unregister YourEmailAddressHere" to majordomo(at)postgresql(dot)org)

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Felipe Schnack 2003-02-19 20:32:38 Re: ANY subquery and PreparedStatements
Previous Message Dirk Bromberg 2003-02-19 18:28:50 Re: Priority of Statments / Connections