Well, the generated predicates would have to handle nulls first / nulls
last, just like if those clauses aren't supported by a given RDBMS, e.g.
when writing:

ctx.selectFrom(account)
   .orderBy(account.name.nullsLast(), account.id)
   .seekAfter(nameValue, idValue)
   .fetch();


The generated SQL would have to be:

SELECT *
FROM account
WHERE
    (CASE WHEN account.name IS NULL THEN 1 ELSE 0 END, COALESCE (
account.name, 'dummy'), account.id)

  > (CASE WHEN :nameValue IS NULL THEN 1 ELSE 0 END, COALESCE (:nameValue,
'dummy'), account.id)

ORDER BY account.name NULLS LAST, account.id


Since jOOQ knows the data type of account.name, we can generate a non-null
dummy value.

Good luck to your performance on that one :-)

On Thu, May 2, 2019 at 4:43 PM <[email protected]> wrote:

> Hi Lukas,
>
> Yeah, it's a little bit messy to deal with, especially when trying to
> generalize the coalesce statement to fields of other datatypes, but it
> appears to be the only workaround for the moment. Not sure what can be done
> for #2786, but looking forward to it!
>
> Thanks again for your help!
>
> Mani
>
> This e-mail message is intended for the named recipient(s) above, and may
> contain information that is privileged, confidential and/or exempt from
> disclosure under applicable law. If you have received this message in
> error, or are not the named recipient(s), please do not read the content.
> Instead, immediately notify the sender and delete this e-mail message. Any
> unauthorized use, disclosure or distribution is strictly prohibited.
> Quantify Labs Inc and the sender assume no responsibility for any errors,
> omissions, or readers' misinterpretations and/ or understanding of the
> content or transmission of this email.
>
> --
> 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