I'm interested in implementing a function to duplicate the behavior of
"IS NOT DISTINCT FROM" on SQL Server.  On PostgreSQL, I'd simply use ?
1 IS NOT DISTINCT FROM ?2 as the function template.  On SQL Server
though, the template involves repeating the same argument: (?1 IS NULL
AND ?2 IS NULL) OR (?1 IS NOT NULL AND ?2 IS NOT NULL AND ?1 = ?2)

Unfortunately, when used with positional parameters, the function
template is not processed correctly.  The system duplicates the ?
within the query, but it doesn't add another copy of the parameter to
the parameter list.  Here are some possible techniques for dealing
with this issue:

1.  Create another interface like ISQLParameterizedFunction that
allows modification of the parameter list as well.
2.  Allow dialects to access the HQL AST and parameter list and modify
them directly.
3.  Replace the positional parameters with named parameters.

Sadly, I'm too tired for my brain to work properly.  I just wanted to
get these thoughts out there to see if anyone had any feedback or work-
arounds.

        Patrick Earl

Reply via email to