From: | David Fetter <david(at)fetter(dot)org> |
---|---|
To: | Robert Treat <xzilla(at)users(dot)sourceforge(dot)net> |
Cc: | Alvaro Herrera <alvherre(at)dcc(dot)uchile(dot)cl>, pgsql-patches(at)postgresql(dot)org |
Subject: | Re: Problem with Create Domain example |
Date: | 2005-05-01 02:45:29 |
Message-ID: | 20050501024528.GA29151@fetter.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-patches |
On Sat, Apr 30, 2005 at 10:08:32PM -0400, Robert Treat wrote:
> On Saturday 30 April 2005 21:14, Alvaro Herrera wrote:
> > On Sat, Apr 30, 2005 at 06:12:27PM -0400, Robert Treat wrote:
> > > --- 167,174 ----
> > > <programlisting>
> > > CREATE DOMAIN us_postal_code AS TEXT
> > > CHECK(
> > > ! VALUE ~ '^\\d{5}$'
> > > ! OR VALUE ~ '^\\d{5}-\\d{4}$'
> > > );
> >
> > Huh, why not
> >
> > VALUE ~ '^\\d{5}(-\\d{4})?$'
> >
> > ?
>
> Not sure what your driving at here... my point is that the \
> escaping is incorrect in the current examples.
>
> If you want to argue that we could make the check constraint simpler
> (or is that more advanced) that seems like another issue. IMHO
> having the OR'd checks is better because it shows that you can
> "stack" constraints inside a domain if you want.
That was pretty much my thought. It's extremely easy to turn regexes
into unmaintainable garbage, whereas the original code is maintainable :)
Cheers,
D
--
David Fetter david(at)fetter(dot)org http://fetter.org/
phone: +1 510 893 6100 mobile: +1 415 235 3778
Remember to vote!
From | Date | Subject | |
---|---|---|---|
Next Message | Alvaro Herrera | 2005-05-01 03:14:12 | Re: Problem with Create Domain example |
Previous Message | Robert Treat | 2005-05-01 02:08:32 | Re: Problem with Create Domain example |