Option to normalize casing of identifiers in the ScriptGenerator
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 38/100
Research direction
Start by locating the ScriptGenerator and its current settings, then trace how identifiers are emitted in generated SQL. Resolve whether casing applies uniformly or needs separate instance-level and database-level settings; done means PreserveOriginal remains the default and LowerCase and UpperCase use invariant casing as specified.
Written by the indexing model from the issue text.
Description
SQL Server compares identifiers with respect to the CI/CS, AI/AS setting of the respective database's collation. While accent sensitivity has no effect on the SQL source code, case-sensitivity may have such an effect when the goal is to produce a 'canonical' form of the source code. The locale part of the collation plays no part in this.
Hence, the settings of the ScriptGenerator should be extended with an option to normalize casing of identifiers as follows:
PreserveOriginal— outputs identifiers as-is; this shall be the default behavior corresponding to the current state (no breaking change)LowerCase— lower-case all identifiers when producing the outputUpperCase— upper-case all identifiers when producing the output
A simple ToLowerInvariant() / ToUpperInvariant() should be used.
Question is, whether the ScriptGenerator should support separate settings for instance-level (global) objects versus objects in a database. This would significantly increase the complexity. See also Database identifiers:
The collation of an identifier depends on the level at which it's defined. Identifiers of instance-level objects, such as logins and database names, are assigned the default collation of the instance. Identifiers of objects in a database, such as tables, views, and column names, are assigned the default collation of the database.
- Dominant language
- GAP
- Stars
- 277
- Forks
- 43
- Avg merge
- 6d 17h
- Merged PRs (30d)
- 3
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.
More from microsoft/SqlScriptDOM
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
microsoft/SqlScriptDOM#228 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
microsoft/SqlScriptDOM#183 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 56/100
microsoft/SqlScriptDOM#226 · 1 reaction ·
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
microsoft/SqlScriptDOM#225 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 58/100
microsoft/SqlScriptDOM#224 ·
All issues in microsoft/SqlScriptDOM
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
-
[BUG]: "Clear All" in Settings doesn't clear the saved analysis, old data comes back after reload Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
AOSSIE-Org/OrgExplorer#253 · 1 comment ·
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
needs triage receiver/oracledb
Difficulty 2/5 1-2 days Newbie friendliness 84/100
open-telemetry/opentelemetry-collector-contrib#51400 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100