# Postgres sql error

**URL:** <https://www.ruby-forum.com/t/postgres-sql-error/113235>\
**Category:** Rails\
**Created:** [August 29, 2007, 4:43am UTC](https://www.ruby-forum.com/t/postgres-sql-error/113235 "2007-08-29T04:43:15Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![dnstevenson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/8dc957/32.png) [@dnstevenson](https://www.ruby-forum.com/u/dnstevenson)\
**Post date:** [August 29, 2007, 4:43am UTC](https://www.ruby-forum.com/t/postgres-sql-error/113235/1 "2007-08-29T04:43:15Z")

</div>

getting the error shown below on a simple “find\_by\_name” for an active  
record. I’ve seen this with migrations when creating tables with  
“force =\> true” but never a simple select like this. There is nothing  
wrong with the sql. It runs fine in pgadmin.

ActiveRecord::StatementInvalid: RuntimeError: ERROR C25P02 Mcurrent  
transaction is aborted, commands  
ignored until end of transaction block Fpostgres.c L859  
Rexec\_simple\_query: SELECT \* FROM destinations WHERE  
(destinations.“name” = ‘foo bar’) LIMIT 1  
/var/lib/gems/1.8/gems/activerecord-1.15.3/lib/active\_record/  
connection\_adapters/abstract\_adapte  
r.rb:128:in `log' /var/lib/gems/1.8/gems/activerecord-1.15.3/lib/active_record/ connection_adapters/postgresql_adap ter.rb:152:in`execute’  
/var/lib/gems/1.8/gems/activerecord-1.15.3/lib/active\_record/  
connection\_adapters/postgresql\_adap  
ter.rb:433:in `select' /var/lib/gems/1.8/gems/activerecord-1.15.3/lib/active_record/ connection_adapters/abstract/databa se_statements.rb:7:in`select\_all’  
/var/lib/gems/1.8/gems/activerecord-1.15.3/lib/active\_record/  
base.rb:427:in `find_by_sql' /var/lib/gems/1.8/gems/activerecord-1.15.3/lib/active_record/ base.rb:997:in`find\_every’  
/var/lib/gems/1.8/gems/activerecord-1.15.3/lib/active\_record/  
base.rb:991:in `find_initial' /var/lib/gems/1.8/gems/activerecord-1.15.3/lib/active_record/ base.rb:1204:in`send’  
/var/lib/gems/1.8/gems/activerecord-1.15.3/lib/active\_record/  
base.rb:1204:in `method_missing' /var/lib/gems/1.8/gems/activesupport-1.4.2/lib/active_support/ deprecation.rb:44:in`silence’  
/var/lib/gems/1.8/gems/activerecord-1.15.3/lib/active\_record/  
base.rb:1204:in `method\_missing’  
/home/dsailer/aptana/workspace/OrbRuby/config/…/lib/juniper/  
stats\_helper.rb:41

---

<div class="post-metadata">

**Author:** ![dnstevenson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/8dc957/32.png) [@dnstevenson](https://www.ruby-forum.com/u/dnstevenson)\
**Post date:** [August 29, 2007, 11:03pm UTC](https://www.ruby-forum.com/t/postgres-sql-error/113235/2 "2007-08-29T23:03:22Z")

</div>

I found the “real” problem in /var/log/postgresql/postgresql-8.2-  
main.log. It was actually an error on the previous sql statement. This  
seems like a rails bug to me, and a really annoying one. Had me off-  
track for awhile.

lesson: don’t count on the rails log files. Check the db log files.
