H2 has a lot of compatibility modes and there are three possible ways for 
NULL handling.

If compatibility mode sets uniqueIndexSingleNull database throws error on 
the first match. No more rows can contain the same data. Only one iteration 
in any case.

If compatibility mode sets uniqueIndexSingleNullExceptAllColumnsAreNull we 
can get row with all nulls and accept new row with all nulls, doesn't 
matter if there are more such rows, or we can get row with some/none nulls 
and reject new row immediately. So we should stop too, but H2 iterates over 
next rows with all nulls for no reason.

Without this flags we check if row contains at least one null to accept 
duplicate, or reject if otherwise. If we have one or more null we can get 
more rows with the same key columns from iterator, but also there is no 
reason too to check them all, anyway result will be the same, but H2 checks 
them too.

ASC / DESC and NULLS FIRST / NULLS LAST are used only for ordering.

Maybe I'm wrong.

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

Reply via email to