cpp-driver
cpp-driver copied to clipboard
[datatype] fix equals method for udt datatypes across schema upgrades
We encountered a bug with this driver, where an altered UDT would cause cass_statement_bind_user_type_by_name_n to fail on a prepared statement that was prepared prior to the db altered.
I think that this should be a sensible fix, it for sure fixes our issue... however, I have no idea if this is actually sound!
Unfortunately I do not have a C++ reproducer for this bug, since we use the rust wrapper to this driver, that reproducer is here: https://gist.github.com/jhgg/d009d1fb994a0fd550bd01bb803baee5
Thinking about this more, I think that although this is semantically correct for IsValidDataType, it may not be right for equals - so maybe we might introduce a separate method that just does the check of mutual fields and have is valid data type invoke that instead.
Thanks for the PR.
What do you think about my second comment? Should I instead refactor this into a "is valid data type for" method, that way equals still remains an equality check?
Additionally, if that's the case, we can drop the name check on the field, this will allow us to handle renaming of a field, and still considering them equal.