I have created a typeorm 'view' entity based on "https://typeorm.io/#/view-entities". And I am trying to apply nestjs crud on it. I want only getManyBase route. The route works well. But when I set alwaysPaginate as true in 'query' filter the end point returns 500, Internal server error.
When paginate is set as true I see there are two queries being executed
To fetch records from view with offset and limit
To get Distinct Count of records from the view
First query is good but there is an issue with second query. Second query looks like this
SELECT COUNT(DISTINCT()) as "cnt" FROM "foo_view" "FooView"
The DISTINCT() method in COUNT has no parameters. That's where the error is. It should ideally contain 'id' and should look something like this SELECT COUNT(DISTINCT(FooView.id)) as "cnt" FROM "foo_view" "FooView" to work
I am using MSSQL database and pagination is working well with all other normal entities
I have created a typeorm 'view' entity based on "https://typeorm.io/#/view-entities". And I am trying to apply nestjs crud on it. I want only
getManyBase
route. The route works well. But when I setalwaysPaginate
as true in 'query' filter the end point returns 500, Internal server error.When paginate is set as true I see there are two queries being executed
First query is good but there is an issue with second query. Second query looks like this
SELECT COUNT(DISTINCT()) as "cnt" FROM "foo_view" "FooView"
The
DISTINCT()
method inCOUNT
has no parameters. That's where the error is. It should ideally contain 'id' and should look something like thisSELECT COUNT(DISTINCT(FooView.id)) as "cnt" FROM "foo_view" "FooView"
to workI am using MSSQL database and pagination is working well with all other normal entities