#6274 closed defect (fixed)
PostgreSQL ERROR: operator does not exist: text = integer
Reported by: | 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 )
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 , 17 years ago
Severity: | major → normal |
---|
comment:2 by , 17 years ago
Component: | browser → version 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 , 17 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 , 17 years ago
Probably goes without saying, but either quoting '1'
or using text_data::int = 1
should do the trick.
comment:5 by , 17 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:8 by , 17 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:10 by , 17 years ago
Keywords: | postgres83 added; postgres removed |
---|---|
Milestone: | 0.11.1 → 0.11 |
Priority: | normal → high |
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.
follow-up: 12 comment:11 by , 17 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.
comment:12 by , 17 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 , 17 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:14 by , 10 years ago
Keywords: | postgresql added |
---|
This is introduced with 8.3beta1.