1

I am new to postgresql and I would grateful if you could please advise on how-to resolve the following error..

I have issued the followed commands:

SELECT sub1.nct_id, sub1.condition, sub1.condition_name,
        sub2.overall_status, sub2.participants,
        e.criteria,
        f.city, f.state, f.country,
        i.intervention_type, i.name AS intervention
FROM (SELECT c.nct_id, c.name AS condition, c.downcase_name AS condition_name
        FROM ctgov.conditions AS c
-- selecting only cancer trials before joining
        WHERE c.name ILIKE '%cancer%') sub1                                 
JOIN (SELECT s.nct_id, s.overall_status, s.enrollment AS participants
        FROM ctgov.studies AS s
-- selecting only completed cancer trials before joining    
        WHERE s.overall_status = 'Completed') sub2                          
    ON sub1.nct_id = sub2.nct_id
JOIN ctgov.eligibilities AS e
    ON sub1.nct_id = e.nct_id
JOIN ctgov.facilities AS f
    ON sub1.nct_id = f.nct_id
JOIN ctgov.interventions AS i
    ON sub1.nct_id = i.nct_id;

And the error is: ERROR: permission denied for schema ctgov SQL state: 42501

Could you please advise on how to setup the privileges to have access to the tables defined in schema?

Thank you in advance!!!

1 Answer 1

0

Your user lacks the permission to access objects in schema ctgov. The owner of that schema (or a superuser) can remedy that with

GRANT USAGE ON SCHEMA ctgov TO your_user_name;

Your user will also need to have the SELECT privilege on the tables and views that you want to use.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.