agstudy / rsqlserver

Sql Server driver database interface (DBI) driver for R. This is a DBI-compliant Sql Server driver based on the System.Data.SqlClient.
82 stars 30 forks source link

Incorrect handling of null values #42

Open ruaridhw opened 6 years ago

ruaridhw commented 6 years ago

@agstudy, I've tried reproducing your example of NULL type handling and found two regressions:

  1. After the dbWriteTable call, the uploaded table contains NULLs in the value column but not in the txt column of the database's table which instead contain blank cells. This can be verified by inspecting the table using means other than rsqlserver.
  2. Using the dbSendQuery and dbReadTable functions, the results are that the txt column returns NAs and the value column returns 0s

Essentially the problems here are that

  1. DB Integer nulls are converted to 0s in R
  2. DB text blanks are converted to NAs in R
  3. R text NAs are converted to blanks in DB

Are you able to reproduce this error on Windows using the current master branch or is this just a mono-specific error?