From 91130af4cb56fc029eb0ab60b97f16f038222966 Mon Sep 17 00:00:00 2001
From: jsalyers <jsalyers@syncad.com>
Date: Fri, 4 Dec 2020 18:28:05 -0500
Subject: [PATCH] [JES] Order by should go in the string_agg function

---
 .../hive_blacklisted_accounts_by_observer_view.sql            | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/hive/db/sql_scripts/hive_blacklisted_accounts_by_observer_view.sql b/hive/db/sql_scripts/hive_blacklisted_accounts_by_observer_view.sql
index d8e05dec0..c6b94bdc0 100644
--- a/hive/db/sql_scripts/hive_blacklisted_accounts_by_observer_view.sql
+++ b/hive/db/sql_scripts/hive_blacklisted_accounts_by_observer_view.sql
@@ -12,11 +12,11 @@ UNION ALL
  SELECT observer_accounts.id AS observer_id,
     following_accounts.id AS blacklisted_id,
     following_accounts.name AS blacklisted_name,
-    string_agg(('blacklisted by '::text || (indirect_accounts.name)::text), ','::text) AS source
+    string_agg(('blacklisted by '::text || (indirect_accounts.name)::text), ','::text ORDER BY indirect_accounts.name) AS source
    FROM (((hive_follows hive_follows_direct
      JOIN hive_follows hive_follows_indirect ON ((hive_follows_direct.following = hive_follows_indirect.follower)))
      JOIN hive_accounts following_accounts ON ((hive_follows_indirect.following = following_accounts.id)))
      JOIN hive_accounts observer_accounts ON ((hive_follows_direct.follower = observer_accounts.id)))
      JOIN hive_accounts indirect_accounts ON ((hive_follows_indirect.follower = indirect_accounts.id))
   WHERE (hive_follows_direct.follow_blacklists AND hive_follows_indirect.blacklisted)
-  GROUP BY observer_accounts.id, following_accounts.id ORDER BY source;
\ No newline at end of file
+  GROUP BY observer_accounts.id, following_accounts.id;
\ No newline at end of file
-- 
GitLab