diff --git a/routes/baseline/gen_baseline.sql b/routes/baseline/gen_baseline.sql index 9bebc34..1b3054b 100644 --- a/routes/baseline/gen_baseline.sql +++ b/routes/baseline/gen_baseline.sql @@ -39,7 +39,7 @@ SELECT string_agg( 'LEFT OUTER JOIN fc.perd '||func||' ON'|| $$ - $$||'(o.'||fkey||' + interval '||format('%L',_interval) ||' )::date <@ '||func||'.drange' + $$||'(o.'||format('%I',cname)||' + interval '||format('%L',_interval) ||' )::date <@ '||func||'.drange' ,E'\n') INTO _perd_joins @@ -75,7 +75,7 @@ SELECT ELSE --use the date key but increment by the target interval --this assumes that the primary key for the func is a date, but it has to be or it wont join anyways - 'o.'||fkey||' + interval '||format('%L',_interval) ||' AS '||fkey + 'o.'||format('%I',cname)||' + interval '||format('%L',_interval) ||' AS '||format('%I',cname) END ELSE 'o.'||format('%I',cname)