Fix SQLite ExecuteUpdate with navigation properties and TPT inheritance#38023
Draft
Fix SQLite ExecuteUpdate with navigation properties and TPT inheritance#38023
Conversation
In multi-table UPDATE statements (with FROM clause), the UPDATE target table no longer gets an alias, and column references use the table name instead of the alias. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: roji <1862641+roji@users.noreply.github.com>
- Multi-table UPDATE statements no longer alias the target table - Column references to the target alias now use the table name - Fix Update_base_type_with_OfType and Update_base_property_on_derived_type tests in TPT and TPTFilters to call correct base methods with proper SQL baselines instead of expecting SqliteException (#31402) - Remove unused Microsoft.Data.Sqlite import from TPT test files Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: roji <1862641+roji@users.noreply.github.com>
SQLite doesn't support referencing the UPDATE target table in JOIN ON clauses within the FROM clause of UPDATE...FROM statements. This fix: 1. Overrides VisitUpdate in SqliteQuerySqlGenerator to not alias the UPDATE target table in multi-table UPDATE statements 2. Replaces column references to the target alias with the table name 3. Lifts JOIN predicates that reference the target table into the WHERE clause, emitting comma-separated tables instead of JOINs This fixes both the navigation property issue and the TPT inheritance issue (#31402). Agent-Logs-Url: https://github.com/dotnet/efcore/sessions/c9a7c8f9-9ec9-4305-abb2-e31de6da3f9d Co-authored-by: roji <1862641+roji@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix ExecuteUpdateAsync throwing SQLite Error 1 with navigation properties
Fix SQLite ExecuteUpdate with navigation properties and TPT inheritance
Mar 27, 2026
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.
SQLite doesn't support referencing the UPDATE target table in JOIN ON clauses within
UPDATE...FROM. This breaksExecuteUpdatewhen navigation properties or TPT inheritance produce JOINs that reference the target table in their ON predicates.Changes
SqliteQuerySqlGenerator.VisitUpdate— For multi-table UPDATEs, emits the target table without alias and lifts JOIN predicates that reference the target into the WHERE clause, converting those JOINs to comma-separated tablesSqliteQuerySqlGenerator.VisitTable— Suppresses alias generation for the UPDATE target tableSqliteQuerySqlGenerator.VisitColumn— Replaces column references to the target alias with the actual table nameReferencesTargetTable— Walks JOIN predicates to detect references to the target table aliasTest changes
NorthwindBulkUpdatesSqliteTest,NonSharedModelBulkUpdatesSqliteTest, and TPT inheritance test filesTPTInheritanceBulkUpdatesSqliteTest/TPTFiltersInheritanceBulkUpdatesSqliteTest: replacedAssert.ThrowsAsync<SqliteException>with proper execution + baseline assertions forUpdate_base_property_on_derived_typeandUpdate_base_type_with_OfType💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.