GiST index question

Started by Eric Flemingover 11 years ago4 messagesgeneral
Jump to latest
#1Eric Fleming
efleming@gmail.com

I have a table that I have defined as:

CREATE TABLE test (
"id" SERIAL PRIMARY KEY,
"first_path" path NOT NULL,
"second_path" path NOT NULL
);

I am attempting to create a GiST index on the two “path” columns using:

CREATE INDEX  "idx_test_first_path" ON test USING gist(first_path);
CREATE INDEX  "idx_test_second_path" ON test USING gist(second_path);

I am getting this error:

Error : ERROR:  data type path has no default operator class for access method "gist"

Is it that I am not allowed to create an index on the path data type or do I need to enable an extension for this to work? Thanks in advance for your help.

Eric Fleming

#2Michael Paquier
michael@paquier.xyz
In reply to: Eric Fleming (#1)
Re: GiST index question

On Thu, Sep 4, 2014 at 8:35 AM, Eric Fleming <efleming@gmail.com> wrote:

I have a table that I have defined as:

CREATE TABLE test (
"id" SERIAL PRIMARY KEY,
"first_path" path NOT NULL,
"second_path" path NOT NULL
);

I am attempting to create a GiST index on the two "path" columns using:

CREATE INDEX "idx_test_first_path" ON test USING gist(first_path);
CREATE INDEX "idx_test_second_path" ON test USING gist(second_path);

I am getting this error:

Error : ERROR: data type path has no default operator class for access
method "gist"

Is it that I am not allowed to create an index on the path data type or do I
need to enable an extension for this to work? Thanks in advance for your
help.

In-core contrib modules (and core) do not have yet support for gist
operator classes for the datatype path as far as I recall.
Regards,
--
Michael

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

#3Giuseppe Broccolo
giuseppe.broccolo@2ndquadrant.it
In reply to: Michael Paquier (#2)
Re: GiST index question

Hi Eric,

As Michael said, path data type does not support for gist operators.
Anyway, you could redefine data type using 'ltree' instead of 'path'. Take
a look on the following link:

http://www.postgresql.org/docs/9.1/static/ltree.html

Try to understand if this could be fine for you.

Cheers,

Giuseppe.

2014-09-04 6:31 GMT+02:00 Michael Paquier <michael.paquier@gmail.com>:

On Thu, Sep 4, 2014 at 8:35 AM, Eric Fleming <efleming@gmail.com> wrote:

I have a table that I have defined as:

CREATE TABLE test (
"id" SERIAL PRIMARY KEY,
"first_path" path NOT NULL,
"second_path" path NOT NULL
);

I am attempting to create a GiST index on the two "path" columns using:

CREATE INDEX "idx_test_first_path" ON test USING gist(first_path);
CREATE INDEX "idx_test_second_path" ON test USING gist(second_path);

I am getting this error:

Error : ERROR: data type path has no default operator class for access
method "gist"

Is it that I am not allowed to create an index on the path data type or

do I

need to enable an extension for this to work? Thanks in advance for your
help.

In-core contrib modules (and core) do not have yet support for gist
operator classes for the datatype path as far as I recall.
Regards,
--
Michael

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

--
Giuseppe Broccolo - 2ndQuadrant Italy
PostgreSQL Training, Services and Support
giuseppe.broccolo@2ndQuadrant.it | www.2ndQuadrant.it

#4Eric Fleming
efleming@gmail.com
In reply to: Giuseppe Broccolo (#3)
Re: GiST index question

Thank you both, I will look into alternative data types. I don’t think ltree will work for my purposes but I am going to try out some others that might; like cube.

Eric Fleming

On Thu, Sep 4, 2014 at 3:42 AM, Giuseppe Broccolo
<giuseppe.broccolo@2ndquadrant.it> wrote:

Show quoted text

Hi Eric,
As Michael said, path data type does not support for gist operators.
Anyway, you could redefine data type using 'ltree' instead of 'path'. Take
a look on the following link:
http://www.postgresql.org/docs/9.1/static/ltree.html
Try to understand if this could be fine for you.
Cheers,
Giuseppe.
2014-09-04 6:31 GMT+02:00 Michael Paquier <michael.paquier@gmail.com>:

On Thu, Sep 4, 2014 at 8:35 AM, Eric Fleming <efleming@gmail.com> wrote:

I have a table that I have defined as:

CREATE TABLE test (
"id" SERIAL PRIMARY KEY,
"first_path" path NOT NULL,
"second_path" path NOT NULL
);

I am attempting to create a GiST index on the two "path" columns using:

CREATE INDEX "idx_test_first_path" ON test USING gist(first_path);
CREATE INDEX "idx_test_second_path" ON test USING gist(second_path);

I am getting this error:

Error : ERROR: data type path has no default operator class for access
method "gist"

Is it that I am not allowed to create an index on the path data type or

do I

need to enable an extension for this to work? Thanks in advance for your
help.

In-core contrib modules (and core) do not have yet support for gist
operator classes for the datatype path as far as I recall.
Regards,
--
Michael

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

--
Giuseppe Broccolo - 2ndQuadrant Italy
PostgreSQL Training, Services and Support
giuseppe.broccolo@2ndQuadrant.it | www.2ndQuadrant.it