Posted: January 29, 2021
I stumbled upon this feature (bug?) in FreeTDS. We use FreeTDS to allow a Python application to read from a Microsoft SQL Server database. We use SQLAlchemy as ORM.
The problem became visible when in Python we checked for the presence of a certain field, meaning that it should have
a value different from None
or the empty string. Tests run with SQLite and PostgreSQL on my Windows machine worked
fine. Only after deploying the application on Linux and using FreeTDS to access the SQL Server database brought the
problem to light.
In the end I could fix the problem in the model by renaming the field x
to unsafe_x
and introducing a property x
that would replace the space by an empty string. This worked because this specific field would either contain an empty
string or a text and never only a space.