[DATABASE] Check SQL boolean values with "IS TRUE"
This way UNKNOWN (NULL) explicitly turns to FALSE when three-valued logic is
reduced to binary.
In pgsqlschema, however, use "IS FALSE" as boolean attributes in pg_index are
non-nullable, there is no outer join and there's no clear preference for NULL
reduction.
Over-complicated constructions in TagCloud queries have been simplified, which
should not affect their performance.
Additionally, in TagCloud's lib/subscriptionspeopleselftagcloudsection.php
a typing mistake in an equi-join of "profile_tag" and "profile_list" on
"tagger" was fixed.
That regression was introduced in f446db8e2a
This commit is contained in:
@@ -83,9 +83,14 @@ function silencespammer($filter, $user, $minimum, $percent)
|
||||
|
||||
$ss = new Spam_score();
|
||||
|
||||
$ss->query(sprintf("SELECT count(*) as spam_count ".
|
||||
"FROM notice join spam_score on notice.id = spam_score.notice_id ".
|
||||
'WHERE notice.profile_id = %d AND spam_score.is_spam = TRUE', $profile->id));
|
||||
$ss->query(sprintf(
|
||||
<<<'END'
|
||||
SELECT COUNT(*) AS spam_count
|
||||
FROM notice INNER JOIN spam_score ON notice.id = spam_score.notice_id
|
||||
WHERE notice.profile_id = %d AND spam_score.is_spam IS TRUE;
|
||||
END,
|
||||
$profile->getID()
|
||||
));
|
||||
|
||||
while ($ss->fetch()) {
|
||||
$spam_count = $ss->spam_count;
|
||||
|
Reference in New Issue
Block a user