Indexing Postgres 9.4使用GIN添加索引

Indexing Postgres 9.4使用GIN添加索引,indexing,doctrine,postgresql-9.4,gwt-gin,Indexing,Doctrine,Postgresql 9.4,Gwt Gin,我使用的是Postgres9.4,JSONB字段,它们工作得很好。 但当我添加GIN索引时,迁移无法创建索引 class Version20160314132147_Gin_Indexes_content extends AbstractMigration { public function up(Schema $schema) { $this->addSql('CREATE INDEX contents_properties_ix ON contents USING gin

我使用的是Postgres9.4,JSONB字段,它们工作得很好。 但当我添加GIN索引时,迁移无法创建索引

class Version20160314132147_Gin_Indexes_content   extends AbstractMigration {

public function up(Schema $schema) {
    $this->addSql('CREATE INDEX contents_properties_ix ON contents USING gin (properties);');
}

/**
 * @param Schema $schema
 */
public function down(Schema $schema) {
    $this->addSql('DROP INDEX contents_properties_ix;');
}
}
错误: [条令\DBAL\Driver\PDOException] SQLSTATE[42704]:未定义的对象:7错误:数据类型json没有访问方法“gin”的默认运算符类 提示:必须为索引指定运算符类或为数据类型定义默认运算符类

Composer.json { “苗条/苗条”:“~2.6”, “条令/orm”:“~2.5”, “条令/dbal”:“2.5”, “symfony/yaml”:“2.8@dev”, “条令/缓存”:“~1。5@dev", “symfony/console”:“2.8@dev”, “symfony/类加载器”:“^2.7.4”, “条令/迁移”:“~1.0”, “predis/predis”:“~1.0.1”, “guzzle http/guzzle”:“~5.0”, “细枝/细枝”:“~1.0”, “php di/php di”:“^5.1.0”, “独白/独白”:“~1。15@dev", “boldtrn/jsonb包”:“~1.0”, “opsway/dbal postgresql”:“~0.1”, “Fzaninoto/faker”:“~1.3.0”, “aws/aws sdk php”:“^3.9”
}

Postgres似乎在抱怨你的专栏
属性
不是文本类型,因此无法使用GIN对其进行索引

您可能已成功将列转换为文本:

CREATE INDEX contents_properties_ix ON contents USING gin (properties::text);

Postgres似乎在抱怨您的专栏
属性
不是文本类型,因此无法使用GIN对其进行索引

您可能已成功将列转换为文本:

CREATE INDEX contents_properties_ix ON contents USING gin (properties::text);