Skip site navigation (1) Skip section navigation (2)

GIN over array of ENUMs

From: Rod Taylor <pg(at)rbt(dot)ca>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: GIN over array of ENUMs
Date: 2013-01-10 17:08:45
Message-ID: CAKddOFDaGUKqQM3Zmpj+n1W0qd=o=FU-Eo1BE87QHGkrD-ghNw@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-hackers
I wish to create this data structure but GIN does not currently support an
array of ENUM. Is intarray() a good place to look into adding ENUM support
or is there already an operator class for working supports enums that I
simply don't see at the moment.

This is being done as an alternative to a very large number of boolean
columns which are rarely true (under 1%).


CREATE TYPE feature AS ENUM ('item1', 'item2', 'item3');
CREATE TABLE test (id serial PRIMARY KEY, features feature[]);

CREATE INDEX test_features_idx ON test USING GIN (features, id);

ERROR:  data type feature[] has no default operator class for access method
"gin"
HINT:  You must specify an operator class for the index or define a default
operator class for the data type.


Thanks in advance,

Rod

Responses

pgsql-hackers by date

Next:From: Tom LaneDate: 2013-01-10 17:09:15
Subject: Re: pg_dump --pretty-print-views
Previous:From: David FetterDate: 2013-01-10 16:51:44
Subject: Re: pg_dump --pretty-print-views

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group