我正在尝试更新表 pg_index(“禁用”特定索引),但我收到关系 pg_index 的错误权限被拒绝。我已经授予所有表上的权限,并且我还尝试授予选择、更新、插入、删除。
我无法更新,但我可以选择。
db=> \z pg_catalog.pg_index;
Access privileges
Schema | Name | Type | Access privileges | Column privileges |
Policies
------------+----------+-------+-------------------------+------------------
-+----------
pg_catalog | pg_index | table | =r/postgres +|
|
| | | report=arwdDxt/postgres | |
(1 row)
最佳答案
您可以以 super 用户身份更新 pg_index,如果不是,您也必须以 super 用户身份授予权限。
但是不要这样做!
对于特定查询,您可以通过 set enable_indexscan = off
禁用索引的使用。
对于批量加载数据(并加快加载速度)- 执行 pg_dump -s
来备份包括索引在内的数据库架构。然后简单地放下它们,加载您的数据并在之后重新创建它们。
关于postgresql - 如何对 pg_index 执行更新,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45036191/