new column list to increment date periods
This commit is contained in:
parent
a8419e9fd6
commit
55dcb65a17
27
sql/col_interval.sql
Normal file
27
sql/col_interval.sql
Normal file
@ -0,0 +1,27 @@
|
||||
DO
|
||||
$$
|
||||
DECLARE
|
||||
clist text;
|
||||
|
||||
BEGIN
|
||||
-------------------------------build a column list----------------------------------------
|
||||
SELECT
|
||||
string_agg(
|
||||
format('%I',cname) || CASE WHEN func IN ('odate','sdate') THEN ' + interval ''1 year''' ELSE '' END,E'\n,' ORDER BY opos ASC)
|
||||
INTO
|
||||
clist
|
||||
FROM
|
||||
fc.target_meta
|
||||
WHERE
|
||||
func NOT IN ('version');
|
||||
|
||||
RAISE NOTICE 'build list: %',clist;
|
||||
|
||||
CREATE TEMP TABLE sql(t text);
|
||||
|
||||
INSERT INTO sql SELECT clist;
|
||||
|
||||
END
|
||||
$$;
|
||||
|
||||
select * from sql;
|
Loading…
Reference in New Issue
Block a user