Fixes for types and explicit casting (#156)
Up until now, explicit casting (using the CAST function) has worked by
setting up a map of known conversions and their respective functions.
However, subclause 9.2, "Store assignment", in ISO/IEC 9075-2 outlines a
very detailed set of steps when converting from one type to another.
- Fix some specific nuances regarding CHARACTER to/from VARYING
CHARACTER conversions with spaces.
- Fix some specific nuances with numeric conversions.
- Character literals (eg. 'foo bar') are now correctly typed as
CHARCATER(n) (according to the standard) instead of CHARACTER
VARYING(0).
- new_character_value() and new_varchar_value() no longer take a length.
The length is determined from the string itself. This is easier from an
API perspective but also more correct to the value being created.
- Some SQLSTATE warnings should be errors (or visa-versa). This has been
corrected from the subclause rules.