我有 product_reviews TABLE与 product_review jsonb列 .

jsonb column : [{"comment": [{"condition": "Good", "Entered": "true"}], "productid": 321}]

CREATE INDEX idx_product_reviews_product_review ON product_reviews  USING gin (CAST (product_review ->> 'productid') AS bigint )   ;

所以当我尝试在这个jsonb列上创建gin索引时,我得到错误 .

ERROR:  data type bigint 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.

我想将productid索引为bigint类型值,所以我可以得到jsonb“comment”值来比较这个productid .