Re: enforcing alphabetic/numeric content in "char" column
От | Rod Kreisler |
---|---|
Тема | Re: enforcing alphabetic/numeric content in "char" column |
Дата | |
Msg-id | JNEGKNDJGBKLBDGPOPFOCEDFDEAA.rod@23net.net обсуждение исходный текст |
Ответ на | enforcing alphabetic/numeric content in "char" column (Joel Rodrigues <borgempath@Phreaker.net>) |
Ответы |
Re: enforcing alphabetic/numeric content in "char" column
|
Список | pgsql-novice |
> -----Original Message----- > From: pgsql-novice-owner@postgresql.org > [mailto:pgsql-novice-owner@postgresql.org]On Behalf Of Joel Rodrigues > Sent: Thursday, November 07, 2002 9:07 AM > To: pgsql-novice@postgresql.org > Subject: [NOVICE] enforcing alphabetic/numeric content in "char" column > > > 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 ? > Your regex should be '^[0-9]$' (the one you have will allow any string as long as there is a numeric character in it somewhere).
В списке pgsql-novice по дате отправления: