List:General Discussion« Previous MessageNext Message »
From:Mertens Bram Date:August 28 2002 5:49pm
Subject:NULL values inserted with \N not NULL?
View as plain text  

I'm using version 3.23.49 on RH7.3.

I'm following the menagerie example and have added some lines to the
"pet" tabel using the LOAD DATA LOCAL INFILE... construction.

I have created a file pet.txt like the manual suggests and have added \N
in some fields to include NULL values.

However when I perfom a simple SELECT on the table the formatting seems
broken, and when I run a query looking for NULL values the result is
"Empty set..."

Here are a few lines from the pet.txt:
flufyy	harold	cat	f	1993-02-04	\n
Chirpy	\n	bird	\n	\n	\n

Here's the first query and some of the output:
mysql> SELECT * FROM pet;
| name   | owner  | species | sex  | birth      | death      |
| flufyy | harold | cat     | f    | 1993-02-04 | 0000-00-00 |
| Chirpy |
      | bird    |
    | 0000-00-00 | 0000-00-00 |
13 rows in set (0.44 sec)

And here's the other query:
mysql> SELECT * FROM pet WHERE death IS NULL;
Empty set (0.23 sec)

What am I doing wrong?

 #  Mertens Bram "M8ram" <bram-mertens@stripped>   Linux User #249103  #
 #  Red Hat Linux 7.3  KDE 3.0.0-10  kernel 2.4.18-3  i686  128MB RAM  #
 #  A priest advised Voltaire on his death bed to renounce the devil.  #
 #  Replied Voltaire, "This is no time to make new enemies."           #

NULL values inserted with \N not NULL?Mertens Bram28 Aug
  • Re: NULL values inserted with \N not NULL?Keith C. Ivey28 Aug
  • Re: NULL values inserted with \N not NULL?Mertens Bram29 Aug