Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RLS seems unable to handle multiple references to the same table. #195

Open
justinanderson opened this issue Aug 24, 2016 · 0 comments
Open

Comments

@justinanderson
Copy link
Member

Given the RLS rule:

grant select access to foo on asdf._file_with_spaces where pay_basis = 'ANN'

And the query:

SELECT * from asdf._file_with_spaces where agency in (SELECT distinct(agency) as _file_with_spaces from asdf._file_with_spaces where agency like 'Department%' order by agency)

The result after an RLS rewrite is:

SELECT * from (
    SELECT * FROM asdf._file_with_spaces WHERE pay_basis = 'ANN')
AS asdf_file_with_spaces where agency in (
    SELECT distinct(agency) as _file_with_spaces from (
        SELECT * FROM asdf_file_with_spaces WHERE pay_basis = 'ANN')
    AS asdf_file_with_spaces where agency like 'Department%' order by agency)

The third occurence of asdf_file_with_spaces is a problem, since it doesn't exist at that point. This query results in a 404 since the table can't be found.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant