Thread: Problem with sql function LOWER

Problem with sql function LOWER

From
"Th Templ"
Date:
Hello,

I try to make this sql request but it returns nothing...

Tables personne
Nom       | Prenom
----------|------------
Test      | Test1

SELECT Nom,Prenom from personne where LOWER(personne.personne_nom)='test';

(0 row)

Is this syntax not correct?
Thanks for your help.
Templth

_________________________________________________________________
Join the world�s largest e-mail service with MSN Hotmail.
http://www.hotmail.com




Re: Problem with sql function LOWER

From
Steve Brett
Date:
SELECT Nom,Prenom from personne where
 LOWER(Nom)='test';

Steve

> -----Original Message-----
> From: Th Templ [mailto:templ_th@hotmail.com]
> Sent: 03 July 2002 14:50
> To: pgsql-jdbc@postgresql.org
> Subject: [JDBC] Problem with sql function LOWER
>
>
> Hello,
>
> I try to make this sql request but it returns nothing...
>
> Tables personne
> Nom       | Prenom
> ----------|------------
> Test      | Test1
>
> SELECT Nom,Prenom from personne where
> LOWER(personne.personne_nom)='test';
>
> (0 row)
>
> Is this syntax not correct?
> Thanks for your help.
> Templth
>
> _________________________________________________________________
> Join the world's largest e-mail service with MSN Hotmail.
> http://www.hotmail.com
>
>
>
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
>     (send "unregister YourEmailAddressHere" to
> majordomo@postgresql.org)
>
>



Re: Problem with sql function LOWER

From
"Th Templ"
Date:
I make a mistake in my mail...

SELECT Nom,Prenom from personne where
LOWER(Nom)='test';

This request returns no row.
Templth

>From: Steve Brett <SBrett@e-mis.com>
>To: Th Templ <templ_th@hotmail.com>, pgsql-jdbc@postgresql.org
>Subject: RE: [JDBC] Problem with sql function LOWER
>Date: Wed, 3 Jul 2002 15:12:52 +0100
>
>SELECT Nom,Prenom from personne where
>  LOWER(Nom)='test';
>
>Steve
>
> > -----Original Message-----
> > From: Th Templ [mailto:templ_th@hotmail.com]
> > Sent: 03 July 2002 14:50
> > To: pgsql-jdbc@postgresql.org
> > Subject: [JDBC] Problem with sql function LOWER
> >
> >
> > Hello,
> >
> > I try to make this sql request but it returns nothing...
> >
> > Tables personne
> > Nom       | Prenom
> > ----------|------------
> > Test      | Test1
> >
> > SELECT Nom,Prenom from personne where
> > LOWER(personne.personne_nom)='test';
> >
> > (0 row)
> >
> > Is this syntax not correct?
> > Thanks for your help.
> > Templth
> >
> > _________________________________________________________________
> > Join the world's largest e-mail service with MSN Hotmail.
> > http://www.hotmail.com
> >
> >
> >
> >
> > ---------------------------(end of
> > broadcast)---------------------------
> > TIP 2: you can get off all lists at once with the unregister command
> >     (send "unregister YourEmailAddressHere" to
> > majordomo@postgresql.org)
> >
> >




_________________________________________________________________
Send and receive Hotmail on your mobile device: http://mobile.msn.com




Re: Problem with sql function LOWER

From
Steve Brett
Date:
seems to work fine on my machine ...

test=# create table personne(Nom text,Prenom text);
CREATE
test=# insert into personne values('Test','Test1');
INSERT 11276949 1
test=# SELECT Nom,Prenom from personne where LOWER(Nom)='test';

 nom  | prenom
------+--------
 Test | Test1
(1 row)

test=# select version();
                           version
-------------------------------------------------------------
 PostgreSQL 7.2 on i686-pc-linux-gnu, compiled by GCC 2.95.2
(1 row)

test=#

Steve

