List:General Discussion« Previous MessageNext Message »
From:Gerald Clark Date:August 13 2002 1:12pm
Subject:Re: NULL values -- expected behavior or bug?
View as plain text  
Empty strings are NOT nulls.
They are just  zero length strings.

Aron Pilhofer wrote:

>>Changing the column to allow NULL doesn't mean that any of the existing
>>values will be *changed* to NULL.  That seems to be what you're expecting,
>>but why?
>>
>
>
>No, no. Maybe I didn't explain well enough. The fields in question contained
>NULL values from the beginning, when I populated them, even though the
>fields were set up not to allow NULLs. Is that clearer?
>
>If I had set up the table correctly from the beginning, there would be some
>records with values, some with NULLs, in a field formatted to accept either
>one. Since I didn't, one would think the insert would fail or something like
>that -- but it didn't. MySQL populated the table just fine. And since NULLs
>weren't allowed, it must have assigned some kind of invisible placeholder
>value or something in those instances. I know it did something along these
>lines because a count() should not have included NULLs, but it did. And a
>select should of NULLs should have produced results, but it didn't.
>
>I realized my mistake, went back and fixed the field, but the count() and
>select still produced the same results. Those placeholder values (and I'm
>just guessing here that's what's going on) are not stripped out.
>
>The bottom line is this: If you create a field in which there will be NULL
>values, you *must* create the table to allow NULLs from the beginning, even
>though inserts and such appear to work. You cannot change the field to allow
>NULLs after the fact and expect it to work correctly.
>
>What I am wondering is whether this is the expected, correct behavior or a
>bug? Also, if there's any workaround that makes those blanks into true
>NULLs?
>
>Hope that's clearer. Thanks in advance!
>
>
>----------------------------------------------------
>: Aron Pilhofer
>: Director, Campaign Finance Information Center
>: Investigative Reporters and Editors
>: National Institute for Computer-Assisted Reporting
>~
>: Phone: (202) 362-3223
>: Email: aron@stripped
>:"SQL Forever"
>
>
>
>
>---------------------------------------------------------------------
>Before posting, please check:
>   http://www.mysql.com/manual.php   (the manual)
>   http://lists.mysql.com/           (the list archive)
>
>To request this thread, e-mail <mysql-thread116888@stripped>
>To unsubscribe, e-mail
> <mysql-unsubscribe-gerald_clark=suppliersystems.com@stripped>
>Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
>
>


Thread
fulltext index update crashRyan Barber12 Aug
  • NULL values -- expected behavior or bug?Aron Pilhofer12 Aug
    • Re: NULL values -- expected behavior or bug?Paul DuBois12 Aug
      • RE: NULL values -- expected behavior or bug?Aron Pilhofer12 Aug
        • Re: NULL values -- expected behavior or bug?Gerald Clark13 Aug
    • Re: NULL values -- expected behavior or bug?Keith C. Ivey12 Aug
  • Re: fulltext index update crashSergei Golubchik12 Aug