简体   繁体   English

Postgres - 具有 SELECT 的新角色显示空表,而超级用户角色显示同一表中的数据

[英]Postgres - new role with SELECT shows empty table, whereas superuser role shows data in same table

thank for taking the time to try answer/understand this question.感谢您花时间尝试回答/理解这个问题。

I am using AWS Aurora Postgres (Engine version: 13.4) database.我正在使用 AWS Aurora Postgres(引擎版本:13.4)数据库。 I referred to this document for creating readwrite and readonly roles for 2 new rdsiam users -> "dev_ro" and "dev_rw".我参考此文档为 2 个新的rdsiam用户创建readwritereadonly角色 -> “dev_ro”和“dev_rw”。 I have granted readwrite role to "dev_rw" and readonly to "dev_ro".我已将readwrite角色授予“dev_rw”,将readonly角色授予“dev_ro”。 The additional changes are:额外的变化是:

  1. myschema is "public" - which is my default schema myschema是“public”——这是我的默认模式
  2. I add the same permissions as "myschema" to another schema called "graphile_worker" (from graphile/worker - which is a job queue).我将与“myschema”相同的权限添加到另一个名为“graphile_worker”的模式(来自graphile/worker - 这是一个作业队列)。

With this in mind, here is what I have done:考虑到这一点,这就是我所做的:

  1. I run my application which adds some repeating jobs (jobs schedule itself), implying that the jobs table can never be empty我运行我的应用程序,它添加了一些重复的作业(作业本身安排),这意味着jobs表永远不会为空
  2. Connect to RDS using the IAM user (doesn't matter dev_ro or dev_rw)使用 IAM 用户连接到 RDS(与 dev_ro 或 dev_rw 无关)
  3. I run SELECT * FROM graphile_worker.jobs in my IDE (dbeaver - shouldn't matter, I think)我在我的 IDE 中运行SELECT * FROM graphile_worker.jobs (dbeaver - 我认为应该无关紧要)
  4. The table shows up empty表格显示为空
  5. Disconnect and Re-connect to RDS using superuser credentials (which are created when server is created)使用超级用户凭据(在创建服务器时创建)断开并重新连接到 RDS
  6. Run same query as above运行与上面相同的查询
  7. See data in the table见表中数据

I don't know why this is happening.我不知道为什么会这样。 I double-checked, both "dev_ro/w" (through the roles) and superuser, have:我仔细检查了“dev_ro/w”(通过角色)和超级用户,都有:

  • CONNECT to database (without doubt) CONNECT到数据库(毫无疑问)
  • SELECT on all tables of graphile_worker schema SELECTgraphile_worker模式的所有表上
  • USAGE on the graphile_worker schemaUSAGE模式上的graphile_worker
  • Moreover, I can query graphile_worker.migrations and the migration records show up as expected (on both devro/w and superuser)!此外,我可以查询graphile_worker.migrations并且迁移记录按预期显示(在 devro/w 和超级用户上)!

Please let me know if there is any more information that I can provide to help debug this issue.如果我可以提供更多信息来帮助调试此问题,请告诉我。

Removing Row-Level Security (RLS) solved this issue.删除行级安全性 (RLS) 解决了这个问题。 Thanks @Hambone for asking the right question.感谢@Hambone 提出了正确的问题。

RLS is removed by executing通过执行删除 RLS

ALTER ROLE <username> WITH BYPASSRLS

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 CREATE TABLE AS SELECT 的 Bigquery 数据沿袭没有显示任何内容 - Bigquery data-lineage for CREATE TABLE AS SELECT shows nothing Terraform 导入和计划显示用户数据发生变化,而没有变化 - Terraform Import and Plan shows change in user data whereas there is no change Hive 表显示 NULL 值 - Hive table shows NULL values 每天我都会在 BigQuery 中收到一个新表,我想将这个新表数据连接到主表,数据集架构相同 - Daily I’m receiving a new table in the BigQuery, I want concatenate this new table data to the main table, dataset schema are same Firestore 网页显示错误数据 - Firestore webpage shows wrong data Airflow:BigQuery SQL 向表中插入空数据 - Airflow: BigQuery SQL Insert empty data to the table 如何创建一个新表,只保留Bigquery中相同ID下超过5条数据记录的行 - How to create a new table that only keeps rows with more than 5 data records under the same id in Bigquery 如何将表复制到新的 bigquery 项目中的空数据集? - How copy a table to an empty dataset in a new bigquery project? 快照永远不会显示 null 即使其中没有数据 - snapshot never shows null even if there is no data in it AWS Cloudwatch 洞察力显示无数据 - AWS Cloudwatch insight shows no data
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM