HELP WITH 'Data Exchange Service' POSTGRESQL

I am completely lost when it comes to this project. The hints aren’t helpful at all, and neither are the lesson or the cheatsheets available. I’m specifically having trouble with the “Granting a Publisher Access to Analytics” portion of the project. The worst part is that there’s no accompanying video to help out the learners when they do get stuck.


If you have suggestions for the course I’d suggest adding them to this section of the forums Suggestions; Feature and Course Requests - Codecademy Forums, make sure to keep the URL and any useful info.

If you’re looking for assistance from other users it would help you if you break any questions down into something others can answer, How to ask good questions (and get good answers) has some good advice on this front.

  1. Although we’re designing a collaborative data environment, we may want to implement some degree of privacy between publishers.

Let’s implement row level security on analytics.downloads . Create and enable policy that says that the current_user must be the publisher of the dataset to SELECT .

The code I typed in:
CREATE POLICY emp_rls_policy ON analytics.downloads
FOR SELECT TO publishers USING (publisher=current_user to return rows);


I am given this error:
ERROR: syntax error at or near “CREATE”
LINE 3: CREATE POLICY emp_rls_policy ON analytics.downloads
ERROR: relation “publishers” does not exist

I was given this error earlier in the lesson…where am I going wrong?

Thanks for your answer!

1 Like

I think there are just some buggy parts in this module, I’ve gotten errors throughout the SQL sections with the correct syntax time and time again.

1 Like

So analytics is a schema, and in order to grant access to the schema you will need to say so in the statement. For this exercise, for example, your statement would read.

GRANT USAGE ON SCHEMA analytics TO publishers;

I also noticed that once i had created the role ‘publishers’ and then went and deleted that line of code, i received that error.

In order to keep the publishers role existing, keep the create role statement line of code and don’t delete it, this should remove that error at least

“publishers” is not a table, it’s a group. You want to include the table you are creating the policy for in your ALTER TABLE statement.

You should take a look at your USING condition, too. The analytics.downloads table doesn’t have a column called “publisher”. You want to find a column in that table which corresponds to a publisher.