Ticket #6274 (closed defect: fixed)
Opened 4 years ago
Last modified 3 years ago
PostgreSQL ERROR: operator does not exist: text = integer
| Reported by: | matthew.wensing@… | Owned by: | cboos |
|---|---|---|---|
| Priority: | high | Milestone: | 0.11 |
| Component: | version control | Version: | devel |
| Severity: | normal | Keywords: | postgres83 |
| Cc: | |||
| Release Notes: | |||
| API Changes: | |||
Description (last modified by cboos) (diff)
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
Change History
comment:1 Changed 4 years ago by anonymous
- Severity changed from major to normal
comment:2 Changed 4 years ago by cboos
- Component changed from browser to version control
- Description modified (diff)
- Keywords postgres added
- Milestone set to 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 Changed 4 years ago by anonymous
psycopg2
And I've been told by some folks in #postgres that this will remain the case for 8.3.
comment:4 Changed 4 years ago by anonymous
Probably goes without saying, but either quoting '1' or using text_data::int = 1 should do the trick.
comment:5 Changed 4 years ago by cboos
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 Changed 4 years ago by anonymous
Excellent. Many thanks.
comment:7 Changed 4 years ago by anonymous
Just noting that the workaround you suggest works.
comment:8 Changed 4 years ago by anonymous
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 Changed 4 years ago by anonymous
For now I just edited ticket/model.py to wrap id=%s in quotes, id='%s'.
comment:10 Changed 4 years ago by cboos
- Keywords postgres83 added; postgres removed
- Milestone changed from 0.11.1 to 0.11
- Priority changed from normal to 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.
comment:11 follow-up: ↓ 12 Changed 4 years ago by mgohlke@…
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 in reply to: ↑ 11 Changed 4 years ago by anonymous
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 Changed 4 years ago by cboos
- Resolution set to fixed
- Status changed from new to closed
comment:14 Changed 3 years ago by anonymous
SELECT bx.*, bl.title FROM boxes bx INNER JOIN blocks bl ON bl.delta=bx.bid WHERE bl.module = 'block' AND bx.bid = 14
SQL error:
ERROR: operator does not exist: character varying = integer at character 69
HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.
In statement:
SELECT bx.*, bl.title FROM boxes bx INNER JOIN blocks bl ON bl.delta=bx.bid WHERE bl.module = 'block' AND bx.bid = 14
HELP PLEASE
415517243 icq



This is introduced with 8.3beta1.