Skip to content

fix: use ConnectionAwareSqlBatch for ChangeEventDAO.insertBatch#25928

Merged
harshach merged 1 commit intomainfrom
fix/change-event-insertbatch-postgres-jsonb
Feb 18, 2026
Merged

fix: use ConnectionAwareSqlBatch for ChangeEventDAO.insertBatch#25928
harshach merged 1 commit intomainfrom
fix/change-event-insertbatch-postgres-jsonb

Conversation

@manerow
Copy link
Copy Markdown
Contributor

@manerow manerow commented Feb 17, 2026

ChangeEventDAO.insertBatch was using a plain @SqlBatch, which works correctly with MySQL but fails on PostgreSQL. The failure occurs because the change_event.json column is of type jsonb in PostgreSQL and requires an explicit cast from character varying. As a result, CSV bulk imports (e.g., glossary terms, database schemas, tables, teams, etc.) triggered a BatchUpdateException when pending change events were flushed in PostgreSQL deployments.

The single-row insert() method already handled this correctly using @ConnectionAwareSqlUpdate with a (:json :: jsonb) cast for PostgreSQL. However, the batch variant introduced in #25542 did not include the database-specific handling.

I replaced @SqlBatch with @ConnectionAwareSqlBatch in insertBatch and added the explicit ::jsonb cast for PostgreSQL, aligning it with the existing insert() implementation and other batch methods in the codebase.

I validated the change by running CSV bulk imports against a PostgreSQL setup and confirming that change events are now inserted without triggering BatchUpdateException.

Type of change:

  • Bug fix
  • Improvement
  • New feature
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation

@gitar-bot
Copy link
Copy Markdown

gitar-bot Bot commented Feb 17, 2026

Code Review ✅ Approved

Clean, well-scoped fix that correctly replaces @SqlBatch with @ConnectionAwareSqlBatch to add the PostgreSQL :: jsonb cast. The implementation is consistent with the existing single-row insert() method and all other @ConnectionAwareSqlBatch usages in the codebase.

Options

Auto-apply is off → Gitar will not commit updates to this branch.
Display: compact → Showing less information.

Comment with these commands to change:

Auto-apply Compact
gitar auto-apply:on         
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Gitar

@sonarqubecloud
Copy link
Copy Markdown

@harshach harshach merged commit f4a8ccc into main Feb 18, 2026
35 of 42 checks passed
@harshach harshach deleted the fix/change-event-insertbatch-postgres-jsonb branch February 18, 2026 01:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend safe to test Add this label to run secure Github workflows on PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants