Index: openacs-4/packages/acs-events/sql/postgresql/acs-events-create.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-events/sql/postgresql/acs-events-create.sql,v
diff -u -r1.13 -r1.14
--- openacs-4/packages/acs-events/sql/postgresql/acs-events-create.sql	5 Apr 2005 19:47:39 -0000	1.13
+++ openacs-4/packages/acs-events/sql/postgresql/acs-events-create.sql	8 Aug 2006 21:26:13 -0000	1.14
@@ -701,7 +701,7 @@
        from  acs_events e
        left join acs_activities a
        on (e.activity_id = a.activity_id)
-       where e.event_id = get_html_p__event_id
+       where e.event_id = get_html_p__event_id;
 
        return v_html_p;
 
@@ -729,7 +729,7 @@
        from  acs_events e
        left join acs_activities a
        on (e.activity_id = a.activity_id)
-       where e.event_id = get_status_summary__event_id
+       where e.event_id = get_status_summary__event_id;
 
        return v_status_summary;
 
@@ -1115,6 +1115,8 @@
        v_days_index		       integer;
        v_day_num		       integer;
        rec_execute		       record;
+       v_new_current_date              timestamptz;
+       v_offset_notice interval;
 begin
 
 	-- Get event parameters
@@ -1213,7 +1215,7 @@
                 -- Find last day of correct month
                 v_last_day := last_day(add_months(v_current_date, v_n_intervals));
                 -- Back up one week and find correct day of week
-                v_current_date := next_day(v_last_day - to_interval(7,''days''), to_char(v_current_date, ''DAY''));
+                v_current_date := next_day(v_last_day ::timestamp - to_interval(7,''days'') :: timestamptz, to_char(v_current_date, ''DAY''));
 	    end if;
 
 	    -- Add a full year (12 months)
@@ -1246,8 +1248,8 @@
                 v_week_date  := v_current_date;
                 while v_days_index <= v_days_length loop
                     v_day_num   := SUBSTR(v_days_of_week, v_days_index, 1);
-                    v_week_date := v_current_date + to_interval(v_day_num,''days'');
-                    if date_trunc(''day'',v_week_date) > date_trunc(''day'',v_start_date) 
+                    v_week_date := (v_current_date ::timestamp + to_interval(v_day_num,''days'')) :: timestamptz;
+	           if date_trunc(''day'',v_week_date) > date_trunc(''day'',v_start_date) 
 		       and date_trunc(''day'',v_week_date) <= date_trunc(''day'',v_stop_date) then
                          -- This is where we add the event
                          v_event_id := acs_event__new_instance(
@@ -1269,13 +1271,13 @@
                  end loop;
 
                  -- Now move to next week with repeats.
-                v_current_date := v_current_date + to_interval(7 * v_n_intervals,''days'');
+                v_current_date := (v_current_date :: timestamp + to_interval(7 * v_n_intervals,''days'')) :: timestamptz;
             else
                 -- All other interval types
                 -- This is where we add the event
                 v_event_id := acs_event__new_instance(
                     insert_instances__event_id,						    -- event_id 
-                    date_trunc(''day'',v_current_date) - date_trunc(''day'',v_event_date)   -- offset
+                    date_trunc(''day'',v_current_date ::timestamp) - date_trunc(''day'',v_event_date ::timestamp)   -- offset
                 );
                 v_last_date_done := v_current_date;
             end if;
