Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
Thread:
Lists: pgsql-hackerspgsql-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

pgsql-hackers by date

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

pgsql-jdbc by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group