#5118 closed defect (bug) (fixed)
Activities meta_query can load duplicates
Reported by: | imath | Owned by: | boonebgorges |
---|---|---|---|
Milestone: | 1.8.1 | Priority: | high |
Severity: | normal | Version: | 1.8 |
Component: | Activity | Keywords: | |
Cc: |
Description
Let's say i have this meta_query :
$meta_query = array( 'relation' => 'OR', array( 'key' => 'test', 'value' => 1, 'type' => 'numeric', 'compare' => '=' ), array( 'key' => 'rand', 'value' => 2, 'type' => 'numeric', 'compare' => '=' ) );
Now in bp_activity table, i have the 2 metas for 2 different activities, let's say :
- activity 19 has a 'test' meta_key with the value of 1
- activity 18 has a 'rand' meta_key with the value of 2
The result is ok, it displays activities 19 && 18
Now if activity 19 has a 'test' meta_key with the value of 1 and a 'rand' meta_key with the value of 2, then the result is not ok as it displays the activity 19 three times.
Change History (4)
#1
@
11 years ago
- Milestone changed from Awaiting Review to 1.9
- Priority changed from normal to high
#2
@
11 years ago
- Owner set to boonebgorges
- Resolution set to fixed
- Status changed from new to closed
In 7318:
#3
@
11 years ago
- Milestone changed from 1.9 to 1.8.1
Following up on the logic described in #5119, I've reconsidered my position on backward compatibility here - I think the possibility of breaking things with the new DISTINCT
keyword is very slight (could only happen for very specific kinds of filters on the activity queries). On the other hand, the meta_query paramater here is of pretty limited use if the fix is not resolved for 1.8.1. So I'm going to move it to the 1.8 branch as well.
Confirmed. We ought to be doing a
DISTINCT
check in our queries. We've never really had reason to ensure distinct before, but here we do.Because it's possible that the DISTINCT check will break some stuff, I'm going to put this in the 1.9 milestone. What imath is doing here, while definitely legitimate, is hopefully an edge case.