JDBC-Interface - Behaviour on Update, Insert or Delete returning ResultSets - Inconsistency to Console & ODBC

Поиск
Список
Период
Сортировка
От Otto Weichselbaum
Тема JDBC-Interface - Behaviour on Update, Insert or Delete returning ResultSets - Inconsistency to Console & ODBC
Дата
Msg-id 46C63762.6000308@sew.at
обсуждение исходный текст
Ответы Re: JDBC-Interface - Behaviour on Update, Insert or Delete returning ResultSets - Inconsistency to Console & ODBC
Список pgsql-bugs
Dear Ladies and Gentlemen,

I do not know if this can even be considered a bug, but I would be
pleased, if somebody could make a statement on this:

environment:


  PostgreSQL 8.1 and 8.2
  Redhat and WinXP

While using views calling functions on INSERT, UPDATE and DELETE via
according rules, I noticed an inconsistent behaviour of the
JDBC-interface of postgres;
 an INSERT-, UPDATE- or DELETE-statement producing tuples as
return-value (in our case through rules calling functions but although
via the 'RETURNING'-clause of a single INSERT- or UPDATE-statement) is
returning the expected number of tuples when called via the console
(even through pgAdmin) or via ODBC
BUT
when called via JDBC only an 'UpdateCount' of 0 is returned;
debugging to protocol-level showed, that the postgreSQL-server does not
even differ between a 'simple' UPDATE or one returning tuples;

a 'simple' UPDATE returning only an 'UpdateCount' produces the
following sequence of commands (at protocol-level):
49 - 50 - 110 - 67 - 90      or in characters      '1' - '2' - 'n' -
'C' - Z'
exactly the same is returned on an UPDATE returning tuples;
of course, as 'n' means that no data is available (according to class
org.postgresql.core.v3.QueryExecutorImpl) no tuple will be available
and the 'UpdateCount' will also be 0;

... so am I right guessing that there is no way to retrieve the
resulting tuples via JDBC? (- in difference to the console and ODBC)

For our needs we implemented a java.sql.Driver encapsulating the
sun.jdbc.odbc.JdbcOdbcDriver that returns the expected values as a
workaround, but that causes additional conversions that are not really
necessary;
in my opinion it would be a better solution to leave the decision,
whether to return the tuples, an 'UpdateCount' or even throw an
Exception up to the implementor of the driver and not to ignore the
fact that tuples where produced already on server-side;

I am looking forward to hearing your point of view!

With best regards,

Otto Weichselbaum


--

<!--
body{
font-family: arial;
font-size: 12px;
}

p.title{
font-size: 14px;
font-variant: small-caps;
font-weight: bold;
font-style: italic;
margin-top: 3px;
margin-bottom: 3px;
}

p.space{
margin-top: 2px;
margin-bottom: 2px;
}
 -->

____________________________
SEW – Otto Weichselbaum
DI (FH) Otto Weichselbaum
A-4040 LINZ, Heindlstrasse 19/4
eMail: Otto.Weichselbaum@sew.at
fax: +43 (0) 732 925400
mobile: +43 (0) 664 8251111

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Douglas Toltzman
Дата:
Сообщение: Re: error while starting database
Следующее
От: "Nitin Saxena"
Дата:
Сообщение: Fwd: error while starting database