Skip to content

Conversation

@dennis-tismenko
Copy link
Contributor

@dennis-tismenko dennis-tismenko commented Dec 9, 2025

Closes #3884

This PR fixes a case sensitivity bug in the PostgreSQL and MSSQL connectors when using id_columns in advanced sync rules:

  • PostgreSQL: Added .lower() to the id_columns transformation
  • MSSQL: Added .lower() and sorted() to match map_column_names() behaviour

Checklists

Pre-Review Checklist

  • this PR does NOT contain credentials of any kind, such as API keys or username/passwords (double check config.yml.example)
  • this PR has a meaningful title
  • this PR links to all relevant github issues that it fixes or partially addresses
  • if there is no GH issue, please create it. Each PR should have a link to an issue
  • this PR has a thorough description
  • Covered the changes with automated tests
  • Tested the changes locally
  • Added a label for each target release version (example: v7.13.2, v7.14.0, v8.0.0)
  • For bugfixes: backport safely to all minor branches still receiving patch releases
  • Considered corresponding documentation changes
  • Contributed any configuration settings changes to the configuration reference
  • if you added or changed Rich Configurable Fields for a Native Connector, you made a corresponding PR in Kibana — N/A

Release Note

PostgreSQL/MSSQL connectors: Fixed a bug where using id_columns in advanced sync rules with mixed-case table or column names caused all documents to receive the same _id, resulting in document overwrites and only 1 document being indexed instead of the expected count.

else:
id_columns_str = f"{id_columns_str}_{table}"
id_columns = [f"{id_columns_str}_{column}" for column in id_columns]
id_columns = [
Copy link
Contributor

Choose a reason for hiding this comment

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

I think what needs to happen is that you have to pass both the fetch-from-db side and the configured-from-config-columns through the same transformation.

The other side puts this through map_column_names while here and in the postgres connector we have 2 different pieces of code that try to do the same, which makes things a bit more confusing and brittle (as someone might not understand that these are to be fully in sync and make small adjustments).

Based on this, I say we pass the columns here through the map_column_names function as well - but I might be missing something.

Copy link
Contributor

@Apmats Apmats left a comment

Choose a reason for hiding this comment

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

I think this functionally is correct. I have a comment about reusing a function that would be good to address.

Good job on tracking this down!

Copy link
Member

@artem-shelkovnikov artem-shelkovnikov left a comment

Choose a reason for hiding this comment

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

Can you change functional test so that it would trigger this bug and verify that the outcome is correct?

@dennis-tismenko dennis-tismenko force-pushed the dennis/fix-id-columns-case-sensitivity branch from 57dba9b to af2a804 Compare December 18, 2025 20:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PostgreSQL/MSSQL: id_columns case sensitivity causes all documents to receive the same _id

5 participants