use the actual column name

This commit is contained in:
Paul Trowbridge 2022-04-05 20:58:22 -04:00
parent c97e92f3bc
commit 66813bb156

View File

@ -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)