It depends on the level of API people want to use. For example, PG
always returns strings. That means we need to know the types for which
we’re querying. Say someone does this against pg:
connection.execute ‘select 1.2 + 20’
we can’t know to cast that to a float. Even doing regexp tests will be
wrong since someone may have tried to select a string.
Most database protocols include type information along with the values themselves, the drivers should be able to do introspection and ‘magically’ cast them completely removing our casting from the picture.
We can do automatic casting, but it’s going to break down at some point
depending on the level of abstraction and the database used.
For a 4.x release though I think we can expect the database drivers to step up and handle that conversion natively. Unless there are any supported databases whose network protocol doesn’t include enough information for the driver to do it itself.