Edgewall Software
Modify

Opened 16 years ago

Closed 16 years ago

Last modified 8 years ago

#6274 closed defect (fixed)

PostgreSQL ERROR: operator does not exist: text = integer

Reported by: matthew.wensing@… Owned by: Christian Boos
Priority: high Milestone: 0.11
Component: version control Version: devel
Severity: normal Keywords: postgres83, postgresql
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description (last modified by Christian Boos)

Created a fresh trac environment, pointed it to an existing SVN repos, and clicked 'Browse Source'. Returned the error:

Trac detected an internal error:

ProgrammingError: operator does not exist: text = integer
LINE 1: SELECT time,author,message FROM revision WHERE rev=1
                                                          ^
HINT:  No operator matches the given name and argument type(s). You might need to add explicit type casts.

This query works fine:

SELECT time,author,message FROM revision WHERE rev='1'

trac 0.11dev-r6120 svn 1.4.0 psql 8.3beta1 Python 2.5

Attachments (0)

Change History (14)

comment:1 by anonymous, 16 years ago

Severity: majornormal

This is introduced with 8.3beta1.

comment:2 by Christian Boos, 16 years ago

Component: browserversion control
Description: modified (diff)
Keywords: postgres added
Milestone: 0.11.1

Looks like this uncovers a non-consistent usage of the rev. It should really be handled as a string at the db level, but apparently no other backend/binding complained so far when given an int…

What bindings are you using? If you're not using psycopg2 already, can you try using those?

comment:3 by anonymous, 16 years ago

psycopg2

And I've been told by some folks in #postgres that this will remain the case for 8.3.

comment:4 by anonymous, 16 years ago

Probably goes without saying, but either quoting '1' or using text_data::int = 1 should do the trick.

comment:5 by Christian Boos, 16 years ago

Well, the right fix is a bit more involved, as currently the svn_fs backend normalizes revision as ints, but the cache layer wants to see a text identifier for the rev, useful for backends that have hexa hash numbers as revision ids (but then, I'm not sure if there's any such backend that uses the cache in its current form).

As a quick workaround, if you're not using a big repository, you can simply disable caching:

[trac]
repository_type = direct-svnfs

comment:6 by anonymous, 16 years ago

Excellent. Many thanks.

comment:7 by anonymous, 16 years ago

Just noting that the workaround you suggest works.

comment:8 by anonymous, 16 years ago

Also getting this. Any workarounds for this one? This comes up when I try to submit a ticket.

ProgrammingError: operator does not exist: text = integer
LINE 1: ...mment',null,description,0 FROM attachment WHERE id=1 ORDER B...
                                                             ^
HINT:  No operator matches the given name and argument type(s). You might need to add explicit type casts.

comment:9 by anonymous, 16 years ago

For now I just edited ticket/model.py to wrap id=%s in quotes, id='%s'.

comment:10 by Christian Boos, 16 years ago

Keywords: postgres83 added; postgres removed
Milestone: 0.11.10.11
Priority: normalhigh

From #6670:

"WHERE rev=%s", (str(rev),)) works perfectly. This is in Postgres 8.3beta4.

I think the str() case is the correct thing to do here.

comment:11 by mgohlke@…, 16 years ago

Why not just wrap it in str(rev) as it is in other parts of versioncontrol/cache.py:CachedChangeset. That's the only place in the file that it's not stringified.

in reply to:  11 comment:12 by anonymous, 16 years ago

Replying to mgohlke@handmark.com:

Why not just wrap it in str(rev) as it is in other parts of versioncontrol/cache.py:CachedChangeset. That's the only place in the file that it's not stringified.

Ignore. Just saw the comment above mentioning the str() cast.

comment:13 by Christian Boos, 16 years ago

Resolution: fixed
Status: newclosed

He he, yes.

Should be fixed in r6415 for trunk and r6416 for 0.10.5dev.

comment:14 by Ryan J Ollos, 9 years ago

Keywords: postgresql added

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Christian Boos.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Christian Boos to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.