Closed (won't fix)
Project:
Menu Per Role
Version:
5.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
31 Oct 2007 at 21:56 UTC
Updated:
5 Feb 2011 at 04:24 UTC
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) {
Comments
Comment #1
scottgifford commentedIMO, a better fix is to use the
db_next_idfunction, which should work with Postgres, Mysql, and any other database providers. The patch I'm using is this:Comment #2
AlexisWilke commentedThis is now 2 years old so I'm closing it. If you can co-maintain, let us know.