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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T12:32:03+00:00 2026-05-27T12:32:03+00:00

I have a PostgreSQL database for a Rails application. I want to store the

  • 0

I have a PostgreSQL database for a Rails application.

I want to store the Facebook user id so I thought I could use integer but its not big enough so I chose float.

However now Rails adds .0 to the end of my user id’s

What datatype can I use so this does not happen for Facebook user ids which are very long example: 100002496803785

  • 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-27T12:32:04+00:00Added an answer on May 27, 2026 at 12:32 pm

    You can use :limit => 8 on your integer column to get a bigint. For example:

    class Pancakes < ActiveRecord::Migration
        def change
            create_table :pancakes do |t|
                t.integer :c, :limit => 8
            end
        end
    end
    

    And then, from psql:

    => \d pancakes
                             Table "public.pancakes"
     Column |  Type   |                       Modifiers                       
    --------+---------+-------------------------------------------------------
     id     | integer | not null default nextval('pancakes_id_seq'::regclass)
     c      | bigint  | not null
    Indexes:
        "pancakes_pkey" PRIMARY KEY, btree (id)
    

    And there’s your eight byte bigint column.

    You could also use a string for the Facebook ID. You’re not doing any arithmetic on the IDs so they’re really just opaque bags of bits that happen to look like large integers, strings will sort and compare just fine so they might be the best option. There would be some storage and access overhead due to the increased size of a string over the integer but it probably wouldn’t be enough to make any noticeable difference.

    Never use a double for something that needs to be exact. You’d probably be fine (except for the trailing .0 of course) in this case because you’d have 52 bits of mantissa and that means that the double would act like a 52 bit integer until your values got large enough to require the exponent. Even so, using double for this would be an awful idea and an abuse of the type system.

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

Sidebar

Related Questions

I have a PostgreSQL database for my Rails application. In the schema named 'public'
I working on Ruby on Rails application using a PostgreSQL database. I have heard
I have a Ruby on Rails application with a PostgreSQL database; several tables have
I have a Rails project which has a Postgres database for the actual application
I have a Postgresql database on which I want to do a few cascading
I currently have an MS Access application that connects to a PostgreSQL database via
I have a Rails application that right now is pretty standard: Heroku/PostgreSQL backend, users
I have a Ruby/Rails app. I have an artists table in my postgresql database
Framework: Rails 2.3.8 Database; PostgreSQL I currently have the following SQL statements (generated by
I have wrote a few simple Rails application, accessing the database via the ActiveRecord

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.