Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8399647
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T21:21:38+00:00 2026-06-09T21:21:38+00:00

I currently have an app on Heroku that keeps throwing errors from this one

  • 0

I currently have an app on Heroku that keeps throwing errors from this one ActiveRecord query.

if category == "-1"
    where('category_id IS null')
else
    where('category_id IS ?', category)
end

The first query with the ‘category_id IS null works just fine but the second query throws such an error:

2012-08-16T18:58:03+00:00 app[web.1]:
2012-08-16T18:58:03+00:00 app[web.1]:
2012-08-16T18:58:03+00:00 app[web.1]: Started GET "/items?cpath=4" for 204.154.121.30            at 2012-08-16 18:58:03 +0000
2012-08-16T18:58:08+00:00 app[web.1]:
2012-08-16T18:58:08+00:00 app[web.1]: ActiveRecord::StatementInvalid (PGError: ERROR:  syntax error at or near "4"
2012-08-16T18:58:08+00:00 app[web.1]: LINE 1: SELECT COUNT(*) FROM "items"  WHERE (category_id IS 4)
2012-08-16T18:58:08+00:00 app[web.1]:                                                             ^
2012-08-16T18:58:08+00:00 app[web.1]:   app/controllers/items_controller.rb:30:in `index'
2012-08-16T18:58:08+00:00 app[web.1]: : SELECT COUNT(*) FROM "items"  WHERE (category_id IS 4)):
2012-08-16T18:58:08+00:00 app[web.1]:
2012-08-16T18:58:08+00:00 app[web.1]:
2012-08-16T18:58:08+00:00 app[web.1]: cache: [GET /items?cpath=4] miss
2012-08-16T18:58:08+00:00 app[web.1]:   Processing by ItemsController#index as HTML
2012-08-16T18:58:08+00:00 app[web.1]:   Parameters: {"cpath"=>"4"}
2012-08-16T18:58:08+00:00 app[web.1]: Completed 500 Internal Server Error in 3ms
2012-08-16T18:58:08+00:00 heroku[router]: GET yisifahan.herokuapp.com/items?cpath=4 dyno=web.1 queue=0 wait=0ms service=
5026ms status=500 bytes=728
2012-08-16T18:58:08+00:00 heroku[web.1]: Error R12 (Exit timeout) -> At least one process failed to exit within 10 seconds of SIGTERM
2012-08-16T18:58:08+00:00 heroku[web.1]: Stopping remaining processes with SIGKILL
2012-08-16T18:58:09+00:00 heroku[web.1]: Process exited with status 137

Does anyone know how to fix this problem? Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T21:21:40+00:00Added an answer on June 9, 2026 at 9:21 pm

    I believe the IS comparison operator is invalid for equality. (http://www.postgresql.org/docs/9.2/static/functions-comparison.html)

    So you’re snippet should look something like:

    if category == "-1"
      where('category_id IS null')
    else
      where('category_id = ?', category)
    end
    

    Honestly you should have some tests checking your code for these cases. It shouldn’t have made its way onto the server as such. I would also suggest you use a postgres database in your development environment so you can make sure you’re code is valid against it’s architecture.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have Rails 3.1 app that I'm currently hosting on Heroku. My problem is
I currently have an app deployed on Heroku which runs on two web dynos
I currently have an app that requires connection to a server in multiple activities.
currently I have an app that creates all sorts of different requests to Facebook
I currently have a deployed app (fortworth.herokuapp.com) that I am attempting to sort movies
I currently have one iPad app, but it now needs to become two. The
I currently have an iPhone app that lets the users take video, upload it
I currently have an app on Heroku Cedar stack running with Unicorn. I also
asked the next thing from Heroku support the other day: I have an app
I have a rails app running a thin server on heroku. It currently uses

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.