On Wed, Apr 29, 2015 at 11:40 PM, Arvids Godjuks <arvids.godj...@gmail.com> wrote:
> Stop trying to fix clever idiots from shooting themselves in the foot. The >> standard result from these actions is to make life a pain for regular or >> better programmers while only adding mild speed bumps to those clever >> idiots. >> >> Things like a numeric type will only encourage the clever idiots to write >> half broken code. >> > > Hello, just want to chip in. > > I use "INT UNSIGNED" for the MySQL primary keys since ages, because > negative primary keys make no sense. Well, mostly ID's for the records > actually can stay strings, but I will have to remember to use a string type > hint every time I pass a record ID. I expect a lot of times to forget that > and write int... > I was bitten a few times by the limits of 32 bit integer sizes too (moved > to a 64 bit server that time), but there are also unsigned 64 bit integers > that can and will be used in math operations and passed around. And we > don't have the "unsigned int". > > Okay, we have GMP. I will have to use it. But let me just ask - if I work > with a DB handling 64 bit integers (all I know handle them) or use a > DECIMAL field - automaticly use GMP then? Oh gosh.... > > Arvids. > I think you point out an interesting problem. It sounds like you designed the DB in isolation from the languages that would use it and then discovered after the fact that using the entire space (because it sounds like a good idea in isolation) can make life tough. Using a signed int would have only reduced your space by half. In many cases, it you need that extra space, you need more than twice and the difference between signed and unsigned is not relevant. If the code and DB are matched, then you don't have these problem. I'd suggest we make sure that we fix it in the right location (I don't think a numeric type is the right location). Walter -- The greatest dangers to liberty lurk in insidious encroachment by men of zeal, well-meaning but without understanding. -- Justice Louis D. Brandeis