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

Поиск
Список
Период
Сортировка
От brian
Тема Re: Checking for string data that makes sense Re: postgresql vs mysql
Дата
Msg-id 45DD5180.4040608@zijn-digital.com
обсуждение исходный текст
Ответ на Checking for string data that makes sense Re: postgresql vs mysql  (Zoltan Boszormenyi <zboszor@dunaweb.hu>)
Список pgsql-general
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 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) <> '')
>
>

If you were ok with a string consisting soley of whitespace.

В списке pgsql-general по дате отправления:

Предыдущее
От: Zoltan Boszormenyi
Дата:
Сообщение: Checking for string data that makes sense Re: postgresql vs mysql
Следующее
От: CaT
Дата:
Сообщение: Re: Checking for string data that makes sense Re: postgresql vs mysql