diff --git a/idb/postgres/postgres.go b/idb/postgres/postgres.go index 9e4b96597..b9ae15af5 100644 --- a/idb/postgres/postgres.go +++ b/idb/postgres/postgres.go @@ -663,7 +663,7 @@ func buildTransactionQuery(tf idb.TransactionFilter) (query string, whereArgs [] } // If returnInnerTxnOnly flag is false, then return the root transaction - if !tf.ReturnInnerTxnOnly && !tf.ReturnRootTxnsOnly { + if !(tf.ReturnInnerTxnOnly || tf.ReturnRootTxnsOnly) { query = "SELECT t.round, t.intra, t.txn, root.txn, t.extra, t.asset, h.realtime FROM txn t JOIN block_header h ON t.round = h.round" } else { query = "SELECT t.round, t.intra, t.txn, NULL, t.extra, t.asset, h.realtime FROM txn t JOIN block_header h ON t.round = h.round" @@ -674,7 +674,7 @@ func buildTransactionQuery(tf idb.TransactionFilter) (query string, whereArgs [] } // join in the root transaction if the returnInnerTxnOnly flag is false - if !tf.ReturnInnerTxnOnly || !tf.ReturnRootTxnsOnly { + if !(tf.ReturnInnerTxnOnly || tf.ReturnRootTxnsOnly) { query += " LEFT OUTER JOIN txn root ON t.round = root.round AND (t.extra->>'root-intra')::int = root.intra" }