List:General Discussion« Previous MessageNext Message »
From:sullivan Date:June 30 1999 1:05am
Subject:LOAD DATA puts NULL into NOT NULL key
View as plain text  
>Description:

Hi - This may be a silly question, but it looks like
LOAD DATA will load \N into a "NOT NULL" key.
How can I prevent this?

>How-To-Repeat:



Here's an example:

create table quesa (
	ident VARCHAR(255) NOT NULL,
	size INT,
	PRIMARY KEY( ident));

load data local infile "quesa.txt" into table quesa;

========= quesa.txt file contents: ===========
alpha	10
\N	20
gamma	30
========= end file =======================

It replies ...
Records: 3  Deleted: 0  Skipped: 0  Warnings: 1

select * from quesa;
+-------+------+
| ident | size |
+-------+------+
| alpha |   10 |
|       |   20 |
| gamma |   30 |
+-------+------+
3 rows in set (0.00 sec)


Questions:

-- How can I view the individual warning messages,
instead of just seeing a count?

-- How can I prevent MySQL from loading NULL fields
into a NOT NULL field?

Many thanks for any hints!
Best regards -

Steve



>Fix:

I wish I knew!

>Submitter-Id:	<submitter ID>
>Originator:	Steve Sullivan
>Organization:
 
>MySQL support: [none | licence | email support | extended email support ]
>Synopsis:	LOAD DATA puts NULL into NOT NULL key
>Severity:	non-critical
>Priority:	medium
>Category:	mysql
>Class:		sw-bug
>Release:	mysql-3.22.23b (Source distribution)
>Server: lt-mysqladmin  Ver 7.11 Distrib 3.22.23b, for pc-linux-gnu on i686
TCX Datakonsult AB, by Monty

Server version		3.22.23b-log
Protocol version	10
Connection		Localhost via UNIX socket
UNIX socket		/tmp/mysql.sock
Uptime:			3 hours 25 min 49 sec

Threads: 2  Questions: 217  Slow queries: 0  Opens: 43  Flush tables: 1  Open tables: 5
>Environment:
	
System: Linux random.mathcom.com 2.2.9 #10 Wed May 19 01:45:21 PDT 1999 i686 unknown
Architecture: i686

Some paths:  /usr/bin/perl /usr/bin/make /usr/bin/gmake /usr/bin/gcc /usr/bin/cc
GCC: Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/specs
gcc version egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)
Compilation info: CC='gcc'  CFLAGS=''  CXX='c++'  CXXFLAGS=''  LDFLAGS=''
Configure command: ./configure  --prefix=/home/sjs
Perl: This is perl, version 5.005_03 built for i386-linux
Thread
LOAD DATA puts NULL into NOT NULL keysullivan30 Jun
  • LOAD DATA puts NULL into NOT NULL keyMichael Widenius30 Jun
  • Re: LOAD DATA puts NULL into NOT NULL keyPaul DuBois30 Jun
Re: LOAD DATA puts NULL into NOT NULL keySteve Sullivan30 Jun