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.13.2.1 --- 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 15 Aug 2005 01:11:32 -0000 1.13.2.1 @@ -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; Index: openacs-4/packages/acs-events/sql/postgresql/timespan-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-events/sql/postgresql/timespan-create.sql,v diff -u -r1.3 -r1.3.8.1 --- openacs-4/packages/acs-events/sql/postgresql/timespan-create.sql 12 Jul 2003 01:10:36 -0000 1.3 +++ openacs-4/packages/acs-events/sql/postgresql/timespan-create.sql 15 Aug 2005 01:11:32 -0000 1.3.8.1 @@ -61,14 +61,14 @@ -- -- @return id of new time interval -- - timestamptz, -- time_intervals.start_date%TYPE default null, - timestamptz -- time_intervals.end_date%TYPE default null + timestamptz, -- time_intervals.start_date%TYPE default null, + timestamptz -- time_intervals.end_date%TYPE default null ) -returns integer as ' -- time_intervals.interval_id%TYPE +returns integer as ' -- time_intervals.interval_id%TYPE declare new__start_date alias for $1; -- default null, new__end_date alias for $2; -- default null - v_interval_id time_intervals.interval_id%TYPE; + v_interval_id time_intervals.interval_id%TYPE; begin select timespan_seq.nextval into v_interval_id from dual; @@ -92,13 +92,13 @@ -- -- @return 0 (procedure dummy) -- - integer -- time_intervals.interval_id%TYPE + integer -- time_intervals.interval_id%TYPE ) returns integer as ' declare - delete__interval_id alias for $1; + delete__interval_id alias for $1; begin - + delete from time_intervals where interval_id = delete__interval_id; @@ -121,9 +121,9 @@ -- -- @return 0 (procedure dummy) -- - integer, -- time_intervals.interval_id%TYPE, - timestamptz, -- time_intervals.start_date%TYPE default null, - timestamptz -- time_intervals.end_date%TYPE default null + integer, -- time_intervals.interval_id%TYPE, + timestamptz, -- time_intervals.start_date%TYPE default null, + timestamptz -- time_intervals.end_date%TYPE default null ) returns integer as ' declare @@ -132,33 +132,33 @@ edit__end_date alias for $3; -- default null begin - -- JS: I hate deeply nested if-else-ifs!!! + -- JS: I hate deeply nested if-else-ifs!!! -- Null for start_date or end_date means dont change. if edit__start_date is not null and edit__end_date is not null then update time_intervals set start_date = edit__start_date, end_date = edit__end_date where interval_id = edit__interval_id; - end if; + end if; - -- Update only the end date if not null even if start date is null + -- Update only the end date if not null even if start date is null if edit__start_date is not null and edit__end_date is null then update time_intervals set start_date = edit__start_date where interval_id = edit__interval_id; - end if; - - -- Update only the start date if not null even if end date is null + end if; + + -- Update only the start date if not null even if end date is null if edit__end_date is not null and edit__start_date is null - then + then update time_intervals - set end_date = edit__end_date - where interval_id = edit__interval_id; - end if; + set end_date = edit__end_date + where interval_id = edit__interval_id; + end if; - return 0; + return 0; end;' language 'plpgsql'; @@ -178,9 +178,9 @@ -- -- @return 0 (procedure dummy) -- - integer, -- time_intervals.interval_id%TYPE, - interval, - interval + integer, -- time_intervals.interval_id%TYPE, + interval, + interval ) returns integer as ' declare @@ -216,9 +216,9 @@ -- -- @return 0 (procedure dummy) -- - integer, -- time_intervals.interval_id%TYPE, - integer, - integer + integer, -- time_intervals.interval_id%TYPE, + integer, + integer ) returns integer as ' declare @@ -228,10 +228,10 @@ begin return time_interval__shift( - shift__interval_id, - to_interval(shift__start_offset,''days''), - to_interval(shift__end_offset,''days'') - ); + shift__interval_id, + to_interval(shift__start_offset,''days''), + to_interval(shift__end_offset,''days'') + ); end;' language 'plpgsql'; @@ -247,17 +247,17 @@ -- -- @return true if the two intervals overlap, false otherwise. -- - integer, -- time_intervals.interval_id%TYPE, - integer -- time_intervals.interval_id%TYPE + integer, -- time_intervals.interval_id%TYPE, + integer -- time_intervals.interval_id%TYPE ) returns boolean as ' declare overlaps_p__interval_id_1 alias for $1; overlaps_p__interval_id_2 alias for $2; - v_start_1 timestamptz; - v_start_2 timestamptz; - v_end_1 timestamptz; - v_end_2 timestamptz; + v_start_1 timestamptz; + v_start_2 timestamptz; + v_end_1 timestamptz; + v_end_2 timestamptz; begin -- Pull out the start and end dates and call the main overlaps_p. select start_date, end_date @@ -271,11 +271,11 @@ where interval_id = overlaps_p__interval_id_2; return time_interval__overlaps_p( - v_start_1, - v_end_1, - v_start_2, - v_end_2 - ); + v_start_1, + v_end_1, + v_start_2, + v_end_2 + ); end;' language 'plpgsql'; @@ -292,17 +292,17 @@ -- -- @return true if the interval bounded by start_date through end_date, false otherwise. -- - integer, -- time_intervals.interval_id%TYPE, - timestamptz, -- time_intervals.start_date%TYPE default null, - timestamptz -- time_intervals.end_date%TYPE default null + integer, -- time_intervals.interval_id%TYPE, + timestamptz, -- time_intervals.start_date%TYPE default null, + timestamptz -- time_intervals.end_date%TYPE default null ) returns boolean as ' declare overlaps_p__interval_id alias for $1; overlaps_p__start_date alias for $2; -- default null, overlaps_p__end_date alias for $3; -- default null - v_interval_start time_intervals.start_date%TYPE; - v_interval_end time_intervals.end_date%TYPE; + v_interval_start time_intervals.start_date%TYPE; + v_interval_end time_intervals.end_date%TYPE; begin -- Pull out the start and end date and call the main overlaps_p. select start_date, end_date @@ -311,11 +311,11 @@ where interval_id = overlaps_p__interval_id; return time_interval__overlaps_p( - v_interval_start, - v_interval_end, - overlaps_p__start_date, - overlaps_p__end_date - ); + v_interval_start, + v_interval_end, + overlaps_p__start_date, + overlaps_p__end_date + ); end;' language 'plpgsql'; @@ -333,17 +333,17 @@ -- -- @return true if intervals overlap, otherwise false. -- - timestamptz, -- time_intervals.start_date%TYPE, - timestamptz, -- time_intervals.end_date%TYPE, - timestamptz, -- time_intervals.start_date%TYPE, - timestamptz -- time_intervals.end_date%TYPE + timestamptz, -- time_intervals.start_date%TYPE, + timestamptz, -- time_intervals.end_date%TYPE, + timestamptz, -- time_intervals.start_date%TYPE, + timestamptz -- time_intervals.end_date%TYPE ) returns boolean as ' declare - overlaps_p__start_1 alias for $1; - overlaps_p__end_1 alias for $2; - overlaps_p__start_2 alias for $3; - overlaps_p__end_2 alias for $4; + overlaps_p__start_1 alias for $1; + overlaps_p__end_1 alias for $2; + overlaps_p__start_2 alias for $3; + overlaps_p__end_2 alias for $4; begin -- JS: Modified yet another deeply nested if-else-if @@ -353,7 +353,7 @@ then -- No overlap if 2nd interval starts after 1st ends if overlaps_p__end_1 < overlaps_p__start_2 - then + then return false; else return true; @@ -364,19 +364,19 @@ then -- No overlap if 2nd interval ends before 1st starts if overlaps_p__end_2 < overlaps_p__start_1 - then + then return false; else return true; - end if; + end if; end if; -- Okay, both start dates are not null if overlaps_p__start_1 <= overlaps_p__start_2 then -- 1st starts before 2nd if overlaps_p__end_1 < overlaps_p__start_2 - then + then -- No overlap if 1st ends before 2nd starts return false; else @@ -388,7 +388,7 @@ -- 1st starts after 2nd if overlaps_p__end_2 < overlaps_p__start_1 - then + then -- No overlap if 2nd ends before 1st starts return false; else @@ -412,10 +412,10 @@ -- -- @return true if intervals are equal, otherwise false. -- - integer, -- time_intervals.interval_id%TYPE, - integer -- time_intervals.interval_id%TYPE + integer, -- time_intervals.interval_id%TYPE, + integer -- time_intervals.interval_id%TYPE ) -returns boolean as ' -- return boolean +returns boolean as ' -- return boolean declare eq__interval_1_id alias for $1; eq__interval_2_id alias for $2; @@ -441,7 +441,7 @@ end;' language 'plpgsql'; -create function time_interval__copy( +create or replace function time_interval__copy( -- -- Creates a new copy of a time interval, offset by optional offset -- @@ -472,23 +472,24 @@ -- -- @return interval_id of the copied interval -- - integer, -- time_intervals.interval_id%TYPE, - interval + integer, -- time_intervals.interval_id%TYPE, + interval ) returns integer as ' -- time_intervals.interval_id%TYPE declare copy__interval_id alias for $1; copy__offset alias for $2; -- default 0 - interval_row time_intervals%ROWTYPE; + interval_row time_intervals%ROWTYPE; + v_foo timestamptz; begin select * into interval_row from time_intervals where interval_id = copy__interval_id; - + return time_interval__new( - interval_row.start_date + copy__offset, - interval_row.end_date + copy__offset - ); + (interval_row.start_date ::timestamp + copy__offset) :: timestamptz, + (interval_row.end_date ::timestamp + copy__offset) :: timestamptz + ); end;' language 'plpgsql'; @@ -503,17 +504,17 @@ -- integer ) -returns integer as ' -- return time_intervals.interval_id%TYPE +returns integer as ' -- return time_intervals.interval_id%TYPE declare copy__interval_id alias for $1; - v_query varchar; - v_result time_intervals.interval_id%TYPE; - rec_datecalc record; + v_query varchar; + v_result time_intervals.interval_id%TYPE; + rec_datecalc record; begin - return time_interval__copy( - copy__interval_id, - interval ''0 days'' - ); + return time_interval__copy( + copy__interval_id, + interval ''0 days'' + ); end;' language 'plpgsql'; @@ -530,19 +531,19 @@ -- -- @return interval_id of the copied interval -- - integer, -- time_intervals.interval_id%TYPE, + integer, -- time_intervals.interval_id%TYPE, integer ) -returns integer as ' -- time_intervals.interval_id%TYPE +returns integer as ' -- time_intervals.interval_id%TYPE declare copy__interval_id alias for $1; copy__offset alias for $2; -- default 0 begin return time_interval__copy( - copy__interval_id, - to_interval(copy__offset,''days'') - ); + copy__interval_id, + to_interval(copy__offset,''days'') + ); end;' language 'plpgsql'; @@ -617,32 +618,32 @@ -- -- @author W. Scott Meeks -- - -- @param interval_id Id of interval to be included/copied in timespan, - -- @param copy_p If true, make another copy of the interval, - -- else simply include the interval in the timespan + -- @param interval_id Id of interval to be included/copied in timespan, + -- @param copy_p If true, make another copy of the interval, + -- else simply include the interval in the timespan -- -- @return Id of new timespan -- - integer, -- time_intervals.interval_id%TYPE - boolean + integer, -- time_intervals.interval_id%TYPE + boolean ) -returns integer as ' -- timespans.timespan_id%TYPE +returns integer as ' -- timespans.timespan_id%TYPE declare - new__interval_id alias for $1; - new__copy_p alias for $2; - v_timespan_id timespans.timespan_id%TYPE; - v_interval_id time_intervals.interval_id%TYPE; + new__interval_id alias for $1; + new__copy_p alias for $2; + v_timespan_id timespans.timespan_id%TYPE; + v_interval_id time_intervals.interval_id%TYPE; begin - -- get a new id; + -- get a new id; select timespan_seq.nextval into v_timespan_id from dual; - if new__copy_p - then - -- JS: Note use of overloaded function (zero offset) - v_interval_id := time_interval__copy(new__interval_id); - else - v_interval_id := new__interval_id; - end if; + if new__copy_p + then + -- JS: Note use of overloaded function (zero offset) + v_interval_id := time_interval__copy(new__interval_id); + else + v_interval_id := new__interval_id; + end if; insert into timespans (timespan_id, interval_id) @@ -665,20 +666,20 @@ -- JS: COMPATIBILITY WITH ORIGINAL VERSION. I DO NOT THINK TRUE -- JS: SHOULD BE THE DEFAULT. -- - -- @param interval_id Id of interval to be copied in timespan, + -- @param interval_id Id of interval to be copied in timespan, -- -- @return Id of new timespan -- - integer -- time_intervals.interval_id%TYPE + integer -- time_intervals.interval_id%TYPE ) -returns integer as ' -- timespans.timespan_id%TYPE +returns integer as ' -- timespans.timespan_id%TYPE declare - new__interval_id alias for $1; + new__interval_id alias for $1; begin return timespan__new( - new__interval_id, - true - ); + new__interval_id, + true + ); end;' language 'plpgsql'; @@ -689,15 +690,15 @@ -- given a start date and end date. A new time interval with the -- start and end dates is automatically created. -- - -- @param start_date Start date of interval to be included/copied in timespan, - -- @param end_date End date of interval to be included/copied in timespan, + -- @param start_date Start date of interval to be included/copied in timespan, + -- @param end_date End date of interval to be included/copied in timespan, -- -- @return Id of new timespan -- - timestamptz, -- time_intervals.start_date%TYPE default null, - timestamptz -- time_intervals.end_date%TYPE default null + timestamptz, -- time_intervals.start_date%TYPE default null, + timestamptz -- time_intervals.end_date%TYPE default null ) -returns integer as ' -- timespans.timespan_id%TYPE +returns integer as ' -- timespans.timespan_id%TYPE declare new__start_date alias for $1; -- default null, new__end_date alias for $2; -- default null @@ -754,21 +755,21 @@ -- -- @param timespan_id Id of timespan to join to -- @param interval_id Id of interval to include/copy into timespan - -- @param copy_p If true, make a new copy of he interval for inclusion - -- into the timespan, otherwise simply include the interval + -- @param copy_p If true, make a new copy of he interval for inclusion + -- into the timespan, otherwise simply include the interval -- -- @return Id of interval being joined -- - integer, -- timespans.timespan_id%TYPE, - integer, -- time_intervals.interval_id%TYPE, + integer, -- timespans.timespan_id%TYPE, + integer, -- time_intervals.interval_id%TYPE, boolean ) returns integer as ' -- time_intervals.interval_id%TYPE declare join_interval__timespan_id alias for $1; join_interval__interval_id alias for $2; join_interval__copy_p alias for $3; -- default true - v_interval_id time_intervals.interval_id%TYPE; + v_interval_id time_intervals.interval_id%TYPE; begin if join_interval__copy_p then v_interval_id := time_interval__copy(join_interval__interval_id); @@ -802,11 +803,11 @@ -- -- @return Id of interval being joined -- - integer, -- timespans.timespan_id%TYPE, - timestamptz, -- time_intervals.start_date%TYPE - timestamptz -- time_intervals.end_date%TYPE + integer, -- timespans.timespan_id%TYPE, + timestamptz, -- time_intervals.start_date%TYPE + timestamptz -- time_intervals.end_date%TYPE ) -returns integer as ' -- time_intervals.interval_id%TYPE +returns integer as ' -- time_intervals.interval_id%TYPE declare join__timespan_id alias for $1; join__start_date alias for $2; -- default null, @@ -816,10 +817,10 @@ -- JS: This will create a new interval with start_date and end_date -- JS: so we might as well return the interval id return timespan__join_interval( - join__timespan_id, - time_interval__new(join__start_date, join__end_date), - false - ); + join__timespan_id, + time_interval__new(join__start_date, join__end_date), + false + ); end;' language 'plpgsql'; @@ -840,15 +841,15 @@ -- -- @return Id of last interval in timespan being joined -- - integer, -- timespans.timespan_id%TYPE, - integer -- timespans.timespan_id%TYPE + integer, -- timespans.timespan_id%TYPE, + integer -- timespans.timespan_id%TYPE ) -returns integer as ' -- time_intervals.interval_id%TYPE +returns integer as ' -- time_intervals.interval_id%TYPE declare join__timespan_1_id alias for $1; join__timespan_2_id alias for $2; - v_interval_id time_intervals.interval_id%TYPE; - rec_timespan record; + v_interval_id time_intervals.interval_id%TYPE; + rec_timespan record; begin -- Loop over intervals in 2nd timespan, join with 1st. for rec_timespan in @@ -857,10 +858,10 @@ where timespan_id = join__timespan_2_id loop v_interval_id := timespan__join_interval( - join__timespan_1_id, - rec_timespan.interval_id, - false - ); + join__timespan_1_id, + rec_timespan.interval_id, + false + ); end loop; -- JS: Return the last interval id joined. Not very useful, since there may be @@ -881,8 +882,8 @@ -- -- @return 0 (procedure dummy) -- - integer, -- timespans.timespan_id%TYPE, - integer -- time_intervals.interval_id%TYPE + integer, -- timespans.timespan_id%TYPE, + integer -- time_intervals.interval_id%TYPE ) returns integer as ' declare @@ -911,12 +912,12 @@ -- -- @return true if interval is in timespan set, otherwise false. -- - integer -- timespans.timespan_id%TYPE + integer -- timespans.timespan_id%TYPE ) returns boolean as ' declare exists_p__timespan_id alias for $1; - v_result integer; + v_result integer; begin -- Only need to check if any rows exist. select count(*) @@ -945,20 +946,20 @@ -- -- @return true if timespan has more than one interval, otherwise false. -- - integer -- timespans.timespan_id%TYPE + integer -- timespans.timespan_id%TYPE ) returns boolean as ' declare multi_interval_p__timespan_id alias for $1; - v_result boolean; + v_result boolean; begin -- ''f'' if 0 or 1 intervals, ''t'' otherwise -- use the simple case syntax select (case count(timespan_id) - when 0 then false - when 1 then false - else true - end) + when 0 then false + when 1 then false + else true + end) into v_result from timespans where timespan_id = multi_interval_p__timespan_id; @@ -979,26 +980,26 @@ -- -- @return true if interval overlaps with anyinterval in timespan, otherwise false. -- - integer, -- timespans.timespan_id%TYPE, - integer -- time_intervals.interval_id%TYPE default null + integer, -- timespans.timespan_id%TYPE, + integer -- time_intervals.interval_id%TYPE default null ) returns boolean as ' declare overlaps_interval_p__timespan_id alias for $1; overlaps_interval_p__interval_id alias for $2; -- default null - v_start_date timestamptz; - v_end_date timestamptz; + v_start_date timestamptz; + v_end_date timestamptz; begin select start_date, end_date into v_start_date, v_end_date from time_intervals where interval_id = overlaps_interval_p__interval_id; return timespan__overlaps_p( - overlaps_interval_p__timespan_id, - v_start_date, - v_end_date - ); + overlaps_interval_p__timespan_id, + v_start_date, + v_end_date + ); end;' language 'plpgsql'; @@ -1016,14 +1017,14 @@ -- @return true if timespan overlaps with second timespan, otherwise false. -- integer, -- timespans.timespan_id%TYPE, - integer -- timespans.timespan_id%TYPE + integer -- timespans.timespan_id%TYPE ) returns boolean as ' declare overlaps_p__timespan_1_id alias for $1; overlaps_p__timespan_2_id alias for $2; - v_result boolean; - rec_timespan record; + v_result boolean; + rec_timespan record; begin -- Loop over 2nd timespan, checking each interval against 1st for rec_timespan in @@ -1032,9 +1033,9 @@ where timespan_id = overlaps_p__timespan_2_id loop v_result := timespan__overlaps_interval_p( - overlaps_p__timespan_1_id, - rec_timespan.interval_id - ); + overlaps_p__timespan_1_id, + rec_timespan.interval_id + ); if v_result then return true; end if; @@ -1058,17 +1059,17 @@ -- -- @return true if interval with start and end dates overlaps with second timespan, otherwise false. -- - integer, -- timespans.timespan_id%TYPE, - timestamptz, -- time_intervals.start_date%TYPE - timestamptz -- time_intervals.end_date%TYPE + integer, -- timespans.timespan_id%TYPE, + timestamptz, -- time_intervals.start_date%TYPE + timestamptz -- time_intervals.end_date%TYPE ) returns boolean as ' declare overlaps_p__timespan_id alias for $1; overlaps_p__start_date alias for $2; -- default null, overlaps_p__end_date alias for $3; -- default null - v_result boolean; - rec_timespan record; + v_result boolean; + rec_timespan record; begin -- Loop over each interval in timespan, checking against dates. for rec_timespan in @@ -1077,10 +1078,10 @@ where timespan_id = overlaps_p__timespan_id loop v_result := time_interval__overlaps_p( - rec_timespan.interval_id, - overlaps_p__start_date, - overlaps_p__end_date - ); + rec_timespan.interval_id, + overlaps_p__start_date, + overlaps_p__end_date + ); if v_result then return true; @@ -1104,16 +1105,16 @@ -- -- @return Id of copied timespan -- - integer, -- timespans.timespan_id%TYPE, - interval + integer, -- timespans.timespan_id%TYPE, + interval ) -returns integer as ' -- timespans.timespan_id%TYPE +returns integer as ' -- timespans.timespan_id%TYPE declare - copy__timespan_id alias for $1; - copy__offset alias for $2; -- default 0 - rec_timespan record; - v_interval_id timespans.interval_id%TYPE; - v_timespan_id timespans.timespan_id%TYPE; + copy__timespan_id alias for $1; + copy__offset alias for $2; -- default 0 + rec_timespan record; + v_interval_id timespans.interval_id%TYPE; + v_timespan_id timespans.timespan_id%TYPE; begin v_timespan_id := null; @@ -1124,20 +1125,20 @@ where timespan_id = copy__timespan_id loop v_interval_id := time_interval__copy( - rec_timespan.interval_id, - copy__offset - ); + rec_timespan.interval_id, + copy__offset + ); if v_timespan_id is null - then - -- JS: NOTE DEFAULT BEHAVIOR OF timespan__new + then + -- JS: NOTE DEFAULT BEHAVIOR OF timespan__new v_timespan_id := timespan__new(v_interval_id); else - -- no copy, use whatever is generated by time_interval__copy + -- no copy, use whatever is generated by time_interval__copy PERFORM timespan__join_interval( - v_timespan_id, - v_interval_id, - false); + v_timespan_id, + v_interval_id, + false); end if; end loop; @@ -1156,20 +1157,20 @@ -- -- @return Id of copied timespan -- - integer -- timespans.timespan_id%TYPE, + integer -- timespans.timespan_id%TYPE, ) -returns integer as ' -- timespans.timespan_id%TYPE +returns integer as ' -- timespans.timespan_id%TYPE declare - copy__timespan_id alias for $1; + copy__timespan_id alias for $1; begin return timespan__copy( - copy__timespan_id, - interval ''0 days'' - ); + copy__timespan_id, + interval ''0 days'' + ); end;' language 'plpgsql'; - + create function timespan__copy ( -- @@ -1182,18 +1183,18 @@ -- -- @return Id of copied timespan -- - integer, -- timespans.timespan_id%TYPE, + integer, -- timespans.timespan_id%TYPE, integer ) -returns integer as ' -- timespans.timespan_id%TYPE +returns integer as ' -- timespans.timespan_id%TYPE declare - copy__timespan_id alias for $1; - copy__offset alias for $2; + copy__timespan_id alias for $1; + copy__offset alias for $2; begin return timespan__copy( - copy__timespan_id, - to_interval(copy__offset,''days'') - ); + copy__timespan_id, + to_interval(copy__offset,''days'') + ); end;' language 'plpgsql';