Hi Max,

That's interesting. What jOOQ version are you using? And what is the
general context in which you are generating this SQL statement?
I've tried:

System.out.println(
    DSL.using(SQLDialect.POSTGRES)
       .renderContext()
       .render(DSL.decode().value(field("x",
Boolean.class)).when(Boolean.FALSE, "true").otherwise("false"))
);


Which correctly yields:


case x when ? then ? else ? end


Do note that there are some subtle differences between PostgreSQL and
Redshift (which is based on a modified PostgreSQL 8.0 version). We do
provide commercial support for the Amazon Redshift database to take into
account these subtle differences.

Best Regards,
Lukas

2016-02-14 1:42 GMT+01:00 Max Kremer <[email protected]>:

> Hi,
>
>   Trying to get a simple CASE expression in my SELECT statement
>
> I want the following:
>
>
> select case some_bool
>        when true then 'true'
>        else 'false' end
>
>
> My java looks like:
>
> DSL.decode().value(someBool).when(Boolean.FALSE, "true").otherwise("false"
> );
>
> But the SQL it generates is
>
> select   case when some_bool is not distinct from true then 'true'
>        when some_bool is not distinct from false then 'false'
>   end
>
> What's up with the "not distinct from" syntax?
>
> I'm using PostGreSQL but I'm also using Redshift. PostGreSQL is ok with
> this but Redshift barfs :(
>
> Any suggestions?
>
> Thanks,
> Max
>
> --
> 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