Create postgresql user with only access to a few tables

For future reference:

su postgres
psql
CREATE USER pg_fulfillment;
GRANT CONNECT ON DATABASE my_database TO pg_fulfillment;
ALTER USER pg_fulfillment WITH PASSWORD 'pw';
REVOKE ALL PRIVILEGES FROM pg_fulfillment;
GRANT SELECT, UPDATE, INSERT ON TABLE mytable TO pg_fulfillment;
GRANT USAGE, SELECT, UPDATE ON SEQUENCE mytable_seq_id TO pg_fulfillment;
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s