I think I figured out question #1. The following works:

public static final SQLDialect SQL_DIALECT = SQLDialect.POSTGRES_9_5;


private static final DefaultDataType<Void> VOID = new DefaultDataType<>(
      SQL_DIALECT, Void.class, "VOID");


private static Field<Void> fieldForCopySchema(String sourceSchema, String 
destSchema,
                                              String destOwner)
{
   return DSL.field(SNAPSchemaType.EXT.name().toLowerCase() + 
".clone_schema({0}, {1}, {2})",
         VOID,
         DSL.val(sourceSchema), DSL.val(destSchema), DSL.val(destOwner));
}




On Tuesday, November 8, 2016 at 8:56:39 AM UTC-5, Jacob G wrote:
>
> I have some questions about calling a custom postgresql function:
>
> 1) I tried using DSL.field to call this postgresql sql function that 
> return VOID, as follows:
>
> private static Field<Void> foo(String param) {
>    return DSL.field("ext.foo({0}, {1}, {2})", Void.class, DSL.val(param));
> }
>
>
> But I get this exception from creating the field:
> org.jooq.exception.SQLDialectNotSupportedException: Type class java.lang.
> Void is not supported in dialect DEFAULT
>  at org.jooq.impl.DefaultDataType.getDataType(DefaultDataType.java:803)
>  at org.jooq.impl.DefaultDataType.getDataType(DefaultDataType.java:747)
>  at org.jooq.impl.DSL.getDataType(DSL.java:16970)
>  at org.jooq.impl.DSL.field(DSL.java:7626)
>
> What am I doing wrong?
>
> 2) Would DSL.function be more appropriate to use instead of DSL.field in 
> question # 1? I wasn't sure how to pass in my argument using DSL.function.
>
> 3) In question #1, is there a way to bind the schema name instead of 
> hardcoding it in the sql? Or is putting it in the sql the best/only way?
>
> Thank you!
>

-- 
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