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

Поиск
Список
Период
Сортировка
От Shashank Tripathi
Тема Re: Checking for string data that makes sense Re: postgresql vs mysql
Дата
Msg-id 7cab9c1b0702220027j7d8360b9g8e2ac9aa09745bc0@mail.gmail.com
обсуждение исходный текст
Ответ на Checking for string data that makes sense Re: postgresql vs mysql  (Zoltan Boszormenyi <zboszor@dunaweb.hu>)
Ответы Re: Checking for string data that makes sense Re: postgresql vs mysql  ("Shashank Tripathi" <shanx@shanx.com>)
Список pgsql-general
>  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 mytable (mycol text not null check (mycol <> ''));

Problem is, if you created your table before MySQL 5, and now simply
want to ALTER your table (which is what I gather you wish to do, as
you already have the table) then adding the CHECK condition may not
work.

I cannot help in this case, and from the turn this thread has taken,
not many others I suppose. Why not try a MySQL experts list instead of
PostgreSQL, but be prepared to have to recreate the table in MySQL 5
with the CHECK constraint, and then importing your data in to it.

Good luck!

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

Предыдущее
От: "Robert Haas"
Дата:
Сообщение: Re: complex referential integrity constraints
Следующее
От: "Shashank Tripathi"
Дата:
Сообщение: Re: Checking for string data that makes sense Re: postgresql vs mysql