Checking for string data that makes sense Re: postgresql vs mysql - Mailing list pgsql-general

From Zoltan Boszormenyi
Subject Checking for string data that makes sense Re: postgresql vs mysql
Date
Msg-id 45DD5099.5030201@dunaweb.hu
Whole thread Raw
In response to Re: postgresql vs mysql  (Chris <dmagick@gmail.com>)
Responses Re: Checking for string data that makes sense Re: postgresql vs mysql  (brian <brian@zijn-digital.com>)
Re: Checking for string data that makes sense Re: postgresql vs mysql  (CaT <cat@zip.com.au>)
Re: Checking for string data that makes sense Re: postgresql vs mysql  ("Shashank Tripathi" <shanx@shanx.com>)
List pgsql-general
Chris írta:
> CaT wrote:
>> On Thu, Feb 22, 2007 at 01:08:04PM +1100, Chris wrote:
>>> In postgres, to stop an empty blank string:
>>>
>>> create table a(a text not null check (char_length(a) > 0));
>>
>> What's wrrong with using
>>
>> a <> ''
>>
>> sd the check? Or is this just a flavour thing?
>
> Nothing, I just thought of the other way first :)
>
> Probably better doing it as a <> '' otherwise postgres might have to
> run the char_length function every time you do an insert (ie might be
> a very slight performance issue).
>

I would do a CHECK (trim(a) <> '')


pgsql-general by date:

Previous
From: Matteo Beccati
Date:
Subject: Re: Odd behaviour of timestamptz
Next
From: brian
Date:
Subject: Re: Checking for string data that makes sense Re: postgresql vs mysql