aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaweł Chmielowski <pchmielowski@process-one.net>2020-03-18 14:04:40 +0100
committerPaweł Chmielowski <pchmielowski@process-one.net>2020-03-18 14:05:05 +0100
commit2d707cc0d2bcf6da1b97cc2351ba5f9a661fba9c (patch)
treeb421912c7fc148524eec247dd2f47aee4de2dce8
parentUse correct type for seconds field in mod_last sql queries (diff)
Fix type of computed field in node_flat sql query
-rw-r--r--src/node_flat_sql.erl9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/node_flat_sql.erl b/src/node_flat_sql.erl
index 38feed821..05cfa12b3 100644
--- a/src/node_flat_sql.erl
+++ b/src/node_flat_sql.erl
@@ -896,14 +896,13 @@ select_affiliation_subscriptions(Nidx, JID, JID) ->
select_affiliation_subscriptions(Nidx, GenKey, SubKey) ->
GJ = encode_jid(GenKey),
SJ = encode_jid(SubKey),
- case catch
- ejabberd_sql:sql_query_t(
- ?SQL("select jid = %(GJ)s as @(G)d, @(affiliation)s, @(subscriptions)s from "
- " pubsub_state where nodeid=%(Nidx)d and jid in (%(GJ)s, %(SJ)s)"))
+ case catch ejabberd_sql:sql_query_t(
+ ?SQL("select jid = %(GJ)s as @(G)b, @(affiliation)s, @(subscriptions)s from "
+ " pubsub_state where nodeid=%(Nidx)d and jid in (%(GJ)s, %(SJ)s)"))
of
{selected, Res} ->
lists:foldr(
- fun({1, A, S}, {_, Subs}) ->
+ fun({true, A, S}, {_, Subs}) ->
{decode_affiliation(A), Subs ++ decode_subscriptions(S)};
({_, _, S}, {Aff, Subs}) ->
{Aff, Subs ++ decode_subscriptions(S)}