Ticket #626 (closed defect: invalid)
Opened 8 years ago
Last modified 8 years ago
error on commiting a new version of a wiki page
| Reported by: | anonymous | Owned by: | jonas |
|---|---|---|---|
| Priority: | high | Milestone: | 0.8 |
| Component: | general | Version: | 0.7.1 |
| Severity: | major | Keywords: | version |
| Cc: | |||
| Release Notes: | |||
| API Changes: | |||
Description
The version number is counted from 1 and steped in increasing order. When the version goes to 10 the next version number should be 11, but trac still try to commit a page with version number 10. When I look into the source, and do some experiemence, I found sqlite think the row generated by 'select 0' only include a text column with content '0'. It made all numeric to be translate to text type, and MAX() function would caompare they in dictionary order. When the last version is 10, the result that we have got is a sequece of ('1' '2' '3' '4' '5' '6' '7' '8' '9' '10' '0'), the maximum of them is also '9' not '10' since sqlite using dictionary order.
I make a patch for it:
begin 644 trac-sql-err.patch
M+2TM('1R86,O5VEK:2YP>2YO<FEG"51H=2!*=6P@,34@,38Z,C<Z,#4@,C`P
M-`HK*RL@=')A8R]7:6MI+G!Y"51H=2!*=6P@,34@,38Z,C@Z,C8@,C`P-`I`
M0"`M-3(U+#D@*S4R-2PY($!`"B`@("`@("`@(&5L<V4Z"B`@("`@("`@("`@
M("!S96QF+G!E<FTN87-S97)T7W!E<FUI<W-I;VX@*'!E<FTN5TE+25]-3T1)
M1EDI"B`@("`@("`@(&-U<G-O<B`]('-E;&8N9&(N8W5R<V]R("@I"BT@("`@
M("`@(&-U<G-O<BYE>&5C=71E("@G4T5,14-4($U!6"AV97)S:6]N*2LQ($92
M3TT@)PHM("`@("`@("`@("`@("`@("`@("`@("`@)RA314Q%0U0@=F5R<VEO
M;B!&4D]-('=I:VD@5TA%4D4@;F%M93TE<R`G"BT@("`@("`@("`@("`@("`@
M("`@("`@("`G54Y)3TX@04Q,(%-%3$5#5"`P(&%S('9E<G-I;VXI)RP@<V5L
M9BYN86UE*0HK("`@("`@("!C=7)S;W(N97AE8W5T92`H)U-%3$5#5"!)1DY5
M3$PH34%8*'9E<G-I;VXI*S$L(#$I($923TT@)PHK("`@("`@("`@("`@("`@
M("`@("`@("`@)RA314Q%0U0@=F5R<VEO;B!&4D]-('=I:VD@5TA%4D4@;F%M
M93TE<RDG"BL@("`@("`@("`@("`@("`@("`@("`@("`L('-E;&8N;F%M92D*
M("`@("`@("`@<F]W(#T@8W5R<V]R+F9E=&-H;VYE*"D*("`@("`@("`@;F5W
A7W9E<G-I;VX@/2!I;G0H<F]W6S!=*0H@("`@("`@("`*
Aho K.F. Li
Attachments
Change History
comment:1 Changed 8 years ago by anonymous
comment:2 Changed 8 years ago by jonas
Can you attach the file instead?
comment:3 Changed 8 years ago by daniel
- Milestone set to 0.8
comment:4 Changed 8 years ago by jonas
What sqlite and pysqlite version are you using?
comment:5 Changed 8 years ago by anonymous
SQLite-2.8.14
PySQLite-0.5.0
I has tried to identify type of result in sqlite console.
And, I found the problem what I had said.
comment:6 Changed 8 years ago by jonas
- Status changed from new to assigned
Yeah, I'm just trying to figure out why the current query seems to work for everybody else…
comment:7 Changed 8 years ago by jonas
Are you even using Trac version 0.7.1? If I remember correctly this query was modified between 0.7.0 and 0.7.1 to work around a bug in sqlite.
The query in trac 0.7.1 looks like this:
cursor.execute ('SELECT MAX(version) FROM (SELECT MAX(version)+1 ' 'FROM wiki WHERE name=%s UNION ALL SELECT 1 ' 'AS version)', self.name)
(from source:/tags/trac-0.7.1/trac/Wiki.py#latest)
And your patch seems to have been created against an older version of Wiki.py.
Please verify that Trac 0.7.1 has the same problem.
comment:8 Changed 8 years ago by anonymous
sorry..
It is my fail. After cheching the version, it is 0.6.1.
comment:9 Changed 8 years ago by jonas
- Resolution set to invalid
- Status changed from assigned to closed



sorry for corrupted patch file in #626. I paste it again:
begin 644 trac-sql-err.patch M+2TM('1R86,O5VEK:2YP>2YO<FEG"51H=2!*=6P@,34@,38Z,C<Z,#4@,C`P M-`HK*RL@=')A8R]7:6MI+G!Y"51H=2!*=6P@,34@,38Z,C@Z,C8@,C`P-`I` M0"`M-3(U+#D@*S4R-2PY($!`"B`@("`@("`@(&5L<V4Z"B`@("`@("`@("`@ M("!S96QF+G!E<FTN87-S97)T7W!E<FUI<W-I;VX@*'!E<FTN5TE+25]-3T1) M1EDI"B`@("`@("`@(&-U<G-O<B`]('-E;&8N9&(N8W5R<V]R("@I"BT@("`@ M("`@(&-U<G-O<BYE>&5C=71E("@G4T5,14-4($U!6"AV97)S:6]N*2LQ($92 M3TT@)PHM("`@("`@("`@("`@("`@("`@("`@("`@)RA314Q%0U0@=F5R<VEO M;B!&4D]-('=I:VD@5TA%4D4@;F%M93TE<R`G"BT@("`@("`@("`@("`@("`@ M("`@("`@("`G54Y)3TX@04Q,(%-%3$5#5"`P(&%S('9E<G-I;VXI)RP@<V5L M9BYN86UE*0HK("`@("`@("!C=7)S;W(N97AE8W5T92`H)U-%3$5#5"!)1DY5 M3$PH34%8*'9E<G-I;VXI*S$L(#$I($923TT@)PHK("`@("`@("`@("`@("`@ M("`@("`@("`@)RA314Q%0U0@=F5R<VEO;B!&4D]-('=I:VD@5TA%4D4@;F%M M93TE<RDG"BL@("`@("`@("`@("`@("`@("`@("`@("`L('-E;&8N;F%M92D* M("`@("`@("`@<F]W(#T@8W5R<V]R+F9E=&-H;VYE*"D*("`@("`@("`@;F5W A7W9E<G-I;VX@/2!I;G0H<F]W6S!=*0H@("`@("`@("`* ` end