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 8215721
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T11:52:51+00:00 2026-06-07T11:52:51+00:00

I have put up an app on Heroku that is running fine locally (using

  • 0

I have put up an app on Heroku that is running fine locally (using sqlite3 as the gem for the database in testing), and when I push to Heroku and try to run it I keep getting this error:

 ActiveRecord::StatementInvalid (PG::Error: ERROR:  syntax error at or near "order"
LINE 1: ...lery_url_id = 'k19fv2mytjEb_3gCezLeRA') ORDER BY `order` ASC                                                              ^
: SELECT "pictures".* FROM "pictures"  WHERE (gallery_url_id = 'k19fv2mytjEb_3gCezLeRA') ORDER BY `order` ASC):
app/controllers/galleries_controller.rb:38:in `show'

Specifically on this line:

@pictures = Picture.find(:all, :conditions => [ 'gallery_url_id = ?', @gallery.url_id ], :order => "`order` ASC")

NOTE: order is a database field, not a SQL call or reference. So don’t go telling me I am doing two orders. That would be silly. Unless somehow it is being parsed that way. Which would also be silly.

I understand that it is some issue from using SQLite in the local testing and PostgreSQL (pg) in the production environment. My question is what do I need to do to fix this? Is it due to a flag that I call in the find that is only supported by SQLite and not PostgreSQL?

  • 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-07T11:52:52+00:00Added an answer on June 7, 2026 at 11:52 am

    Backticks for quoting identifiers are a MySQL-ism that SQLite also supports. The standard syntax (which PostgreSQL uses) for quoting identifiers is to use double quotes:

    :order => '"order" ASC'
    

    I’d recommend that you do two things as soon as possible:

    1. Change the name of your "order" column to something that isn’t reserved.
    2. Install PostgreSQL and develop using PostgreSQL is you’re planning on deploying to Heroku. Your development stack should always exactly match your deployment stack.

    The second point is quite important. Database portability is a myth, there are so many little differences between databases that writing code that works the same in multiple databases is difficult and means writing your own portability layer (and no, ActiveRecord is not that portability layer). This minor quoting problem will probably be the first of many little issues.

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

Sidebar

Related Questions

I have a background that i put in my app and there are places
We've put together an app that is mostly working in phonegap. We have an
I have a new app that I made and put in the store yesterday.
I am trying to put my app live on heroku but I am running
I have an app running on heroku, which I versioning on github too. But
I have put together a simple ASP.NET MVC 3 test web app that uses
I am using Devise with my rails app. It works great locally. I have
I installed an application from app store that uses gps. I have only put
I have now my rails 3.2.1 app running on Heroku. I've tried to upload
I have put one global tabBarController in iphone app that I have been working

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.