我有一个使用 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/