serendipity_event_freetag & postgresql errors & fix

Creating and modifying plugins.
Post Reply
jemm4jemm
Regular
Posts: 15
Joined: Thu Apr 19, 2007 2:54 pm

serendipity_event_freetag & postgresql errors & fix

Post by jemm4jemm »

Hello,

S9Y and Freetag plugin and Postgresql (now respectively at 1.1.2 and 2.85 and 8.x) have been creating these errors for quite some time.

ERROR: for SELECT DISTINCT, ORDER BY expressions must appear in select list
STATEMENT: SELECT DISTINCT e1.entryid,
e2.title
FROM {PREFIX}entrytags AS e1
LEFT JOIN {PREFIX}entries AS e2
ON e1.entryid = e2.id
WHERE e1.tag IN ('sometag1', 'othertag2', 'anothertag3')
AND e1.entryid != 21
AND e2.isdraft = 'false'
AND e2.timestamp <= 1176964710
ORDER BY e2.timestamp DESC
LIMIT 5

ERROR: column "two.entryid" must appear in the GROUP BY clause or be used in an aggregate function
STATEMENT: SELECT one.tag, two.entryid, count(two.tag) AS total
FROM {PREFIX}entrytags
AS one
JOIN {PREFIX}entrytags AS two
ON two.entryid = 21
AND one.tag = two.tag
GROUP BY one.tag
ORDER BY total DESC
LIMIT 5

I'm not good at sql, but solutions should be:
Fixing first one needs "SELECT DISTINCT e1.entryid, e2.title, e2.timestamp"
Fixing second one needs "GROUP BY one.tag, two.entryid".
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: serendipity_event_freetag & postgresql errors &

Post by garvinhicking »

Hi!

Thanks a lot! I just commited your two pgsql fixes! :)

Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Post Reply