1
我使用MariaDB的10.2.6。當使用root用戶運行語句時,它可以工作。但是,如果我用另一個用戶(訪問權限有限)嘗試它,它會失敗,說我無法在動態生成的視圖上執行SELECT。我不能明確地將SELECT授予該表,因爲它不存在。「ERROR 1142(42000):SELECT命令被拒絕」 的 '遞歸' 聲明MariaDB的10.2.6
這裏是遞推式的語句:
with recursive hierarchy (id, parent_department_id) as
(
SELECT id, parent_department_id
from department
where parent_company_id = 1
union all
select e.id, e.parent_department_id
from department e
join hierarchy h ON e.parent_department_id = h.id
)
select e.*
from hierarchy h
join department e ON e.id = h.id;
錯誤:
ERROR 1142 (42000): SELECT command denied to user 'aclapi'@'localhost' for table 'hierarchy'
當我以root身份登錄,並嘗試在層次結構授予SELECT用戶:
ERROR 1146 (42S02): Table 'vblpso.hierarchy' doesn't exist
我想如何授予權限以允許WITH RECURSIVE語句的工作(不使用授予所有privi GES)?
感謝您創建併發布Jira bug報告。我希望這只是一個文檔問題。 –
嗯......在10.2.2中適用於我。此外,它在8.0.0上以其他方式失敗。 –