Re: [SQL] FW: indexing functions - Mailing list pgsql-general

From Gene Selkov Jr.
Subject Re: [SQL] FW: indexing functions
Date
Msg-id 199903021934.NAA24471@mail.xnet.com
Whole thread Raw
In response to FW: indexing functions  (Bas Peters <bpeters@idc.nl>)
List 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 ü). To enable the user to search the
> > ü 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

pgsql-general by date:

Previous
From: Paulo da Silva
Date:
Subject: A security problem (newbie)
Next
From: "Gene Selkov Jr."
Date:
Subject: Re: [GENERAL] NEWBIE: How do I use \copy to populate from a flat file