Comments (4)
Fixed by recent LINQ improvements
from marten.
public class MainTable
{
[Identity]
public string Id { get; set; }
public string IncludedTableId { get; set; }
public int ExportId { get; set; }
}
public class IncludedTable
{
public string Id { get; set; }
public string OtherProperty { get; set; }
}
Where T is MainTable
await session.Query<T>()
.Include(x => x.IncludedTableId, includedTableDocuments)
.Where(i => i.ExportId == exportId)
.OrderBy(i => i.IncludedTableId)
.Select(i => i.IncludedTableId)
.Distinct()
.Skip(skip)
.Take(take)
.ToListAsync();
from marten.
The Include()
+ Distinct()
usage is the problem here. In this case, with that combination, the Select()
and Distinct()
usage cannot be part of the temp table creation. That's going to have to be added underneath the last SelectorStatement
.
Here's the SQL generated so far:
drop table if exists mt_temp_id_list1;
create temp table mt_temp_id_list1 as (
select DISTINCT(d.data ->> 'IncludedTableId') as data from bugs.mt_doc_maintable as d where CAST(d.data ->> 'ExportId' as integer) = :p0 order by d.data ->> 'IncludedTableId' OFFSET :p1 LIMIT :p2
);
select d.id, d.data from bugs.mt_doc_includedtable as d where d.id in (select d.data ->> 'IncludedTableId' from mt_temp_id_list1 as d);
select * from mt_temp_id_list1 as d;$
$
42883: operator does not exist: text ->> unknown
Currently parked in branch GH2810
from marten.
In this case, I don't think there's any way to prevent the Include() from over-fetching
from marten.
Related Issues (20)
- It seems that .ToPagedListAsync() could not be combined with a .Select when using Query<T> HOT 1
- Curious why drop netstandard HOT 1
- Missing repository information in NuGet package HOT 5
- Unable to Load related Entities/Documents Successfully HOT 2
- Bug: IMartenQueryable doesn't work well with Projection. HOT 4
- Include does not work after migrating to v7.26.1 from v6 HOT 16
- Async deamon healthcheck in combination with master table tenancy throws unsupported error HOT 1
- Include and Count does not work together after migrating to V7. HOT 1
- When using paging with an include, Stats.TotalResults is equal to the number of results on the page only instead of the total overall results HOT 4
- Error when using numeric revisioned documents with identity map HOT 1
- Marten is not creating the database in a console application HOT 3
- `DropExisting()` fails with "DROP DATABASE cannot be executed within a pipeline"
- `MaintenanceDatabase(...)` is required for create & drop database operations HOT 3
- Question on FullTextSearch with field containing URL in F# HOT 3
- MetadataToken collisions causing unpredictable Linq query execution when using custom method call parsers HOT 4
- "Sequence contains more than one element" exception when using lambda FirstOrDefaultAsync() rather than explicit Where() HOT 1
- Polly retries not working when getting connection failures. HOT 3
- Query on child collection can't use GIN Index
- FetchForWriting should assert that it is only usable for single stream projections HOT 4
- IncludeArchivedEvents not being honored on Generated Projections HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from marten.