Skip to content

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

Merged
kenhys merged 1 commit into
fluent:masterfrom
Watson1978:out_sql
May 18, 2026
Merged

out_sql: fix unmapped columns being explicitly set to NULL on INSERT#169
kenhys merged 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>
Copy link
Copy Markdown
Contributor

@kenhys kenhys left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@kenhys kenhys merged commit c1a2c27 into fluent:master May 18, 2026
37 checks passed
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

2 participants