fsprojects / SQLProvider

A general F# SQL database erasing type provider, supporting LINQ queries, schema exploration, individuals, CRUD operations and much more besides.
https://fsprojects.github.io/SQLProvider
Other
572 stars 146 forks source link

Columns with similar names on the DB collide in SQLProvider #599

Open ghost opened 5 years ago

ghost commented 5 years ago

Description

When a table has 2 or more columns whose names are only different by "special" characters, SQLProvider creates indistinct mappings for them.

Repro steps

  1. Create a table with these columns
    • [ExampleColumn]
    • [ExampleColumn:]
    • [ExampleColumn_]
  2. Try to query this table from SQLProvider

Expected behavior

I would expect, given F#'s ability to create identifiers with special characters, that SQLProvider wouldn't need to alter your column names in any way (at least, as an option when creating the provider).

Actual behavior

SQLProvider will rename these fields with indistinct names, causing an exception to be thrown, and the table becomes un-queryable.

Known workarounds

Create a view in your database that disambiguates that column names and use that from SQLProvider, but this is not acceptable since you're then designing the database around an arbitrary tool in a separate code stack.

Related information