Closed (fixed)
Project:
Subgroups for Organic groups
Version:
5.x-3.x-dev
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
4 Sep 2006 at 19:59 UTC
Updated:
25 Sep 2006 at 23:00 UTC
The database manipulating functions of this module are not optimized for pgsql - I got some error messages while using it, for example:
warning: pg_query(): Query failed: ERROR: syntax error at or near "IGNORE" at character 8 in /home/hangya/hangya.selfip.net/cserkesz/includes/database.pgsql.inc on line 84.
user warning: query: INSERT IGNORE INTO term_hierarchy (`parent`,`tid`) VALUES (8,7) in /home/hangya/hangya.selfip.net/cserkesz/includes/database.pgsql.inc on line 103.
Comments
Comment #1
Hangya commentedAnd another, in the Modules view:
warning: Invalid argument supplied for foreach() in /home/hangya/hangya.selfip.net/cserkesz/modules/og_subgroups/og_subgroups.module on line 253.
Comment #2
donengel commentedHi Hangya,
I've (hopefully) fixed the bug you found in #1, which was simultaneously reported as http://drupal.org/node/82298 #2. I'll hopefully have a look at the bug you reported first (sql compatibility) soon - my new job training starts tomorrow so my schedule is less in my control for a few days.
Here's the text I also posted in response to the same bug being reported in the other thread, in case it's of interest. Thanks so much for finding and reporting both of these bugs. Sorry for any inconvenience.
"More detail on the bug: the problem was that, on installing the module,
a nodeapi insert was faked (as in og.module) for each group that didn't
have a term in the Groups vocabulary yet. This insert created the term,
but also called the same functions that handled the creation of a new
group. These functions looked to see which members and subgroups were
selected and saved the selection. Because the insert was called from
the install of the module, not the creation from scratch of a group,
there was no form input to draw from. Therefore, there was the error
message (because the array didn't exist) and the memberships were erased
(because the functions were setting the members and subgroups to equal
the set of people and subgroups in the nonexistant arrays). The fix was
just to have it see if the arrays exist, and if not, skip calling those
functions - so, the functions are only called now when there's a true
insert of a new group, and skipped when there's a fake "insert" of a
group that already existed and is only "new" in the sense that it didn't
have a term in the vocabulary before."
Comment #3
donengel commentedHi Hangya,
I believe I've fixed the bug that was giving you the "INSERT IGNORE" error. Please let me know if not.
More detail on the bug: It seems pgsql, which is unfamiliar to me, does not support the "ignore" option on INSERT that exists in mysql. However, it turns out that the one place in the code where I was using it, it was unnecessary. I was using it to prevent error reporting on failed insertion of duplicate parent/child information in the term hierarchy table, which would have failed because of the redundancy. The function where this was happening was actually wiping the parent/child information clean for the given parent before going through the insert process, so with no redundancy in the input and a clean slate before the input, no duplicates were possible. I simply removed the word "IGNORE" from the sql command.
Comment #4
Hangya commentedThere were another error in the new code:
warning: pg_query(): Query failed: ERROR: syntax error at or near "`" at character 29 in /home/hangya/hangya.selfip.net/cserkesz/includes/database.pgsql.inc on line 84.
user warning: query: INSERT INTO term_hierarchy (`parent`,`tid`) VALUES (11,9) in /home/hangya/hangya.selfip.net/cserkesz/includes/database.pgsql.inc on line 103.
But when I removed the ` characters form the 248. line of og_subgroups module, it works correctly now.
Comment #5
donengel commentedThanks for finding this bug, and fixing it! I've made the same change and uploaded the corrected file. I guess this is another difference between mysql and pgsql.
Comment #6
donengel commentedComment #7
(not verified) commented