Hi,

I'm doing a course project extending PostgreSQL
somehow. One part of this is using an index on a
function. I thought it's easy to create an function
index initially. But later found that PostgreSQL only
allow functions taking one or more columns. But the
function I need to create index on takes composite
type. Specifically, a relation R, a user-defined
function f, f takes R (the composite type as its
argument), f returns a float. f is defined in C. I
want to create a function index like this:

create index idx on R (f(R))

But it doesn't pass PostgreSQL's grammar.

Any suggestion?



__________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.
http://search.yahoo.com

Thu, 22 May 2003 22:30:05 -0700 (PDT)
You Lun <youlun2000@yahoo.com>
index on function
You Lun <youlun2000@yahoo.com> writes:
> I want to create a function index like this:
> create index idx on R (f(R))
> But it doesn't pass PostgreSQL's grammar.

Right now you have no alternative but to spell out all the columns of R.

There has been talk of fixing this by replacing functional indexes with
indexes over general expressions, but I dunno how soon it will happen.

			regards, tom lane

Fri, 23 May 2003 09:23:32 -0400
Tom Lane <tgl@sss.pgh.pa.us>
Re: index on function 