> 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: [EMAIL PROTECTED]
:"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 <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to