Publishing a dacpac with collation 1054 (Thai) errors out if column names differ by spaces or special characters like '_'
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 460
- Forks
- 29
- Avg merge
- 4d 9h
- Merged PRs (30d)
- 7
Description
- SqlPackage or DacFx Version: 162.5.57
- .NET Framework (Windows-only) or .NET Core: 8.0
- Environment (local platform and source/target platforms): Windows 11 OS, Azure MSSQL database or SQL2022
Publishing fails with the following error for a dacpac with collation 1054 (Thai) when the column name differs by space or special character such as '_'.
---> Microsoft.Data.Tools.Schema.Sql.Deployment.DeploymentFailedException: The reference to the element with the name '[dbo].[Table1].[column1 _]' could not be resolved. More than one element with this name exists. To resolve the error, you must add one or more disambiguators.
---> Microsoft.Data.Tools.Schema.Sql.Deployment.DeploymentFailedException: The reference to the element with the name '[dbo].[Table1].[time stamp]' could not be resolved. More than one element with this name exists. To resolve the error, you must add one or more disambiguators.
**Note: The issue does not repro on SqlPackage\DacFx Net462; however, it reproduces in Net8.0.**
Issue does not repro on DacFx Net462 because it uses [NLS ](https://learn.microsoft.com/en-us/dotnet/standard/base-types/string-comparison-net-5-plus) globalization standard whereas Net 5+ move to [ICU](https://learn.microsoft.com/en-us/dotnet/core/extensions/globalization-icu#use-nls-instead-of-icu)
In[ Net5+](https://learn.microsoft.com/en-us/dotnet/standard/base-types/string-comparison-net-5-plus), for some collations like Thai (1054), spaces are not used as word separators. In ICU, spaces or special characters like ‘_’ are ignored for locale 1054. This causes SqlString Equals to return the same result for [TimeStamp] and [time stamp] or [Column _] and [Column], leading to an error in DacFx.
**Steps to Reproduce:**
1. Create a database in Azure Sql or Sql-2022 and set the collation to 1054 (Thai)
2. Create a table with following column names
- [Column _]
- [Column]
- [TimeStamp]
- [time stamp]
3. Extract and publish dacpac to Azure Sql or Sql-2022
**Did this occur in prior versions? If not - which version(s) did it work in?** The issue does not repro on SqlPackage\DacFx Net462; however, it reproduces in Net8.0.
(DacFx/SqlPackage/SSMS/Azure Data Studio)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the listed reproduction using Thai collation 1054 and compare Net462 with Net8.0, focusing on the reported SqlString equality behavior under NLS versus ICU. Done means publishing the dacpac succeeds for column names that differ by spaces or special characters without an ambiguous-reference error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, sql
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100