Re: Checking for string data that makes sense Re: [GENERAL] postgresql vs mysql

2007-02-22 Thread Shashank Tripathi
I would do a CHECK (trim(a) <> '') TRIM() would add some processing time, so I'd include it only if there was a chance of spaces getting added. From a puritanical point of view, it is definitely a good idea. To the original poster, this syntax should work in MySQL as well: create table myt

Re: Checking for string data that makes sense Re: [GENERAL] postgresql vs mysql

2007-02-22 Thread Shashank Tripathi
On 22/02/07, Shashank Tripathi <[EMAIL PROTECTED]> wrote: > I would do a CHECK (trim(a) <> '') TRIM() would add some processing time, so I'd include it only if there was a chance of spaces getting added. From a puritanical point of view, it is definitely a good idea. To the original poster, t

Re: Checking for string data that makes sense Re: [GENERAL] postgresql vs mysql

2007-02-22 Thread brian
Zoltan Boszormenyi wrote: I would do a CHECK (trim(a) <> '') If you were ok with a string consisting soley of whitespace. I meant NOT NULL CHECK(trim(a) <> ''), keeping the context of the above example. Right. I plead that it was late when i replied. I honestly don't know what i was thi

Re: Checking for string data that makes sense Re: [GENERAL] postgresql vs mysql

2007-02-22 Thread CaT
On Thu, Feb 22, 2007 at 11:27:18AM +0100, Zoltan Boszormenyi wrote: > >>I would do a CHECK (trim(a) <> '') > > > >Whitespaces are values too, you know. > > Yes, I know. But e.g. for a real people name, would you store > accidentally entered spaces before or after the actual name, too? > Which woul

Re: Checking for string data that makes sense Re: [GENERAL] postgresql vs mysql

2007-02-22 Thread Zoltan Boszormenyi
CaT írta: On Thu, Feb 22, 2007 at 09:13:13AM +0100, Zoltan Boszormenyi wrote: Chris ?rta: CaT wrote: On Thu, Feb 22, 2007 at 01:08:04PM +1100, Chris wrote: create table a(a text not null check (char_length(a) > 0)); What's wrrong with using a <> ''

Re: Checking for string data that makes sense Re: [GENERAL] postgresql vs mysql

2007-02-22 Thread CaT
On Thu, Feb 22, 2007 at 09:13:13AM +0100, Zoltan Boszormenyi wrote: > Chris ?rta: > >CaT wrote: > >>On Thu, Feb 22, 2007 at 01:08:04PM +1100, Chris wrote: > >>>create table a(a text not null check (char_length(a) > 0)); > >> > >>What's wrrong with using > >> > >>a <> '' > > > >Nothing, I just thoug

Re: Checking for string data that makes sense Re: [GENERAL] postgresql vs mysql

2007-02-22 Thread brian
Zoltan Boszormenyi wrote: 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 thin

Checking for string data that makes sense Re: [GENERAL] postgresql vs mysql

2007-02-22 Thread Zoltan Boszormenyi
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