Subject Re: [firebird-support] Creating indexes on array columns
Author Helen Borrie
At 02:53 PM 15/10/2004 +1100, you wrote:

>I have a three component array, all numerics, and I can't create an index on
>any of them.
>
>Here's what I'm doing...(Indexes are at the bottom)
>
>/* Create a structure for storing a 3D point in space
>0-355 degrees, with 1 places of precision(for testing), all integer based
>for sp
>eed
>The dimensions shall be x,y,z
>*/
>CREATE DOMAIN point AS NUMERIC(3,1) [3];
>
>select 'Domain created OK' from rdb$database;
>
>/* Create a table for storing polygons */
>CREATE TABLE poly (
> int_poly NUMERIC(18,0) NOT NULL, /* The Poly ID */
> pnt_from POINT NOT NULL,
> pnt_to POINT NOT NULL,
> int_order INTEGER,
> PRIMARY KEY(int_poly)
>);
>select 'Poly table created ok' from rdb$database;
>CREATE GENERATOR gen_poly;
>select 'Poly table generator created ok' from rdb$database;
>
>/* Create a multi-dimensional index for the points */
>CREATE ASC INDEX POLY_FROM ON poly pnt_from[1],pnt_from[2],pnt_from[3];
>CREATE ASC INDEX POLY_FROM ON poly (pnt_from[1],pnt_from[2],pnt_from[3]);
>CREATE ASC INDEX POLY_FROM ON poly (pnt_to);
>CREATE ASC INDEX POLY_FROM ON poly (pnt_to [3]);
>select 'Poly table indexes created ok' from rdb$database;
>
>None of the index create lines work...any ideas?
>Also, creating a UNIQUE (pnt_from, pnt_to) in the table also dies...

Yup. An array type is just a specialised blob, can't index it, can't put
constraints on it.

As for ideas - I can't off-hand think of what characteristic of an array
would lend it to indexing. An array supposedly stores a finite series of
congruent values. If there's an attribute of the series that requires it
to be constrained in any other way, then the obvious relational solution is
to make a table for these series...

./heLen