period mods

This commit is contained in:
Paul Trowbridge 2018-09-20 15:57:02 -04:00
parent 9e05d8261f
commit 10223cf72f
3 changed files with 11 additions and 3 deletions

View File

@ -34,7 +34,12 @@ COMMENT ON COLUMN evt.acct.prop IS 'properties';
CREATE TABLE evt.fspr ( CREATE TABLE evt.fspr (
id ltree id ltree
,dur tstzrange ,dur tstzrange
); )
COMMENT ON COLUMN evt.fspr.id IS 'fiscal period';
COMMENT ON COLUMN evt.fspr.dur IS 'duration of period as timestamp range';
CREATE INDEX id_gist ON evt.fspr USING GIST (id);
--------------------------relational ledger------------------------------------------ --------------------------relational ledger------------------------------------------

View File

@ -36,6 +36,6 @@ SELECT
)::ltree t2 )::ltree t2
,tstzrange(gs.d,gs.d + '1 month'::interval) r ,tstzrange(gs.d,gs.d + '1 month'::interval) r
FROM FROM
generate_series('2018-01-01 00:00'::timestamptz,'2099-12-01 00:00'::timestamptz,'1 month') gs(d) generate_series('2018-01-01 00:00'::timestamptz,'2099-12-01 00:00'::timestamptz,'1 day') gs(d)
INNER JOIN m ON INNER JOIN m ON
m.cm = extract(month from gs.d) m.cm = extract(month from gs.d)

View File

@ -3,3 +3,6 @@ CREATE TABLE evt.fspr (
id ltree id ltree
,dur tstzrange ,dur tstzrange
) )
CREATE INDEX id_gist ON evt.fspr USING GIST (id);