Ticket #3844 (new defect)

Opened 2 months ago

Last modified 2 weeks ago

Oops postgreSQL

Reported by: butterflow Assigned to: e2jk
Priority: normal Component: TicketModifiedFilesPlugin
Severity: normal Keywords:
Cc: Trac Release: 0.11

Description

Oops in the following two SQL in PostgreSQL

SELECT path FROM node_change WHERE rev=4

  • HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.

ORDER BY 1*rev DESC ...

  • HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.
Oops…
Trac detected an internal error: ProgrammingError: operator does not exist: text = integer LINE 1: SELECT path 

FROM node_change WHERE rev=4 ^ HINT: No operator matches the given name and argument type(s). You might need 

to add explicit type casts.
There was an internal error in Trac. It is recommended that you inform your local Trac administrator and give 

him all the information he needs to reproduce the issue. 

To that end, you could   
==== How to Reproduce ====

While doing a GET operation on `/modifiedfiles/3`, Trac issued an internal error.

''(please provide additional details here)''


Request parameters:
{{{
{'id': u'3'}
}}}


User Agent was: `Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; 

InfoPath.1; .NET CLR 3.0.04506.30; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022)`

==== System Information ====

|| '''Trac''' || `0.11.1` ||
|| '''Python''' || `2.5.2 (r252:60911, Feb 21 2008, 13:11:45) [MSC v.1310 32 bit (Intel)]` ||
|| '''setuptools''' || `0.6c8` ||
|| '''psycopg2''' || `2.0.7` ||
|| '''Genshi''' || `0.5.1` ||
|| '''mod_python''' || `3.3.1` ||
|| '''Pygments''' || `0.11.1` ||
|| '''Subversion''' || `1.5.2 (r32768)` ||
|| '''jQuery:''' || `1.2.6` ||

==== Python Traceback ====
{{{
Traceback (most recent call last):
  File "c:\python25\lib\site-packages\Trac-0.11.1-py2.5.egg\trac\web\main.py", line 423, in 

_dispatch_request
    dispatcher.dispatch(req)
  File "c:\python25\lib\site-packages\Trac-0.11.1-py2.5.egg\trac\web\main.py", line 197, in dispatch
    resp = chosen_handler.process_request(req)
  File "build\bdist.win32\egg\ticketmodifiedfiles\ticketmodifiedfiles.py", line 30, in process_request
    (id, files, deletedfiles, ticketsperfile, filestatus, conflictingtickets, ticketisclosed, revisions) = 

self.__process_ticket_request(req)
  File "build\bdist.win32\egg\ticketmodifiedfiles\ticketmodifiedfiles.py", line 133, in 

__process_ticket_request
    cursor2.execute("SELECT path FROM node_change WHERE rev=" + str(rev))
  File "c:\python25\lib\site-packages\Trac-0.11.1-py2.5.egg\trac\db\util.py", line 51, in execute
    return self.cursor.execute(sql)
  File "c:\python25\lib\site-packages\Trac-0.11.1-py2.5.egg\trac\db\util.py", line 51, in execute
    return self.cursor.execute(sql)
ProgrammingError: operator does not exist: text = integer
LINE 1: SELECT path FROM node_change WHERE rev=4
                                              ^
HINT:  No operator matches the given name and argument type(s). You might need to add explicit type casts.


}}}
      a ticket at this site.

The action that triggered the error was: 

GET: /modifiedfiles/3
TracGuide — The Trac User and Administration Guide 
Oops…
Trac detected an internal error: ProgrammingError: operator does not exist: integer * text LINE 1: ...ERE 

path='trunk/hello/hello/Program.cs' ORDER BY 1*rev DESC ... ^ HINT: No operator matches the given name and 

argument type(s). You might need to add explicit type casts.
There was an internal error in Trac. It is recommended that you inform your local Trac administrator and give 

him all the information he needs to reproduce the issue. 

To that end, you could   
==== How to Reproduce ====

While doing a GET operation on `/modifiedfiles/3`, Trac issued an internal error.

''(please provide additional details here)''


Request parameters:
{{{
{'id': u'3'}
}}}


User Agent was: `Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; 

InfoPath.1; .NET CLR 3.0.04506.30; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022)`

==== System Information ====

|| '''Trac''' || `0.11.1` ||
|| '''Python''' || `2.5.2 (r252:60911, Feb 21 2008, 13:11:45) [MSC v.1310 32 bit (Intel)]` ||
|| '''setuptools''' || `0.6c8` ||
|| '''psycopg2''' || `2.0.7` ||
|| '''Genshi''' || `0.5.1` ||
|| '''mod_python''' || `3.3.1` ||
|| '''Pygments''' || `0.11.1` ||
|| '''Subversion''' || `1.5.2 (r32768)` ||
|| '''jQuery:''' || `1.2.6` ||

