Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<PackageVersion Include="FluentAssertions" Version="6.12.0" />
<PackageVersion Include="FSharp.Core" Version="9.0.100" />
<PackageVersion Include="FSharp.SystemTextJson" Version="1.3.13" />
<PackageVersion Include="JasperFx" Version="1.28.1" />
<PackageVersion Include="JasperFx" Version="1.28.2" />
<PackageVersion Include="JasperFx.Events" Version="1.31.0" />
<PackageVersion Include="JasperFx.Events.SourceGenerator" Version="1.5.0">
<PrivateAssets>all</PrivateAssets>
Expand Down
46 changes: 46 additions & 0 deletions src/DocumentDbTests/Bugs/Bug_PR_3702_list_index_compile_error.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Marten;
using Marten.Linq.MatchesSql;
using Marten.Schema;
using Marten.Testing.Harness;
using NpgsqlTypes;
using Weasel.Postgresql.Tables;
using Xunit;

namespace DocumentDbTests.Bugs;

public class Bug_PR_3702_list_index_compile_error : BugIntegrationContext
{
[Fact]
public async Task can_create_array_duplicate_column_on_a_list_field()
{
StoreOptions(opts =>
{
opts.RegisterDocumentType<DocWithIndexOnList>();
});

await theStore.Storage.ApplyAllConfiguredChangesToDatabaseAsync();

var newDoc = new DocWithIndexOnList { Id = Guid.NewGuid(), ListOfStrings = ["foo", "bar", "baz"] };
theSession.Store(newDoc);
await theSession.SaveChangesAsync();

List<string> arrayFilter = ["foo", "baz"];
var queriedDoc = await theSession.Query<DocWithIndexOnList>()
.Where(x => x.MatchesSql("d.list_of_strings @> ?", arrayFilter))
.FirstOrDefaultAsync();

Assert.Equal(newDoc.Id, queriedDoc.Id);
}

public class DocWithIndexOnList
{
public Guid Id { get; set; }

[DuplicateField(DbType = NpgsqlDbType.Array | NpgsqlDbType.Text, PgType = "text[]", IndexMethod = IndexMethod.gin)]
public List<string> ListOfStrings { get; set; }
}
}
Loading