Hello,

Unfortunately, we overlooked the possibility of distinguishing between
functions that return a TABLE (of a type) or a SETOF (a type) in
PostgreSQL. So, when we implemented support for table-valued functions, we
only supported those that return a TABLE type, in jOOQ 3.5. jOOQ 3.6 will
also support SETOF functions. The relevant feature request is already
implemented on GitHub:
https://github.com/jOOQ/jOOQ/issues/3376

So, if you want code generator support for these types, you have two
options:

- Build the current jOOQ 3.6.0-SNAPSHOT yourself, directly from GitHub
- Replace SETOF by TABLE (but beware of the subtle implications this has on
your PostgreSQL schema, itself)

Once that is supported, you can call the function as documented here:
http://www.jooq.org/doc/latest/manual/sql-building/table-expressions/table-valued-functions/

Of course, you can always just create a plain SQL table:

Table<?> table = DSL.table("public.get_test(1)");


I hope this helps,
Lukas

2015-01-13 14:07 GMT+01:00 <[email protected]>:

> New data: it seems that the JOOQ code generator does not create a
> routines/GetTest.java for that function.
> I can't find out why.
>
>
>
> On Monday, January 12, 2015 at 5:48:33 PM UTC+1, [email protected] wrote:
>>
>> Hi.
>>
>> Let's say I have a simple function in my Postgresql:
>> CREATE OR REPLACE FUNCTION public.get_test(id_p integer)
>>  RETURNS SETOF test
>>  LANGUAGE plpgsql
>> AS $function$
>> BEGIN
>>     RETURN QUERY SELECT * FROM test WHERE id = id_p LIMIT 1;
>> END;
>> $function$
>>
>> Since that returns a SETOF, I'd like to put the result of this function
>> into a Result<TestRecord>.
>> I don't find the way to do it, though. Is there one?
>>
>>
>> Adrien.
>>
>  --
> You received this message because you are subscribed to the Google Groups
> "jOOQ User Group" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups "jOOQ 
User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to