Path: redb/redb.Tests.Integration/Tests/Base/FreeOrderPositionTestsBase.cs
Snapshot: redb, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages.
License: Apache-2.0. Repository: https://github.com/redbase-app/redb
Page: https://redbase.app/src/dev-2026-12-06/redb/redb.Tests.Integration/Tests/Base/FreeOrderPositionTestsBase.cs
----
using redb.Core;
using redb.Core.Query;
using redb.Tests.Integration.Helpers;
using redb.Tests.Integration.Models;
namespace redb.Tests.Integration.Tests.Base;
///
/// The inner statement of a Free query returns _ord next to _id, the position of the row in the order of the query,
/// and the list read sorts by it after the join. Numbering the rows outside the statement (ROW_NUMBER() OVER (ORDER BY
/// (SELECT NULL)) on SQL Server, row_number() OVER () on PostgreSQL) relied on the plan reading them in order: on SQL
/// Server OrderByDescending(key).DistinctBy(key) came back ascending.
///
public abstract class FreeOrderPositionTestsBase
{
protected readonly IRedbService Redb;
protected FreeOrderPositionTestsBase(IRedbService redb) => Redb = redb;
public static IEnumerable