Improve error handling for when a non-type 1 UUID is given to bind() on a timeuuid column

Description

When attempting to bind a non-type 1 UUID to BoundStatement on a timeuuid column the driver will return the error:

This happens because the TimeUUID codec only accepts type 1 UUIDs, so no other compatible codec can be found, and thus this error is raised. It isn't immediately obvious to the user that this is happening.

Instead we should allow the TimeUUIDCodec to accept all UUIDs and throw a failure during serialization (as it currently would if the codec would be used):

The only loss of functionality of doing this is that a user could not register a custom UUID <-> timeuuid codec of their own that accepts non-type 1 UUIDs, which I can't think of a use case for currently.


Final fix:

  • TimeUUIDCodec now accepts all kinds of UUIDs but rejects non-type 1 at serialization/format time

  • The same logic is applied to AsciiCodec when given non-ASCII strings

Environment

None

Pull Requests

None
Fixed

Assignee

Andy Tolbert

Reporter

Andy Tolbert

Labels

None

PM Priority

None

Affects versions

Fix versions

Pull Request

None

Doc Impact

None

Size

None

External issue ID

None

External issue ID

None

Priority

Minor
Configure