Skip to content

Fix F# option date index member selection#1

Merged
nkosi23 merged 1 commit intomasterfrom
codex/fix-datetime-option-index-migration-issue
Feb 4, 2026
Merged

Fix F# option date index member selection#1
nkosi23 merged 1 commit intomasterfrom
codex/fix-datetime-option-index-migration-issue

Conversation

@nkosi23
Copy link
Copy Markdown
Owner

@nkosi23 nkosi23 commented Feb 4, 2026

Motivation

  • Fix a regression where F# option date/time fields were resolved as generic value types and emitted CAST(... as timestamp)/timestamptz in computed index DDL instead of using the mt_immutable_* functions, which caused Postgres errors about non-immutable functions in index expressions.
  • Ensure the computed index test exercises F# option value type registration so the regression is covered.

Description

  • In src/Marten/StoreOptions.MemberFactory.cs added a guard in ValueTypeMemberSource.TryResolve to skip treating FSharpOption<T> as a generic value type when T is DateTime, DateTimeOffset, DateOnly, or TimeOnly, by returning false early so the specialized DateTimeMember/DateTimeOffsetMember logic is used instead.
  • Added a helper method isSpecialFSharpOptionDateType(Type) to centralize the date/time type check.
  • In src/DocumentDbTests/Indexes/computed_indexes.cs updated the test fsharp_date_related_options_indexes_are_created to call _.RegisterFSharpOptionValueTypes() so the F# option value types are registered during test setup.

Testing

  • No automated test suite was executed as part of this change (tests were not run).
  • The fsharp_date_related_options_indexes_are_created test was updated to register F# option value types to cover the regression scenario expected to be validated by the test suite.

Codex Task

@nkosi23 nkosi23 merged commit 0cff8a1 into master Feb 4, 2026
3 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant