Compare commits

..

No commits in common. "c61729e0175575c6453d354191370d823d6e46b4" and "993a476bea62c36be30afb3b00289f83ca820fbf" have entirely different histories.

6 changed files with 31 additions and 50 deletions

View File

@ -461,8 +461,8 @@ BEGIN
CASE ISNULL(q.last_source, '') CASE ISNULL(q.last_source, '')
WHEN 'mrq' THEN 'Similar Quote' WHEN 'mrq' THEN 'Similar Quote'
WHEN 'mrs' THEN 'Similar Sale' WHEN 'mrs' THEN 'Similar Sale'
WHEN 'dsq' THEN 'Last Quote' WHEN 'dsq' THEN 'Last Sale'
WHEN 'dss' THEN 'Last Sale' WHEN 'dss' THEN 'Last Quote'
ELSE '' ELSE ''
END END
ELSE 'No Recent' ELSE 'No Recent'
@ -596,5 +596,5 @@ BEGIN
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
-- Final: Return all calculated fields and JSON payloads. -- Final: Return all calculated fields and JSON payloads.
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
SELECT guidance_price, ui_json FROM @queue; SELECT guidance_price, ui_json FROM @queue;
END; END;

View File

@ -265,7 +265,7 @@ BEGIN
,_tmath ,_tmath
,_volume_range ,_volume_range
FROM FROM
pricequote.target_prices_base tp pricequote.target_prices tp
WHERE WHERE
tp.stlc = _stlc tp.stlc = _stlc
AND tp.ds = _v1ds AND tp.ds = _v1ds
@ -283,7 +283,7 @@ BEGIN
INTO INTO
_tprice_last _tprice_last
FROM FROM
pricequote.target_prices_base tp pricequote.target_prices tp
WHERE WHERE
tp.stlc = _stlc tp.stlc = _stlc
AND tp.ds = _last_dataseg AND tp.ds = _last_dataseg

View File

@ -14,3 +14,28 @@ GRANT SELECT, INSERT, UPDATE, DELETE ON pricequote.target_prices TO PUBLIC;
DROP TABLE IF EXISTS import.core_target; DROP TABLE IF EXISTS import.core_target;
CREATE TABLE import.core_target AS (SELECT * FROM pricequote.core_target); CREATE TABLE import.core_target AS (SELECT * FROM pricequote.core_target);
WITH
expand AS (
SELECT
c.compset,
c.stlc,
c.floor,
b.ds,
b.chan,
b.tier,
b.vol,
b.val,
b.price,
json_pretty(to_json(b.math)) math
FROM
pricequote.core_target c
LEFT JOIN LATERAL pricequote.build_pricing_path_base (options||jsonb_build_object('entity','Anchor','attr',c.stlc,'val',c.floor,'func','Price')) b ON b.lastflag
)
-- select count(*) from expand
INSERT INTO
pricequote.target_prices_base
SELECT
*
FROM
expand

View File

@ -1,27 +0,0 @@
DELETE FROM pricequote.target_prices_base;
WITH
expand AS (
SELECT
c.compset,
c.stlc,
c.floor,
b.ds,
b.chan,
b.tier,
b.vol,
b.val,
b.price,
b.math math
FROM
pricequote.core_target c
LEFT JOIN LATERAL pricequote.build_pricing_path_base (options||jsonb_build_object('entity','Anchor','attr',c.stlc,'val',c.floor,'func','Price')) b ON b.lastflag
)
-- select count(*) from expand
INSERT INTO
pricequote.target_prices_base
SELECT
*
FROM
expand;

View File

@ -1,17 +0,0 @@
DROP TABLE pricequote.target_prices_base CASCADE;
CREATE TABLE pricequote.target_prices_base (
compset TEXT NOT NULL,
stlc TEXT NOT NULL,
floor NUMERIC NOT NULL,
ds TEXT NOT NULL,
chan TEXT NOT NULL,
tier TEXT NOT NULL,
vol INT4RANGE NOT NULL,
val NUMERIC NOT NULL,
price NUMERIC,
math TEXT[],
PRIMARY KEY (stlc, ds, chan, tier, vol)
);
GRANT SELECT, INSERT, UPDATE, DELETE ON pricequote.target_prices_base TO PUBLIC;

View File

@ -8,4 +8,4 @@ SELECT
,price ,price
,to_jsonb(math)::text AS math ,to_jsonb(math)::text AS math
FROM FROM
pricequote.target_prices_base; pricequote.target_prices;