Skip to content
DevMeme
7106 of 7435
Iranian Rial Collapse Overflows Database Column, Breaks Startup Jobs
Databases Post #7791, on Mar 5, 2026 in TG

Iranian Rial Collapse Overflows Database Column, Breaks Startup Jobs

Why is this Databases meme funny?

Level 1: The Piggy Bank That's Too Small

Imagine you built a piggy bank with a slot that fits coins up to a certain size, because no coin you'd ever seen was bigger. Then one day the country starts printing dinner-plate-sized coins, and your piggy bank just... jams. Nothing's wrong with the piggy bank — it's doing exactly what you built it to do — but the world changed the size of money on you. That's what happened here: a country's money lost so much value so fast that the numbers got bigger than the computer's storage box was built to hold, and the website broke. The funny part is the mismatch in scale — a whole country's economy collapsed, and one of the casualties was a job website's homework robot.

Level 2: What "Overflowing a Column" Means

Databases make you declare, up front, how big each piece of data can be. A column type like DECIMAL(8,2) says: "numbers with up to 8 digits total, 2 of them after the decimal point" — so a maximum of 999999.99. Try to store 1,000,000.00 and the database doesn't round or truncate; it throws an error and rejects the write entirely.

Background jobs are tasks that run behind the scenes instead of while a user waits — things like "fetch today's exchange rates for every currency and update the salaries shown on the job board." When one of those jobs hit the rial's new exchange rate and tried to write a number bigger than the column allowed, the job crashed. Job systems usually retry failed work, so it crashed again, and again, lighting up the error dashboard.

The Iranian Rial is one of the world's weakest currencies, and a collapse means one US dollar suddenly buys more than a million rials. The chart in the tweet shows the rial's value in dollars flatlining near 0,00002 for years, then dropping straight down. Early-career takeaway: when you size a field — money, counters, dates, name lengths — you're making a prediction. Real data eventually visits every edge case you ruled out, and VARCHAR(20) will someday meet a person whose name is 21 characters long.

Level 3: Geopolitics Files a Regression

The beauty of this postmortem — posted by Marc Köhlbrugge, the indie hacker behind Startup Jobs and WIP (note the WIP cap on his avatar) — is the causal chain's absurd length: macroeconomic collapse → currency devaluation → exchange-rate API returns a seven-digit number → DECIMAL column overflows → Ruby background jobs crash → a job board for startups stops working. Nothing in that chain is a bug in the classic sense. Every component behaved exactly as designed. The assumption failed — some past code review where 1,000,000 looked like a comically generous upper bound for any exchange rate. The five-year chart attached to the post is the perfect visual: years of flat, boring line, then a sheer vertical cliff to the red dot at zero. That cliff is the exact shape of every "this will never happen" finally happening.

Veterans recognize the genre instantly because it rhymes with the classics: Y2K's two-digit years, the 2038 Unix timestamp rollover, Gangnam Style overflowing YouTube's 32-bit view counter, phone-number columns that choked on international formats. The pattern is always the same: a schema encodes a snapshot of the world's current shape, the world moves, and the database — doing its job perfectly — refuses to lie about it. The systemic reason this keeps happening is that schema bounds are decided early, under uncertainty, by people optimizing for storage and validation strictness, while the inputs are generated decades later by politicians, central banks, and wars. You cannot unit-test against the future of the Iranian economy. The channel's caption frames it exactly right: "Geopolitics VS your server" — and geopolitics is undefeated.

There's also a quiet lesson in the failure mode being background jobs. Currency-sync jobs run on schedules, retry on failure, and alert late. An overflow like this doesn't page anyone at the moment of the cliff; it surfaces hours later as a pile of dead jobs and a confused founder reverse-engineering world events from a stack trace.

Level 4: NUMERIC Overflow Is a Type-System Confession

Turns out it was caused by the collapse of the Iranian Rial which lead to the exchange rate exceeding 1,000,000 and overflowing a database column

What actually fired here is almost certainly a fixed-point precision constraint, not an integer wraparound. SQL's DECIMAL(p,s) / NUMERIC(p,s) types allocate p total significant digits with s reserved after the decimal point — so a column like DECIMAL(12,6) can hold at most 999999.999999. Exchange rates need many fractional digits (the chart in the screenshot shows the rial trading around 0,00002 dollars per rial — five leading zeros), so engineers reasonably skew precision toward the fractional side. The moment the inverse rate (rials per dollar) crossed 1,000,000, the integer portion needed a seventh digit that was never allocated, and the database did the correct, contractually honest thing: raised numeric value out of range and failed the write. Every background job touching that row then died in a loop.

This is the fundamental trade-off of fixed-point arithmetic: unlike IEEE 754 floating point, which degrades gracefully by silently sacrificing precision as magnitude grows, fixed-point types have a hard ceiling and fail loudly. For money, that loudness is the feature — floats famously can't represent 0.10 exactly, which is why every fintech style guide screams "never store currency in floats." But the cost of that rigor is that schema authors must bound the domain in advance, and the domain here is "the future behavior of all world economies." Hyperinflation is the canonical adversarial input: Zimbabwe printed a hundred-trillion-dollar note; Hungary's 1946 pengő inflated so fast that 10^29 of them made one new forint. Any finite (p,s) is a bet against history, and history has a 100% hit rate against optimists.

