Support many-to-many via array column instead of via a join table
See original GitHub issueI am trying to generate the following sql with linq but no success so far:
SELECT
t1.id,
t2.id
FROM public.table1 t1
INNER JOIN public.table2 t2 ON ARRAY[t2.id]::bigint[] <@ t1.t2_ids;
Table1:
public class Table1
{
public long Id { get;set; }
public long[] T2Ids { get; set }
}
Table2:
public class Table2
{
public long Id { get;set; }
}
Is this possible with LINQ?
Issue Analytics
- State:
- Created 2 years ago
- Reactions:4
- Comments:10 (6 by maintainers)
Top Results From Across the Web
Inner join "many-to-many" table rows as array
I know that Arrays are possible with PostgreSQL, but I don't get how to write such a query and probably already spent too...
Read more >Convert right side of join of many to many into array
What I'd like to do is convert the right side of a join into an array so the result is one row. Example...
Read more >join table by querying many to many relationship
Hi everyone! I am trying to select a specific row with its id which should be the join result of a many to...
Read more >The best way to map a JPA and Hibernate many- ...
In this article, we are going to see how you can map a many-to-many database relationship using an intermediary entity for the join...
Read more >Many-to-many relationships | ER Diagram
Many to many relationships in entity relationship diagrams explained. Draw ER diagrams and design database structures easily.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
This is definitely not something that EF Core can generate at this point.
Note https://github.com/dotnet/efcore/issues/23523 which is about providing this for Cosmos (some info also in https://github.com/dotnet/efcore/issues/16920#issuecomment-989721078); the same work could be done for PostgreSQL as well. Keeping on the backlog.
Duplicate of https://github.com/dotnet/efcore/issues/30551