Add tests for Value column quoting in Single/SingleOrDefault queries. Fix #1234#1263
Open
fdcastel wants to merge 1 commit intoFirebirdSQL:masterfrom
Open
Add tests for Value column quoting in Single/SingleOrDefault queries. Fix #1234#1263fdcastel wants to merge 1 commit intoFirebirdSQL:masterfrom
fdcastel wants to merge 1 commit intoFirebirdSQL:masterfrom
Conversation
Open
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Investigation
I performed a thorough investigation of the full SQL generation pipeline:
EF Core base behavior: The
QuerySqlGenerator.VisitColumn()in EF Core 10.0.0 always callsDelimitIdentifier()on column names, wrapping them in double quotes ("Value"). Similarly,VisitProjection()quotes the alias.Firebird provider:
FbSqlGenerationHelperinherits fromRelationalSqlGenerationHelperand does NOT overrideDelimitIdentifier(). The base implementation always wraps identifiers in double quotes:"Value".FbQuerySqlGenerator: Does not override
VisitColumn,VisitProjection,VisitValues, orVisitSelect— all column reference generation goes through the base class which properly quotes.Conclusion: The
Valuecolumn name IS properly quoted as"Value"in the current codebase (targeting EF Core 10.0.0). The issue reporter was likely using an older version of the provider. The reserved word conflict is avoided by the double-quote quoting.Tests Added
Four regression tests in ElementaryTests.cs:
SqlQueryScalarSingleQuotesValueColumn— VerifiesSqlQueryRaw<int>().SingleAsync()quotesValueSqlQueryScalarSingleOrDefaultQuotesValueColumn— VerifiesSqlQueryRaw<int>().SingleOrDefaultAsync()quotesValueSqlQueryScalarComposedWhereQuotesValueColumn— Verifies composed.Where()onSqlQueryRaw<int>quotesValueEntitySingleOrDefaultQuotesIdentifiers— Verifies entitySingleOrDefaultAsync()works correctlyEach test asserts that the generated SQL contains no unquoted
Valuereferences (only properly quoted"Value").