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

Поиск
Список
Период
Сортировка
От Oliver Jowett
Тема Re: Fwd: [JDBC] Weird issues when reading UDT from stored function
Дата
Msg-id 4D5BC65D.8070507@opencloud.com
обсуждение исходный текст
Ответ на Re: Fwd: [JDBC] Weird issues when reading UDT from stored function  (Robert Haas <robertmhaas@gmail.com>)
Ответы Re: Fwd: [JDBC] Weird issues when reading UDT from stored function  (Florian Pflug <fgp@phlo.org>)
Список pgsql-hackers
On 17/02/11 01:10, Robert Haas wrote:

> If you do SELECT function_with_one_out_parameter() rather than SELECT
> * FROM function_with_one_out_parameter(), you'll get just one
> argument.  Does that help at all?

Unfortunately, not really, because it doesn't work for cases where
there's more than one OUT parameter (if you use the SELECT f() form in
that case, you get one gigantic result column, not one column per OUT
parameter)

I dug into the code and it's actually slightly different to what I
originally described. Currently given a JDBC escape of the form

  "{ call f(?,?,?,?) }"

it will rewrite that to:

  "SELECT * FROM f($1,$2,$3,$4) AS RESULT"

and this rewriting happens before we know which parameters are bound as
OUT parameters. So we can't special-case the one-OUT-parameter case
without quite a rewrite (no pun intended).

Once we get to the point of query execution, we know which parameters
are OUT parameters, and we bind void parameter values to those (v3
protocol). You have to do a PREPARE/EXECUTE to pass in void parameter
types to get the equivalent via psql, as far as I can tell.

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?

Oliver

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

Предыдущее
От: rsmogura
Дата:
Сообщение: Re: Fwd: [JDBC] Weird issues when reading UDT from stored function
Следующее
От: Greg Smith
Дата:
Сообщение: Re: [PERFORM] pgbench to the MAXINT