Please create an account to participate in the Slashdot moderation system

 



Forgot your password?
typodupeerror
×
User Journal

Journal rho's Journal: A MySQL Interlude 1

Mein Broder: So, in MySQL, when you exceed the maximum size of a TEXT column, does it throw an exception, or does it just truncate the data to fit?

Me: Well, it being MySQL, it will probably do something differently on Tuesdays than it does on the vernal equinox... but it probably will throw an exception and bitch about how you suck at data planning. Which is the proper thing to do, because who would want their database silently truncating data?

Mein Broder: In this case, I'd actually prefer it, 'cause otherwise I'd have to programmatically truncate it myself. These data aren't really that important, and truncating would be acceptable. It would be nice if I could be a lazy programmer.

Me: I think you're out of luck. But let's take a look:

MySQL Manual -- If you assign a value to a BLOB or TEXT column that exceeds the column type's maximum length, the value is truncated to fit.

Me: Astounding. Your desire to be a lazy, shiftless programmer has been facilitated by other lazy, shiftless programmers who have built the world's most rickety database management system.

This discussion has been archived. No new comments can be posted.

A MySQL Interlude

Comments Filter:
  • How about the NOT NULL = NULL trick?

    CREATE TABLE mys_rulz (
    id INT NOT NULL,
    you VARCHAR(32) NOT NULL,
    me VARCHAR(32) NOT NULL DEFAULT 'loser'
    );

    INSERT INTO mys_rulz (id) VALUES(5);
    INSERT INTO mys_rulz (you) VALUES('I am teh 37337 pgmr!');

    SELECT * FROM mys_rulz;

    .| id | you | me |
    .| 5 | (null) | loser |
    .| 0 | I am teh 37337 pgmr! | loser |

    Lazy, rickety POS database, indeed.

    .

    ,

    .

    Lameness filter encountered. Post aborted!
    Reason: Please use fewer 'junk' characters.

    Lorem ipsum dolor sit amet, cons

So you think that money is the root of all evil. Have you ever asked what is the root of money? -- Ayn Rand

Working...