X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 767E7D1B4E7 for ; Mon, 1 Mar 2004 21:15:35 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 04198-03 for ; Mon, 1 Mar 2004 17:15:31 -0400 (AST) Received: from mail.michaelchaney.com (mail.michaelchaney.com [207.65.84.68]) by svr1.postgresql.org (Postfix) with ESMTP id F409ED1E923 for ; Mon, 1 Mar 2004 17:15:28 -0400 (AST) Received: from pcp08698233pcs.500ash01.tn.comcast.net (fractal.trailer) [69.137.114.17] by mail.michaelchaney.com with esmtp (Exim 4.20 #1 (FreeBSD)) id 1Axud8-00075Z-DY; Mon, 01 Mar 2004 15:07:14 -0600 Received: from mdchaney by fractal.trailer with local (Exim 3.35 #1 (Debian)) id 1AxuiF-0004yR-00 for ; Mon, 01 Mar 2004 15:12:31 -0600 Date: Mon, 1 Mar 2004 15:12:31 -0600 From: Michael Chaney To: pgsql-sql@postgresql.org Subject: Re: User defined types -- Social Security number... Message-ID: <20040301211231.GA19105@michaelchaney.com> References: <200402221132.50311.josh@agliodbs.com> <20040301031716.GB4046@michaelchaney.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.3.28i Organization: Michael Chaney Consulting Corporation X-URL: http://www.michaelchaney.com/ X-MailScanner-Information: Please see http://www.michaelchaney.com/mail/spam.php for more information X-MailScanner: Found to be clean X-MailScanner-SpamCheck: not spam, SpamAssassin (score=0.5, required 5, IN_REP_TO, SOCIAL_SEC_NUMBER, PORN_10) X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200403/9 X-Sequence-Number: 17108 On Sun, Feb 29, 2004 at 11:11:31PM -0500, Christopher Browne wrote: > The world rejoiced as mdchaney@michaelchaney.com (Michael Chaney) wrote: > > Look, you're thinking way too hard on this. An SSN is a 9-digit number, > > nothing more. There are some 9-digit numbers which aren't valid SSN's, > > and you might want to get fancy and create a constraint for that. > > > > Regardless, you are making a *major* mistake of confusing data > > storage with rendering. It is common to *render* an SSN as > > xxx-xx-xxxx and its cousin the FETID (Federal Employers Tax ID) as > > xx-xxxxxxx. To store the dashes makes no sense. They're in the > > same place each time, it's wasted data. > > > > Store the SSN as an "integer". When you begin to think about this > > correctly, the "leading zeros" problem disappears since that is also a > > *rendering* issue. > > Well put. > > The one thing that is a bit unfortunate is that 32 bit ints aren't > quite big enough for this. You need 1 extra digit :-(. For what? The largest SSN is 999,999,999, a signed 32-bit int goes to just over 2,000,000,000. Ever hear of a "4GB limit"? Michael -- Michael Darrin Chaney mdchaney@michaelchaney.com http://www.michaelchaney.com/