Skip to content

Falsey column defaults not used #45

@harto

Description

@harto

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:

if column.default.present?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions