--- a/server/sources/rql2sql.py Tue Jan 06 12:53:47 2009 -0800
+++ b/server/sources/rql2sql.py Wed Jan 07 09:47:56 2009 +0100
@@ -76,7 +76,7 @@
unstable.remove(varname)
torewrite.add(var)
newselect = Select()
- newselect.need_distinct = False
+ newselect.need_distinct = newselect.need_intersect = False
myunion = Union()
myunion.append(newselect)
# extract aliases / selection
@@ -487,7 +487,9 @@
elif self._state.restrictions and self.dbms_helper.needs_from_clause:
sql.insert(1, 'FROM (SELECT 1) AS _T')
sqls.append('\n'.join(sql))
- if distinct:
+ if select.need_intersect:
+ return '\nINTERSECT\n'.join(sqls)
+ elif distinct:
return '\nUNION\n'.join(sqls)
else:
return '\nUNION ALL\n'.join(sqls)