Re: Case-sensitive problem - Mailing list pgsql-general

From Alvaro Herrera
Subject Re: Case-sensitive problem
Date
Msg-id Pine.LNX.4.44.0207021308330.1986-100000@cm-lcon-46-187.cm.vtr.net
Whole thread Raw
In response to Re: Case-sensitive problem  (linux_211@hotmail.com (igor))
List 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 by date:

Previous
From: frbn
Date:
Subject: Re: Does postgreSQL have distributed database management
Next
From: Oleg Bartunov
Date:
Subject: Re: namespaces and schemas