varchar lengths

Поиск
Список
Период
Сортировка
От Marcus Engene
Тема varchar lengths
Дата
Msg-id 4C987DA3.9050405@engene.se
обсуждение исходный текст
Ответы Re: varchar lengths  (Richard Huxton <dev@archonet.com>)
Re: varchar lengths  ("Massa, Harald Armin" <chef@ghum.de>)
Список pgsql-general
Hi list,

In Oracle I can...
create table a
(
  b varchar2(10 chars)
);
...and then, regardless of character encoding and how much space an
ascii character vs a ö takes, 10 characters will fit there.

If I do say a web-thing in php I have to do horrors like...
if (10 < mb_strlen ($b, '8bit'))
{
     // fail to explain to the user why it's too long
}

I could be liberal with the length and instead do a...
create table a
(
  b varchar(40)
);
...but I like constraints and this isn't a mysql list so I don't have to
motivate that.

Is there anything I've misunderstood? How does the rest of you deal with
this situation?

Thanks,
Marcus

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

Предыдущее
От: A B
Дата:
Сообщение: What is the effect of locale on numbers?
Следующее
От: Richard Huxton
Дата:
Сообщение: Re: varchar lengths