Hello everyone,
I am trying to finish the “Data Exchange Service” project. Here is the link to the project: the link
I run these queries for step 9:
SET ROLE abc_open_data;
SELECT * FROM analytics.downloads
limit 10;
However, I am getting this error:
ERROR: permission denied for schema analytics
LINE 1: SELECT * FROM analytics.downloads
I think i gave the role “abc_open_data” the proper credentials to access the schema "analytics.
Here is my SQL code:
-- STEP 1
-- SELECT rolname
-- FROM pg_roles
-- WHERE rolsuper IS TRUE;
--STEP 2
-- SELECT *
-- FROM pg_roles;
--STEP 3
-- SELECT *
-- FROM pg_roles;
--STEP 4
CREATE ROLE abc_open_data
WITH login nosuperuser;
-- SELECT rolname FROM pg_roles WHERE rolname = 'abc_open_data';
--STEP 5
CREATE ROLE publishers WITH LOGIN IN ROLE abc_open_data;
--STEP 6
GRANT USAGE, CREATE ON SCHEMA
analytics TO publishers;
--STEP 7
GRANT SELECT ON ALL TABLES IN SCHEMA analytics TO publishers;
--STEP 8
SELECT * FROM information_schema.table_privileges
WHERE grantee = 'publishers';
--STEP 9
SET ROLE abc_open_data;
SELECT * FROM analytics.downloads
limit 10;
I’m not sure why i am getting a “permission denied” error. I think the error is happening in step 5. Perhaps i am not creating the roles correctly so that “abc_open_data” inherits the privileges from “publishers”. Any ideas? Any help is greatly appreciated. Thanks everyone and happy coding