Opened 12 years ago

Last modified 9 years ago

#9976 assigned defect

Internal error with Postgresql database. — at Version 2

Reported by: rzhidalgo@yahoo.com Owned by: Roberto Longobardi
Priority: normal Component: FaqPlugin
Severity: normal Keywords:
Cc: Trac Release: 0.12

Description (last modified by Ryan J Ollos)

Clicking on the FAQ top menu option generates an Internal Server Error. The trac.log displays:

ProgrammingError: column "wiki.text" must appear in the GROUP BY clause or be used in an aggregate function
LINE 1: SELECT name, text, max(version) FROM wiki WHERE name LIKE 'F...

Change History (2)

comment:1 Changed 12 years ago by rzhidalgo@yahoo.com

The solution is to modify a SQL statement in the macros.py file to be valid with Postgresql. Below is the new SQL statement (macros.py (line 246)):

current:

    sql = "SELECT name, text, max(version) FROM wiki WHERE name LIKE '%s%%' GROUP BY name ORDER BY name" % curpage

new:

    sql = "SELECT name, text, version FROM wiki WHERE name LIKE '%s%%' AND version = (select max(version) FROM wiki WHERE name LIKE '%s%%')" % (curpage, curpage)
Last edited 9 years ago by Ryan J Ollos (previous) (diff)

comment:2 Changed 12 years ago by Ryan J Ollos

Description: modified (diff)
Note: See TracTickets for help on using tickets.