Changeset e5e4b416e07adf6285bb5140316e5624a8f44224

Show
Ignore:
Timestamp:
10/21/09 14:22:06 (5 years ago)
Author:
Theo Schlossnagle <jesus@omniti.com>
git-committer:
Theo Schlossnagle <jesus@omniti.com> 1256134926 +0000
git-parent:

[f0400f824c10ceac576427c5023429506384cd8a]

git-author:
Theo Schlossnagle <jesus@omniti.com> 1256134926 +0000
Message:

fix varset fetching

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • sql/scaffolding.sql

    rdfd06d8 re5e4b41  
    4242\i sprocs/noit.metric_text_archive_log_changes.sql 
    4343\i sprocs/noit.update_metric_summary_fulltext.sql 
     44\i sprocs/noit.update_check_currently.sql 
     45\i sprocs/noit.update_mns_via_check_currently.sql 
    4446\i sprocs/noit.update_mns_via_check_tag.sql 
    4547\i sprocs/noit.update_mns_via_metric_tag.sql 
     
    5153\i sprocs/stratcon.init_metric_numeric_rollup_5m.sql 
    5254\i sprocs/stratcon.map_uuid_to_sid.sql 
    53 \i sprocs/stratcon.metric_name_summary_tsvector.sql 
    5455\i sprocs/stratcon.window_robust_derive.sql 
    5556\i sprocs/stratcon.update_config.sql 
     57\i sprocs/stratcon.rollup_metric_numeric_5m.sql 
     58\i sprocs/stratcon.metric_name_summary_compile_fts_data.sql 
     59 
    5660\i sprocs/prism.add_graph_tags.sql 
    5761\i sprocs/prism.add_tags.sql 
  • sql/sprocs/stratcon.fetch_varset.sql

    rdfd06d8 re5e4b41  
    1313  end if; 
    1414 
    15   return query select * from stratcon._fetch_varset(v_sid::integer, in_name, in_start_time, in_end_time, in_hopeful_nperiods); 
     15  return query select * from stratcon.fetch_varset(v_sid::integer, in_name, in_start_time, in_end_time, in_hopeful_nperiods); 
    1616end 
    1717$BODY$ 
     
    2020GRANT EXECUTE ON FUNCTION stratcon.fetch_varset(uuid, text, timestamp with time zone, timestamp with time zone, integer) TO stratcon; 
    2121 
    22 -- Function: stratcon._fetch_varset(integer, text, timestamp with time zone, timestamp with time zone, integer) 
     22-- Function: stratcon.fetch_varset(integer, text, timestamp with time zone, timestamp with time zone, integer) 
    2323 
    24 CREATE OR REPLACE FUNCTION stratcon._fetch_varset(in_sid integer, in_name text, in_start_time timestamp with time zone, in_end_time timestamp with time zone, in_hopeful_nperiods integer) 
     24CREATE OR REPLACE FUNCTION stratcon.fetch_varset(in_sid integer, in_name text, in_start_time timestamp with time zone, in_end_time timestamp with time zone, in_hopeful_nperiods integer) 
    2525  RETURNS SETOF noit.metric_text_changelog AS 
    2626$BODY$declare 
     
    3030  v_start_text text; 
    3131  v_next_text text; 
     32  v_prev_text boolean; 
    3233  v_end_adj timestamptz; 
    3334  v_change_row noit.metric_text_changelog%rowtype; 
    3435begin 
    3536  -- Map out uuid to an sid. 
     37  v_prev_text := false; 
    3638  v_sid := in_sid; 
    3739 
     
    8789  order by whence asc 
    8890  loop 
     91 
    8992    v_next_text := v_change_row.value; 
    90     if v_change_row.value is not null and 
    91        v_start_text != v_change_row.value then 
     93    if v_change_row.value is not null and not v_prev_text and 
     94       (v_start_text is null or v_start_text <> v_change_row.value) then 
    9295      v_change_row.value := coalesce(v_start_text, '[unset]') || ' -> ' || coalesce(v_change_row.value, '[unset]'); 
    9396    else 
    94       v_change_row.value := v_start_text
     97      v_change_row.value := coalesce(v_change_row.value, '[unset]')
    9598    end if; 
    96     if v_next_text is not null then 
     99    if v_start_text is null and v_next_text is not null then 
    97100      v_start_text := v_next_text; 
    98101    end if; 
     102    v_prev_text := true; 
    99103    return next v_change_row; 
    100104  end loop; 
     
    115119  LANGUAGE 'plpgsql' SECURITY DEFINER; 
    116120  
    117 GRANT EXECUTE ON FUNCTION stratcon._fetch_varset(integer, text, timestamp with time zone, timestamp with time zone, integer) TO stratcon; 
     121GRANT EXECUTE ON FUNCTION stratcon.fetch_varset(integer, text, timestamp with time zone, timestamp with time zone, integer) TO stratcon; 
    118122