bulk_insert icon indicating copy to clipboard operation
bulk_insert copied to clipboard

Falsey column defaults not used

Open harto opened this issue 5 years ago • 1 comments

Column default values like '' or false aren't used when a value is omitted for that column.

For example, if I have a table foo with a column bar that has a default value of '', and I don't provide a value for bar in my call to bulk_insert, the newly-inserted row will have a bar value of NULL, and not '' like I expect.

The issue seems to be the use of #present? to determine a column has a default value: https://github.com/jamis/bulk_insert/blob/3ded6b059af8d239ca0f5fbecca0de6138d49592/lib/bulk_insert/worker.rb#L50

harto avatar Sep 17 '19 20:09 harto

Hi @harto , thank you very much for raising his issue. Would you be able to short snippet to reproduce the issue?

If you can write a unit test and suggest a change, I will be happy to review your pr

mberlanda avatar May 19 '20 19:05 mberlanda