Thread: SQL select doesn't work
Hello! I use xwiki with postgresql, xwiki uses hibernate. I have exception on select, that successful executed in psql: select distinct xwikidocum0_.XWD_WEB as col_0_0_, xwikidocum0_.XWD_NAME as col_1_0_, xwikidocum0_.XWD_DATE as col_2_0_ from xwikidoc xwikidocum0_ where (xwikidocum0_.XWD_HIDDEN<>true or xwikidocum0_.XWD_HIDDEN is null) and 1=1 and xwikidocum0_.XWD_AUTHOR='XWiki.leonidv' order by xwikidocum0_.XWD_DATE desc Exception: org.postgresql.util.PSQLException: ERROR: could not find hash function for hash operator 2060 at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java: 2102) at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java: 1835) at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java: 257) at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java: 500) at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java: 388) at org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java: 273) at org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java: 96) at org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java: 96) at org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java: 96) at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java: 186)
Given that this is an error from the backend (see receiveErrorResponse in the stack trace), my guess is you're not running quite the same query in psql. So, 1. What is the definition of the xwikidoc table? 2. How did you figure out what SQL Hibernate is using here? How are you executing it in psql? I imagine the main difference here could be if Hibernate is using a prepared statement and you're just substituting parameters directly into the psql query instead of using PREPARE/EXECUTE (which still might not be *quite* the same thing, but it's probably closer). --- Maciek Sakrejda | System Architect | Truviso 1065 E. Hillsdale Blvd., Suite 215 Foster City, CA 94404 www.truviso.com