williamwicks/sqlbits — pull request #1 by jeffbski (2013-12-05 22:13:57+00:00)
Title: Prevent collapsing of null parameters

The process of collapsing parameters into unique values
needs to exclude null parameters otherwise it can cause
an exception if the two are for different field types.

For instance: using INSERT.INTO with a char field and
a integer field, both with null values, if we collapse
into the same parameter it will cause an error in Postgres:

"inconsistent type deduced for parameter $N"

Since sqlbits doesn't know the types of the parameters
it would be safer for it to not collapse null parameters
and instead keep each individual one.

After searching online to determine how SQL treats nulls,
I found a few references that indicate that SQL 2003 declares
Null markers to not be equal, so it seems that not collapsing
nulls should be the default SQL behavior and not just specific
to Postgres.

http://en.wikipedia.org/wiki/Null_(SQL)#When_two_nulls_are_equal:_grouping.2C_sorting.2C_and_some_set_operations

Failing test and fix are provided.