Hi,

I am trying to access index structures outside PostgreSQL becuase I am
working with a home grown
query processor.
My stand-alone program will access index structures stored in PostgreSQL
database by using registered
user-defined functions to PostgreSQL server.
As the first step, I wrote a user-defined function for open a specified
index relation as follows:

Relation        open_gist(char *index_name)
{
        /* .../src/backend/access/index/indexam.c */
        return index_openr(index_name);
}

And register the function as follows:

CREATE FUNCTION open_gist(opaque)
   RETURNS opaque
   AS
'/usr/local/postgresql-7.1.3/src/backend/access/gist_ops/lib_gist.so.1.0'
   LANGUAGE 'c';

Up to here, there has been no problem.
But, when I tried to open an index by using select statement, I got an error
message as follows:

test=# select open_gist("b3dix");
ERROR:  Attribute 'b3dix' not found
ERROR:  Attribute 'b3dix' not found

However, there is the index named "b3dix" in my database as follows:

test=# \di
   List of relations
 Name  | Type  | Owner
-------+-------+--------
 b3dix | index | jeongs

Is there any one who knows what problem is?

One more question is about "opaque".
What is the usefulness of the data type in the PostgreSQL context?
And what do I need to specify for "void" return data type when I register a
user-defined function.
For example,

void close_gist(Relation index_relation);

CREATE FUNCTION close_gist(opaque)
   RETURNS ?
   AS
'/usr/local/postgresql-7.1.3/src/backend/access/gist_ops/lib_gist.so.1.0'
   LANGUAGE 'c';

Thank you for reading this question.

Cheers.





Mon, 19 Nov 2001 18:39:49 -0000
"Seung Hyun Jeong" <jeongs@cs.man.ac.uk>
about index_openr() function