News for hackers. Stuff that matters.
Re:A terrible schema from a clueless programmer by superjan on Sunday November 07, 2021 @05:29PM (#29144182)
At my previous job, a particular database was designed using ascii strings fields for a particular field rather than unicode. If you then query with a string in unicode format, the database decided that the comparison should be done in unicode. The only way was to table scan and convert all ascii fields to unicode on the fly. It was found only in production.

Given that you mention China in your story, did GB 18030 have anything to do with your problems?

https://en.wikipedia.org/wiki/GB_18030

Re:A terrible schema from a clueless programmer by AdrianB1 on Sunday November 07, 2021 @09:10PM (#29145537)
That sounds like newbie developers wrote that and no DBAs were involved in checking the code, not a database design problem, you are throwing blame without knowing enough about the matter. If your string fit in a varchar, it makes absolutely no sense to change it to nvarchar because your query has unicode as input.
Re:A terrible schema from a clueless programmer by eyelidlessness on Sunday November 07, 2021 @11:24PM (#29146116)
I reread the parent quote several times and cannot detect a hint of throwing blame at all.
Re:A terrible schema from a clueless programmer by superjan on Monday November 08, 2021 @01:53AM (#29146659)
Most, but not all of the team were young, and the DB schema was designed by themselves. I did not intend to throw blame. It is more the kind of situation where a sensible decision (at first glance) creates a footgun down the road.
Re:A terrible schema from a clueless programmer by xupybd on Sunday November 07, 2021 @11:29PM (#29146137)
What? The database made the call to compare the strings as Unicode. Are you accusing the DB developers of not doing their job?
Re:A terrible schema from a clueless programmer by AdrianB1 on Monday November 08, 2021 @08:27AM (#29149004)
Yes, databases don't decide, developers do.