Path: redb/redb.Tests.Integration/Tests/Unit/PostgresServerVersionTests.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/Unit/PostgresServerVersionTests.cs ---- using System; using AwesomeAssertions; using redb.Postgres.Data; using Xunit; namespace redb.Tests.Integration.Tests.Unit; /// /// PostgreSQL 15 is the lowest supported server: the schema creates a unique index with NULLS NOT DISTINCT. An older /// server is refused before any schema work with one message that names the server found and the one required, /// instead of a syntax error from the middle of the creation script. Shown on server_version_num values, no server /// needed. /// public class PostgresServerVersionTests { [Theory] [InlineData("150000")] [InlineData("150014")] [InlineData("160004")] [InlineData("180001")] [InlineData(" 170002\n")] public void Supported_server_passes(string versionNum) => PostgresServerVersion.FindProblem(versionNum).Should().BeNull(); [Theory] [InlineData("140012", "14.12")] [InlineData("140000", "14.0")] [InlineData("130018", "13.18")] [InlineData("90624", "9.6.24")] public void Older_server_is_refused_with_both_versions(string versionNum, string shown) { var problem = PostgresServerVersion.FindProblem(versionNum); problem.Should().NotBeNull(); problem.Should().Contain($"PostgreSQL {shown}"); problem.Should().Contain("PostgreSQL 15 or newer"); } [Theory] [InlineData(null)] [InlineData("")] [InlineData("fifteen")] public void Unreadable_answer_is_refused_and_quoted(string? versionNum) { var problem = PostgresServerVersion.FindProblem(versionNum); problem.Should().NotBeNull(); problem.Should().Contain("PostgreSQL 15 or newer"); } [Fact] public void Ensure_throws_NotSupportedException_with_the_message() { var act = () => PostgresServerVersion.EnsureSupported("140012"); act.Should().Throw().WithMessage("*PostgreSQL 15 or newer*PostgreSQL 14.12*"); } [Fact] public void Ensure_passes_on_a_supported_server() { var act = () => PostgresServerVersion.EnsureSupported("150004"); act.Should().NotThrow(); } }