| Project: | Planet profile |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed (won't fix) |
Issue Summary
Hi swe3tdave,
I installed ubuntu-drupal yesterday
with a pgsql system to add some spice
but I have problems with some queries
The one I think I have fixed appears in two places:
near lines 202 and 288.
SELECT COUNT(f.fid) cnt, f.*, (UNIX_TIMESTAMP(NOW()) - checked) _checked
FROM {planet_feeds} f LEFT OUTER JOIN {planet_items} i
ON i.fid = f.fid WHERE f.uid = %d GROUP BY f.fid;3 issues with that:
1. "AS" is needed for column names
causes pgsql to fail if missing.
SELECT COUNT(f.fid) AS cnt, f.*, (UNIX_TIMESTAMP(NOW()) - checked) AS _checked
FROM {planet_feeds} f LEFT OUTER JOIN {planet_items} i
ON i.fid = f.fid WHERE f.uid = %d GROUP BY f.fid;2. UNIX_TIMESTAMP() is undefined in pgsql
and most likely in sqlite and other DB backends.
For me, the easiest is to let PHP compute it, unix timestamp is
returned natively by time()
3. f.* causes GROUP BY clause to fail
It should include all listed fields.
Only 'f._checked', 'f.title', 'f.cnt', 'f.fid' used. No field in planet_items, just count.
But what is the intent here ? Listing all feeds associated with current user, along with items count.
I'd suggest to write " separates queries:
* a loop on user feeds
* for each feed, a "scalar query" to get items count
I attach the patch for the above fixes.
I'm not sure the first block is reachable. If it is, why not refactoring the duplicated code to a single function ?
Best regards,
Michelle
| Attachment | Size |
|---|---|
| queries1.patch | 4.91 KB |
Comments
#1
Here's the global patch of my work so far.
There's still a lot of work to do on it.
I can now add feeds, but if I do from admin/settings/planet, the 'Original author' list being empty, no uid is associated with. Thus the feeds don't appear in list ("WHERE uid=%d" clause not satisfied).
It would also be grand if you could add some documentation to the code, especially in big blocks.
Thanks
#2
I'd like to point out that the Ubuntu-Drupal team has completed their Planet module which is much more stable and featured than this modules.
As per this issue: Our SQL is written in a way that this isn't an issue. This it great because it helps us avoid such situations.
Try it out and see which you prefer. http://drupal.org/project/udplanet
#3
This project is being abandoned by the maintainer (swe3tdave) in favor of a similar project that has many of the bugs in this module taken care of. Please try to udplanet module (http://drupal.org/project/udplanet) to see if this bug still exists. If it does please report it. This module is actively maintained and the Ubuntu-Drupal team that maintains it will make every effort to ensure the issue is resolved as quickly as possible.
Because this project is now abandoned, I and setting the Status to Won't Fix and removing anyone assigned to it.
Thanks,
MTecknology