Re: Case-sensitive problem

From: Alvaro Herrera <alvherre(at)atentus(dot)com>
To: igor <linux_211(at)hotmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Case-sensitive problem
Date: 2002-07-02 17:12:26
Message-ID: Pine.LNX.4.44.0207021308330.1986-100000@cm-lcon-46-187.cm.vtr.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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)

In response to

Browse pgsql-general by date

  From Date Subject
Next Message liping guo 2002-07-02 17:23:07 Does postgreSQL have distributed database management like ORACLE does?
Previous Message Piet DeVries 2002-07-02 16:26:18 Re: Does postgreSQL have distributed database management like ORACLE