<snip>
testdb=# CREATE FUNCTION p_enhance_address4 (address OUT u_address_type) AS $$ BEGIN address := (SELECT t_author.address FROM t_author WHERE first_name = 'George'); END; $$ LANGUAGE plpgsql;
CREATE FUNCTION
testdb=# SELECT * FROM p_enhance_address4();
street | zip | city | country | since | code

------------------------+--------+-----------+---------+------------+------
("Parliament Hill",77) | NW31A9 | Hampstead | England | 1980-01-01 |
(1 row)

The second problem is that the JDBC driver always generates calls in the
"SELECT * FROM ..." form, but this does not work correctly for
one-OUT-parameter-that-is-a-UDT, as seen in the example immediately
above. Here's how to do the call for that particular case:

testdb=# SELECT p_enhance_address4();
                        p_enhance_address4
-------------------------------------------------------------------
 ("(""Parliament Hill"",77)",NW31A9,Hampstead,England,1980-01-01,)
(1 row)

The challenge is that the bare SELECT form doesn't work for multiple OUT parameters, so the driver has to select one form or the other based on
the number of OUT parameters.

Any questions? (I'm sure there will be questions. Sigh.)

Oliver

I don't want to blame or anything similar, any idea is good, as any effort as well, but if user will register one output parameter, but procedure will have two will it be possible to check this? I'm little lost in this nested records. If there will be no such check I suggest to configure this by connection parameter, because in any way UDTs aren't such popular, user should have choice to decide "I want better checks", or "I need this! Everything is on my side".


--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to