Path: redb/redb.Tests.Integration/Tests/Unit/StringCollationIndexNameTests.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/StringCollationIndexNameTests.cs ---- using System.Text; using redb.Core.Query; using redb.Postgres.Sql; namespace redb.Tests.Integration.Tests.Unit; /// /// The name of the StringCollation index is the name PostgreSQL keeps. PostgreSQL cuts an identifier past 63 bytes, and /// a collation name may be 63 characters long (CollationNameValidator), so the prefix plus the collation can pass the /// limit. The build statement is cut by the server, but the look-up of an INVALID leftover compares the name as a value: /// with the long name it never finds the leftover, CREATE INDEX IF NOT EXISTS then meets the cut name and builds nothing, /// and every start logs the index as built while it stays INVALID. No database required. /// public class StringCollationIndexNameTests { private const int PostgreSqlIdentifierBytes = 63; [Fact] public void LongCollation_GivesTheNamePostgreSqlKeeps() { var collation = "und-u-ks-level2-kc-false-ka-shifted-x-icu"; CollationNameValidator.IsValid(collation).Should().BeTrue("the setting accepts it"); var name = new PostgreSqlDialect().StringCollationIndexName(collation); Encoding.UTF8.GetByteCount(name).Should().BeLessThanOrEqualTo(PostgreSqlIdentifierBytes); name.Should().Be("IX__values__String_pattern_und_u_ks_level2_kc_false_ka_shifted_x_icu"[..PostgreSqlIdentifierBytes], "an index built before under the cut name keeps being found"); } [Fact] public void ShortCollation_KeepsItsName() { new PostgreSqlDialect().StringCollationIndexName("und-x-icu").Should().Be("IX__values__String_pattern_und_x_icu"); } }