==== Python Traceback ====
{{{
Traceback (most recent call last):
  File "c:\python25\lib\site-packages\Trac-0.11.1-py2.5.egg\trac\web\main.py", line 423, in 

_dispatch_request
    dispatcher.dispatch(req)
  File "c:\python25\lib\site-packages\Trac-0.11.1-py2.5.egg\trac\web\main.py", line 197, in dispatch
    resp = chosen_handler.process_request(req)
  File "build\bdist.win32\egg\ticketmodifiedfiles\ticketmodifiedfiles.py", line 30, in process_request
    (id, files, deletedfiles, ticketsperfile, filestatus, conflictingtickets, ticketisclosed, revisions) = 

self.__process_ticket_request(req)
  File "build\bdist.win32\egg\ticketmodifiedfiles\ticketmodifiedfiles.py", line 144, in 

__process_ticket_request
    cursor.execute("SELECT change_type FROM node_change WHERE path='" + file + "' ORDER BY 1*rev DESC LIMIT 

1")
  File "c:\python25\lib\site-packages\Trac-0.11.1-py2.5.egg\trac\db\util.py", line 51, in execute
    return self.cursor.execute(sql)
  File "c:\python25\lib\site-packages\Trac-0.11.1-py2.5.egg\trac\db\util.py", line 51, in execute
    return self.cursor.execute(sql)
ProgrammingError: operator does not exist: integer * text
LINE 1: ...ERE path='trunk/hello/hello/Program.cs' ORDER BY 1*rev DESC ...
                                                             ^
HINT:  No operator matches the given name and argument type(s). You might need to add explicit type casts.


}}}
      a ticket at this site.

The action that triggered the error was: 

GET: /modifiedfiles/3
TracGuide — The Trac User and Administration Guide 

Attachments

PostgreSQL_explicit_cast.diff (1.1 kB) - added by butterflow on 10/01/08 23:12:47.

Change History

10/01/08 23:12:47 changed by butterflow

  • attachment PostgreSQL_explicit_cast.diff added.

10/02/08 03:02:45 changed by e2jk

OK, I'll look into it. This is postreSQL related, because it seems to work fine both in SQLite and MySQL.

10/02/08 08:55:46 changed by butterflow

Hi e2jk,

The attached patch fixed the above two problems in PostgreSQL and worked in SQLite as well as MySQL.

10/02/08 09:25:39 changed by e2jk

It may work with your current versions, but I know for sure that at least your second patch won't work if you use SQLite < 3.2.3: c.f.: #3239.

As I noted in this ticket, it seems that Trac itself is using the 1*column hack.

The whole problem in this bug (and previous #3239 and #3781) is to find something that will work flawlessly with different versions of SQLite, MySQL and PostgreSQL. As I currently only have a testing platform using SQLite, I cannot certify that it works with other databases. I rely (for now) on tickets that people file against the extension to know what and when things fail concerning the database.

I am planning to set up a testing environment to be able to test the extension with the 3 DBs. I'll get into this when I'll have the testing env up and running.

Thank you butterflow for your feedback!

10/03/08 06:33:59 changed by mail@matthias-lohr.net

how can i fix that in 0.10 ?

10/03/08 06:36:08 changed by anonymous

Well, if you're using Postgres with 0.10, apply the patch provided by butterflow (look at the attachment of this ticket). It should work as butterflow said.

10/03/08 06:44:33 changed by matthias

but in which file i have to search?

10/03/08 07:17:35 changed by e2jk

it's written on top of the patch: 0.11/ticketmodifiedfiles/ticketmodifiedfiles.py. You even have the lines where to change the code...

10/03/08 08:03:52 changed by matthias

i asked because i have no such file ;) i installed trac from apt debian repositories..

10/03/08 08:08:36 changed by e2jk

I'm sorry Matthias, but I don't understand where your problem comes from... This is a ticket opened against the plugin, not against Trac itself... I guessed you had a problem with the plugin, because you wrote on this page. The file I told you to edit is the source code of the plugin.

I'm going on weekend now, I'll look at your messages on Monday. Good luck!

11/21/08 03:19:41 changed by anonymous

Just a quick message to inform you all that I have not forgotten this problem, but right now I am pretty busy at work... I'll be working on it as soon as I have the time!


Add/Change #3844 (Oops postgreSQL)




Change Properties
Action