enforcing alphabetic/numeric content in "char" column

From: Joel Rodrigues <borgempath(at)Phreaker(dot)net>
To: pgsql-novice(at)postgresql(dot)org
Subject: enforcing alphabetic/numeric content in "char" column
Date: 2002-11-07 14:07:23
Message-ID: 3C8D48DD-F25A-11D6-A698-0005024EF27F@Phreaker.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Hello,

The task is to allow data entries like "007", leading zeros
included. I tried various numeric data types and they all trim
it down to "7". Using char(3) works, but I want to put a CHECK
on it to ensure no non-numeric data is entered. The following,
and numerous variations on it, do not work:

iso3dnum char(3) CHECK (iso3dnum ~ '[0-9]')

Any suggestions ?

Cheers,
Joel

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Bruno Wolff III 2002-11-07 14:33:55 Re: Speed Performance Question
Previous Message Schneider, Nina 2002-11-07 13:55:18 postgres for skyrix