From ab96a07e70f0861f927b8b67d1520ce651c8bfb2 Mon Sep 17 00:00:00 2001 From: Paul Trowbridge Date: Thu, 20 Sep 2018 20:04:08 -0400 Subject: [PATCH] merge period approaches --- schema/suggested_data/periods.sql | 21 ++++++++++++++++ schema/suggested_date/periods.sql | 41 ------------------------------- 2 files changed, 21 insertions(+), 41 deletions(-) delete mode 100644 schema/suggested_date/periods.sql diff --git a/schema/suggested_data/periods.sql b/schema/suggested_data/periods.sql index b437ecd..39553da 100644 --- a/schema/suggested_data/periods.sql +++ b/schema/suggested_data/periods.sql @@ -30,3 +30,24 @@ FROM m.calendar_month = extract(month from gs.d) ORDER BY gs.d ASC +/* +INSERT INTO + evt.fspr +SELECT + --TO_CHAR(gs.d,'YYYY.MM.DD')::ltree t1 + ( + --year + to_char(extract(year from gs.d),'FM0000') + --quarter + ||'.'||to_char(m.fq,'FM00') + --month + ||'.'||to_char(m.fm,'FM00') + --day + ||'.'||to_char(extract(day from gs.d),'FM00') + )::ltree t2 + ,tstzrange(gs.d,gs.d + '1 month'::interval) r +FROM + generate_series('2018-01-01 00:00'::timestamptz,'2099-12-01 00:00'::timestamptz,'1 day') gs(d) + INNER JOIN m ON + m.cm = extract(month from gs.d) +*/ \ No newline at end of file diff --git a/schema/suggested_date/periods.sql b/schema/suggested_date/periods.sql deleted file mode 100644 index dcfee0d..0000000 --- a/schema/suggested_date/periods.sql +++ /dev/null @@ -1,41 +0,0 @@ -WITH ---startign month -m as ( - SELECT - * - FROM - ( - VALUES - (1,1,1) - ,(2,2,1) - ,(3,3,1) - ,(4,4,2) - ,(5,5,2) - ,(6,6,2) - ,(7,7,3) - ,(8,8,3) - ,(9,9,3) - ,(10,10,4) - ,(11,11,4) - ,(12,12,4) - ) X (cm,fm,fq) -) -INSERT INTO - evt.fspr -SELECT - --TO_CHAR(gs.d,'YYYY.MM.DD')::ltree t1 - ( - --year - to_char(extract(year from gs.d),'FM0000') - --quarter - ||'.'||to_char(m.fq,'FM00') - --month - ||'.'||to_char(m.fm,'FM00') - --day - ||'.'||to_char(extract(day from gs.d),'FM00') - )::ltree t2 - ,tstzrange(gs.d,gs.d + '1 month'::interval) r -FROM - generate_series('2018-01-01 00:00'::timestamptz,'2099-12-01 00:00'::timestamptz,'1 day') gs(d) - INNER JOIN m ON - m.cm = extract(month from gs.d) \ No newline at end of file