Re: Moving from PHP to Java: A result was returned when none was expected.

Поиск
Список
Период
Сортировка
От Jan de Visser
Тема Re: Moving from PHP to Java: A result was returned when none was expected.
Дата
Msg-id 2006570.ov43Rr8ITK@coyote
обсуждение исходный текст
Ответ на Re: Moving from PHP to Java: A result was returned when none was expected.  (Alexander Farber <alexander.farber@gmail.com>)
Список pgsql-general
On Wednesday, June 15, 2016 9:07:10 PM EDT Alexander Farber wrote:
> I only understand a quarter of what you guys are writing,
> but to me the JDBC driver throwing SQLException
> "A result was returned when none was expected"
> when my stored function is declared as "void" with
>
> CREATE OR REPLACE FUNCTION words_skip_game(
>         IN in_uid integer,
>         IN in_gid integer)
>         RETURNS void AS
> $func$
> BEGIN
>
>
> is a strange decision. Why throw the exception, what's the benefit?
>
> Even if PostgreSQL does not have stored functions (???),
> why does not JDBC driver workaround that fact?

In addition to what Adrian and David had to say, I'll reiterate what I said
upthread: use PreparedStatement.executeQuery instead of
PreparedStatement.executeUpdate, and ignore the result. You are executing a
SELECT after all, and 'void' is a result, albeit a not very informative one.

And if you only understand a quarter of what we are writing, you may want to
read up on both jdbc and pgsql. Porting from PHP to java involves more than
mechanical replacing statements. Understanding the technologies is important.



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

Предыдущее
От: Adrian Klaver
Дата:
Сообщение: Re: Data ingestion failing when using higher Batch size
Следующее
От: "David G. Johnston"
Дата:
Сообщение: Re: regarding schema only migration from sqlserver to postgres with runmtk.sh