Re: [SQL] FW: indexing functions

From: "Gene Selkov Jr(dot)" <selkovjr(at)mcs(dot)anl(dot)gov>
To: Bas Peters <bpeters(at)idc(dot)nl>, pgsql-general(at)postgreSQL(dot)org
Subject: Re: [SQL] FW: indexing functions
Date: 1999-03-02 18:36:50
Message-ID: 199903021934.NAA24471@mail.xnet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> > Is it possible to manipulate the way an index is created by using
> > functions?

Yes, it is possible:

\h create index
Command: create index
Description: construct an index
Syntax:
CREATE [UNIQUE] INDEX indexname ON class_name [USING access_method]
( attr1 [type_class1], ...attrN | funcname(attr1, ...) [type_class] );
^^^^^^^^^^^^^^^^^^^^

You are responsible for providing the function in any acceptable form
(the only one I am familiar with is a c-coded shared object)

> > I would like to store SGML data in text fields that include
> > a lot of entities (like &uuml;). To enable the user to search the
> > &uuml; character as u I would like to index those entities as the
> > character without the diacritical marks. Is this possible?

Not without the transformation you apply before indexing. It could be
a user-defined function called from the CREATE INDEX instruction
above, or any filter applied externally before the data are loaded to
postgres.

If the data you are talking about are just words with character
entities, it would be a reasonable investment to write a user-defined
function. If the goal is to be able to run queries related to the
structure of the SGML documents, these will have to be split into a
number of tables representing their structure (assuming all records
adhere to the same model), and at this point, character filters can
also be applied. The records themselves will have to be stored as
blobs in a postgres database or as individual files outside.

--Gene

Browse pgsql-general by date

  From Date Subject
Next Message Gene Selkov Jr. 1999-03-02 19:00:21 Re: [GENERAL] NEWBIE: How do I use \copy to populate from a flat file
Previous Message Paulo da Silva 1999-03-02 18:35:22 A security problem (newbie)