Today I once again wrote some nice SQL to fix yesterdays fuckup. A few years ago I would have written a #Perl script, but nowadays my #SQL is good enough (and #Postgres has nice enough features) to d…