Issue 984591
Created on 2004-07-03 12:34 by uzak, last changed 2004-10-08 06:06 by richard.
File name |
Uploaded |
Description |
Edit |
Remove |
rdbms_common.patch
|
uzak,
2004-07-03 14:25
|
patch for wrong order in joins |
|
|
msg1334 |
Author: [hidden] (uzak) |
Date: 2004-07-03 12:34 |
|
When I try to search on Multilink items this happens
(roundup-0.7.5, postgresql backend):
psycopg.ProgrammingError: ERROR: JOIN/ON clause refers
to "_issue", which is not part of JOIN select
distinct(_issue.id),_priority._order,_issue._activity
from _issue,issue_nosy LEFT OUTER JOIN _priority on
_issue._priority=_priority.id where
_issue.id=issue_nosy.nodeid and issue_nosy.linkid in
('3','1') and _issue.__retired__ <> 1 order by
_priority._order,_issue._activity desc
[...]
File
"/usr/lib/python2.3/site-packages/roundup/cgi/PageTemplates/PythonExpr.py",
line 72, in __call__
return f()
File "<string>", line 2, in f
File
"/usr/lib/python2.3/site-packages/roundup/cgi/templating.py",
line 2056, in batch
l = klass.filter(matches, filterspec, sort, group)
File
"/usr/lib/python2.3/site-packages/roundup/backends/rdbms_common.py",
line 2270, in filter
self.db.cursor.execute(sql, args)
ProgrammingError: ERROR: JOIN/ON clause refers to
"_issue", which is not part of JOIN
It works when the FROM part is changed to ... from
_issue_nosy,_issue ...
|
msg1335 |
Author: [hidden] (uzak) |
Date: 2004-07-03 13:07 |
|
Logged In: YES
user_id=244310
In my instance, this patch helps:
@@ -2076,7 +2076,7 @@
timezone = self.db.getUserTimezone()
# vars to hold the components of the SQL statement
- frum = [] # FROM clauses
+ frum = ['_'+cn] # FROM clauses
loj = [] # LEFT OUTER JOIN clauses
where = [] # WHERE clauses
args = [] # *any* positional arguments
@@ -2243,7 +2243,6 @@
orderby.append(o)
# construct the SQL
- frum.append('_'+cn)
frum = ','.join(frum)
if where:
where = ' where ' + (' and '.join(where))
|
msg1336 |
Author: [hidden] (uzak) |
Date: 2004-07-03 14:25 |
|
Logged In: YES
user_id=244310
I've attached the correct patch now.:)
|
msg1337 |
Author: [hidden] (richard) |
Date: 2004-07-03 23:05 |
|
Logged In: YES
user_id=6405
I've tried to reproduce the error using the SQL you supplied, but
no dice. My postgresql handles the SQL just fine. Perhaps it's my
postgresql version? I'm running 7.4.1
The change doesn't appear to affect my postgresql, or sqlite, so
I'll apply it.
|
msg1338 |
Author: [hidden] (uzak) |
Date: 2004-07-04 08:42 |
|
Logged In: YES
user_id=244310
Sorry for bothering you again, but I can reproduce the
problem on a different machine, even in a new installed
tracker, too.
My postgresql and roundup:
ii postgresql 7.4.3-1
ii roundup 0.7.5-1
How to reproduce:
* install & initialize new tracker
* start the web-frontend
* create a issue, set admin and anonymous on the nosy list
* go to the search page, create a search which will match
the issue you have created in the previous step
* add a nosy=1 condition to search URI
You'll run into trouble as you tell postgresql you want to
have a join of issue_nosy with priority, although you are
accessing _issue's columns in the join. That's why the order
is important.
Perhaps, I should have added this comment when I created
this issue, sorry.
|
msg1339 |
Author: [hidden] (richard) |
Date: 2004-07-19 01:36 |
|
Logged In: YES
user_id=6405
Followed your instructions (though instead of searching, I just
used the "Show All" link which I modified to include the nosy
filter parameter - effectively the same, but the URL is easier to
edit ;)
I was unable to reproduce the error either with the latest CVS
maint-0-7 branch code. Please try checking out this branch (see
the developers doc for info how to do this) and test against it.
I am not currently able to upgrade to posgresql 7.4.3, as no RPM
is available.
The SQL generated by this version of the code is (I hope this
comes out readable):
select distinct(_issue.id),_priority._order,_issue._activity
from issue_nosy,_issue
LEFT OUTER JOIN _priority on _issue._priority=_priority.id
where (_issue._status is NULL or
(_issue._status in ('1','2','3','4','5','6','7')))
and _issue.id=issue_nosy.nodeid
and issue_nosy.linkid in ('1')
and _issue.__retired__ <> 1
order by _priority._order,_issue._activity desc
|
msg1340 |
Author: [hidden] (richard) |
Date: 2004-09-29 07:32 |
|
Logged In: YES
user_id=6405
I'm going to have to close this issue if there's no feedback.
|
msg1341 |
Author: [hidden] (a1s) |
Date: 2004-09-29 10:54 |
|
Logged In: YES
user_id=8719
i guess the sql statement should look like this:
select distinct(_issue.id),_priority._order,_issue._activity
from _issue INNER JOIN issue_nosy ON
_issue.id=issue_nosy.nodeid
LEFT OUTER JOIN _priority on _issue._priority=_priority.id
where (_issue._status is NULL or
(_issue._status in
('1','2','3','4','5','6','7')))
and issue_nosy.linkid in ('1')
and _issue.__retired__ <> 1
order by _priority._order,_issue._activity desc
"where" and "join on" are two different syntaxes for table
joins, and i am not sure if they can be combined. (perhaps
not, if we get this error.)
|
msg1342 |
Author: [hidden] (richard) |
Date: 2004-10-08 06:06 |
|
Logged In: YES
user_id=6405
I've finally manage to reproduce the error. If I switch the "from"
table names in the O.P's SQL, it works fine (ie. "from
issue_nosy,_issue") but if they're around the other way (ie. "from
_issue,issue_nosy") then I get an error.
I believe this has been fixed since the SQL generation now
always puts the _issue table (or whatever the class table is
called) last in the from list.
|
|
Date |
User |
Action |
Args |
2004-07-03 12:34:41 | uzak | create | |
|