Prevent NULL value on NOT NULL column when value is an empty string

This patch is a suggestion and is missing a test case.