server/sources/rql2sql.py
branchstable
changeset 6297 23c1e50ff97b
parent 6286 4d10e9895679
child 6491 ee9a10b6620e
equal deleted inserted replaced
6296:b7484ae2c693 6297:23c1e50ff97b
   759         restrictions, tables = self._state.pop_scope()
   759         restrictions, tables = self._state.pop_scope()
   760         if restriction:
   760         if restriction:
   761             restrictions.append(restriction)
   761             restrictions.append(restriction)
   762         restriction = ' AND '.join(restrictions)
   762         restriction = ' AND '.join(restrictions)
   763         if not restriction:
   763         if not restriction:
       
   764             if tables:
       
   765                 return 'SELECT 1 FROM %s' % ', '.join(tables)
   764             return ''
   766             return ''
   765         if not tables:
   767         if not tables:
   766             # XXX could leave surrounding EXISTS() in this case no?
   768             # XXX could leave surrounding EXISTS() in this case no?
   767             sql = 'SELECT 1 WHERE %s' % restriction
   769             sql = 'SELECT 1 WHERE %s' % restriction
   768         else:
   770         else: