textmachine/platform/docs/p8-review/axis1-money/a1-ceiling-column-doc.sql

19 lines
1.2 KiB
SQL

-- A1/money. Migration 00007_credits.sql says of reservations.ceiling_micro_usd:
-- "What the engine was told its ceiling was. Kept because 'why did this run stop' is answered
-- from here, not from the engine's config file, which the next run rewrites."
-- Since 00011_ceiling_argument.sql / D39.122 that is false, and 00011 says so itself ("It is NOT
-- ceiling_micro_usd"). holdTx writes the column as a copy of the hold AMOUNT ($4,$4), and the number
-- actually handed to the process is run_attempts.ceiling_arg_micro_usd.
select r.engine_run_id,
r.amount_micro_usd as hold,
r.ceiling_micro_usd as "00007 says: what the engine was told",
a.ceiling_arg_micro_usd as "what the engine was ACTUALLY told (00011)"
from reservations r
join run_attempts a
on a.run_id = split_part(r.engine_run_id,'#',1)
and a.attempt_no = split_part(r.engine_run_id,'#',2)::int
order by r.opened_at;
-- observed on the stand of 24.08:
-- run_EGWANOODQPXGGPTY#1 | 30000 | 30000 | 30000 (first run of the book: they agree)
-- run_7SGVRDCQE4CVNK2S#1 | 60000 | 60000 | 80000 (second: argv was --ceiling-usd 0.080000)
-- run_YL5BBU64HQB7EQOB#1 | 30000 | 30000 | 80000 (third: argv was --ceiling-usd 0.080000)