Closed (fixed)
Project:
Simplenews Statistics
Version:
6.x-3.0-alpha3
Component:
Code
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
14 Dec 2011 at 14:32 UTC
Updated:
28 Jan 2012 at 10:26 UTC
Jump to comment: Most recent file
Comments
Comment #1
rmcom commentedon a different instance, I get the following error message:
warning: pg_query(): Query failed: ERROR: syntax error at or near "LEFT" LINE 8: order by created desc LEFT JOIN support_ticket st ON n... ^ in /var/www/includes/database.pgsql.inc on line 138.
user warning: query: select n.nid, n.title, t.name, n.created, ss.send, ss.unique_opens, ss.user_unique_click_through from simplenews_statistics ss inner join node n on ss.nid=n.nid inner join term_node tn on n.vid=tn.vid inner join term_data t on tn.tid=t.tid where t.vid=1 order by created desc LEFT JOIN support_ticket st ON n.nid = st.nid WHERE ( (st.client IN (1,2) OR st.client IS NULL)) in /var/www/sites/all/modules/contrib/simplenews_statistics/simplenews_statistics.module on line 284.
Comment #2
weseze commentedCould you try the latest dev release and see if that fixes it? The dev is currently just as stable to use as the alpha.
Comment #3
rmcom commentedI am afraid I can't at the moment as our testing instance is not available at the moment, but will do so asap.
Comment #4
weseze commentedComment #5
weseze commentedthe new alpha2 version contains a few bugfixes related to these issues. Please update and report back. Thanks!
Comment #6
rmcom commentedIssue completely fixed: stats of old newsletters are now showing. Thank you, weseze!
However, after I updated to alpha2, I cannot see the opens and clicks anymore:
All the tables at admin/content/simplenews/statistics/NODE are empty and show "No statistics available"althought the numbers on the overview page at admin/content/simplenews/statistics seem correct.
Does this mean that the data is lost or only that it is not showing on the opens and clicks pages?
If the data was lost during the update, I would have to go back to my db backup asap. Please advise.
Comment #7
rmcom commentedI can confirm thanks to the new Views integration (which is absolutely fantastic!! thank you!) that the data is there, but it does not show in the standard statistics tables.
Revised issue summary:
All the tables (opens and clicks) at
admin/content/simplenews/statistics/NID
are empty and show "No statistics available"
although the numbers on the overview page at admin/content/simplenews/statistics seem correct.
Comment #8
weseze commentedI can not think of a reason why it isn't working... could you attach an sql -dump of the 3 simplenews_statistics tables?
Comment #9
rmcom commentedHere are the error messages I am getting:
at /admin/content/simplenews/statistics/NID (opens)
warning: pg_query(): Query failed: ERROR: column "simplenews_statistics_opens.nid" must appear in the GROUP BY clause or be used in an aggregate function LINE 1: select count(*) from (select nid, email, timestamp, count(em... ^ in /var/www/includes/database.pgsql.inc on line 138.
user warning: query: select count(*) from (select nid, email, timestamp, count(email) as opens from simplenews_statistics_opens where nid=43 group by email) as results group by nid in /var/www/sites/all/modules/contrib/simplenews_statistics/simplenews_statistics.module on line 346.
warning: pg_query(): Query failed: ERROR: column "simplenews_statistics_opens.nid" must appear in the GROUP BY clause or be used in an aggregate function LINE 1: select nid, email, timestamp, count(email) as opens from sim... ^ in /var/www/includes/database.pgsql.inc on line 138.
user warning: query: select nid, email, timestamp, count(email) as opens from simplenews_statistics_opens where nid=43 group by email ORDER BY timestamp DESC LIMIT 50 OFFSET 0 in /var/www/sites/all/modules/contrib/simplenews_statistics/simplenews_statistics.module on line 346.
and at /admin/content/simplenews/statistics/NID/clicks (clicks)
warning: pg_query(): Query failed: ERROR: column "simplenews_statistics_clicks.nid" must appear in the GROUP BY clause or be used in an aggregate function LINE 1: select count(*) from (select nid, url, email, count(url) as ... ^ in /var/www/includes/database.pgsql.inc on line 138.
user warning: query: select count(*) from (select nid, url, email, count(url) as clicks from simplenews_statistics_clicks where nid=43 group by email, url) as results group by nid in /var/www/sites/all/modules/contrib/simplenews_statistics/simplenews_statistics.module on line 376.
warning: pg_query(): Query failed: ERROR: column "simplenews_statistics_clicks.nid" must appear in the GROUP BY clause or be used in an aggregate function LINE 1: select nid, url, email, count(url) as clicks from simplenews... ^ in /var/www/includes/database.pgsql.inc on line 138.
user warning: query: select nid, url, email, count(url) as clicks from simplenews_statistics_clicks where nid=43 group by email, url ORDER BY email DESC LIMIT 50 OFFSET 0 in /var/www/sites/all/modules/contrib/simplenews_statistics/simplenews_statistics.module on line 376.
Comment #10
weseze commentedOk, I'm not used to writing sql for postgre and I haven't got a test environment... So could you try something?
In the simplenews_statistics.module, find:
$count_query = 'select count(*) from ('.$main_query.') as results group by nid';And change it to:
$count_query = 'select count(nid) from ('.$main_query.') as results group by nid';There should be 2 occurences of this line of code, both need to be changed.
Please do let me know if that works, so I can commit it.
Comment #11
rmcom commentedI made the two changes (changing '*' to 'nid' twice) in simplenews_statistics.module
I am still getting the following error:
warning: pg_query(): Query failed: ERROR: column "simplenews_statistics_opens.nid" must appear in the GROUP BY clause or be used in an aggregate function LINE 1: select count(nid) from (select nid, email, timestamp, count(... ^ in /var/www/includes/database.pgsql.inc on line 138.
user warning: query: select count(nid) from (select nid, email, timestamp, count(email) as opens from simplenews_statistics_opens where nid=31 group by email) as results group by nid in /var/www/sites/all/modules/contrib/simplenews_statistics/simplenews_statistics.module on line 346.
warning: pg_query(): Query failed: ERROR: column "simplenews_statistics_opens.nid" must appear in the GROUP BY clause or be used in an aggregate function LINE 1: select nid, email, timestamp, count(email) as opens from sim... ^ in /var/www/includes/database.pgsql.inc on line 138.
user warning: query: select nid, email, timestamp, count(email) as opens from simplenews_statistics_opens where nid=31 group by email ORDER BY timestamp DESC LIMIT 50 OFFSET 0 in /var/www/sites/all/modules/contrib/simplenews_statistics/simplenews_statistics.module on line 346.
Could this comment provide a solution? http://drupal.org/node/280742#comment-1075735
Comment #12
rmcom commentedI have also installed the module on a new instance and am getting these new error messages at /admin/content/simplenews/statistics when I send a newsletter:
warning: pg_query(): Query failed: ERROR: column "xxx@xxx.com" does not exist LINE 1: ...nid from simplenews_statistics_clicks where email="xxx@xx... ^ in /var/www/includes/database.pgsql.inc on line 138.
user warning: query: select nid from simplenews_statistics_clicks where email="xxx@xxx.com" and nid=92 limit 1 in /var/www/sites/all/modules/contrib/simplenews_statistics/simplenews_statistics.module on line 492.
warning: pg_query(): Query failed: ERROR: column "xxx@xxx.com" does not exist LINE 1: ...stics_clicks (email, nid, url, timestamp) values ("xxx@xx... ^ in /var/www/includes/database.pgsql.inc on line 138.
user warning: query: insert into simplenews_statistics_clicks (email, nid, url, timestamp) values ("xxx@xxx.com", 92, "http://www.xxx.com/link", 1327345100) in /var/www/sites/all/modules/contrib/simplenews_statistics/simplenews_statistics.module on line 503.
Are those related?
From what you can see, are these errors related to me using postgresql?
Please let me know what else I can do to help.
Comment #13
weseze commentedI don't think it has got anything to do with postgresql. It's much more likely something to do with me writing bad query's... My plan to get this fixed is working on the views integration and getting rid of all the custom query's.
I'll try and get it working as soon as possible. (have been a bit busy with another project ;))
Comment #14
rmcom commentedGreatly appreciated! I am standing by to help in any way I can.
Comment #15
rmcom commentedI am also getting this error at /admin/content:
warning: pg_query(): Query failed: ERROR: column "xxx@xxx.com" does not exist LINE 1: ...nid from simplenews_statistics_clicks where email="xxx@xx... ^ in /var/www/includes/database.pgsql.inc on line 138.
user warning: query: select nid from simplenews_statistics_clicks where email="xxx@xxx.com" and nid=94 limit 1 in /var/www/sites/all/modules/contrib/simplenews_statistics/simplenews_statistics.module on line 492.
warning: pg_query(): Query failed: ERROR: column "xxx@xxx.com" does not exist LINE 1: ...stics_clicks (email, nid, url, timestamp) values ("xxx@xx... ^ in /var/www/includes/database.pgsql.inc on line 138.
user warning: query: insert into simplenews_statistics_clicks (email, nid, url, timestamp) values ("xxx@xxx.com", 94, "http://www.xxx.com", 1327378561) in /var/www/sites/all/modules/contrib/simplenews_statistics/simplenews_statistics.module on line 503.
Comment #16
rmcom commentedAnd at the send, the dblog registers for some, not all, outgoing emails for each the following succession of 4 php error messages:
Message 1:
pg_query(): Query failed: ERROR: column "abc@def.com" does not exist LINE 1: ...nid from simplenews_statistics_clicks where email="abc@de... ^ in /var/www/includes/database.pgsql.inc on line 138.
Message 2:
query: select nid from simplenews_statistics_clicks where email="abc@def.com" and nid=94 limit 1 in /var/www/sites/all/modules/contrib/simplenews_statistics/simplenews_statistics.module on line 492.
Message 3:
pg_query(): Query failed: ERROR: column "abc@def.com" does not exist LINE 1: ...stics_clicks (email, nid, url, timestamp) values ("abc@de... ^ in /var/www/includes/database.pgsql.inc on line 138.
Message 4:
query: insert into simplenews_statistics_clicks (email, nid, url, timestamp) values ("abc@def.com", 94, "http://www.abc.com/link", 1327442843) in /var/www/sites/all/modules/contrib/simplenews_statistics/simplenews_statistics.module on line 503.
Hope this is of value!
Comment #17
rmcom commentedweseze,
A friend of mine was kind enough to take a look and figured out what was going on. Thanks Mr. 3T!
This patch takes care of both query issues described above: (a) the opens/clicks display issue and (b) the query issue (the 4 messages) that I posted twice. (b) also made it impossible for the db to record some open and click data.
Attached the patch, already tested on a production server this evening.
Should be be ready to roll! alpha3 ?
Comment #18
weseze commentedThanks for sharing the patch!
It looks very good, but I have a question. Could you ask Mr. 3T for me and post back?
Why has he:
changed to:
Comment #19
rmcom commentedMr. 3T writes:
weseze, another question:
I just looked at the table, and I would also need the date/time stamp per click in the CLICKS table and do the primary sort by that:
Could you add date/time column with sort preference to clicks table before you roll the patch?
Comment #20
weseze commentedPatch comitted (thanks for the work!)
Also added the timestamp for the clicks to the table and made it the default sort.
3.0-alpha3 should be online shortly ;)
Comment #21
weseze commentedComment #22
rmcom commentedoops, opening the issue again, as the timestamp query produces the following error:
warning: pg_query(): Query failed: ERROR: column "simplenews_statistics_clicks.timestamp" must appear in the GROUP BY clause or be used in an aggregate function LINE 1: SELECT COUNT(*) FROM (SELECT url, timestamp, email, COUNT(ur... ^ in /var/www/includes/database.pgsql.inc on line 138.
user warning: query: SELECT COUNT(*) FROM (SELECT url, timestamp, email, COUNT(url) AS clicks FROM simplenews_statistics_clicks WHERE nid=94 GROUP BY email, url) AS results in /var/www/sites/all/modules/contrib/simplenews_statistics/simplenews_statistics.module on line 314.
warning: pg_query(): Query failed: ERROR: column "simplenews_statistics_clicks.timestamp" must appear in the GROUP BY clause or be used in an aggregate function LINE 1: SELECT url, timestamp, email, COUNT(url) AS clicks FROM simp... ^ in /var/www/includes/database.pgsql.inc on line 138.
user warning: query: SELECT url, timestamp, email, COUNT(url) AS clicks FROM simplenews_statistics_clicks WHERE nid=94 GROUP BY email, url ORDER BY timestamp DESC LIMIT 50 OFFSET 0 in /var/www/sites/all/modules/contrib/simplenews_statistics/simplenews_statistics.module on line 314.
I will ask Mr. 3T if he can take a look for a patch.
Comment #23
rmcom commentedComment #24
rmcom commentedComment #25
rmcom commentedFixed, thanks to Mr. 3T, patch enclosed.
Comment #26
weseze commentedcomitted to dev.
Comment #27
weseze commentedIt's better you open a new issue if you find bugs like these. I can create a better log and better commit message if there are seperate issues for seperate bugs ;)