Because of at least two issues where the update can break, I'm going to revert this:
[1] bug 1921523
[2] If there are multiple money.bnm_payment rows where the same ID, it can fail like this:
ERROR: more than one row returned by a subquery used as an expression
CONTEXT: SQL statement "SELECT home_ou FROM actor.usr WHERE id = (SELECT accepting_usr FROM money.bnm_payment WHERE id = current_payment.id)"
PL/pgSQL function money.payment_by_billing_type(bigint) line 62 at SQL statement
SQL statement "INSERT INTO money.materialized_payment_by_billing_type (
xact, payment, billing, payment_ts, billing_ts, payment_type, billing_type, amount, billing_ou, payment_ou
) SELECT xact, payment, billing, payment_ts, billing_ts, payment_type, billing_type, amount, billing_ou, payment_ou
FROM money.payment_by_billing_type( p.xact )"
PL/pgSQL function tmp_populate_p_b_bt() line 10 at SQL statement
The second issue is arguably the result of pathological data in the test database where I encountered the problem, but this close to 3.7-beta, it's looking to me like more baking is required.
Because of at least two issues where the update can break, I'm going to revert this:
[1] bug 1921523
[2] If there are multiple money.bnm_payment rows where the same ID, it can fail like this:
ERROR: more than one row returned by a subquery used as an expression payment. id)" by_billing_ type(bigint) line 62 at SQL statement zed_payment_ by_billing_ type (
payment_ type, billing_type, amount, billing_ou, payment_ou
payment_ type, billing_type, amount, billing_ou, payment_ou by_billing_ type( p.xact )" p_b_bt( ) line 10 at SQL statement
CONTEXT: SQL statement "SELECT home_ou FROM actor.usr WHERE id = (SELECT accepting_usr FROM money.bnm_payment WHERE id = current_
PL/pgSQL function money.payment_
SQL statement "INSERT INTO money.materiali
xact, payment, billing, payment_ts, billing_ts,
) SELECT xact, payment, billing, payment_ts, billing_ts,
FROM money.payment_
PL/pgSQL function tmp_populate_
The second issue is arguably the result of pathological data in the test database where I encountered the problem, but this close to 3.7-beta, it's looking to me like more baking is required.