postgres - "sequence" table missing error
cquincy - October 31, 2007 - 21:56
| Project: | Menu per Role |
| Version: | 5.x-1.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Description
When using this module with postgres it reports an error that the "sequence" table is missing. The sequence table is only created when using mysql or mysqli. If you create that table anyways for postgres you will run into an issue where it can't find the value of the last menu item and then any permissions assigned when creating a new menu item won't be saved. The module appears to work correctly if the menu item is saved first and then the menu item is edited.
Current work around for me:
create sequence table in postgres to get around missing table error.
Patch menu_per_role.module as follows:
*** menu_per_role.module.orig Wed Oct 31 15:50:12 2007
--- menu_per_role.module Wed Oct 31 15:52:43 2007
*************** function menu_per_role_form_submit($form
*** 62,68 ****
--- 62,74 ----
}
else {
//a new item has been added, try to determine the mid
+
$form_values['mid'] = db_result(db_query("SELECT id FROM {sequences} WHERE name = '{menu}_mid'"));
+
+ // postgress doesn't write to sequence table, look in postgres menu_mid_seq sequence
+ if (!$form_values['mid'])
+ $form_values['mid'] = db_result(db_query("SELECT last_value from {menu}_mid_seq"));
+
}
foreach ($form_values['roles'] as $rid => $checked) {
if ($checked) {