Skip to content

out_sql: fix unmapped columns being explicitly set to NULL on INSERT#169

Open
Watson1978 wants to merge 1 commit into
fluent:masterfrom
Watson1978:out_sql
Open

out_sql: fix unmapped columns being explicitly set to NULL on INSERT#169
Watson1978 wants to merge 1 commit into
fluent:masterfrom
Watson1978:out_sql

Conversation

@Watson1978
Copy link
Copy Markdown
Contributor

When using column_mapping, columns that are not mapped should be ignored during the INSERT query, allowing the database to apply its default values (e.g., DEFAULT NOW()).

However, the previous implementation passed only the array of record objects to activerecord-import, which caused ActiveRecord to automatically fill unmapped columns with nil and insert them as NULL.

Fixes #156

@Watson1978 Watson1978 requested a review from kenhys May 16, 2026 15:45
When using `column_mapping`, columns that are not mapped should be ignored
during the INSERT query, allowing the database to apply its default values
(e.g., `DEFAULT NOW()`).

However, the previous implementation passed only the array of record objects
to `activerecord-import`, which caused ActiveRecord to automatically fill
unmapped columns with `nil` and insert them as `NULL`.

Signed-off-by: Shizuo Fujita <fujita@clear-code.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fluentd Inserting NULL Value in PostgreSQL Column Not Mapped in Table Configuration

1 participant