This repository has been archived by the owner on Jan 16, 2025. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Change-type: patch
See: https://balena.zulipchat.com/#narrow/stream/345890-balena-io/topic/Server.20side.20pagination.20-.20Enpal.20feedback/near/423035741
Explanation:
The presence of numerous NULL values in certain columns creates a non-unique sorting scenario, subject to PostgreSQL's (PG) optimization strategies, which may rely on disk storage order.
This issue extends beyond specific columns and applies to any column containing NULL values. For instance, when sorting by a column with NULLs, the sorting behavior may become unpredictable.
To maintain compliance with PostgreSQL documentation, which mandates predictable and unique sorting, we propose a potential workaround. This involves incorporating an '$orderby id' clause alongside the primary sorting column. The '$orderby id' clause ensures ascending or descending order, aligned with the user's chosen sorting direction for other columns.
It's worth noting that if the code can recognize a unique column, we may revisit this solution. Upon sorting the table by such a unique column, the workaround to enforce predictable sorting behavior could be removed.