Re: datatype advice numeric vs. varchar

From: Ron Johnson <ron(dot)l(dot)johnson(at)cox(dot)net>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: datatype advice numeric vs. varchar
Date: 2007-01-18 13:14:23
Message-ID: 45AF72AF.7010304@cox.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 01/18/07 00:22, Michael Glaesemann wrote:
>
> On Jan 18, 2007, at 15:15 , Gene wrote:
>
>> My calculations for disk space based off some information i found
>> online are ( 8 + ( 2 bytes for every four digits) ) for numeric and (
>> 4 + number of chars ) for a utf8 varchar datatype. Are these
>> calculations still valid and has anyone tried using numeric for this
>> purpose or is this really stupid?
>
> While telephone numbers typically consist of digits, they're not
> numbers: they're strings of digits. For example, a telephone number in
> Tokyo is (typically) a string of 10 digits, beginning with "03".
> 0311111111 as numeric would have unexpected results when retrieved.
> While you may not be concerned with Japanese phone numbers, I use it as
> an example to show that telephone "numbers" are actually strings.

Not only that, but since the number pad also has "*" & "#", there
/might/ be obscure times when you need to use them.

> In short, use strings (text/varchar).

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFFr3KvS9HxQb37XmcRAtWLAKCAM5hbrZtTmK4aK6N1zv8rVALkGQCg2E0P
KMvry9tlIyCNH9LjiV+8M78=
=wY6z
-----END PGP SIGNATURE-----

In response to

Browse pgsql-general by date

  From Date Subject
Next Message shakahshakah@gmail.com 2007-01-18 13:28:07 Re: datatype advice numeric vs. varchar
Previous Message Bill Moran 2007-01-18 13:07:15 Re: Index bloat of 4x