From: David Johnston <polobo@yahoo.com>
To: Carlos Mennens <carlos.mennens@gmail.com>
Cc: PostgreSQL \(SQL\) <pgsql-sql@postgresql.org>
Subject: Re: Unable To Alter Data Type
Date: Wed, 11 Jan 2012 20:21:25 -0500
Message-ID: <26EC0BB6-61A9-4DBE-BEB0-7043F44A5A9D@yahoo.com> (raw)
In-Reply-To: <CAAQLLO5uyH7tp_GMxbGe0OxmqL_hJXOOJVnmT_HgPENKZLvGDQ@mail.gmail.com>
References: <CAAQLLO5aXWj=Ss+9rKyohWcnb3Fnm2k_pAQu_pDfL=76VrbHzQ@mail.gmail.com>
<00be01ccd0bf$1340da50$39c28ef0$@yahoo.com>
<CAAQLLO5uyH7tp_GMxbGe0OxmqL_hJXOOJVnmT_HgPENKZLvGDQ@mail.gmail.com>
On Jan 11, 2012, at 19:30, Carlos Mennens <carlos.mennens@gmail.com> wrote:
> On Wed, Jan 11, 2012 at 7:13 PM, David Johnston <polobo@yahoo.com> wrote:
>> However, I will say again, you DO NOT WANT TO ACTUALLY DO THIS!
>>
>> The specific issue is that some US Postal Code begin with a zero ( 0 ) and
>> so whenever you want to the zip_code value you need to pad leading zeros if
>> the length is less than 5. Now consider that a full zip_code can be in 5+4
>> format with an embedded hyphen and you no longer can even store it as
>> numeric. If you deal with Canada (and maybe Mexico) at all then spaces and
>> letters become acceptable characters within the zip_code.
>
> David - Thank you for that great info / explanation. Very informative
> and helpful. I was not required to make this change but rather just
> goofing off attempting to learn SQL as I'm rather terrible at it. Can
> you tell me if there's an organized cheat sheet or something
> documented in regards to data types commonly used for commonly used
> field association? I think that's great for people who can't look at
> the documentation and clearly understand specific definitions or
> assumed categorization based on the type definition.
If you can perform reasonable arithmetic on the field value you encode it as a number otherwise you should use text; even if the only possibly valid values are numbers.
David J.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: polobo@yahoo.com, carlos.mennens@gmail.com
Subject: Re: Unable To Alter Data Type
In-Reply-To: <26EC0BB6-61A9-4DBE-BEB0-7043F44A5A9D@yahoo.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox