On Tue, 5 Aug 2003, Nick May wrote:
> ... that is the number I want to plonk, for aesthetic reasons if no
> other, into my database spec... call it whimsy if you will.... Of
> course I can always plonk in big, bad old "255" - but I learned to code
> on machines where 255 bytes was 1/4 of all memory and it just doesn't
> seem RIGHT to be so slovenly, even though it matters not a jot....
There is nothing slovenly about this. You are not specifying how much
space is used, you are specifying a limit beyond which you may not use
more space.
> Even
> though it saves no memory it is still a good habit of mind to allocate
> no more resources than you need...
You are allocating the same amount of resources whether you specify
varchar(255) or varchar(1).
Unless, of course, you consider programmer time, where if you specify a
field with too small a limit and later have to fix it, it costs you a
lot of time and money.
Think about the Y2K problem, and all the "savings" achieved by using
two-character year fields rather than four.
> Am I alone in just occasionally sanity checking for length as well as
> other aspects of the validity of data?
I sanity-check for length, too. But as far as length goes, I consider
only e-mail addresses longer than a kilobyte to be definitively insane.
cjs
--
Curt Sampson <cjs_at_cynic.net> +81 90 7737 2974 http://www.NetBSD.org
Don't you know, in this new Dark Age, we're all light. --XTC
Received on Tue Aug 5 09:05:00 2003