Document mssql uuid comparison
bojanserafimov opened this issue · 2 comments
MSSQL considers the last 6 bytes of the uuid most significant, which is different from what most databases do and what we expect https://docs.microsoft.com/en-us/dotnet/framework/data/adonet/sql/comparing-guid-and-uniqueidentifier-values
Since this behavior is different from the behavior of our other backends, we should document this in the @filter
section of our README.
Alternatively, we can disallow inequality filters with uuids that are not db-agnostic (see https://github.com/kensho-technologies/graphql-compiler/pull/765/files). This makes our backends behave the same, but limits the expressive power of the filter.
How about adding a new scalar UUID
custom type for uuids, and documenting that its comparison behavior is database-defined and may differ between backends?
This solves two problems:
- It makes it obvious when a user supplied illegal inputs for a comparison — e.g.
= "123"
makes no sense as an operation against a UUID, and can be checked statically. - It ensures that if we are ever tempted to implement something like a (paginated) streaming cross-database join along a UUID foreign key, we have some well-defined docs that can guide our implementation in a good direction. Otherwise, I can see this becoming a very difficult bug to track down.