several type conversion required
This commit is contained in:
parent
de2fdc869f
commit
bd26f4ab2f
@ -68,7 +68,7 @@ COMMENT ON COLUMN evt.gl.bprkeys IS 'extract from initial basic pecuniary record
|
|||||||
|
|
||||||
CREATE TABLE evt.bal (
|
CREATE TABLE evt.bal (
|
||||||
acct ltree REFERENCES evt.acct(acct)
|
acct ltree REFERENCES evt.acct(acct)
|
||||||
,perd ltree
|
,perd ltree REFERENCES evt.fspr(id)
|
||||||
,obal numeric(12,2)
|
,obal numeric(12,2)
|
||||||
,debits numeric(12,2)
|
,debits numeric(12,2)
|
||||||
,credits numeric(12,2)
|
,credits numeric(12,2)
|
||||||
@ -117,7 +117,7 @@ CREATE OR REPLACE FUNCTION evt.log_insert() RETURNS trigger
|
|||||||
,ex_gl_line AS (
|
,ex_gl_line AS (
|
||||||
SELECT
|
SELECT
|
||||||
id
|
id
|
||||||
,gl_line->>'account' account
|
,(gl_line->>'account')::ltree account
|
||||||
,(gl_line->>'amount')::numeric amount
|
,(gl_line->>'amount')::numeric amount
|
||||||
,gl_rownum
|
,gl_rownum
|
||||||
--aggregate all the path references back to the gl line
|
--aggregate all the path references back to the gl line
|
||||||
@ -144,15 +144,15 @@ CREATE OR REPLACE FUNCTION evt.log_insert() RETURNS trigger
|
|||||||
INSERT INTO
|
INSERT INTO
|
||||||
evt.gl (bprid,acct, amount,tstmp , fspr, glline, bprkeys)
|
evt.gl (bprid,acct, amount,tstmp , fspr, glline, bprkeys)
|
||||||
SELECT
|
SELECT
|
||||||
id
|
e.id
|
||||||
,account
|
,e.account
|
||||||
,amount
|
,e.amount
|
||||||
,(bprkeys->>'date')::timestamptz
|
,(e.bprkeys->>'date')::timestamptz
|
||||||
,p.fspr
|
,p.id
|
||||||
,gl_rownum
|
,e.gl_rownum
|
||||||
,bprkeys
|
,e.bprkeys
|
||||||
FROM
|
FROM
|
||||||
ex_gl_line
|
ex_gl_line e
|
||||||
LEFT OUTER JOIN evt.fspr p ON
|
LEFT OUTER JOIN evt.fspr p ON
|
||||||
p.dur @> (bprkeys->>'date')::timestamptz;
|
p.dur @> (bprkeys->>'date')::timestamptz;
|
||||||
RETURN NULL;
|
RETURN NULL;
|
||||||
@ -164,6 +164,4 @@ CREATE TRIGGER log_insert
|
|||||||
AFTER INSERT ON evt.bpr
|
AFTER INSERT ON evt.bpr
|
||||||
REFERENCING NEW TABLE AS ins
|
REFERENCING NEW TABLE AS ins
|
||||||
FOR EACH STATEMENT
|
FOR EACH STATEMENT
|
||||||
EXECUTE PROCEDURE evt.log_insert();
|
EXECUTE PROCEDURE evt.log_insert();
|
||||||
|
|
||||||
COMMIT;
|
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
CREATE TABLE evt.bal (
|
CREATE TABLE evt.bal (
|
||||||
acct ltree REFERENCES evt.acct(acct)
|
acct ltree REFERENCES evt.acct(acct)
|
||||||
,perd ltree
|
,perd ltree REFERENCES evt.fspr(id)
|
||||||
,obal numeric(12,2)
|
,obal numeric(12,2)
|
||||||
,debits numeric(12,2)
|
,debits numeric(12,2)
|
||||||
,credits numeric(12,2)
|
,credits numeric(12,2)
|
||||||
|
@ -34,7 +34,7 @@ CREATE OR REPLACE FUNCTION evt.log_insert() RETURNS trigger
|
|||||||
,ex_gl_line AS (
|
,ex_gl_line AS (
|
||||||
SELECT
|
SELECT
|
||||||
id
|
id
|
||||||
,gl_line->>'account' account
|
,(gl_line->>'account')::ltree account
|
||||||
,(gl_line->>'amount')::numeric amount
|
,(gl_line->>'amount')::numeric amount
|
||||||
,gl_rownum
|
,gl_rownum
|
||||||
--aggregate all the path references back to the gl line
|
--aggregate all the path references back to the gl line
|
||||||
|
Loading…
Reference in New Issue
Block a user