Path: redb/redb.Tests.Integration/Tests/Postgres/PostgresSqlPreviewTests.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/Postgres/PostgresSqlPreviewTests.cs ---- using redb.Core.Query; using redb.Core.Query.Aggregation; using redb.Tests.Integration.Fixtures; using redb.Tests.Integration.Models; using redb.Tests.Integration.Tests.Base; namespace redb.Tests.Integration.Tests.Postgres; [Collection("Postgres")] public class PostgresSqlPreviewTests : SqlPreviewTestsBase { public PostgresSqlPreviewTests(PostgresFixture fixture) : base(fixture.Redb) { } // The Free module averages the elements of an array as their sum over their count: it unnests the array and // guards the count with NULLIF, where Pro writes AVG over the element rows. public override async Task Preview_AggAvgOverArray_ContainsUnnestAndNullIf() { var sql = await Redb.Query() .ToAggregateSqlStringAsync(x => new { Avg = Agg.Average(x.Props.SkillLevels.Select(s => s)) }); sql.ToUpperInvariant().Should().Contain("UNNEST(").And.Contain("NULLIF("); sql.Should().ContainEquivalentOf("_long"); } }