Modify

Opened 6 years ago

Closed 5 years ago

#4705 closed defect (fixed)

WikiCssPlugin: PostgresSQL error with latest changeset

Reported by: olistudent Owned by: martin_s
Priority: normal Component: WikiCssPlugin
Severity: normal Keywords:
Cc: Trac Release: 0.11

Description

Hi.

With last update (http://trac-hacks.org/changeset/5121) I get an error message in my log files:

2009-02-25 22:46:01,182 Trac[plugin] ERROR: FEHLER:  Spalte »wiki.version« muss in der GROUP-BY-Klausel erscheinen oder in einer Aggregatfunktion verwendet werden
2009-02-25 22:46:01,729 Trac[plugin] ERROR: FEHLER:  Spalte »wiki.version« muss in der GROUP-BY-Klausel erscheinen oder in einer Aggregatfunktion verwendet werden
2009-02-25 22:46:03,087 Trac[plugin] ERROR: FEHLER:  Spalte »wiki.version« muss in der GROUP-BY-Klausel erscheinen oder in einer Aggregatfunktion verwendet werden
2009-02-25 22:46:11,275 Trac[plugin] ERROR: FEHLER:  Spalte »wiki.version« muss in der GROUP-BY-Klausel erscheinen oder in einer Aggregatfunktion verwendet werden
2009-02-25 22:46:26,445 Trac[plugin] ERROR: FEHLER:  Spalte »wiki.version« muss in der GROUP-BY-Klausel erscheinen oder in einer Aggregatfunktion verwendet werden
2009-02-25 22:46:33,158 Trac[plugin] ERROR: FEHLER:  Spalte »wiki.version« muss in der GROUP-BY-Klausel erscheinen oder in einer Aggregatfunktion verwendet werden
2009-02-25 22:46:41,930 Trac[plugin] ERROR: FEHLER:  Spalte »wiki.version« muss in der GROUP-BY-Klausel erscheinen oder in einer Aggregatfunktion verwendet werden
2009-02-25 22:46:53,990 Trac[plugin] ERROR: FEHLER:  Spalte »wiki.version« muss in der GROUP-BY-Klausel erscheinen oder in einer Aggregatfunktion verwendet werden
2009-02-25 22:46:55,241 Trac[plugin] ERROR: FEHLER:  Spalte »wiki.version« muss in der GROUP-BY-Klausel erscheinen oder in einer Aggregatfunktion verwendet werden
2009-02-25 22:46:56,274 Trac[plugin] ERROR: FEHLER:  Spalte »wiki.version« muss in der GROUP-BY-Klausel erscheinen oder in einer Aggregatfunktion verwendet werden

Sorry for the german language but I know it's no problem for you. ;-)

I reverted the change and everything seems to works fine.

Attachments (0)

Change History (8)

comment:1 Changed 6 years ago by martin_s

  • Status changed from new to assigned

Could you try the following short patch:

  • wikicssplugin/0.11/tracwikicss/plugin.py

     
    4646            cursor.execute( \
    4747                "SELECT text, MAX(version) FROM wiki WHERE name='%s' " \
    48                 "GROUP BY text ORDER BY version DESC;" % self.wikipage )
     48                "GROUP BY text,version ORDER BY version DESC;" % self.wikipage )
    4949            content = cursor.fetchone()
    5050            if not content:

comment:2 Changed 6 years ago by martin_s

Sorry, the last line of the previous comment should be of course outside the text window. Here again the patch:

  • wikicssplugin/0.11/tracwikicss/plugin.py

     
    4646            cursor.execute( \
    4747                "SELECT text, MAX(version) FROM wiki WHERE name='%s' " \
    48                 "GROUP BY text ORDER BY version DESC;" % self.wikipage )
     48                "GROUP BY text,version ORDER BY version DESC;" % self.wikipage )
    4949            content = cursor.fetchone()
    5050            if not content:

comment:3 follow-up: Changed 6 years ago by olistudent

With this change the error has gone but the plugin doesn't seem to work anymore or uses a wrong version of css page.

comment:4 in reply to: ↑ 3 Changed 6 years ago by martin_s

I now simplified the SQL query ([5315]) to avoid the need for GROUP BY by kicking the unneeded MAX() out. Tell me if it works for you.

comment:5 Changed 6 years ago by olistudent

Because there is only one column in the result now I needed the following change:

  • tracwikicss/plugin.py

     
    4949            content = cursor.fetchone()
    5050            if not content:
    5151                raise Exception("WikiCss: Configured wiki page '%s' doesn't exits." % self.wikipage)
    52             req.send(content[0], content_type='text/css', status=200)
     52            req.send(content, content_type='text/css', status=200)
    5353        except RequestDone:
    5454            pass
    5555        except Exception, e:

But now it works fine. Thank you.

comment:6 Changed 6 years ago by martin_s

  • Resolution set to fixed
  • Status changed from assigned to closed

The fact when a scalar or a tuple is returned is still quite confusing for me. Python isn't my main programming language. I'm also not sure if this depends on the DB backend in this case. Therefore I put a simple test in ([5334]) to check if content is a tuple or not which is the most stable solution.

comment:7 Changed 5 years ago by martin_s

  • Resolution fixed deleted
  • Status changed from closed to reopened

This should be reprogrammed to use the WikiPage model provided by Trac.

comment:8 Changed 5 years ago by martin_s

  • Resolution set to fixed
  • Status changed from reopened to closed

Fixed in [6951]. Now the WikiPage model of Trac is used which should make it completely compatible with all DB backends Trac itself supports.

Add Comment

Modify Ticket

Action
as closed The owner will remain martin_s.
The resolution will be deleted. Next status will be 'reopened'.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.