I'm using Google as a login system for my latest project. So, my users table has a column named googleid, which stores Google's unique user id, which is a number, with a few dozen digits. For example, it might be 105561241212957286025. Since I'm not going to do any mathematical operations on this data, should I store it as a number, or as a string, in my database? Also note that if I used a numerical value I would actually have to specify a custom precision because the built-in numerical types in PostgreSQL aren't big enough for this value.
Should arbitrary numbers be stored as strings in a database?
database;authentication;strings;numbers
Store it as a string.You've already stated some of the reasons why:You're not going to do any mathematical operations on itYou need a very large precision number to store that many digitsLet me give you a few more reasons:ID's don't conceptually have a sequence or sort order, nor should they.  ID's therefore have no numeric semantics whatsoever; the only advantage numbers might have is storage size.Use a string, and if Google decides to change to GUIDs or base64 numbers for their ID's, your project will still work.I have been using Guid's for Primary Keys in SQL databases for awhile now, and I consider them ideal for ID's becauseThey are globally-unique, so only joins that make sense will actually produce any output.They're 128 bit numbers internally, so they can be stored more efficiently than string keys.  The hexadecimal representation just exists for display purposes.