Skip to content

Extra Underscore in Column Names When Using snake_case During Data-Only Migration from MSSQL to PostgreSQL #1669

Open
@GentiSe

Description

@GentiSe

Description

When using pgloader to perform a data-only migration from Microsoft SQL Server to PostgreSQL, and specifying a column naming convention such as snake_case, an additional underscore is incorrectly added to column names that already contain underscores.

Steps to Reproduce

  1. In SQL Server, have a table with a column named Column_Name.
  2. Use pgloader with data only migration enabled and with snake_case name transformation.
  3. Observe that pgloader attempts to write to a column named column__name (with a double underscore) instead of the correct column_name.

Expected Behavior

pgloader should map the column as it is from sql server to psql without adding an underscore if it has one.

Actual Behavior

pgloader transforms Column_Name into column__name, inserting an additional underscore, which causes a mismatch with the actual column names in the PostgreSQL schema and results in a migration failure.

Additional Notes

  • This issue only occurs during data-only migration when the PostgreSQL schema is pre-created.
  • The error does not occur when pgloader is allowed to create the schema (as it then matches its own column naming logic).

Wasn't able to find any command in the docs that handles this part.

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