• (nodebb)

    Literally the first thought was: "Did they use strings?" Either the situation is too common, or I've seen too much shit.

  • klinsten1 (github) in reply to Allexxann

    had this situation also.. even worse where sometimes there was '1' and sometimes '1 '... and everyone could make some changes to the behavior of their GUI, so three people could have three different results from the same query... took a few of us quite some time to figure that out!

  • dusoft (unregistered)

    Thanks to MariaDB having ENUMs internally coded as integers.

  • (nodebb)

    In the aftermath, I blame the person who defined this field more than I blame MySQL for its bizzare enum conventions. If you're doing enums (which are generally a good thing), then give them proper names like successful and unsuccessful or something. Not 0 and 1.

    At the very least, don't give them stringly numeric values. But if the column was defined as INT this would be a different story

  • scragar (unregistered)

    I once worked somewhere that employed an ENUM with 3 values, 'Y', 'N', and 'NULL'(it wasn't a nullable field, one of the allowed values was the string NULL).

    Enums in DBs were a bad idea.

  • (nodebb) in reply to klinsten1

    sometimes there was '1' and sometimes '1 '

    Coincidentally, I just had to resolve a situation where [a] the customer had added values with trailing spaces to the primary lookup column and [b] my predecessor had not thought to trim user input in either the front or back ends. Jolly good times.

  • Hmmmm 🤨 (unregistered)

    This seems like one of those cases where, as painful as it may be, you are far better off exorcising it than trying to keep it chained to the boiler. Also, good example case for showing why one should decouple code from database operations.

  • Randal L. Schwartz (github)

    Obligatory "FILE_NOT_FOUND" not found message.

  • Randal L. Schwartz (github)

    Obligatory "FILE_NOT_FOUND" not found message.

  • (nodebb)

    Maybe if you keep checking it'll appear. :)

  • Joe (unregistered) in reply to dpm

    We have a ref data system that doesn't trim input, and users who enter data quite often get data sent to them in Excel sheets. Any guesses as to what kind of data issues we see sometimes?

  • Stuart (unregistered)

    Silent data conversions are THE number one reason why I dislike MySQL. I can understand why they do it, but it's the source of so many issues when the conversion it makes is not the one you expected. Hard failures instead of quietly doing something that you think is probably right - it makes for more robust code, and problems that are far easier to figure out and fix.

  • User1234 (unregistered)

    I have to deal with such a database here - back in the day when this was developed, ENUMs were probably seen as "not enterprise-y enough", and all these fields were implemented as INTs, normally with 1 standing in for the affirmative, and 0 for negative.

    And then there are those privation fields (like "unsuccessful" or "missing"), where of course 1 is bad and 0 is good. Not to worry about it, it is just my brain twisting every time I have to read these.

    Apparently, constraints were also not "enterprise-y" enough, so the DB has none of these. And test tables that were set up during the development are also in prod now at least since 15 years, and nobody dares to touch them, because who knows what they are still used for - there is no documentation after all, and the developers have long since moved on to greener pastures.

    That has the effect that there are e.g. no less than three different tables that seem to refer to "categories", all with slightly different names, but seriously different categories. When I have to create a report, it took a while to know which of these I should join with the category IDs to get a useful result (I know now, but it took me a while. Spoiler: it is not the one that is just plainly called "categories"...)

    So, rage over. I look at it on the bright side: I learned a lot from this DB - even though it is mostly what never to do when setting up a database.

  • (nodebb)

    Silent data conversions and weakly typed languages simply guarantee corner case errors while making the main case slightly quicker / lazier to implement. What a great tradeoff. Not.

    If one really uses TDD, and I know way too few do, squishy types that means every single assignment or comparison needs a dozen corner case tests to validate it. Fat chance of that happening in the management environment where squishy languages are in use.

Leave a comment on “Unenumerbrated”

Log In or post as a guest

Replying to comment #706261:

« Return to Article