put target rebuild in a proc
This commit is contained in:
parent
581224dad8
commit
5ec3f1d9c1
@ -1,29 +1,28 @@
|
|||||||
BEGIN;
|
CREATE OR REPLACE PROCEDURE pricequote.refresh_target_prices_base()
|
||||||
DELETE FROM pricequote.target_prices_base;
|
LANGUAGE plpgsql
|
||||||
|
AS $$
|
||||||
|
BEGIN
|
||||||
|
DELETE FROM pricequote.target_prices_base;
|
||||||
|
|
||||||
WITH
|
WITH expand AS (
|
||||||
expand AS (
|
SELECT
|
||||||
SELECT
|
c.compset,
|
||||||
c.compset,
|
c.stlc,
|
||||||
c.stlc,
|
c.floor,
|
||||||
c.floor,
|
b.ds,
|
||||||
b.ds,
|
b.chan,
|
||||||
b.chan,
|
b.tier,
|
||||||
b.tier,
|
b.vol,
|
||||||
b.vol,
|
b.val,
|
||||||
b.val,
|
b.price,
|
||||||
b.price,
|
b.math AS math
|
||||||
b.math math
|
FROM pricequote.core_target c
|
||||||
FROM
|
LEFT JOIN LATERAL pricequote.build_pricing_path_base(
|
||||||
pricequote.core_target c
|
c.options || jsonb_build_object('entity','Anchor','attr',c.stlc,'val',c.floor,'func','Price')
|
||||||
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
|
) AS b
|
||||||
)
|
ON b.lastflag
|
||||||
-- select count(*) from expand
|
)
|
||||||
INSERT INTO
|
INSERT INTO pricequote.target_prices_base
|
||||||
pricequote.target_prices_base
|
SELECT * FROM expand;
|
||||||
SELECT
|
END;
|
||||||
*
|
$$;
|
||||||
FROM
|
|
||||||
expand;
|
|
||||||
|
|
||||||
COMMIT;
|
|
||||||
|
Loading…
Reference in New Issue
Block a user