From 6462e742d9798ccca37a6b66c92718f3d210e3b3 Mon Sep 17 00:00:00 2001 From: Paul Trowbridge Date: Fri, 1 Apr 2022 16:29:36 -0400 Subject: [PATCH] fc.sql table is still missing from initial schema setup, shoudl be fc.sql (cmd, t) --- routes/scale/gen_scale.sql | 3 ++- routes/scale/generate_route_sql.sh | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/routes/scale/gen_scale.sql b/routes/scale/gen_scale.sql index dc47225..77d4c18 100644 --- a/routes/scale/gen_scale.sql +++ b/routes/scale/gen_scale.sql @@ -21,6 +21,7 @@ DECLARE BEGIN -----------------populate application variables-------------------------------------------- +--need a handler if any of these are not specified-- SELECT (SELECT cname FROM fc.target_meta WHERE appcol = 'order_date') INTO _order_date; SELECT (SELECT cname FROM fc.target_meta WHERE appcol = 'ship_date') INTO _ship_date; SELECT (SELECT cname FROM fc.target_meta WHERE appcol = 'order_status') INTO _order_status; @@ -180,7 +181,7 @@ INTO RAISE NOTICE '%', _sql; -INSERT INTO fc.sql SELECT 'scale', _sql ON CONFLICT ON CONSTRAINT sql_pkey DO UPDATE SET t = EXCLUDED.t; +INSERT INTO fc.sql SELECT 'scale', _sql ON CONFLICT (cmd) DO UPDATE SET t = EXCLUDED.t; END $func$; diff --git a/routes/scale/generate_route_sql.sh b/routes/scale/generate_route_sql.sh index e53dd62..98d5eb1 100755 --- a/routes/scale/generate_route_sql.sh +++ b/routes/scale/generate_route_sql.sh @@ -1,4 +1,4 @@ # execure the sql for scale which builds the sql and inserts into a table -$PGD -f gen_scale.sql +$PG -f gen_scale.sql # pull the sql out of the table and write it to route directory -$PGD -c "SELECT t FROM fc.sql WHERE cmd = 'scale'" -t -A -o scale.sql +$PG -c "SELECT t FROM fc.sql WHERE cmd = 'scale'" -t -A -o scale.sql