小编dan*_*sky的帖子

如何为带有索引的 Postgres 表创建仅插入用户?

这是我建议的架构:

CREATE TABLE Surveys (
    id serial primary key,
    user_email citext,
    survey_data jsonb,
    created_at timestamp default current_timestamp
);
CREATE INDEX surveys_email_idx ON Surveys(user_email);

CREATE USER SurveyWriter;
Run Code Online (Sandbox Code Playgroud)

我知道我需要:

GRANT INSERT ON dbname.Surveys TO SurveyWriter;
Run Code Online (Sandbox Code Playgroud)

但我还需要:

GRANT INSERT, UPDATE ON dbname.surveys_email_idx to SurveyWriter;
Run Code Online (Sandbox Code Playgroud)

还有什么我没有想到的吗?

schema postgresql permissions

5
推荐指数
1
解决办法
326
查看次数

标签 统计

permissions ×1

postgresql ×1

schema ×1