• Sock Puppet #5 (unregistered)

    Well, I've come up with a new reason not to register for this site. My handle is not registratable! Is this the reason for your name, C-Octothorpe?

  • (cs) in reply to Lockwood
    Lockwood:
    I have a 2 dumb questions.

    Let us assume that the specification for the system is "The client has to be notified when any change happens to their reservation" This includes the "Your reservation for resource Room 101 for Monday 5 September 2011 has been deleted" message.

    1. Why is getting that email sent at the point in time that the delete occurs a bad thing?

    2. What else would you do, have something polling to go "Is anything missing now? How about now? Now?" How else would you be able to act on a direct DELETE statement.

    Assuming you're not trolling, the proper thing to do would be to take business actions in your business layer, not your data layer. Something like Reservation.Delete(bool sendEmailNotification = true). It can perform the delete transaction against the database and if it succeeds, send the email. Just think - now you can delete records without sending emails!
  • LANMind (unregistered) in reply to frits
    frits:
    I had this same situation one time. There, I fixed it by running the DELETE statement in a loop until SELECT returned 0 records. I'm a bit of a Rock Star 'round these parts.

    I hope you're not proud of that...

  • LANMind (unregistered) in reply to Lockwood
    Lockwood:
    I have a 2 dumb questions.

    Let us assume that the specification for the system is "The client has to be notified when any change happens to their reservation" This includes the "Your reservation for resource Room 101 for Monday 5 September 2011 has been deleted" message.

    1. Why is getting that email sent at the point in time that the delete occurs a bad thing?

    2. What else would you do, have something polling to go "Is anything missing now? How about now? Now?" How else would you be able to act on a direct DELETE statement.

    There's no reason why your db server can't send emails, despite what you might read here in the comments, but it is certainly a really bad idea to do it from a trigger. If for any reason your mail server is unreachable, it will block the trigger and hang the process until it times out, potentially locking the table upon which the trigger resides. Triggers should be fast as hell.

    If you put business logic in your database, the preferred method of sending emails is to throw data to a table used for queueing, then have a a separate job that polls the table.

  • cheap shot (unregistered)

    In my mind, TRWTF is the problem solving approach used by our protagonist.

    An appropriate way of dealing with a strange behaviour like this would be to (a) try to reproduce the problem in order to (b) identify and fix the actual cause before (c) repairing the damage.

    Instead, this guy jumps straight to (c) and hopes that (a) and (b) get taken care of by themselves?

  • (cs) in reply to Yazeran
    Yazeran:
    What is happening to this site????

    The last 3 or 4 comments I have made have vanished without a trace (one made last night in this thread, and several in other threads over the last month or so), I do not think that i have been rude in any way....

    What's the deal, I'm even a registered user for what it is worth

    Same here. WTH? I had a lengthy post about Java's division by zero problems that just vanished...

  • (cs)

    I am re-posting this deleted comment to combat the god-****-stupid random deletion of idiot moderators. **** off, jackasses, this is a valid comment.

    Sock Puppet #5:
    Want to prove I'm not trolling. Let me prefix it with this: I have no idea what articles were referenced--author did not take the time to use the link, so I did not take the time to read them. If you divide a primitive by zero, I think you get an error; but I have reached a case where division by zero took place, and it resulted in no exception. I'm not going to go through the effort to reproduce this case, because my original point still stands. The function in question needed to test inputs, and because it did not the WTF error occurred.

    This is Java, so let the Java-bashing ensue. Since this article is a day-old, let me assure you that I will never read your responses.

    **** you, mods.

  • (cs) in reply to Sock Puppet 5
    Sock Puppet 5:
    I am re-posting this deleted comment to combat the god-****-stupid random deletion of idiot moderators. **** off, jackasses, this is a valid comment.
    Sock Puppet #5:
    Want to prove I'm not trolling. Let me prefix it with this: I have no idea what articles were referenced--author did not take the time to use the link, so I did not take the time to read them. If you divide a primitive by zero, I think you get an error; but I have reached a case where division by zero took place, and it resulted in no exception. I'm not going to go through the effort to reproduce this case, because my original point still stands. The function in question needed to test inputs, and because it did not the WTF error occurred.

    This is Java, so let the Java-bashing ensue. Since this article is a day-old, let me assure you that I will never read your responses.

    **** you, mods.

    You save your comments?

  • 3rd Ferguson (unregistered) in reply to cheap shot
    cheap shot:
    In my mind, TRWTF is the problem solving approach used by our protagonist.

    An appropriate way of dealing with a strange behaviour like this would be to (a) try to reproduce the problem in order to (b) identify and fix the actual cause before (c) repairing the damage.

    Instead, this guy jumps straight to (c) and hopes that (a) and (b) get taken care of by themselves?

    The text establishes both the system as "unreliable" and the urgency of the issue. With such a system, manual intervention is most likely SOP in the course of day-to-day production support. Our hero no doubt assumed the cause was either already known (and not fixed for economic reasons) or would require an inordinate amount of troubleshooting--which, in fact, it did.

    Why would you chose an unknowable amount of down time in order to perform A and B rather than go for a seemingly immediate fix? What would you tell your boss, much less the users? "Sorry, I'm looking for the root cause but this system is an unreliable turd. I'll get back to you...some time." They all already know it's a turd from having to use it, they just want to get on with life. When you look for root causes, you risk an unknowable length of down time while you fumble around trying to find a root cause--which you may not even be able to address.

    Now, in this case, unfortunately for our hero, he still ended up looking like a dope while he fumbled around figuring out why his immediate fix didn't fix anything, or rather fixed only 1/1138th of the problem. But his support technique makes good sense to me. Fix the data issue now, pacify the users now, and THEN get on the developmestigration environment and look for root causes where the users don't need to see the sausage being made.

    CAPTCHA: sagaciter - reading my posts makes you sagacious, I am the sagaciter

  • Mods Hate Dissenting Opinion (unregistered) in reply to Sock Puppet 5
    Sock Puppet 5:
    I am re-posting this suppressed comment to combat the god-****-stupid targeted, discriminatory deletion by FASCIST moderators. **** off, oppressor, I HAVE RIGHTS!
    Sock Puppet #5:
    Perfectly valid comment

    **** you, FASCISTS!

    FTFY

  • (cs) in reply to LANMind

    Thanks. That makes sense.

    Not trolling, I could see some company wanting to track every delete, whether a user delete or a direct delete from the db.

  • (cs) in reply to frits
    frits:
    Sock Puppet 5:
    I am re-posting this deleted comment to combat the god-****-stupid random deletion of idiot moderators. **** off, jackasses, this is a valid comment.
    Sock Puppet #5:
    Want to prove I'm not trolling. Let me prefix it with this: I have no idea what articles were referenced--author did not take the time to use the link, so I did not take the time to read them. If you divide a primitive by zero, I think you get an error; but I have reached a case where division by zero took place, and it resulted in no exception. I'm not going to go through the effort to reproduce this case, because my original point still stands. The function in question needed to test inputs, and because it did not the WTF error occurred.

    This is Java, so let the Java-bashing ensue. Since this article is a day-old, let me assure you that I will never read your responses.

    **** you, mods.

    You save your comments?
    Farfox saved by backs enough for me to copy it. I think there was a longer comment that got deleted for some inane reason. I'm glad they didn't bother to delete the fake Nagesh, though...****ers.

  • SpectateSwamp (unregistered) in reply to frits
    frits:
    Sock Puppet 5:
    I am re-posting this deleted comment...
    You save your comments?
    With SpecatateSwamp DesktopSearch finding you're forum posts is easy. Copy each one before htting "Submit' to the main text file and later go to the search buttton to find it. Deasktop Search is so the wave of the future. Computers can do some amazeing things with the data of your online experince.

    SDoes anyone else notice the red lines under my worreds? some kinf of pattern maybe code messege?

    SpectatteSwampDesktop Search - Computing's EASY BUTTOn~!

  • QJo (unregistered) in reply to Sock Puppet 5
    Sock Puppet 5:
    I am re-posting this deleted comment to combat the god-****-stupid random deletion of idiot moderators. **** off, jackasses, this is a valid comment.
    Sock Puppet #5:
    Want to prove I'm not trolling. Let me prefix it with this: I have no idea what articles were referenced--author did not take the time to use the link, so I did not take the time to read them. If you divide a primitive by zero, I think you get an error; but I have reached a case where division by zero took place, and it resulted in no exception. I'm not going to go through the effort to reproduce this case, because my original point still stands. The function in question needed to test inputs, and because it did not the WTF error occurred.

    This is Java, so let the Java-bashing ensue. Since this article is a day-old, let me assure you that I will never read your responses.

    **** you, mods.

    Are you sure you didn't originally post this against "The Rockstar's Guard", dated 29th August?

    Titter. This smacks of one of those comedy-movie routines where someone bursts into a room to harangue the occupants about how they have committed some indignity against him (e.g. they've misapproriated something of his), only to realise that (a) he burst into the wrong room, and is railing against a complete bunch of strangers, and (b) the indignity that was done against him never actually happened, but it was the result of his own absent-mindedness.

  • Hortical (unregistered) in reply to Sock Puppet 5
    Sock Puppet 5:
    I am re-posting this deleted comment to combat the god-****-stupid random deletion of idiot moderators. **** off, jackasses, this is a valid comment.
    Sock Puppet #5:
    Want to prove I'm not trolling. Let me prefix it with this: I have no idea what articles were referenced--author did not take the time to use the link, so I did not take the time to read them. If you divide a primitive by zero, I think you get an error; but I have reached a case where division by zero took place, and it resulted in no exception. I'm not going to go through the effort to reproduce this case, because my original point still stands. The function in question needed to test inputs, and because it did not the WTF error occurred.
    Perhaps they were right to do so? It reads like you're refusing to highlight and drag a text link, insisting on remaining willfully ignorant and then assert your willfully ignorant belief of how a well-documented system works.

    Want to know how division by zero works in Java? Look it up!

  • (cs) in reply to Lockwood
    Lockwood:
    2) What else would you do, have something polling to go "Is anything missing now? How about now? Now?" How else would you be able to act on a direct DELETE statement.
    Easy. Have a table with pending emails. The scheduling triggers merely generate email rows in the emails table. The emails table can be monitored by a dedicated process that gets async input from the database whenever that table is appended to, and removes the email rows as they get successfully sent.
  • QJo (unregistered) in reply to Sock Puppet 5
    Sock Puppet 5:
    frits:
    You save your comments?
    Farfox saved by backs enough for me to copy it. I think there was a longer comment that got deleted for some inane reason. I'm glad they didn't bother to delete the fake Nagesh, though...****ers.

    As for me, I find it's prudent to be polite to the mods of any forum to which I contribute, in case they decided to take pains to exclude me.

  • QJo (unregistered) in reply to QJo
    QJo:
    Sock Puppet 5:
    I am re-posting this deleted comment to combat the god-****-stupid random deletion of idiot moderators. **** off, jackasses, this is a valid comment.
    Sock Puppet #5:
    Want to prove I'm not trolling. Let me prefix it with this: I have no idea what articles were referenced--author did not take the time to use the link, so I did not take the time to read them. If you divide a primitive by zero, I think you get an error; but I have reached a case where division by zero took place, and it resulted in no exception. I'm not going to go through the effort to reproduce this case, because my original point still stands. The function in question needed to test inputs, and because it did not the WTF error occurred.

    This is Java, so let the Java-bashing ensue. Since this article is a day-old, let me assure you that I will never read your responses.

    **** you, mods.

    Are you sure you didn't originally post this against "The Rockstar's Guard", dated 29th August?

    Titter. This smacks of one of those comedy-movie routines where someone bursts into a room to harangue the occupants about how they have committed some indignity against him (e.g. they've misapproriated something of his), only to realise that (a) he burst into the wrong room, and is railing against a complete bunch of strangers, and (b) the indignity that was done against him never actually happened, but it was the result of his own absent-mindedness.

    I've found it. It was "358940 in reply to 358828" on Page 4 of the previous day's comments.

    (Smirks behind hand, most definitely does not laugh jeeringly and point, that would be bad-mannered.)

  • ac (unregistered) in reply to Kayaman
    Kayaman:
    I was reading the wikipedia's "List of countries by coffee consumption per capita" and noticed USA's 4.2kg (that's about 9 pounds) and thought to myself:

    Only four kilos? That's April for us.

    I though this was a joke. It really exists! They even have a map!

  • Noel (unregistered) in reply to Glenn
    Glenn:
    So.... TRWTF is being able to write a delete statement against a production database. Surely the developer should not have access. What about testing and a change control process?

    Why wouldn't a developer have access? He's a developer, he should have access to everything. Who has access if not the developers?

  • (cs) in reply to QJo
    QJo:
    QJo:
    Sock Puppet 5:
    I am re-posting this deleted comment to combat the god-****-stupid random deletion of idiot moderators. **** off, jackasses, this is a valid comment.
    Sock Puppet #5:
    Want to prove I'm not trolling. Let me prefix it with this: I have no idea what articles were referenced--author did not take the time to use the link, so I did not take the time to read them. If you divide a primitive by zero, I think you get an error; but I have reached a case where division by zero took place, and it resulted in no exception. I'm not going to go through the effort to reproduce this case, because my original point still stands. The function in question needed to test inputs, and because it did not the WTF error occurred.

    This is Java, so let the Java-bashing ensue. Since this article is a day-old, let me assure you that I will never read your responses.

    **** you, mods.

    Are you sure you didn't originally post this against "The Rockstar's Guard", dated 29th August?

    Titter. This smacks of one of those comedy-movie routines where someone bursts into a room to harangue the occupants about how they have committed some indignity against him (e.g. they've misapproriated something of his), only to realise that (a) he burst into the wrong room, and is railing against a complete bunch of strangers, and (b) the indignity that was done against him never actually happened, but it was the result of his own absent-mindedness.

    I've found it. It was "358940 in reply to 358828" on Page 4 of the previous day's comments.

    (Smirks behind hand, most definitely does not laugh jeeringly and point, that would be bad-mannered.)

    I stand corrected...newborn infants can have a mental effect as bad as alcohol.
  • Zog (unregistered)

    3 or 4 cups of coffee A DAY!!! You should come an live in Finland....3 cups before you get out of bed for start....

    ...this is what's wrong with today's programmers...obviously no concept of what coffee is or what its for...

    In my day....oy YOU!! Get off my lawn!

  • harmonictempest (unregistered)

    I like that it apparently took them "a few years" to figure out that they couldn't delete reservations on the Outlook calendar. o.O

  • Z00n3$!$ (unregistered) in reply to Zog
    Zog:
    3 or 4 cups of coffee A DAY!!! You should come an live in Finland....3 cups before you get out of bed for start....

    ...this is what's wrong with today's programmers...obviously no concept of what coffee is or what its for...

    ...or where to insert it.

  • Z00n3$!$ (unregistered) in reply to malfist
    malfist:
    Poor martin
    malfist: Poor martin mal-fist: Poor martin bad-fist: Poor martin fisting-gone-wrong: Poor martin!

    Poor martin and his poor rectum.

    Was I the only one who caught that?

  • QJo (unregistered) in reply to Z00n3$!$
    Z00n3$!$:
    malfist:
    Poor martin
    malfist: Poor martin mal-fist: Poor martin bad-fist: Poor martin fisting-gone-wrong: Poor martin!

    Poor martin and his poor rectum.

    Was I the only one who caught that?

    No you weren't regrettably - but I had to look up "pink sock". I wish I hadn't, it was as distasteful as your posts frequently are.

  • anonymouser (unregistered) in reply to Noel
    Noel:
    Glenn:
    So.... TRWTF is being able to write a delete statement against a production database. Surely the developer should not have access. What about testing and a change control process?

    Why wouldn't a developer have access? He's a developer, he should have access to everything. Who has access if not the developers?

    I'll bet he says only DBAs.

  • (cs) in reply to frits
    frits:
    Sock Puppet 5:
    I am re-posting this deleted comment to combat the blah blah whiny-crap blah...
    You save your comments?
    Don't you?

    How else does one go back and relive those moments of feeling elite after pretending to be witty on an internet message board?

    I'm actually thinking of putting all my favorite comments into a nice book, so I can read it to my children. Hell, I might even throw in the not-so-great ones too; I felt smart when I posted them.

  • Z00n3$!$ (unregistered) in reply to QJo
    QJo:
    Z00n3$!$:
    malfist:
    Poor martin
    malfist: Poor martin mal-fist: Poor martin bad-fist: Poor martin fisting-gone-wrong: Poor martin!

    Poor martin and his poor rectum.

    Was I the only one who caught that?

    No you weren't regrettably - but I had to look up "pink sock". I wish I hadn't, it was as distasteful as your posts frequently are.

    I guess you've never had that happen to you. Typically, if I make this happen, I'll pull it out as far as possible and bat at it playfully while the naive boy panics. I love the look on their faces.

    Some days I wish it could be done to the throat too. Just imagine it. Let those images swirl through your head.

  • (cs) in reply to Noel
    Noel:
    Glenn:
    So.... TRWTF is being able to write a delete statement against a production database. Surely the developer should not have access. What about testing and a change control process?

    Why wouldn't a developer have access? He's a developer, he should have access to everything. Who has access if not the developers?

    Ideally, only DBAs should have access to the production database. And even when devs do have access, they can't modify stuff, they only do SELECTs.

    Of course, in some WTF-powered businesses, devs are given UPDATE/INSERT/DELETE powers because they have to constantly fix some DB screwup caused by WTFy code.

    Example: An "Enterprisey" app that would call a WebService which applied charges on some accounts ... the webservice would sometimes barf, but the transaction might have been partially committed because each charge was made inside its own transaction. The calling app had no way to know if the transaction succeeded in these cases, so all unknown status transactions were left in an "unknown state" and had to be manually checked. WTF indeed!!!

  • (cs) in reply to QJo
    QJo:
    No you weren't regrettably - but I had to look up "pink sock". I wish I hadn't, it was as distasteful as your posts frequently are.
    Pro tip: if you need to look up a term seen on the internet, it's wisest to assume the answer won't be safe for work and may not be safe for home either if you have delicate sensibilities.
  • Cleveland Steamer (unregistered) in reply to PedanticCurmudgeon
    PedanticCurmudgeon:
    QJo:
    No you weren't regrettably - but I had to look up "pink sock". I wish I hadn't, it was as distasteful as your posts frequently are.
    Pro tip: if you need to look up a term seen on the internet, it's wisest to assume the answer won't be safe for work and may not be safe for home either if you have delicate sensibilities.
    TOOT! TOOT!
  • (cs) in reply to Cleveland Steamer
    Cleveland Steamer:
    PedanticCurmudgeon:
    Pro tip: if you need to look up a term seen on the internet, it's wisest to assume the answer won't be safe for work and may not be safe for home either if you have delicate sensibilities.
    TOOT! TOOT!
    And here we have a didactic example. If you concluded that you didn't really need to know what a Cleveland Steamer is, go to the head of the class. Conversely, you fail if you looked it up.
  • Brian White (unregistered) in reply to JamieC
    JamieC:
    Lockwood:
    I have a 2 dumb questions.

    Let us assume that the specification for the system is "The client has to be notified when any change happens to their reservation" This includes the "Your reservation for resource Room 101 for Monday 5 September 2011 has been deleted" message.

    1. Why is getting that email sent at the point in time that the delete occurs a bad thing?

    2. What else would you do, have something polling to go "Is anything missing now? How about now? Now?" How else would you be able to act on a direct DELETE statement.

    To answer your dumb questions

    1. It's not, and nobody that Im aware of said it was so.

    2. Sending emails (outside of perhaps server monitoring) is not the job of SQL Server. This is application logic and should happen in the application. ie

    3. User Chooses to delete a block of meetings

    a) begin atomic operation b) Delete records from database (better: Mark as cancelled in database) c) Compile 1 email (FFS!) with a list of the deleted meetings and send to originator of meeting / requestor of delete. 3) Sit back happy that you have a sensible solution.

    Tracking conference rooms and providing direct interactive write access to developers is also usually not the job of a production sql server database. Please note - if a developer can open up a query window and just type 'delete * from meeting where user_login_id = "somebody"' - then a trigger is literally the only thing you can rely on. The application code layer is totally ignored in that situation. So make the application layer as nice as you want to, and in X% of the time people won't be alerted.

    I like how you first delete the meeting, then look up who owned it :)

  • aliquot (unregistered)

    TODO: Create unit tests with >1 Row Affected

  • Owen Two (unregistered) in reply to danixdefcon5
    danixdefcon5:
    Example: An "Enterprisey" app that would call a WebService which applied charges on some accounts ... the webservice would sometimes barf, but the transaction might have been partially committed because each charge was made inside its own transaction. The calling app had no way to know if the transaction succeeded in these cases, so all unknown status transactions were left in an "unknown state" and had to be manually checked. WTF indeed!!!
    A transaction is an atomic action; it either succeeds in its entirety or completely rolls back.
  • CDave (unregistered)

    My favorite part is where Martin actually scheduled the room once a week for the next 21 years. Now that is job security. "you can't fire me, I have the conference room scheduled"

  • (cs) in reply to CDave
    CDave:
    My favorite part is where Martin actually scheduled the room once a week for the next 21 years. Now that is job security. "you can't fire me, I have the conference room scheduled"
    "... AND YOU CAN'T DELETE THE SCHEDULE! BWA-HA-HA-HA-HAAAAAH ....!"
  • (cs)

    I was averaging about three to four cups a day

    ONLY 3 to 4? I call shenanigans.

  • Aoler (unregistered) in reply to pjt33
    pjt33:
    foo:
    Amtep:
    I like how our thoughtful submitter made sure that Martin would receive all 1137 notification emails. Craftsmanship like that is just not appreciated anymore these days.

    Don't be rediculous. The emails were sent to "allusers"

    Please unsubscribe me from this list.
    me too

  • L. (unregistered) in reply to dkf
    dkf:
    L.:
    Errr . how would that not trigger the same trigger again in a never-ending loop of love and unity ?
    The database takes special care to ensure that the trigger is not entered recursively. From the MSSQL docs (in the Remarks section; there's no convenient anchor nearby):
    If an INSTEAD OF trigger defined on a view executes a statement against the view that would ordinarily fire the INSTEAD OF trigger again, it is not called recursively. Instead, the statement is resolved as modifications against the base tables underlying the view. In this case, the view definition must meet all the restrictions for an updatable view. For a definition of updatable views, see Modifying Data Through a View.
    While that's not necessarily the right database docs, I'd be very startled if others worked any different: recursive entry of a trigger would be “A Very Bad Thing”.

    Aaaaand that's a friggin scandal ... no default trigger should be protected from recursive hell - how else can you guarantee:

    a) integrity b) Mail-Hell

    I know it's a nice noob-style default, and it's a good thing it's part of the docs but it's still a pity that the default should hide the logic ... damn docs and gotchas !

    There is one good reason to allow recursive triggers : consistency. What you're talking about is "having the possibility to prevent recursion", which is of course important. Having it implemented by default is syntactic sugar hiding the horrible truth from the noobs (seriously, if there's got to be recursion check or event propagation, do it explicitly, not hidden in a default).

    ms190739.aspx

    So in fact, it's a noob option on by default, and everything is manageable as should be, except that for some reason MSSQL thinks that 32 levels deep nesting is enough . fail db -> now we have the REAL WTF .. you want coding advice from these guys you're sure ? ^^

    And for comparison, a real dbms (PostgreSQL):

    docs/9.1/static/trigger-definition.html

    Where you see : programmer's responsibility, virtually limitless (although your computer might blowup after max(int8) levels of nesting ... says the legend).

    As a summary: My bad, I really thought mssql could be respected, I was (a bit) wrong.

  • L. (unregistered) in reply to Programming Hero

    Right ... the big issue is not recursion (although I prefer to have an unused railgun in the cupboard instead of no railgun), it's SQL server having varying levels up to only 32 ... and you not even mentioning it as a major fail.

    No REAL programmer would disable recursive triggers in their database.

    Let's see, blade 1 in enclosure 1 is on fire, thus enclosure 1 is on fire, thus blades 2-9 are on fire. No recursion you sure ?

    What about a table containing citizens from the middle ages, some of which have "the black death".. AHAAA !! recursive trigger with foreach(citizen in same city block) if(random(1-100)>p(black death contamination)) -> give black death

    I like it . recursion enables black death . all smooth . I'm not sane but ... I think being affraid of recursive triggers (or black death) is for noobs, sorry.

    There ARE cases where it will be the best modelisation you can have. And not using it IS a crime - wish there was death sentence though.

  • L. (unregistered) in reply to L.

    Tell you what, we can do better. In all logic, people will start running away when they notice too many victims of the black death, I think we can safely ADD another RECURSIVE trigger to manage the panic effect ... yum. God bless SQL.

  • (cs) in reply to LANMind
    LANMind:
    Lockwood:
    I have a 2 dumb questions.

    Let us assume that the specification for the system is "The client has to be notified when any change happens to their reservation" This includes the "Your reservation for resource Room 101 for Monday 5 September 2011 has been deleted" message.

    1. Why is getting that email sent at the point in time that the delete occurs a bad thing?

    2. What else would you do, have something polling to go "Is anything missing now? How about now? Now?" How else would you be able to act on a direct DELETE statement.

    There's no reason why your db server can't send emails, despite what you might read here in the comments, but it is certainly a really bad idea to do it from a trigger. If for any reason your mail server is unreachable, it will block the trigger and hang the process until it times out, potentially locking the table upon which the trigger resides. Triggers should be fast as hell.

    If you put business logic in your database, the preferred method of sending emails is to throw data to a table used for queueing, then have a a separate job that polls the table.

    +10 Internets for you. This is state-of-the-art stuff. Check out Service Broker in SQL Server.

  • QJo (unregistered) in reply to hoodaticus
    hoodaticus:
    LANMind:
    Lockwood:
    I have a 2 dumb questions.

    Let us assume that the specification for the system is "The client has to be notified when any change happens to their reservation" This includes the "Your reservation for resource Room 101 for Monday 5 September 2011 has been deleted" message.

    1. Why is getting that email sent at the point in time that the delete occurs a bad thing?

    2. What else would you do, have something polling to go "Is anything missing now? How about now? Now?" How else would you be able to act on a direct DELETE statement.

    There's no reason why your db server can't send emails, despite what you might read here in the comments, but it is certainly a really bad idea to do it from a trigger. If for any reason your mail server is unreachable, it will block the trigger and hang the process until it times out, potentially locking the table upon which the trigger resides. Triggers should be fast as hell.

    If you put business logic in your database, the preferred method of sending emails is to throw data to a table used for queueing, then have a a separate job that polls the table.

    +10 Internets for you. This is state-of-the-art stuff. Check out Service Broker in SQL Server.

    Service Broker? Isn't that something that makes the service broke?

  • Crusty (unregistered)

    Name almost any design philosophy from OO onwards, databases will break it: stored procedures, transactions, cascading operations, triggers, flat data types, fixed string lengths, numeric display specifications. Databases work best with old procedural waterfall and (sometimes) iterated development dating from the old Fortran/Cobol/Lisp mindset.

  • L. (unregistered) in reply to Crusty
    Crusty:
    Name almost any design philosophy from OO onwards, databases will break it: stored procedures, transactions, cascading operations, triggers, flat data types, fixed string lengths, numeric display specifications. Databases work best with old procedural waterfall and (sometimes) iterated development dating from the old Fortran/Cobol/Lisp mindset.

    Errr right sure . show me your java implementation of a transaction-safe solution and tell me it was worth developping.

    Then compare performance against a good dbms ...

    Also, what kind of DB have you been using .??? why do you think SP's break OOP ? transactions /cascades /triggers are an issue for you ??? is it because you'd much prefer to implement that in the much weaker language layer ?.

    Flat data types , fixed string lengths, ... -- try a real dbms like PostgreSQL because you sound uninformed right there.

    Databases work best as databases: i.e. basic data management layer, including enforcement of rules (real dbms only, not mysql) of any kind, fast access, transactional integrity and general ACID compliance (which, believe me, if you want to implement in <insert your language here>, is going to be slow, painful and useless).

    Then ... "old procedural waterfall" vs "OO onwards" is slightly manichean don't you think ?

    I've got some code where I do not use OO semantics and it doesn't prevent me from guaranteeing full reusability and all that, without any heavy syntax or language-enforced principles.

    What you call design philosophies from OO onwards aren't necessarily better alternatives, they've all got strengths and weaknesses and classifying them as better is definitely not the best approach.

  • yername (unregistered) in reply to TooSoonASys, She Says...
    TooSoonASys:
    Confession: I have, on at least one occasion, posted obscene, unsavory or otherwise inappropriate comments to this website.

    Was this true before you clicked Submit?

  • (cs) in reply to harmonictempest
    harmonictempest:
    I like that it apparently took them "a few years" to figure out that they couldn't delete reservations on the Outlook calendar. o.O

    That's because, for most sane users, they could delete just fine.

    If you only scheduled a one-off meeting, and tried to delete it, it would work.

    If you scheduled a repeating meeting, and only tried to cancel a single instance of it at a time, it would work.

    If you were only canceling a couple of instances, and it only happened rarely, you might think you just absentmindedly told it to cancel one. Or you could have chosen to just delete one and then the other.

    But, this guy had made enough reservations he could repeat the behavior. And, I'm guessing, he was saying 'delete every one of them, even the ones that already happened', so there was no apparent effect at the point he was looking at on his calendar.

    Yeah, that's bound to happen before a really long time. But they probably also disregarded the first couple of reported instances. "Well, I created a test meeting, and then deleted it, and it worked just fine for me."

  • Luiz Felipe (unregistered) in reply to frits
    frits:
    I had this same situation one time. There, I fixed it by running the DELETE statement in a loop until SELECT returned 0 records. I'm a bit of a Rock Star 'round these parts.
    Exactly what i thinked. put it in a loop and forget.

Leave a comment on “Confessions: The Non-deleting Delete”

Log In or post as a guest

Replying to comment #:

« Return to Article