Support PostgreSQL native inheritance
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 25/100
Research direction
Start by reading the PostgreSQL table inheritance documentation linked in the issue, including its caveats, and review the related Npgsql issue and Stack Overflow discussion. The requested outcome is EF Core support for mapping CLR inheritance to PostgreSQL native inheritance as an alternative to TPH, TPC, and TPT, including the described parent and child query behavior.
Written by the indexing model from the issue text.
Description
PostgreSQL natively supports table inheritance in the database (see docs here, and also some current caveats). In theory EF Core could map CLR inheritance relations to this scheme as an additional alternative to TPH/TPC/TPT.
- You use a special DDL to specify that one table (
capitals)INHERITS FROManother table (cities). - The child table (
capitals) implicitly contains fields from the parent (cities), so to get capitals you only need to select from the child table. In that sense it's like TPC. - However, tables need to be created for both child and parent, in that sense it's like TPT.
- Selecting from the parent table will by default return children rows, so selecting from cities will return all cities. A special
SELECT ... FROM ONLY CITIESsyntax can return only the parents.
Requested in https://github.com/npgsql/Npgsql.EntityFrameworkCore.PostgreSQL/issues/59 and this SO.
Disclaimer: I'm opening this after a conversation with @divega in which he expressed interest, but I imagine the internal impact would be really non-trivial and beyond what you'd want to provide.
- Dominant language
- C#
- Stars
- 14.8k
- Forks
- 3.4k
- Avg merge
- 2d 5h
- Merged PRs (30d)
- 134
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from dotnet/efcore
-
Difficulty 4/5 3-5 days Newbie friendliness 55/100
-
customer-reported
Difficulty 5/5 Over a week Newbie friendliness 38/100
-
area-cosmos area-vector-search
Difficulty 5/5 Over a week Newbie friendliness 25/100
-
area-cosmos
Difficulty 5/5 Over a week Newbie friendliness 25/100
-
area-tools needs-design
Difficulty 4/5 3-5 days Newbie friendliness 25/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
-
:watch: Not Triaged 11.0 fundamentals/subsvc
Difficulty 2/5 1-3 hours Newbie friendliness 92/100
dotnet/AspNetCore.Docs#37699 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
SubtitleEdit/subtitleedit#15108 · 1 comment ·
-
area/docs-content Bug pulumi/docs
Difficulty 1/5 1-3 hours Newbie friendliness 94/100
-
agentic-workflows untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 76/100