Обсуждение: upper() and lower() on varchar

Поиск
Список
Период
Сортировка

upper() and lower() on varchar

От
Maarten Boekhold
Дата:
Hi,

Is there a way to get upper() and lower() to work on a varchar column? It
seems like these functions are only defined on the text datatype (in 6.3.2).

I guess what I need in this case is some way to convert varchar to text.
Will (text_in(varchar_out(column)) work?

Maarten

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


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

От
Sferacarta Software
Дата:
Hello Maarten,

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?

MB> Maarten

MB> _____________________________________________________________________________
MB> | TU Delft, The Netherlands, Faculty of Information Technology and Systems  |
MB> |                   Department of Electrical Engineering                    |
MB> |           Computer Architecture and Digital Technique section             |
MB> |                          M.Boekhold@et.tudelft.nl                         |
MB> -----------------------------------------------------------------------------

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)


Best regards,
   Jose'                            mailto:sferac@bo.nettuno.it



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

От
Maarten Boekhold
Дата:
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.Boekhold@et.tudelft.nl                         |
-----------------------------------------------------------------------------