Skip to content

[BUG] Pagination does not work properly #197

@Simon128

Description

@Simon128

Describe the bug or question
Pagination in EndpointCreator will produce inconsistent results, as there is no ordering applied together with the offset and limit.
Postgres explanation on why we need order by when doing pagination: https://www.postgresql.org/docs/current/queries-limit.html

To Reproduce

Description
Expecting the arguments "sort_columns" and "sort_orders" of FastCRUD.get_multi to be set, if applying pagination https://github.com/igorbenav/fastcrud/blob/82b6b17ec6bdae0ef6069f7ad7fdaf7518d6714b/fastcrud/endpoint/endpoint_creator.py#L413 Could for example just use the _get_primary_keys function and "desc" as default sort order to achieve this.

Will have a performance impact, as SQL order by is not free lunch.

Metadata

Metadata

Assignees

Labels

Automatic EndpointRelated to automatic endpoint creation functionalitybugSomething isn't workingenhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions