about index_openr() function

From: "Seung Hyun Jeong" <jeongs(at)cs(dot)man(dot)ac(dot)uk>
To: <pgsql-hackers(at)postgresql(dot)org>
Subject: about index_openr() function
Date: 2001-11-19 18:39:49
Message-ID: 001701c17129$919a2240$15c65882@cs.man.ac.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 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.

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2001-11-19 18:44:30 Re: postgresql.conf
Previous Message Tom Lane 2001-11-19 18:39:04 Re: OCTET_LENGTH is wrong