Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

217
Views
can't drop view because of dependencies

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;

over 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!