variables are nested in customer json

This commit is contained in:
Paul Trowbridge 2023-11-21 15:38:47 -05:00
parent d6c4d71851
commit b04f67d9f0
2 changed files with 5 additions and 3 deletions

View File

@ -156,7 +156,8 @@ BEGIN
--RAISE NOTICE 'cust %', jsonb_pretty(_customer);
----------------price history-------------------------------
SELECT jsonb_build_object('hist',rlarp.get_hist(_mold, _v1ds, _cust, substring(_chan,1,1))) INTO _hist;
RAISE NOTICE 'varb %', _customer;
SELECT jsonb_build_object('hist',rlarp.get_hist(_mold, _v1ds, _customer->'customer'->>'cust', substring(_customer->'customer'->>'chan',1,1))) INTO _hist;
--RAISE NOTICE 'history %', jsonb_pretty(_hist);
----------------target pricing------------------------------

View File

@ -1,5 +1,5 @@
WITH
sel AS (select 'v1:P.P.PLT..' _v1ds, 'ALTMAN PLANTS' _cust, 'XNS0T1G3' _mold, 'D' _chan)
sel AS (select 'v1:L..PLT..' _v1ds, 'DREAM WITH COLORS' _cust, 'UL.12000' _mold, 'D' _chan)
,sort AS (
SELECT
p.agglevel
@ -150,4 +150,5 @@ FROM
--SELECT rnk, jsonb_pretty(doc) doc, jsonb_pretty(season) season FROM rel_sort
--SELECT jsonb_pretty(jsonb_agg(doc)) FROM rel_sort
--SELECT jsonb_pretty(jsonb_obj_aggc(doc)) FROM rel_sort--INTO _result FROM rel_sort WHERE rnk = 1;
SELECT * FROM rel_sort;
--SELECT * FROM rel_sort;
SELECT jsonb_obj_aggc(doc) FROM rel_sort WHERE rnk = 1;