Postgres sequence usage I have an Postgres database with two users: dev and junit. Junit and dev objects are dropped and created regularly.

They both have the same objects unshared for tables, however, sequences are shared, and dev is the owner. I just use normal create statements.

I want to grant all to junit for the sequence but this fails with:

dev=&gt; grant all on sequence serial to junit;
WARNING:  no privileges were granted for "serial"
GRANT


After this junit has no select rights on the sequence, how can I fix this? 

I also would like to know whether there are recipes for this kind of setups, where I can use the same DDL for the two different users without modifying the script? I've been looking into schemas but I haven't found the solution so far.
The warning


WARNING:  no privileges were granted for "serial"



indicates that the granting role doesn't have the necessary privilege to grant privileges on the object in question.


Either execute the GRANT command as the role owning the sequence.
Or do the same as superuser (default superuser is postgres).
Or GRANT the necessary privilege to the role dev so that this role can in turn grant it to others:


GRANT ALL ON SEQUENCE serial TO dev WITH GRANT OPTION;

The name serial for a sequence isn't particularly wise, but since serial is not a name of a base type and not a reserved word, it wouldn't cause any immediate trouble.

Aside:
Unfortunately the manual uses the name serial in the CREATE SEQUENCE and ALTER SEQUENCE examples. I feel like a suggestion to pgsql-docs@postgresql.org might be in order ...