Skip to content
Snippets Groups Projects
Commit b6eb872d authored by Mariusz Trela's avatar Mariusz Trela
Browse files

A fix in `delete_hive_post` SQL function

parent 53a9684b
No related branches found
No related tags found
4 merge requests!456Release candidate v1 24,!230Setup monitoring with pghero,!135Enable postgres monitoring on CI server,!86Post are removed correctly
......@@ -543,16 +543,16 @@ def setup(db):
RETURN QUERY UPDATE hive_posts AS hp
SET counter_deleted =
(
SELECT max( hp.counter_deleted ) + 1
FROM hive_posts hp
INNER JOIN hive_accounts ha ON hp.author_id = ha.id
INNER JOIN hive_permlink_data hpd ON hp.permlink_id = hpd.id
SELECT max( hps.counter_deleted ) + 1
FROM hive_posts hps
INNER JOIN hive_accounts ha ON hps.author_id = ha.id
INNER JOIN hive_permlink_data hpd ON hps.permlink_id = hpd.id
WHERE ha.name = _author AND hpd.permlink = _permlink
)
FROM hive_posts hp1
INNER JOIN hive_accounts ha ON hp1.author_id = ha.id
INNER JOIN hive_permlink_data hpd ON hp1.permlink_id = hpd.id
WHERE hp.id = hp1.id AND ha.name = _author AND hpd.permlink = _permlink
WHERE hp.id = hp1.id AND ha.name = _author AND hpd.permlink = _permlink AND hp1.counter_deleted = 0
RETURNING hp.id, hp.depth;
END
$function$
......
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