title: ERROR: permission denied for sequence cities_id_seq using Postgres
body: <p>I'm new at postgres (and at database info systems all in all). I ran following sql script on my database:</p>
  
  <pre><code>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;
  </code></pre>
  
  <p>When, as the user www, trying to:</p>
  
  <pre><code>insert into cities (name) values ('London');
  </code></pre>
  
  <p>I get the following error:</p>
  
  <pre><code>ERROR: permission denied for sequence cities_id_seq
  </code></pre>
  
  <p>I get that the problem lies with the serial type. That's why I grant select, insert and delete rights for the *_id_seq to www. Yet this does not fix my problem. What am I missing?</p>