Re: [SQL] upper() and lower() on varchar

From: Maarten Boekhold <maartenb(at)dutepp2(dot)et(dot)tudelft(dot)nl>
To: Sferacarta Software <sferac(at)bo(dot)nettuno(dot)it>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: [SQL] upper() and lower() on varchar
Date: 1998-09-02 13:40:44
Message-ID: Pine.SUN.3.91.980902153759.8707C-100000@dutepp2.et.tudelft.nl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Wed, 2 Sep 1998, Sferacarta Software wrote:

> marted, 1 settembre 98, you wrote:
>
> MB> Hi,
>
> MB> Is there a way to get upper() and lower() to work on a varchar column? It
> MB> seems like these functions are only defined on the text datatype (in 6.3.2).
>
> MB> I guess what I need in this case is some way to convert varchar to text.
> MB> Will (text_in(varchar_out(column)) work?
>
>
> It works for me (6.3.2)
> take a look:
>
> create table a(a varchar(10));
> insert into a values ('AAA');
> insert into a values ('aaa');
>
> select * from tbl;
> fld
> ---
> aaa
> AAA
> (2 rows)
>
> select * from tbl where upper(fld)='AAA';
> fld
> ---
> aaa
> AAA
> (2 rows)

I tried some stuff, and

select lower(aroms) from product where aroms='VAUGHAN STEVIE RAY'

works, but:

select * from product where lower(aroms)='vaughan stevie ray';
FATAL 1: palloc failure: memory exhausted

And:

rockhouse=> create index product_lower on product (lower(aroms));
ERROR: DefineIndex: (null) class not found

Anybody knows if I'm doing something wrong here? This is a 6.3.2 system
with all patches from ftp.postgresql.org applied, plus the patch for
enabling functional indices.

Maarten

_____________________________________________________________________________
| TU Delft, The Netherlands, Faculty of Information Technology and Systems |
| Department of Electrical Engineering |
| Computer Architecture and Digital Technique section |
| M(dot)Boekhold(at)et(dot)tudelft(dot)nl |
-----------------------------------------------------------------------------

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Ronnie Doggart 1998-09-02 16:48:23 Help with setting up table and importing data.
Previous Message Sferacarta Software 1998-09-02 12:33:28 Re: [SQL] upper() and lower() on varchar