db2topg
db2topg copied to clipboard
empty string inserted as null
My solution is check quoted when $field eq ''
if ($field eq '') # fast exit for empty (should mean null)
{
if ($colnull[$num] == 1)
{
my $quoted = $csv->is_qoted($num); # keep empty string
$field = $quoted ? '' : '\N';
}
# No need to set it at '' if null isn't authorized, it is already
$outrow.= $field;
next;
}