Re: Re: Lock up on 7.0.2 involving CREATE FUNCTION/INDEX..

From: Philip Hallstrom <philip(at)adhesivemedia(dot)com>
To: Mike Mascari <mascarm(at)mascari(dot)com>
Cc: pgsql-general(at)postgresql(dot)org, Lamar Owen <lamar(dot)owen(at)wgcr(dot)org>
Subject: Re: Re: Lock up on 7.0.2 involving CREATE FUNCTION/INDEX..
Date: 2000-08-10 03:08:10
Message-ID: Pine.BSF.4.21.0008092004170.80432-100000@illiad.adhesivemedia.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I know... using your example below, try the following:

CREATE INDEX test_idx ON test (UPPER(field));

On my system I get the following errors:

devloki=> create index foo on rolo_entry (UPPER(fname));
ERROR: DefineIndex: function 'upper(varchar)' does not exist
devloki=> create index foo on rolo_entry (UPPER(varchar(fname)));
ERROR: parser: parse error at or near "varchar"
devloki=> create index foo on rolo_entry (UPPER(text(fname)));
ERROR: parser: parse error at or near "("
devloki=> create index foo on rolo_entry (UPPER(text fname));
ERROR: parser: parse error at or near "fname"
devloki=> create index foo on rolo_entry (UPPER(fname::text));
ERROR: parser: parse error at or near "::"
devloki=> create index foo on rolo_entry (UPPER(CAST(fname AS TEXT)));
ERROR: parser: parse error at or near "cast"

So, by creating a function such as UPPER(varchar) instead of the built-in
UPPER(text), I can do what I want.

What's odd, is that I can create the function UPPER(varchar) which then
calls UPPER(text) and use it all I want. However, if I then try to create
an index (like my first example above) it locks up the entire machine.

I just realized this after someone mentioned there was probably a
recursive loop, but wouldn't that affect simple select statements as well?

Oh well... I've renamed my function with a prefix which I'll probably just
do all the time as it makes it easy to know what's mine and what's not.

-philip

On Wed, 9 Aug 2000, Mike Mascari wrote:

> Philip Hallstrom wrote:
> >
> > Is there another function that will uppercase? Or is there some way to
> > call the other UPPER function? Or something within plpgsql I don't know
> > about.
> > Thanks!
> > -philip
>
> I don't understand this. UPPER() is a built-in function:
>
> stocks=# create table test (field varchar(16));
> CREATE
> stocks=# insert into test values ('hello');
> INSERT 1788137 1
> stocks=# select upper(field) from test;
> upper
> -------
> HELLO
> (1 row)
>
> The oid for upper is 871. Do you not have this in your pg_proc?
>
> --
>
> Cheers,
>
> Mike Mascari
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Lamar Owen 2000-08-10 03:26:00 Re: Re: Lock up on 7.0.2 involving CREATE FUNCTION/INDEX..
Previous Message Prasanth A. Kumar 2000-08-10 02:46:30 Re: Re: Lock up on 7.0.2 involving CREATE FUNCTION/INDEX..