我是Postgres(以及所有数据库信息系统)的新手。我在数据库上运行了以下sql脚本:
create table cities (
id serial primary key,
name text not null
);
create table reports (
id serial primary key,
cityid integer not null references cities(id),
reportdate date not null,
reporttext text not null
);
create user www with password 'www';
grant select on cities to www;
grant insert on cities to www;
grant delete on cities to www;
grant select on reports to www;
grant insert on reports to www;
grant delete on reports to www;
grant select on cities_id_seq to www;
grant insert on cities_id_seq to www;
grant delete on cities_id_seq to www;
grant select on reports_id_seq to www;
grant insert on reports_id_seq to www;
grant delete on reports_id_seq to www;
当以用户www身份尝试:
insert into cities (name) values ('London');
我收到以下错误:
ERROR: permission denied for sequence cities_id_seq
我知道问题出在串行类型上。这就是为什么我授予www的* _id_seq选择,插入和删除权限的原因。但这不能解决我的问题。我想念什么?
2
对序列授予插入/删除对我来说没有意义。我很惊讶它甚至可以工作。
—
a_horse_with_no_name 2012年