Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I am having an issue with PostgreSQL, while using Grails/GORM. I want to be able to figure out what the query is that is running. It is failing asking about a field that I do not have in the class, and I can not find in the db either, so I am wondering how to debug this.

Here is my exception:

ERROR: column this_.level_version does not exist Position: 123. Stacktrace follows: org.postgresql.util.PSQLException: ERROR: column this_.level_version does not exist Position: 123 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 grails.orm.PagedResultList.(PagedResultList.java:55) at at.TriviaController.list(script13759817432761717501241.groovy:15) at grails.plugin.cache.web.filter.PageFragmentCachingFilter.doFilter(PageFragmentCachingFilter.java:186) at grails.plugin.cache.web.filter.AbstractFilter.doFilter(AbstractFilter.java:63) at com.brandseye.cors.CorsFilter.doFilter(CorsFilter.java:69) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1146) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:679)

share|improve this question
add comment (requires an account with 50 reputation)

1 Answer

up vote 0 down vote accepted

You can specify logSql=true in your Datasource.groovy. See docs.

share|improve this answer
That helped me find this: grails-dev.blogspot.com/2013/06/… – nycynik 22 hours ago
If you want to see it formatted add format_sql=true in hibernate block too. – Sérgio Michels 22 hours ago
There's more detail at burtbeckwith.com/blog/?p=1604 – Burt Beckwith 21 hours ago
add comment (requires an account with 50 reputation)

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.