Skip to content
Snippets Groups Projects
Commit 4df4ace7 authored by Bartek Wrona's avatar Bartek Wrona
Browse files

Merge branch 'cherry-pick-31529ec2' into 'master'

Changes done in the MR 476 cherry-picked into master.

See merge request !478
parents 02b28201 9f6e71a4
No related branches found
Tags v1.24.2
2 merge requests!519Merge branch 'bw_issue_134' into 'develop',!478Changes done in the MR 476 cherry-picked into master.
......@@ -110,6 +110,27 @@ $BODY$
DROP FUNCTION IF EXISTS calculate_account_reputations_for_block;
DROP TABLE IF EXISTS __new_reputation_data;
CREATE UNLOGGED TABLE IF NOT EXISTS __new_reputation_data
(
id integer,
author_id integer,
voter_id integer,
rshares bigint,
prev_rshares bigint
);
DROP TABLE IF EXISTS __tmp_accounts;
CREATE UNLOGGED TABLE IF NOT EXISTS __tmp_accounts
(
id integer,
reputation bigint,
is_implicit boolean,
changed boolean
);
CREATE OR REPLACE FUNCTION calculate_account_reputations_for_block(_block_num INT, _tracked_account VARCHAR DEFAULT NULL::VARCHAR)
RETURNS SETOF accountreputation
LANGUAGE 'plpgsql'
......@@ -130,16 +151,9 @@ DECLARE
__traced_author int;
__account_name varchar;
BEGIN
CREATE UNLOGGED TABLE IF NOT EXISTS __new_reputation_data
(
id integer,
author_id integer,
voter_id integer,
rshares bigint,
prev_rshares bigint
);
TRUNCATE TABLE __new_reputation_data;
DELETE FROM __new_reputation_data;
INSERT INTO __new_reputation_data
SELECT rd.id, rd.author_id, rd.voter_id, rd.rshares,
COALESCE((SELECT prd.rshares
......@@ -152,15 +166,9 @@ BEGIN
ORDER BY rd.id
;
CREATE UNLOGGED TABLE IF NOT EXISTS __tmp_accounts
(
id integer,
reputation bigint,
is_implicit boolean,
changed boolean
);
TRUNCATE TABLE __tmp_accounts;
DELETE FROM __tmp_accounts;
INSERT INTO __tmp_accounts
SELECT ha.id, ha.reputation, ha.is_implicit, false AS changed
FROM __new_reputation_data rd
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment