Skip to content

Fix | Build ReservedWords table in code#4328

Open
edwardneal wants to merge 13 commits into
dotnet:mainfrom
edwardneal:fix/issue-3372-reservedwords
Open

Fix | Build ReservedWords table in code#4328
edwardneal wants to merge 13 commits into
dotnet:mainfrom
edwardneal:fix/issue-3372-reservedwords

Conversation

@edwardneal
Copy link
Copy Markdown
Contributor

Description

This PR populates the ReservedWords collection returned by SqlConnection.GetSchema in code, rather than by deserializing the SqlMetaData.xml embedded resource.

There are currently 393 reserved words in this embedded resource. To make this easier to review, I've broken it down commit-by-commit.

I'm aiming to do nothing more than migrate the data out of the XML file, with one exception: the "NATIONAL " keyword is now corrected to "NATIONAL", removing the trailing space. I believe this was an oversight.

Separately to this, I've noticed two things:

  • This list of words hasn't been kept in sync with the publicly documented set of reserved words. I've linked to the documentation and noted all missing words, but it's not clear at present whether they should all be added, or whether there are other criteria. If we add any, we'll need to make sure the minimum version is correctly specified.
  • If we're to take the linked documentation as canonical, there's an additional reserved word which is unique to Azure Synapse Analytics. This highlights the requirement for Cleanup | Consolidate connection capability metadata #3862 (because we're no longer basing the list of reserved words strictly on the version of the SQL Server) and raises the question of whether we determine this with a query of SERVERPROPERTY('EngineEdition'), or a simpler check against the DNS name.

I've avoided pulling a response to either of them in this PR in order to prevent it drifting into the weeds and to keep it self-contained.

Issues

Contributes to #3372.

Testing

I've manually verified that reserved words match, and added a test which verifies that the data is correct. With adjustment to account for the "NATIONAL " case, this same test also passes against main.

@edwardneal edwardneal requested a review from a team as a code owner May 30, 2026 20:25
@github-project-automation github-project-automation Bot moved this to To triage in SqlClient Board May 30, 2026
<ReservedWord>CURSOR</ReservedWord>
</ReservedWords>
<ReservedWords>
<ReservedWord>NATIONAL </ReservedWord>
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is the only reserved word I expect to be different between the old and the new structure. I've assumed that it was a typo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: To triage

Development

Successfully merging this pull request may close these issues.

1 participant