Description

A screenshot of an X.com post by Marc Köhlbrugge (@marckohlbrugge, verified, yellow cartoon avatar with a 'WIP' cap) reading: 'A bunch of background jobs for Startup Jobs started failing... Turns out it was caused by the collapse of the Iranian Rial which lead to the exchange rate exceeding 1,000,000 and overflowing a database column' with a sweat-smile emoji. Attached is a 5-year currency chart (tabs 1D, 5D, 1M, 1Y, 5Y, Max) showing the Rial's value hovering around 0.00002 from 2023 through 2025 before plunging vertically to nearly 0.00000 at the far right, ending in a red dot. A real-world postmortem gem: geopolitical macroeconomics manifesting as a numeric overflow in a column sized on the assumption that exchange rates stay below one million

Comments

22
Anonymous ★ Top Pick Somewhere a 2015 code review approved DECIMAL(8,2) with the comment 'no currency will ever need more' - geopolitics just filed the regression
  1. Anonymous ★ Top Pick

    Somewhere a 2015 code review approved DECIMAL(8,2) with the comment 'no currency will ever need more' - geopolitics just filed the regression

  2. @RiedleroD 4mo

    …collapse? I struggle to believe that story is actually true

    1. @RiedleroD 4mo

      like ok it dropped from 70 to 64 over the last month, but that's hardly what's being suggested by the guy's screenshot

  3. @RiedleroD 4mo

    wait nvm he was in the 5Y view

    1. @RiedleroD 4mo

      there's certainly something real funky going on though. this doesn't feel quite right

      1. @RiedleroD 4mo

        other way around shows this, which I also find dubious

        1. @RiedleroD 4mo

          the only mildly relevant thing I could find is that they're introducing a "new rial" that is just the same one except 4 zeroes less. similar thing as with old and new polish złoty: same currency, you just make the number smaller for less tedium. I would expect this to, if any at all, produce the opposite effect of what we're seeing though. wikipedia mentions the iranian protests being caused by inflation (an eyewatering 40%) but says nothing about the rial falling off a cliff, which leads me to believe google is just wrong about this

          1. @RiedleroD 4mo

            I can find several sources claiming that december through january the year-to-year inflation was between 45% and 60%. eyewatering, terrible, incredible. but not the cliff google would lead you to believe. so I believe what happened was that google (or whatever google's source is) just doesn't have the data and frankly, made that shit up. and that's what messed with mr. money's database

            1. @RiedleroD 4mo

              original tweet: https://xcancel.com/marckohlbrugge/status/2028236228970099180 oh and about "exceeding 1 million" - that happened in early 2025, not recently. *maybe* it was 2²⁰, which is 1,048,576 but I doubt that it took almost a year to go from 1M to 1.04M considering the 40% inflation rate, and 20 is a weirdly arbitrary number of bits to have. 24 would be more understandable, or 23 if we're doing signed integers (why though)

              1. @NaNmber 4mo

                holy research 🤯

              2. @SamsonovAnton 4mo

                Remember crude oil prices going negative in 2020? That's why. 👌

                1. @RiedleroD 4mo

                  no? what?

                  1. @deadgnom32 4mo

                    during covid oil consumption has extremely reduced in extremely short time. while millions of barrels were still on their way to destination points. countries just had no idea where to store it and they had no chance to consume that much before oil arrival, so that created a unique phenomenon, when mathematicaly supply was so much higher than demand, that prices went negative.

                    1. @deadgnom32 4mo

                      but it was only a math phenomenon, as actual cosumer you still had to pay for it.

                      1. @FreeNickname 4mo

                        Not really, if I recall correctly? One note is that that's wasn't crude oil price per se. That was crude oil futures price. And yes, you could "buy" it for a negative price. And you would get paid to have it. The catch is that you wouls actually legally have to accept that crude oil delivery. Like physically accept it and store it somewhere. And if you don't, you'd get fined A LOT.

                        1. @deadgnom32 4mo

                          yes. I meant exactly this as a basic consumer you still had to pay for it, but if you can store a whole tanker somewhere, that is where the negative price comes.

                          1. @FreeNickname 4mo

                            Ah, I see. Then we're talking about the same thing 🤝 It's just that to me "basic consumer" of crude oil IS the one who buys it, since usual people don't buy crude oil 🙂 So, from my point of view, "basic consumers of crude oil" could, in fact, "buy" it for a negative price 🙂

                            1. @deadgnom32 4mo

                              yes it was just. that many people thought — nice. I can take a couple of barrels and sell it afterwards. no, you need to take the whole tanker and as a basic consumer if you would like to buy a couple — the storage owner won't pay you for that. he will sell it to you for money if you somehow manage to talk them into selling it to you

                        2. @deadgnom32 4mo

                          I may have failed to express myself correctly. I'm very tired lately

                    2. @deadgnom32 4mo

                      basically, oil prices are mostly automatically computed, formulae just weren't designed for situations like this, since supply usually quickly adjusts to demand changes, it has never been expected to have such an extreme drop

                    3. @RiedleroD 4mo

                      dang. crazy

              3. @TERASKULL 4mo

                based xcancel user

Use J and K for navigation