Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ExecuteUpdate generates invalid SQL for SQLite with TPT #31402

Open
roji opened this issue Aug 2, 2023 · 2 comments
Open

ExecuteUpdate generates invalid SQL for SQLite with TPT #31402

roji opened this issue Aug 2, 2023 · 2 comments

Comments

@roji
Copy link
Member

roji commented Aug 2, 2023

This manifests after unblocking ExecuteUpdate TPT support (as long as the updates touch only a single table in the hierarchy).

Example test is TPTInheritanceBulkUpdatesSqliteTest.Update_base_property_on_derived_type:

public virtual Task Update_base_property_on_derived_type(bool async)
    => AssertUpdate(
        async,
        ss => ss.Set<Kiwi>(),
        e => e,
        s => s.SetProperty(e => e.Name, "SomeOtherKiwi"),
        rowsAffectedCount: 1);

SQL:

UPDATE "Animals" AS "a"
SET "Name" = 'SomeOtherKiwi'
FROM "Birds" AS "b"
INNER JOIN "Kiwi" AS "k" ON "a"."Id" = "k"."Id"
WHERE "a"."Id" = "b"."Id"

Error: SQLite Error 1: 'no such column: a.Id'.

@roji
Copy link
Member Author

roji commented Aug 3, 2023

Possibly a dup of #28886

@roji roji added this to the Backlog milestone Aug 3, 2023
@roji roji self-assigned this Aug 3, 2023
@palhal
Copy link

palhal commented Jan 11, 2024

I'm facing the same problem. I can work around it by making Animal.Id nullable, but that's often not an option. Making it nullable (int? vs int) produces a much more complicated (though valid) SQL.

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

No branches or pull requests

2 participants