• GbyBE@discuss.tchncs.de
    link
    fedilink
    arrow-up
    1
    ·
    1 year ago

    Let’s say I was once very happy that I remembered learning about a certain Oracle feature called flashback queries one day when I made that mistake.

  • TheSlad@sh.itjust.works
    link
    fedilink
    arrow-up
    1
    ·
    1 year ago

    Where clauses should be syntactically required for delete or update statements. Throw an error without them. If you really want to hit every record in the table then throw a WHERE true in there just to be explicit.

    Its such a common mistake i dont get why this isnt a thing.

    • GBU_28@lemm.ee
      link
      fedilink
      English
      arrow-up
      1
      ·
      1 year ago

      Good idea.

      Easy enough to slap a where 1=1; on there if you want to burn the place down

  • bar1@lemm.ee
    link
    fedilink
    arrow-up
    1
    ·
    1 year ago

    A very real problem I ran into in SSMS was I had inadvertently highlighted all parts of the script except the “where” clause and executed it. I thought to myself, “why is this taking so long for such a low impact change?”

    I knew running ad-hoc scripts in a production environment was risky, but I accepted it. We had a fresh enough backup already loaded in our sandbox environment and the removed data was quickly restored from there after some cursing and some quick hacking. This happened 6 years ago.

    The data that was deleted? All the user accounts of our biggest client. This happened at 10 AM in the morning on a weekday. FML. I was lucky to keep my job.

    As an aside, if you do something on my level of stupid, then escalate the issue up the chain of command as quickly as possible. Do not hide it. If you’ve built up enough good will with your co-workers and bosses, they will rally to your aid. Definitely don’t try to hide it. That will almost certainly lead to termination.

    Check my war wounds. Every soldier has a story to tell.