Skip to content

Add tests for Value column quoting in Single/SingleOrDefault queries. Fix #1234#1263

Open
fdcastel wants to merge 1 commit intoFirebirdSQL:masterfrom
fdcastel:fix-issue-1234
Open

Add tests for Value column quoting in Single/SingleOrDefault queries. Fix #1234#1263
fdcastel wants to merge 1 commit intoFirebirdSQL:masterfrom
fdcastel:fix-issue-1234

Conversation

@fdcastel
Copy link
Member

Investigation

I performed a thorough investigation of the full SQL generation pipeline:

  1. EF Core base behavior: The QuerySqlGenerator.VisitColumn() in EF Core 10.0.0 always calls DelimitIdentifier() on column names, wrapping them in double quotes ("Value"). Similarly, VisitProjection() quotes the alias.

  2. Firebird provider: FbSqlGenerationHelper inherits from RelationalSqlGenerationHelper and does NOT override DelimitIdentifier(). The base implementation always wraps identifiers in double quotes: "Value".

  3. FbQuerySqlGenerator: Does not override VisitColumn, VisitProjection, VisitValues, or VisitSelect — all column reference generation goes through the base class which properly quotes.

  4. Conclusion: The Value column 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 — Verifies SqlQueryRaw<int>().SingleAsync() quotes Value
  • SqlQueryScalarSingleOrDefaultQuotesValueColumn — Verifies SqlQueryRaw<int>().SingleOrDefaultAsync() quotes Value
  • SqlQueryScalarComposedWhereQuotesValueColumn — Verifies composed .Where() on SqlQueryRaw<int> quotes Value
  • EntitySingleOrDefaultQuotesIdentifiers — Verifies entity SingleOrDefaultAsync() works correctly

Each test asserts that the generated SQL contains no unquoted Value references (only properly quoted "Value").

@fdcastel fdcastel mentioned this pull request Mar 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant