postgresql - Postgres 9.3,hstore 1.1,未知运算符 '?'

标签 postgresql hstore postgresql-9.3

我有一个使用 hstore 收集表更改的日志表。类似于:

CREATE TABLE "gt_wells"."log_edits" (
      "well_gid"    SERIAL
    , "modified_by" TEXT
    , "edit"        HSTORE
);

其中“编辑”是记录的先前值和新值之间的差异。一切都按预期工作。

我想选择编辑了特定列的行,因此使用具有 super 用户权限的登录角色我可以成功运行:

SELECT DISTINCT "well_gid"
FROM "gt_wells"."log_edits"
WHERE "edit" ? 'full_sized_class;

但是当我从另一个角色运行它时,我得到一个未知的运算符错误:

SET ROLE "inl-trigger";
SELECT DISTINCT "well_gid"
FROM "gt_wells"."log_edits"
WHERE "edit" ? 'full_sized_class' AND "modified_by" != 'inl-trigger';
RESET ROLE;

Error : ERROR:  operator does not exist: public.hstore ? unknown
LINE 3: WHERE "edit" ? 'full_sized_class' AND "modified_by" != 'inl-...
                     ^
HINT:  No operator matches the given name and argument type(s). You might need to add explicit type casts.

将“full_sized_class”转换为 TEXT 没有帮助。 hstore 扩展存在于 db 中,我已将“inl-trigger”权限授予 hstore 类型:

CREATE EXTENSION hstore;
Error : ERROR:  extension "hstore" already exists

GRANT ALL ON TYPE hstore TO "inl-trigger";
Affected rows : 0, Time: 0.00sec

如果我让“inl-trigger”成为 super 用户,一切都会按预期进行。那么我缺少什么特权?为什么“inl-trigger”不能使用 hstore 运算符?

最佳答案

模式 hstore 上所需的用法已安装到:

GRANT USAGE ON SCHEMA public TO "inl-trigger";

关于postgresql - Postgres 9.3,hstore 1.1,未知运算符 '?',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24269704/

相关文章:

postgresql - 关系 <table_name> 的权限被拒绝

sql - Postgresql 表存在,但查询时得到 "relation does not exist"

sql - 如何在 Postgresql 中使用带有 hstore 列的 GIST 或 GIN 索引?

postgresql - 如何使用 PostgreSQL 解决 Rails 中的错误 'fe_sendauth: no password supplied'?

postgresql - 如何将json数组传递给postgresql函数

postgresql - 为什么 PostgreSQL 在 SELECT FOR UPDATE SKIP LOCKED 时抛出并发更新错误?

python - PostgreSQL 不使用 psycopg2 在 AWS Lambda 上的 Python 中插入

python - Heroku 上的 django-hstore

PostgreSQL hstore : improve LIKE performance with index?

python - Django hstore 字段和索引