[More info] Not unique table/alias problem
peashooter - August 8, 2008 - 09:05
| Project: | OG Calendar |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | postponed (maintainer needs more info) |
Jump to:
Description
Hi,
I seem to get the following error warning when viewing an og_calendar while not logged in as admin (so any normal or authenticated user).
user warning: Not unique table/alias: 'n' query: SELECT MAX(e.event_end) as event_end FROM event e INNER JOIN....
I have no idea how to solve it.
The page is here http://globaldemo.org/og_calendar/232
but a cursory google search revealed that many others are having the same problem:
http://www.scbbs.com/og_calendar/136
http://npstac.org/og_calendar/5
Any ideas?
Cheers

#1
Perhaps this is a support request? Any ideas?
#2
Is this still a problem with the latest development release?
#3
#4
#5
I am also encountering the same problem, has this problem been sorted out?
The error I get when an authenticated user access the Group Calender is:
user warning: Not unique table/alias: 'n' query: SELECT MAX(e.event_end) as event_end FROM event e INNER JOIN node n ON n.nid = e.nid LEFT JOIN node n ON e.nid = n.nid INNER JOIN node_access na ON na.nid = e.nid WHERE ((n.moderate != 1 OR n.uid = 3)) AND (na.grant_view >= 1 AND ((na.gid = 0 AND na.realm = 'all') OR (na.gid = 0 AND na.realm = 'og_public') OR (na.gid = 3 AND na.realm = 'og_subscriber'))) AND ( n.status=1 AND UNIX_TIMESTAMP(e.event_start) < 1230748200) in /var/www/html/drupalmysite/modules/og_calendar/og_calendar.module on line 162
#6
I can't replicate this problem at the present time,
#7
Same problem for me.
In my case, I created a new user role after everything was set up with og and og_user_roles. Users in a drupal user role (not og role) created prior to the og setup don't trigger the error. My guess, a access issue...
On drupal v5, event module 5.x-1.0 and og_calendar 5.x-1.1, the following brings back everything to normal:
Comment out twice the lines '$sql = db_rewrite_sql(...' in og_calendar.module function _og_calendar_event_nav.
The function provides the next - previous navigation links.
function _og_calendar_event_nav($timestamp, $dir, $gid) {if ($dir == 'prev') {
$sql = "SELECT MAX(e.event_end) as event_end FROM {event} e INNER JOIN {node} n ON n.nid = e.nid WHERE e.event_start < %d";
// COMMENT OUT:
// $sql = db_rewrite_sql($sql, 'e', 'nid', array('og_nid' => $gid));
$range = db_result(db_query($sql, $timestamp));
if (!empty($range)) {
$date = gmmktime(0, 0, 0, gmdate('m', $range), 1, gmdate('Y', $range));
}
}
if ($dir == 'next') {
$sql = "SELECT MIN(e.event_start) as event_start FROM {event} e INNER JOIN {node} n ON n.nid = e.nid WHERE e.event_end > %d";
// COMMENT OUT:
// $sql = db_rewrite_sql($sql, 'e', 'nid', array('og_nid' => $gid));
#8
subscribing