Re: String manipulation

From: Bruno Wolff III <bruno(at)wolff(dot)to>
To: pativo <pativo(at)arcor(dot)de>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: String manipulation
Date: 2004-02-17 19:32:46
Message-ID: 20040217193246.GB28099@wolff.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, Feb 17, 2004 at 03:46:53 -0800,
pativo <pativo(at)arcor(dot)de> wrote:
> Hello to all,
>
> I have small problem. I have some database fields (VARCHAR)
> and these field should hold some ahex coded values. So the
> string length must be even and each character can only be
> 0-9, a-f or A-F.

You can use a constraint that checks the value versus a regular
expression. Something like: ~ '^([0-9a-fA-F][0-9a-fA-F])+$^'
Unless the 150 character limit is a real business rule, you probably
want to use TEXT instead of VARCHAR(150).

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Pascal Polleunus 2004-02-17 19:55:54 Re: String manipulation
Previous Message Bruno Wolff III 2004-02-17 19:29:44 Re: how to merge a table from another DB