can't drop view because of dependencies

Viewed 951

when dropping this view:

drop view employees;

i get the following error message:

ERROR:  cannot drop view employees because other objects depend on it
DETAIL:  view telephone_number_collection depends on view employees
view email_collection depends on view employees
policy employee_rights_select_only_own_person_address on table person_addresses depends on view employees
policy employee_rights_select_only_own_person_email on table person_emails depends on view employees
policy employee_rights_select_only_own_person_telnumber on table person_telephone_numbers depends on view employees
HINT:  Use DROP ... CASCADE to drop the dependent objects too.
SQL state: 2BP01

dropping the views email_collection and telephone_number_collection works to avoid the first part of the error. But i don't understand the second part:

policy employee_rights_select_only_own_person_address on table person_addresses depends on view employees
policy employee_rights_select_only_own_person_email on table person_emails depends on view employees
policy employee_rights_select_only_own_person_telnumber on table person_telephone_numbers depends on view employees

i can't find the 3 policys in the 3 described tables. Can anyone help me understand the error message respectively finding the policies in pgAdmin to check if i can use DROP ... CASCADE or delete the policies manually without destroying important things?

edit: the actual problem was, that i tied to replace a function, where the return type changed. But thats impossible. If the return type changes you have to first drop the function und than create it again.

drop FUNCTION public.get_employees;

But it was impossible to drop the function because of a dependency on the view employees.

ERROR:  cannot drop function get_employees() because other objects depend on it
DETAIL:  view employees depends on function get_employees()
view telephone_number_collection depends on view employees
view email_collection depends on view employees
policy employee_rights_select_only_own_person_address on table person_addresses depends on view employees
policy employee_rights_select_only_own_person_email on table person_emails depends on view employees
policy employee_rights_select_only_own_person_telnumber on table person_telephone_numbers depends on view employees
HINT:  Use DROP ... CASCADE to drop the dependent objects too.
SQL state: 2BP01

That's why i asked the first question. I only want to drop all views and policies temporary and create them again after i droped and created the function public.get_employees;

0 Answers
Related