fix errors
This commit is contained in:
parent
15e8697ece
commit
29e5cd0ef5
@ -2207,8 +2207,8 @@ CREATE OR REPLACE FUNCTION insert_or_update_policy_details(
|
||||
LANGUAGE plpgsql
|
||||
AS $$
|
||||
DECLARE
|
||||
cur_commiment_val INT8;
|
||||
cur_commiment_frac INT4;
|
||||
cur_commitment_val INT8;
|
||||
cur_commitment_frac INT4;
|
||||
cur_accumulated_total_val INT8;
|
||||
cur_accumulated_total_frac INT4;
|
||||
BEGIN
|
||||
@ -2238,33 +2238,29 @@ BEGIN
|
||||
in_transferable_val,
|
||||
in_transferable_frac,
|
||||
in_fulfillment_state)
|
||||
RETURNING (policy_details_serial_id,
|
||||
accumulated_total_val,
|
||||
accumulated_total_frac,
|
||||
fulfillment_state)
|
||||
INTO (out_policy_details_serial_id,
|
||||
out_accumulated_total_val,
|
||||
out_accumulated_total_frac,
|
||||
out_fulfillment_state)
|
||||
ON CONFLICT (policy_hash_code) DO NOTHING;
|
||||
ON CONFLICT (policy_hash_code) DO NOTHING
|
||||
RETURNING policy_details_serial_id INTO out_policy_details_serial_id;
|
||||
|
||||
-- If the insert was successful, return
|
||||
-- We assume that the fullfilment_state was correct in first place.
|
||||
IF FOUND THEN
|
||||
out_accumulated_total_val = in_accumulated_total_val;
|
||||
out_accumulated_total_frac = in_accumulated_total_frac;
|
||||
out_fulfillment_state = in_fulfillment_state;
|
||||
RETURN;
|
||||
END IF;
|
||||
|
||||
-- We had a conflict, grab the parts we need to update.
|
||||
SELECT (policy_details_serial_id,
|
||||
SELECT policy_details_serial_id,
|
||||
commitment_val,
|
||||
commitment_frac,
|
||||
accumulated_total_val,
|
||||
accumulated_total_frac)
|
||||
INTO (out_policy_details_serial_id,
|
||||
accumulated_total_frac
|
||||
INTO out_policy_details_serial_id,
|
||||
cur_commitment_val,
|
||||
cur_commitment_frac,
|
||||
cur_accumulated_total_val,
|
||||
cur_accumulated_total_frac)
|
||||
cur_accumulated_total_frac
|
||||
FROM policy_details
|
||||
WHERE policy_hash_code = in_policy_hash_code;
|
||||
|
||||
@ -2277,7 +2273,7 @@ BEGIN
|
||||
|
||||
IF (out_accumulated_total_val > (1 << 52))
|
||||
THEN
|
||||
RAISE EXCEPTION "accumulation overflow";
|
||||
RAISE EXCEPTION 'accumulation overflow';
|
||||
END IF;
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user