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

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: Alexander Farber <alexander(dot)farber(at)gmail(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Moving from PHP to Java: A result was returned when none was expected.
Date: 2016-06-15 19:20:22
Message-ID: 4cdfd08c-fac4-6e55-72bd-71a28520b01e@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 06/15/2016 12:07 PM, 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

Because as I see it you used executeUpdate(), which is for doing INSERT,
UPDATE, DELETE directly. You are actually running function that hides
the UPDATE and returns a void resultset, which executeUpdate() does not
know what to do with. As was mentioned upstream try using executeQuery()
instead.

>
> 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?

Because JDBC is meant to be used against many database engines and is
meant to be fairly generic?

>
> Regards
> Alex

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2016-06-15 19:37:20 Re: Data ingestion failing when using higher Batch size
Previous Message Edson Richter 2016-06-15 19:19:41 Re: Index seems "lost" after consecutive deletes