• (cs) in reply to Abdiel
    Abdiel:
    drachenstern:
    Remy Porter:
    CREATE TABLE catch22 ( a INTEGER NOT NULL CONSTRAINT aRule CHECK (a = 1 AND b = 0), b INTEGER NOT NULL CONSTRAINT bRule CHECK (a = 0 AND b = 1))
    So on the terms I'm too chickenshit to try this, what happens to SQL Server if you try to implement this?
    I don't see anything wrong, or even paradoxical, about this code. You simply state that in every row inserted, a must equal one and b must equal zero. Also, a must equal zero and b must equal one. Hence, whatever you try to insert in the table, you will only get a constraint violation error.

    I do not see any (at least no obvious) way to implement the paradox Remy Porter probably had in mind in procedural code.

    I agree I see nothing wrong with it as well, perhaps I should have used Oracle as my DB provider of choice to bash this AM? Also, I really am curious if it would allow this since it seems like a simple enough thing to check. I'm just betting it blows up the instance.

  • (cs) in reply to Phlip
    Phlip:
    This isn't a WTF, it's just a standard sanity check. They're just encoding the business rule that customers' orders should never be fulfilled. Now, thanks to that forward-thinking, should a bug in the code ever accidentally fulfil a customer's order, it'll raise an error condition.

    That's just robust coding.

    LMAO. You win the funniest post of the day award.

  • (cs) in reply to Abdiel
    Abdiel:
    drachenstern:
    Remy Porter:
    CREATE TABLE catch22 ( a INTEGER NOT NULL CONSTRAINT aRule CHECK (a = 1 AND b = 0), b INTEGER NOT NULL CONSTRAINT bRule CHECK (a = 0 AND b = 1))
    So on the terms I'm too chickenshit to try this, what happens to SQL Server if you try to implement this?

    I do not see any (at least no obvious) way to implement the paradox Remy Porter probably had in mind in procedural code.

    It's not a paradox. It's a catch-22. You cannot insert a record because you must satisfy two conflicting conditions. There are probably better ways to write it, like defaulting B to 1 and CHECKing that B is always 1. Then A has a constraint that B cannot be 1.

    Or, to quote Bruce Campbell: If you need it, you haven't got it. And if you have it, you certainly don't need less of it.

  • brian j. parker (unregistered)

    I'm going to guess the logic was that they currently delete orders once they are fulfilled, but planned to add a feature in the future that fulfilled orders would instead be archived. So, put that bit in, and you can preemptively write logic that only acts on unfulfilled orders.

    I'm not defending it, I'd do it differently, but at least you're only wasting a bit of space (literally!) per order. Too often I see something like this as a 'Y'/'N' character field, using a whole byte or two per order.

  • BBT (unregistered)

    This was probably on an embedded system. While we all know they have no file systems, it's also true that they have very limited resources. While it might be ok to allow a bit to have 2 values on a non-embedded system, on an embedded system those values are precious and it would be foolish to let a full 50% of the possible values be wasted where they weren't necessary. Better to only allow the values that are used, so the other values can be reserved for other important things.

    Not a WTF.

  • (cs) in reply to drachenstern
    drachenstern:
    Remy Porter:
    CREATE TABLE catch22 ( a INTEGER NOT NULL CONSTRAINT aRule CHECK (a = 1 AND b = 0), b INTEGER NOT NULL CONSTRAINT bRule CHECK (a = 0 AND b = 1))
    So on the terms I'm too chickenshit to try this, what happens to SQL Server if you try to implement this?
    SQL Server won't allow a column level constraint that references other columns. It would have to be rewritten as a table level constraint to work in SQL Server.
  • Nihilist (unregistered) in reply to Phlip
    Phlip:
    They're just encoding the business rule that customers' orders should never be fulfilled.
    The Real WTF is that they use the wrong language for this. This could be done much more effectively using the Nil Programming Language.
  • Someone (or something) (unregistered)

    There are situations where a column may be constrained to a constant value without it being a WTF: see e.g. (darn Akismet) www. (damnit) keyongtech. (damnit) com/2128650-unique-pk-across-two-tables.

    e.g. there might be another table FulfilledOrders with the opposite constraint CHECK( [Is Fulfilled] = 1 ).

    But then the IDENTITY(1,1) shouldn't be in CustomerOrder, so I guess it is a WTF after all...

    Akismet 4 Poster 1

  • Adam (unregistered)

    Since many of us work with logic professionally, we're probably familiar with the definition of a tautology: a statement which by its very structure must be true. For example:

    a == a

    In some cases you don't even have to evaluate the variables and consider what they refer to -- it can be determined that the statement is true without even doing that much work.

    Here's one in a language unique to nondeterministic processors, AKA humans:

    That which is more fit to survive is more likely to survive.

    You don't even have to dereference "that which is more fit to survive" to see that the statement has to be true. But link this tautology to a more widely recognized label -- evolution -- and suddenly a huge flock of nondeterministic processors get their panties in a bunch.

    The universe contains a lot more stable atoms than unstable ones simply because the unstable ones don't tend to hang around that long. And so on right up to galaxies, and everything in between. We're here, quite simply, because the alternative is less probable.

    There now, you owe your life to a tautology. Lesson concluded. You may now return to merriment and chaos.

  • (cs) in reply to Martin Milan
    Martin Milan:
    Erm, actually, you could only implement DoesThisRowNotExist with the given constraint - and IsValidOrNotValid would be impossible, as it would always be false...

    Me? Pendantic???

    Martin

    Well, technically, DoesThisRowNotExist would be a paradox since the row must exist for it's non-existence flag to exist.

  • FTW (unregistered)

    Using a bit field for "tautology" is kind of like saying, "Your condition can only be met if someone else with much less flexibility in decision-making can verify that it's true."

    Kind of like Middle Management.

  • (cs) in reply to Jaime
    Jaime:
    SQL Server won't allow a column level constraint that references other columns. It would have to be rewritten as a table level constraint to work in SQL Server.

    Is that true? I know you can use a function as your check constraint- I assumed that the function could do whatever it wanted to. I haven't actually tried to implement such a thing, but if I were going to, I'd do it in Oracle, which I'm more familiar with.

  • (cs)

    One of the possible definitions of "fact" is "a piece of information presented as having objective reality", in which case it actually makes sense to talk about true facts ("Doctor Who is a British TV series") vs. false facts ("Doctor Who is an American TV series") vs. opinions ("Doctor Who is a good TV series").

  • FTW (unregistered) in reply to emurphy

    It's not a fact unless it's a fact. False Fact is merely rhetoric that confuses real concept with artistic literary license.

    However, there is another word for "False Fact". It's called a LIE.

  • Mike (unregistered) in reply to Adam
    Adam:
    Since many of us work with logic professionally, we're probably familiar with the definition of a tautology: a statement which by its very structure must be true. For example:

    a == a

    In some cases you don't even have to evaluate the variables and consider what they refer to -- it can be determined that the statement is true without even doing that much work.

    Here's one in a language unique to nondeterministic processors, AKA humans:

    That which is more fit to survive is more likely to survive.

    You don't even have to dereference "that which is more fit to survive" to see that the statement has to be true. But link this tautology to a more widely recognized label -- evolution -- and suddenly a huge flock of nondeterministic processors get their panties in a bunch.

    The universe contains a lot more stable atoms than unstable ones simply because the unstable ones don't tend to hang around that long. And so on right up to galaxies, and everything in between. We're here, quite simply, because the alternative is less probable.

    There now, you owe your life to a tautology. Lesson concluded. You may now return to merriment and chaos.

    public static bool operator==(MyObject a, MyObject b) {
      Random r = new Random();
      return r.next(0,2) == 0;
    }
  • Paula (unregistered)

    TRWTF is the use of SQLServer.

  • incassum (unregistered) in reply to drachenstern
    drachenstern:
    toth:
    OMG:
    Ziplodocus:
    ritual "John's" attire.
    FTFY
    FTFTFYFY
    FTFTFTFYFYFY
    FTFY'all
  • (cs) in reply to Remy Porter
    Remy Porter:
    Jaime:
    SQL Server won't allow a column level constraint that references other columns. It would have to be rewritten as a table level constraint to work in SQL Server.

    Is that true? I know you can use a function as your check constraint- I assumed that the function could do whatever it wanted to. I haven't actually tried to implement such a thing, but if I were going to, I'd do it in Oracle, which I'm more familiar with.

    Yup. I even tried it to be sure that it's still true in newer versions of SQL Server. The rewrite is fairly trivial:

    CREATE TABLE catch22 ( a INTEGER NOT NULL, b INTEGER NOT NULL, CONSTRAINT aRule CHECK (a = 1 AND b = 0), CONSTRAINT bRule CHECK (a = 0 AND b = 1))

    Oracle has fewer restriction on the expression used in a check constraint, but it still has the same underlying issues. If you create constraints or triggers that reference other objects or other rows, you can get an ORA-04091 error if the use of the table causes a "mutating update". SQL Server simply prevents the most obviously dangerous cases at definition instead of at runtime.

  • consequat (unregistered) in reply to Alargule
    Alargule:
    What's a tautology?
    The first chicken was hatched from the first chicken egg that was laid by the first chicken.
  • FuBar (unregistered) in reply to dpm
    dpm:
    What's a tautology?
    Say 'tautology' again. Say 'tautology' again, I dare you, I double dare you motherfscker, say 'tautology' one more Goddamn time!
    What? blam!
  • blunder (unregistered) in reply to Adam
    Adam:
    That which is more fit to survive is more likely to survive.

    Cute. But even this Wikipedia definition is better than yours:

    Wikipedia:
    Natural selection is the process by which certain heritable traits—those that make it more likely for an organism to survive and successfully reproduce —become more common in a population over successive generations.

    If you're as good at logic as you think you are, then I hope you can see where defining it in terms of the effect on the gene pool removes the need to mention survival twice.

  • Sensitive Claude (unregistered) in reply to FTW
    FTW:
    Using a bit field for "tautology" is kind of like saying, "Your condition can only be met if someone else with much less flexibility in decision-making can verify that it's true."

    Kind of like Middle Management.

    Hey, I'm a middle manager, you insensitive clod!
  • The head of IT (unregistered) in reply to drachenstern
    Also, I really am curious if it would allow this since it seems like a simple enough thing to check. I'm just betting it blows up the instance.

    I'm the head of IT, believe me .. if you type "google" into google you CAN break the internet! Don't try it, even for fun!

  • (cs) in reply to Adam
    Adam:
    Since many of us work with logic professionally, we're probably familiar with the definition of a tautology: a statement which by its very structure must be true. For example:

    a == a

    Like the subject of this thread: http://forums.thedailywtf.com/forums/p/16567/221120.aspx#221120

  • (cs) in reply to incassum
    incassum:
    drachenstern:
    toth:
    OMG:
    Ziplodocus:
    ritual "John's" attire.
    FTFY
    FTFTFYFY
    FTFTFTFYFYFY
    FTFY'all
    Oh now where's the fun in fixing all the bugs in the code on the first pass?

    "Yes boss, I've been real busy, I've had at least 13 checkins this week"

    Yes, that was sarcasm. Good grief, I can't make any of you soulless BOFH laugh can I? I prefer to not checkin until the night before shipping, of course.

    </lame>
  • Some Wonk (unregistered) in reply to My Name
    My Name:
    fnord:
    The first rule of the tautology club is the first rule of the tautology club

    I am the president of the tautology club, because I am the president of the tautology club.

    Here, how'd you become president, then. I didn't vote for you.

  • Joe (unregistered) in reply to nonpartisan
    nonpartisan:
    It is when creating the new code block sans the "if (true)" creates the same scope.

    You mean like this:

    if (true);
      {
         static volatile register int result = do_stuff();
         return 7;
      }
    // Else
      do_nothing();
    

    --Joe

  • (cs)

    The tautology bit, or tbit, is a major breakthrough in information theory. Since tbits are by definition equal to themselves, their state requires an entropy of zero to encode. Using this knowledge, I shall write a revolutionary new quantum tbit encoding algorithm which will be able to losslessly compress any file of any size to zero bits. For enhanced data integrity in enterprise applications, a cryptograhic hash may be optionally specified at a cost of an additional zero bits

    It will be done when it's done.

  • Milton (unregistered)

    Kinda surprised this hasn't made it up here yet:

    http://xkcd.com/703/

  • FTW (unregistered) in reply to Sensitive Claude

    Sorry, Claude, but for the record I wasn't bashing Middle Management. Your job is hardest of all because to be successful at it, you have to tactfully not please anyone!

    COMPROMISE, n. Such an adjustment of conflicting interests as gives each adversary the satisfaction of thinking he has got what he ought not to have, and is deprived of nothing except what was justly his due.

    • Ambrose Bierce
  • jesus_christ_you_people (unregistered) in reply to Ziplodocus
    Ziplodocus:
    opp:
    Adequate enough isn't tautology. It just implies that your aim is mediocrity (or the worst possible implementation that still works).

    Is there a spectrum of adequacy? I would say adequate is an absolute. As good as necessary. I would, however argue that enough is the tautologic word in the case of Adequate Enough

    Of course there's a spectrum of 'adequacy', just like there's a spectrum of 'legal'. So just as you can have a video in your collection with the label "barely legal" you can have entire teams of developers who are barely adequate.

    I leave it as an exercise to the reader to determine which, if any, is actually desirable :-(

  • Edosoft (unregistered) in reply to drachenstern

    Msg 8141, Level 16, State 0, Line 1 Column CHECK constraint for column 'a' references another column, table 'catch22'. Msg 1750, Level 16, State 0, Line 1 Could not create constraint. See previous errors.

  • nasch (unregistered) in reply to jesus_christ_you_people
    jesus_christ_you_people:

    Of course there's a spectrum of 'adequacy', just like there's a spectrum of 'legal'. So just as you can have a video in your collection with the label "barely legal" you can have entire teams of developers who are barely adequate.

    That is true, but I don't think it means what you think it means. Barely adequate means barely good enough to be adequate. They're still either adequate, or not. You would not (or at least I would not) describe a developer as extremely adequate, or compare two developers and consider which is more adequate than the other. I would still consider adequacy an absolute.

    BTW I think your analogy fails in the same way: barely legal is exactly as legal as any other legality. That is, it is no more legal to look at porn of 40 year olds than of 18 year olds.

  • (cs) in reply to Edosoft
    Edosoft:
    Msg 8141, Level 16, State 0, Line 1 Column CHECK constraint for column 'a' references another column, table 'catch22'. Msg 1750, Level 16, State 0, Line 1 Could not create constraint. See previous errors.
    Already been addressed. See post #308112, fourteen posts up from yours. SQL Server requires a multi-column constraint to be defined as a table level constraint.
  • RDP (unregistered) in reply to consequat

    The first chicken hatched from an egg that was a mutant laid by a near-chicken. Evolution DOES answer the question of which came first, and it was the chicken-egg, not the chicken.

  • mike (unregistered)

    The self-referential jokes in this thread about tautology are as lame and pathetic as the self-referential jokes in this thread about tautology.

  • Me? (unregistered)

    The database was not installed on his computer, the file was on a network share with full permissions. Anyone uninstalling the client would cause the same thing...

  • Dirge (unregistered)

    Consider the tautology: an unnecessary construct that adds no meaning, context, or understanding and may as not exist.

    Actually, the tautology is sometimes useful as an intermediate step in symbolic logic. It doesn't change the overall meaning of the logic, but turning "A" into "If A Then A" can make it possible to use other rules on it.

    Also, it's frequently used in embedded systems development where there is no filesystem as such.

  • knocvk (unregistered) in reply to mike
    mike:
    The self-referential jokes in this thread about tautology are as lame and pathetic as the self-referential jokes in this thread about tautology.

    Yup....

  • Browny (unregistered)

    The Comments on TDWTF are deteriorating at a rate of knots!!

  • bedazzled by starry things (unregistered)

    I'm Henry the Eighth I am, 'enery the Eighth I am I am. I got married to the girl next door, She's been married, seven times before. And every-one was an 'enery (enery!), Every was an 'enery. 'enery the Eighth I am I am, Hen'ry the eighth I am.

    Second verse - same as the first...

  • Silverhill (unregistered)

    This is the comment without end-- Yes, it goes on and on, my friend. Somebody started typing it, not knowing what it was....

  • (cs) in reply to bedazzled by starry things
    bedazzled by starry things:
    I'm Henry the Eighth I am, 'enery the Eighth I am I am. I got married to the girl next door, She's been married, seven times before. And every-one was an 'enery (enery!), She wouldn't have a Willy or a Sam (no Sam!) I'm 'er eighth old man named Henery, Hen'ry the eighth I am.

    Second verse - same as the first...

    FTFY

  • Anonymous Coward (unregistered) in reply to Kef Schecter

    Ideally, the word tautology should be linked to a wiki or dictionary page, presumably containing the definition, which in turn would keep redirecting to itself.

  • Anonymously Yours (unregistered)

    That isn't a tautology. John's empty string was clearly preparing a quantum computing experiment. If bit was ever flagged as 1, empty string would know that the database in the alternate fork of the decision matrix was returning the value.

  • Ernie (unregistered) in reply to brian j. parker

    So reading bits is efficient now? I didn't know DBMS are tuned for that low level storage and efficiency :P

  • (cs) in reply to gdjfkghl
    gdjfkghl:
    The second rule is the same as first, except that it is second.

    tautology_club_rule(RuleNumber) :- tautology_club_rule(RuleNumber).

    Funny that Prolog would answer "no" to that if it ever halted.

  • Xythar (unregistered) in reply to Kef Schecter
    Kef Schecter:
    Alargule:
    What's a tautology?

    A tautology.

    This is the best possible answer to that question.

  • Quirkafleeg (unregistered) in reply to consequat
    consequat:
    Alargule:
    What's a tautology?
    The first chicken was hatched from the first chicken egg that was laid by the first chicken.
    Why did the chicken c̶r̶o̶s̶s̶ ̶t̶h̶e̶ ̶r̶o̶a̶d̶ travel in time?
  • Kirby L. Wallace (unregistered) in reply to Phlip

    Either that, or the CustomerOrders Table only contains completed (ie, not partial) orders. It becomes an Order when all of it's line items have been accounted for, or some such.

    Think about it this way, what if the database also contained a table called "CustomerOrdersInProgress" that had the same structure as the CustomerOrder table, but without that constraint? Updating then could be accomplished by "INSERT CustomerOrder SELECT * FROM CustomerOrderInProgress" which will skip any CustomerOrdersInProgress where IsFulfilled = -1 ... well, that and a heck of a lot of "INSERT FAILED CHECK CONSTRAINT" error messages. But if you just turn off all error messages and error checking, you're golden. Problemo Solved!

    ;-)

Leave a comment on “The Tautology Type”

Log In or post as a guest

Replying to comment #:

« Return to Article