Extract SQL value type

This also begins moving other types outside of the Serializer namespace
Make #sql_value recursively process arrays
Fix spec description
Allow comparison of case-insensitive regexes
Convert nil checks to SQL queries