Re: Fwd: [JDBC] Weird issues when reading UDT from stored function

From: Florian Pflug <fgp(at)phlo(dot)org>
To: Oliver Jowett <oliver(at)opencloud(dot)com>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Lukas Eder <lukas(dot)eder(at)gmail(dot)com>, rsmogura <rsmogura(at)softperience(dot)eu>, pgsql-jdbc(at)postgresql(dot)org, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Fwd: [JDBC] Weird issues when reading UDT from stored function
Date: 2011-02-16 13:36:49
Message-ID: A7BF4EA6-9385-47B3-B9BC-34649BBD4F6F@phlo.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-jdbc

On Feb16, 2011, at 13:43 , Oliver Jowett wrote:
> Anyway, it's a bit counterintuitive that
>
> SELECT * FROM f($1,$2) AS RESULT
>
> where f() takes two OUT parameters always returns two columns, but
>
> SELECT * FROM f($1) AS RESULT
>
> might return any number of columns! Is that really the correct behavior
> here?

Hm, I've browsed through the code and it seems that the current behaviour
was implemented on purpose.

build_function_result_tupdesc_d() in funcapi.c explicitly does

/*
* If there is no output argument, or only one, the function does not
* return tuples.
*/
if (numoutargs < 2)
return NULL;

and examine_parameter_list() in functioncmds.c takes care to set
requiredResultType to RECORDOID only if there is more than one OUT
parameter, otherwise it gets set to the (one) OUT parameter's type.

Might make sense to check the list archives, maybe there is something
there that elucidates the reasoning behind this...

best regards,
Florian Pflug

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2011-02-16 13:40:51 Re: new clang report
Previous Message Greg Smith 2011-02-16 13:15:41 Re: [PERFORM] pgbench to the MAXINT

Browse pgsql-jdbc by date

  From Date Subject
Next Message Tom Lane 2011-02-16 15:23:43 Re: Fwd: [JDBC] Weird issues when reading UDT from stored function
Previous Message Oliver Jowett 2011-02-16 12:43:09 Re: Fwd: [JDBC] Weird issues when reading UDT from stored function