Skip to content

Commit bb58e47

Browse files
committed
Zero is a valid value for an ID column, don't coerce it to NULL
1 parent 6e331b4 commit bb58e47

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/Drivers/DML/redshift.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ Driver.prototype.insert = function (table, data, keyProperties, cb) {
3434
} else {
3535
for(i = 0; i < keyProperties.length; i++) {
3636
prop = keyProperties[i];
37-
ids[prop.name] = data[prop.mapsTo] || null;
37+
// Zero is a valid value for an ID column
38+
ids[prop.name] = data[prop.mapsTo] !== undefined ? data[prop.mapsTo] : null;
3839
}
3940

4041
return cb(null, ids);

0 commit comments

Comments
 (0)