5 ms·
> we should keep numeric data in “integer”, “numeric” fields I end up keeping numeric data as text when I'm ingesting an external data source that I don't trus
by roywiggins 6y ago
> we should keep numeric data in “integer”, “numeric” fields
I end up keeping numeric data as text when I'm ingesting an external data source that I don't trust not to change ID format on me. They're all numeric now, but the format could change, and the actual numeric value of the ID is not important at all.
- bcrosby95 6y agoYes, be careful conflating numeric data with data that looks numerical. IDs fall into the latter for sure. Unless you have complete control over it, then it might always be numeric. E.g. back when I thought I was super smart, on one project I made the credit card cvv a number. Except they can start with 0. Whoops.
- barnabask 6y agoSame here, but with US postal codes. Having grown up on the west coast I didn't realize some started with a zero until embarrassingly late in life.
- roywiggins 6y agoThe best rule of thumb I've seen for this is that unless incrementing a value makes sense, probably use a text field unless you have some other really good reason. So: auto-incremented IDs yes, arbitrary IDs that you don't control no, phone numbers no, SSNs/PINs/ZIP codes, also no.