Я новичок в 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
Я понимаю, что проблема заключается в последовательном типе. Вот почему я предоставляю права выбора, вставки и удаления для * _id_seq на www. Но это не решает мою проблему. Что мне не хватает?