Description of problem: I have RHEV-M setup with 200 VMs. When I sorted VMs by Host (reproduced with other fields as well) click on arrow to go to next page than all VMs disappeared forever till next login to admin portal. I found the next errors in engine log file: 2015-03-04 11:45:40,843 ERROR [org.ovirt.engine.core.bll.SearchQuery] (ajp-/127.0.0.1:8702-3) Query SearchQuery failed. Exception message is StatementCallback; bad SQL grammar [SELECT * FROM ((SELECT distinct vms.* FROM vms ) ORDER BY fn_get_comparable_ip_list(vm_ip) ASC,vm_name ASC ) as T1 OFFSET (1 -1) LIMIT 100]; nested exception is org.postgresql.util.PSQLException: ERROR: for SELECT DISTINCT, ORDER BY expressions must appear in select list Position: 62 : org.springframework.jdbc.BadSqlGrammarException: StatementCallback; bad SQL grammar [SELECT * FROM ((SELECT distinct vms.* FROM vms ) ORDER BY fn_get_comparable_ip_list(vm_ip) ASC,vm_name ASC ) as T1 OFFSET (1 -1) LIMIT 100]; nested exception is org.postgresql.util.PSQLException: ERROR: for SELECT DISTINCT, ORDER BY expressions must appear in select list Position: 62: org.springframework.jdbc.BadSqlGrammarException: StatementCallback; bad SQL grammar [SELECT * FROM ((SELECT distinct vms.* FROM vms ) ORDER BY fn_get_comparable_ip_list(vm_ip) ASC,vm_name ASC ) as T1 OFFSET (1 -1) LIMIT 100]; nested exception is org.postgresql.util.PSQLException: ERROR: for SELECT DISTINCT, ORDER BY expressions must appear in select list Position: 62 2015-03-04 11:45:50,501 INFO [org.ovirt.engine.core.bll.SearchQuery] (ajp-/127.0.0.1:8702-8) ResourceManager::searchBusinessObjects - erroneous search text - Vms: page 2 SORTBY HOST ASC 2015-03-04 11:45:54,218 INFO [org.ovirt.engine.core.bll.SearchQuery] (ajp-/127.0.0.1:8702-10) ResourceManager::searchBusinessObjects - erroneous search text - Vms: page 1 SORTBY HOST ASC Version-Release number of selected component (if applicable): RHEV-M 3.5.1-0.1 (build vt14) How reproducible: Steps to Reproduce: 1. 2. 3. Actual results: Expected results: Additional info:
Created attachment 997801 [details] engine log file
the "bad SQL grammar" implies that there is something wrong with the SQL query generated for the "Vms: page 1 SORTBY HOST ASC" (which, AFAIK, is a legal search text, otherwise an SQL query would not be generated in the first place).
Verified on ovirt-engine-backend-3.6.0-0.0.master.20150610173629.gitdf68a60.el6.noarch