> -----Original Message-----
> From: Th Templ [mailto:templ_th@hotmail.com]
> Sent: 03 July 2002 15:19
> To: SBrett@e-mis.com
> Cc: pgsql-jdbc@postgresql.org
> Subject: RE: [JDBC] Problem with sql function LOWER
>
>
> I make a mistake in my mail...
>
> SELECT Nom,Prenom from personne where
> LOWER(Nom)='test';
>
> This request returns no row.
> Templth
>
> >From: Steve Brett <SBrett@e-mis.com>
> >To: Th Templ <templ_th@hotmail.com>, pgsql-jdbc@postgresql.org
> >Subject: RE: [JDBC] Problem with sql function LOWER
> >Date: Wed, 3 Jul 2002 15:12:52 +0100
> >
> >SELECT Nom,Prenom from personne where
> >  LOWER(Nom)='test';
> >
> >Steve
> >
> > > -----Original Message-----
> > > From: Th Templ [mailto:templ_th@hotmail.com]
> > > Sent: 03 July 2002 14:50
> > > To: pgsql-jdbc@postgresql.org
> > > Subject: [JDBC] Problem with sql function LOWER
> > >
> > >
> > > Hello,
> > >
> > > I try to make this sql request but it returns nothing...
> > >
> > > Tables personne
> > > Nom       | Prenom
> > > ----------|------------
> > > Test      | Test1
> > >
> > > SELECT Nom,Prenom from personne where
> > > LOWER(personne.personne_nom)='test';
> > >
> > > (0 row)
> > >
> > > Is this syntax not correct?
> > > Thanks for your help.
> > > Templth
> > >
> > > _________________________________________________________________
> > > Join the world's largest e-mail service with MSN Hotmail.
> > > http://www.hotmail.com
> > >
> > >
> > >
> > >
> > > ---------------------------(end of
> > > broadcast)---------------------------
> > > TIP 2: you can get off all lists at once with the
> unregister command
> > >     (send "unregister YourEmailAddressHere" to
> > > majordomo@postgresql.org)
> > >
> > >
>
>
>
>
> _________________________________________________________________
> Send and receive Hotmail on your mobile device: http://mobile.msn.com
>



Re: Problem with sql function LOWER

From
Jean-Luc Lachance
Date:
Is Nom of type varchar or char?....

If char:
SELECT Nom,Prenom from personne where trim(lower(Nom))='test';



Th Templ wrote:
>
> I make a mistake in my mail...
>
> SELECT Nom,Prenom from personne where
> LOWER(Nom)='test';
>
> This request returns no row.
> Templth
>
> >From: Steve Brett <SBrett@e-mis.com>
> >To: Th Templ <templ_th@hotmail.com>, pgsql-jdbc@postgresql.org
> >Subject: RE: [JDBC] Problem with sql function LOWER
> >Date: Wed, 3 Jul 2002 15:12:52 +0100
> >
> >SELECT Nom,Prenom from personne where
> >  LOWER(Nom)='test';
> >
> >Steve
> >
> > > -----Original Message-----
> > > From: Th Templ [mailto:templ_th@hotmail.com]
> > > Sent: 03 July 2002 14:50
> > > To: pgsql-jdbc@postgresql.org
> > > Subject: [JDBC] Problem with sql function LOWER
> > >
> > >
> > > Hello,
> > >
> > > I try to make this sql request but it returns nothing...
> > >
> > > Tables personne
> > > Nom       | Prenom
> > > ----------|------------
> > > Test      | Test1
> > >
> > > SELECT Nom,Prenom from personne where
> > > LOWER(personne.personne_nom)='test';
> > >
> > > (0 row)
> > >
> > > Is this syntax not correct?
> > > Thanks for your help.
> > > Templth
> > >
> > > _________________________________________________________________
> > > Join the world's largest e-mail service with MSN Hotmail.
> > > http://www.hotmail.com
> > >
> > >
> > >
> > >
> > > ---------------------------(end of
> > > broadcast)---------------------------
> > > TIP 2: you can get off all lists at once with the unregister command
> > >     (send "unregister YourEmailAddressHere" to
> > > majordomo@postgresql.org)
> > >
> > >
>
> _________________________________________________________________
> Send and receive Hotmail on your mobile device: http://mobile.msn.com
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org



Re: Problem with sql function LOWER

From
Tom Lane
Date:
"Th Templ" <templ_th@hotmail.com> writes:
> SELECT Nom,Prenom from personne where
> LOWER(Nom)='test';

I'm guessing that Nom is of type char(N) and therefore has padding
spaces in it.  You should use varchar or text instead of char to
avoid this sort of difficulty.

            regards, tom lane



Re: Problem with sql function LOWER

From
"Th Templ"
Date:
That's the problem! I try it the sql statement with a varchar field and it
works good.
Templth

>I'm guessing that Nom is of type char(N) and therefore has padding
>spaces in it.  You should use varchar or text instead of char to
>avoid this sort of difficulty.
>
>            regards, tom lane

_________________________________________________________________
Join the world�s largest e-mail service with MSN Hotmail.
http://www.hotmail.com