Modify

Opened 16 years ago

Closed 16 years ago

#3844 closed defect (fixed)

Oops postgreSQL

Reported by: JaeWook Choi Owned by: Emilien Klein
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 (1)

PostgreSQL_explicit_cast.diff (1.1 KB) - added by JaeWook Choi 16 years ago.

Download all attachments as: .zip

Change History (12)

Changed 16 years ago by JaeWook Choi

comment:1 Changed 16 years ago by Emilien Klein

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

comment:2 Changed 16 years ago by JaeWook Choi

Hi e2jk,

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

comment:3 Changed 16 years ago by Emilien Klein

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!

comment:4 Changed 16 years ago by Matthias Lohr

how can i fix that in 0.10 ?

comment:5 Changed 16 years ago 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.

comment:6 Changed 16 years ago by Matthias Lohr

but in which file i have to search?

comment:7 Changed 16 years ago by Emilien Klein

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

comment:8 Changed 16 years ago by Matthias Lohr

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

comment:9 Changed 16 years ago by Emilien Klein

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!

comment:10 Changed 16 years ago 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!

comment:11 Changed 16 years ago by Emilien Klein

Resolution: fixed
Status: newclosed

Resolved in r4956 and r4996.

In ticket #4254, I have removed the direct database calls and replaced it with Trac API calls, so this database-dependant error should not exist anymore.

Please update the plugin to tell me if it actually works in PostgreSQL!

To reinstall:

easy_install http://trac-hacks.org/svn/ticketmodifiedfilesplugin

or install from the zip file you can find on the plugin's homepage: http://trac-hacks.org/wiki/TicketModifiedFilesPlugin

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Emilien Klein.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


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

 
Note: See TracTickets for help on using tickets.