ERROR: permission denied for sequence cities_id_seq using Postgres

后端 未结 4 1898
耶瑟儿~
耶瑟儿~ 2020-12-07 08:15

I\'m new at postgres (and at database info systems all in all). I ran following sql script on my database:

create table cities (
id serial primary key,
name          


        
4条回答
  •  粉色の甜心
    2020-12-07 08:39

    Since PostgreSQL 8.2 you have to use:

    GRANT USAGE, SELECT ON SEQUENCE cities_id_seq TO www;
    

    GRANT USAGE - For sequences, this privilege allows the use of the currval and nextval functions.

    Also as pointed out by @epic_fil in the comments you can grant permissions to all the sequences in the schema with:

    GRANT USAGE, SELECT ON ALL SEQUENCES IN SCHEMA public TO www;
    

提交回复
热议问题