Re: Case-sensitive problem

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема Re: Case-sensitive problem
Дата
Msg-id Pine.LNX.4.44.0207021308330.1986-100000@cm-lcon-46-187.cm.vtr.net
обсуждение исходный текст
Ответ на Re: Case-sensitive problem  (linux_211@hotmail.com (igor))
Список pgsql-general
igor dijo:

> So ,exactly what I am doing is to migrate all database (MS SQL) to the
> PostgreSQL server also with the dates. But I am still receiving one
> strange problem: When some datatype is defined in MS SQL for example
> like username char(15) and the data there is for example:'peter',then
> what I receive in PostgreSQL is 'peter          ' so exactly 15
> characters. When I make SELECT *  FROM users where username='peter' I
> am not receiving no-one row ,but when I type SELECT * FROM users where
> username='peter         ' then I receive whole row.

Well, as you know already, the correct datatype for the username should
be varchar.  And after that you have to correct the values in the
columns, trimming the spaces at the end: 'peter         ' is the same in
varchar() and in char(); it's 'peter' that's different, because char()
appends spaces at insertion time.

I think you can correct them with
UPDATE users SET username=trim(username)

--
Alvaro Herrera (<alvherre[a]atentus.com>)
"Y eso te lo doy firmado con mis lagrimas" (Fiebre del loco)




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

Предыдущее
От: frbn
Дата:
Сообщение: Re: Does postgreSQL have distributed database management
Следующее
От: Oleg Bartunov
Дата:
Сообщение: Re: namespaces and schemas