Skip to content

Conversation

stephencelis
Copy link
Member

We made Statement: Hashable for convenience in holding onto statements in a shared key for SQLiteData, but that isn't really necessary, since we can always call out to the underlying query fragment to get a hashable value.

This conformance unfortunately can cause bugs, including == resolving to the equality operator when a query operator was expected. Another bug is that @Table @Selection types conform to Statement, and this equatable implementation was preferred over the default synthesized version, making Table values equatable strictly by the underlying query, which meant @Ephemeral fields weren't taken into account at all.

With 0.20.0, all @Table applications introduced a Statement conformance, and so this issue becomes much more widespread.

While this change can break SQLiteData if someone upgrades StructuredQueries before upgrading SQLiteData with the changes from pointfreeco/sqlite-data#245.

We made `Statement: Hashable` for convenience in holding onto statements
in a shared key for SQLiteData, but that isn't really necessary, since
we can always call out to the underlying query fragment to get a
hashable value.

This conformance unfortunately can cause bugs, including `==` resolving
to the equality operator when a query operator was expected. Another bug
is that `@Table @Selection` types conform to `Statement`, and this
equatable implementation was preferred over the default synthesized
version, making `Table` values equatable strictly by the underlying
query, which meant `@Ephemeral` fields weren't taken into account at
all.

With 0.20.0, all `@Table` applications introduced a `Statement`
conformance, and so this issue becomes much more widespread.

While this change can break SQLiteData if someone upgrades
StructuredQueries before upgrading SQLiteData with the changes from
pointfreeco/sqlite-data#245.
@stephencelis stephencelis merged commit 6426bec into main Oct 8, 2025
3 checks passed
@stephencelis stephencelis deleted the remove-hashable-from-statement branch October 8, 2025 18:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants