Search Postgresql Archives

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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jun 15, 2016 at 3:07 PM, Alexander Farber <alexander.farber@xxxxxxxxx> 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?


​As far as JDBC is concerned is see a single row of data, with a single column, whose contents include a datum of type void.  It interprets this as being "a result" and thus asks you to put it somewhere.  Its doesn't treat "void" any different than, say "integer".  Whether or not it should might be worthy of a discussion but that is how it works today.

​As for the exception - I suppose its a bit of looking over the programmer's shoulder.  You wrote a query that returns data but decided to ignore the data - the driver assumes a mistake was made and throws an exception informing you of that fact.  How much of this is our decision and how much of it is specified by JDBC I do not know.​

​While void "indicates that a function returns no value​" it is itself a value; hence the dilemma.

Patches are welcome if you think there is a better way for us to operate.

David J.
 

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux