由于依赖关系,无法删除视图

eoigrqb6  于 2021-07-24  发布在  Java
关注(0)|答案(0)|浏览(435)

删除此视图时:

drop view employees;

我收到以下错误消息:

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

删除视图email\u collection和telephone\u number\u collection可以避免错误的第一部分。但我不明白第二部分:

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

我在所描述的3个表中找不到3个策略。有人能帮我理解错误信息,分别在pgadmin中查找策略,检查我是否可以使用drop。。。在不破坏重要内容的情况下手动级联或删除策略?
edit:实际的问题是,我绑定了一个函数来替换返回类型发生了变化的函数。但那是不可能的。如果返回类型更改,则必须先删除函数,然后再创建它。

drop FUNCTION public.get_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

所以我问了第一个问题。我只想暂时删除所有视图和策略,并在我删除并创建public.get\u employees函数后重新创建它们;

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题