There are a couple of things wrong:
A) The query does a join on vid and nid, which means it doesn't capture all changes.
B) It counts across all revisions, not just the published version.

Comments

jthinaka’s picture

Status: Active » Needs review
StatusFileSize
new1.03 KB

Please see attached patch for the issue above.

crookednumber’s picture

Title: Reports not working. » Module doesn't play well with revisions
crookednumber’s picture

Title: Module doesn't play well with revisions » Node query is unnecessarily complex -- and likely flawed

It doesn't need to touch any revision table, or look at any vids, since we're just grabbing most recent value.

Something like:

SELECT n.title, fdb.body_value AS body, n.uid, u.name FROM node AS n, users AS u, field_data_body AS fdb WHERE n.nid=fdb.entity_id and fdb.entity_type='node' and u.uid=n.uid;

crookednumber’s picture

Status: Needs review » Closed (fixed)

[7.x-1.x dad402b] Issue #1503364 by CrookedNumber: Node query is unnecessarily complex -- and likely flawed
1 files changed, 1 insertions(+), 1 deletions(-)

crookednumber’s picture

Amending commit message to give full credits:

[7.x-1.x c7296b2] Issue #1503364 by jthinaka, CrookedNumber: Node query is unnecessarily complex -- and likely flawed
1 files changed, 1 insertions(+), 1 deletions(-)