Changeset e0c506312941e8582aba0e588fbd7826a08b213f

Show
Ignore:
Timestamp:
03/17/10 15:43:46 (4 years ago)
Author:
Robert Treat <robert@omniti.com>
git-committer:
Robert Treat <robert@omniti.com> 1268840626 +0000
git-parent:

[373974a6fbcec5a328d77ddbfa850b1682f58b0b]

git-author:
Robert Treat <robert@omniti.com> 1268840626 +0000
Message:

make this forward compatible with postgres 9 and potential keyword reservations

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • sql/sprocs/stratcon.choose_window.sql

    r3b7392c re0c5063  
    1 -- Function: stratcon.choose_window(timestamp with time zone, timestamp with time zone, integer) 
     1-- Function: stratcon.choose_v_window(timestamp with time zone, timestamp with time zone, integer) 
    22 
    33CREATE OR REPLACE FUNCTION stratcon.choose_window(IN in_start_time timestamp with time zone, IN in_end_time timestamp with time zone, IN in_hopeful_nperiods integer, OUT tablename text, OUT period interval, OUT nperiods integer) 
     
    55$BODY$ 
    66declare 
    7   window record; 
     7  v_window record; 
    88begin 
    99  -- Figure out which table we should be looking in 
    10   for window in 
     10  for v_window in 
    1111    select atablename, aperiod, anperiods 
    1212    from (select aperiod, round(iv/isec) ::integer as anperiods, atablename, 
     
    4040  limit 1 
    4141  loop 
    42     tablename := window.atablename; 
    43     period := window.aperiod; 
    44     nperiods := window.anperiods; 
     42    tablename := v_window.atablename; 
     43    period := v_window.aperiod; 
     44    nperiods := v_window.anperiods; 
    4545    return next; 
    4646  end loop;