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

  • SEARCH
  • Home
  • 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 7663697
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T14:06:49+00:00 2026-05-31T14:06:49+00:00

I have a Rails app using a Postgres database with a table called geolite_blocks.

  • 0

I have a Rails app using a Postgres database with a table called geolite_blocks. If I call ActiveRecord like this:

GeoliteBlock.find_by_startIpNum 2776360991

The query works perfectly. However, if I do the query like this:

GeoliteBlock.where("startIpNum >= ?", 2776360991)

I get this error:

ActiveRecord::StatementInvalid: PGError: ERROR:  column "startipnum" does not exist
LINE 1: ... "geolite_blocks".* FROM "geolite_blocks"  WHERE (startIpNum...
                                                             ^
: SELECT "geolite_blocks".* FROM "geolite_blocks"  WHERE (startIpNum >= 2776360991)

But I know that the column exists because I just queried by it with the first code example. Any ideas as to why this might be happening, and how I can eliminate it? Thanks for any help!

  • 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-05-31T14:06:50+00:00Added an answer on May 31, 2026 at 2:06 pm

    Column names in SQL are case insensitive unless they were quoted when they were created. Someone created your startIpNum column with quotes around it so you have to quote it every time you use it:

    GeoliteBlock.where('"startIpNum" >= ?', 2776360991)
    

    The error you’re getting from PostgreSQL mentions startipnum because PostgreSQL normalizes identifiers to lower case (the SQL standard says that they should be normalized to upper case though).

    This:

    GeoliteBlock.find_by_startIpNum 2776360991
    

    works because AR will quote the startIpNuM part behind your back. Similarly, GeoliteBlock.where(:startIpNum => 2776360991) would also work.

    I’d recommend that you change the schema to use lower case column names so that you won’t have to worry about this anymore.

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

Sidebar

Related Questions

I have a RESTful resource in my Rails app called Photo. I'm using Paperclip
I have a photo rails app using paperclip. My model called photo and the
I have already implemented some AJAX pagination in my Rails app by using the
I have a rails app that uses heavily js (over 1MB total). I'd like
I have a jruby/rails app using: jruby 1.4.0 Rails 2.3.5 ActiveMQ 5.3.0 Mule ESB
I have a rails app with a mobile view using jqtouch. If the application
I have a Rails app whose major part is to query another web-service using
I have a rails app running on Heroku. I am using paperclip for some
I have a rails app using delayed job, it works fine in development. However,
So I have a Rails 3 app using Paperclip to crop images. I have

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.