about index_openr() function - Mailing list pgsql-hackers

From Seung Hyun Jeong
Subject about index_openr() function
Date
Msg-id 001701c17129$919a2240$15c65882@cs.man.ac.uk
Whole thread Raw
List pgsql-hackers
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 relationsName  | 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.






pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: postgresql.conf
Next
From: Alex Avriette
Date:
Subject: Re: Super Optimizing Postgres