BUG #14564: Unable to create GIN index for character type

From: volodymyr(dot)volynets(at)gmail(dot)com
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #14564: Unable to create GIN index for character type
Date: 2017-02-22 16:07:42
Message-ID: 20170222160742.1465.72081@wrigleys.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 14564
Logged by: Volodymyr Volynets
Email address: volodymyr(dot)volynets(at)gmail(dot)com
PostgreSQL version: 9.4.5
Operating system: OSX x86_64-apple-darwin
Description:

Hi,

1) Here's create table statement:

CREATE TABLE cm_countries
(
cm_country_tenant_id integer NOT NULL,
cm_country_code character(2) NOT NULL,
cm_country_name character varying(120) NOT NULL,
cm_country_code3 character(3) NOT NULL,
cm_country_number smallint DEFAULT 0,
cm_country_region_id smallint DEFAULT 0,
cm_country_sub_region_id smallint DEFAULT 0,
cm_country_inactive smallint NOT NULL DEFAULT 0,
CONSTRAINT cm_countries_pk PRIMARY KEY (cm_country_tenant_id,
cm_country_code)
);

2) I added btree_gin extension:

CREATE EXTENSION btree_gin
SCHEMA pg_catalog
VERSION "1.0";

3) Trying to create gin index:

CREATE INDEX cm_countries_fulltext_idx ON cm_countries USING gin
(cm_country_code, cm_country_name);

Error:

ERROR: data type character 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.
********** Error **********

ERROR: data type character has no default operator class for access method
"gin"
SQL state: 42704
Hint: You must specify an operator class for the index or define a default
operator class for the data type.

4) Looked into operator classes for gin:

index_method,opclass_name,opfamily_name,indexed_type,is_default
"gin", "char_ops", "char_ops", ""char"", t

Is it possible to add operator class for type "character" in addition to
type "char"?

Thank you!

Browse pgsql-bugs by date

  From Date Subject
Next Message Devrim Gündüz 2017-02-22 19:27:45 Re: Error mtk 11009
Previous Message Tom Lane 2017-02-22 15:16:54 Re: BUG #14563: count(*) gives a wrong result in PostgreSQL for some regex with pg_trm/GIN index