From de2fdc869fe46891418654799b017c372de511e6 Mon Sep 17 00:00:00 2001 From: Paul Trowbridge Date: Thu, 20 Sep 2018 22:39:34 -0400 Subject: [PATCH] specify fspr not null so that a left join null result forces it to bomb --- db_deploy.sql | 2 +- schema/tables/gl.sql | 4 ++-- schema/triggers/gl_insert.sql | 0 3 files changed, 3 insertions(+), 3 deletions(-) create mode 100644 schema/triggers/gl_insert.sql diff --git a/db_deploy.sql b/db_deploy.sql index 5c34ac0..0c4b1bb 100644 --- a/db_deploy.sql +++ b/db_deploy.sql @@ -49,7 +49,7 @@ CREATE TABLE evt.gl ( ,pstmp timestamptz DEFAULT CURRENT_TIMESTAMP --populates by trigger join to evt.fspr ,tstmp timestamptz - ,fspr ltree REFERENCES evt.fspr (id) + ,fspr ltree NOT NULL REFERENCES evt.fspr (id) ,amount numeric (12,2) ,glline INT ,bprkeys JSONB diff --git a/schema/tables/gl.sql b/schema/tables/gl.sql index 7f750dc..27d23ec 100644 --- a/schema/tables/gl.sql +++ b/schema/tables/gl.sql @@ -1,5 +1,5 @@ --------------------------relational ledger------------------------------------------ - +--DROP TABLE evt.gl CREATE TABLE evt.gl ( id INT GENERATED ALWAYS AS IDENTITY PRIMARY KEY ,bprid INT REFERENCES evt.bpr (id) @@ -7,7 +7,7 @@ CREATE TABLE evt.gl ( ,pstmp timestamptz DEFAULT CURRENT_TIMESTAMP --populates by trigger join to evt.fspr ,tstmp timestamptz - ,fspr ltree REFERENCES evt.fspr (id) + ,fspr ltree NOT NULL REFERENCES evt.fspr (id) ,amount numeric (12,2) ,glline INT ,bprkeys JSONB diff --git a/schema/triggers/gl_insert.sql b/schema/triggers/gl_insert.sql new file mode 100644 index 0000000..e69de29