Index: includes/date.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/signup/includes/date.inc,v
retrieving revision 1.16.2.2
diff -u -p -r1.16.2.2 date.inc
--- includes/date.inc	19 Dec 2008 01:00:35 -0000	1.16.2.2
+++ includes/date.inc	24 Dec 2008 14:29:34 -0000
@@ -19,14 +19,16 @@ function _signup_date_admin_sql($content
   // content types, we'll potentially be JOINing on the same tables and
   // columns for different content types.  To defend against duplicate table
   // names or ambiguous columns in the query, use the content type to alias.
-  $alias = $content_type;
+  $alias = db_escape_table($content_type);
 
   // See what fields to SELECT.
   $fields[] = $alias .'.'. $field['database']['columns']['value']['column'];
   if (isset($field['database']['columns']['timezone']['column'])) {
     $fields[] = $alias .'.'. $field['database']['columns']['timezone']['column'];
   }
-  $table = '{'. $field['database']['table'] .'} '. $alias;
+  // We need to quote the alias in case someone used a reserved word for the
+  // machine-readable name of a content type.
+  $table = '{'. $field['database']['table'] .'} `'. $alias .'`';
   return array(
     'fields' => $fields,
     'joins' => array("LEFT JOIN $table ON $alias.vid = n.vid"),
