Home > Archive > MySQL ODBC Connector > October 2005 > Bug? Set Null Value in NOT NULL field...









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Bug? Set Null Value in NOT NULL field...
LMS

2005-10-27, 5:28 pm

Hi,
I have this structure:
-----------------------------------------------
CREATE TABLE tabla (
id int(10) unsigned NOT NULL auto_increment,
nombre varchar(100) NOT NULL default '',
PRIMARY KEY (id),
UNIQUE KEY nombre (nombre),
UNIQUE KEY id (id)
) ENGINE=MyISAM;

SELECT * FROM tabla
++++++++++++++++++++
+++++++++++++
+ id + nombre +
++++++++++++++++++++
+++++++++++++
+ 1 + marcos +
++++++++++++++++++++
+++++++++++++

Now, I make a update:
---------------------------------
UPDATE tabla SET nombre = NULL WHERE id = 1;
---------------------------------
MySQL responds: "Query OK, 0 rows affected (0,01 sec)".
Again I do select:

SELECT * FROM tabla
++++++++++++++++++++
+++++++++++++
+ id + nombre +
++++++++++++++++++++
+++++++++++++
+ 1 + +
++++++++++++++++++++
+++++++++++++

MySQL Server change the NULL value by '', Why?, this is a bug?.

Thanks for any answer.......
Marcelo Sosa

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql? unsub...sie.nctu.edu.tw

Jeff Smelser

2005-10-27, 5:28 pm

--nextPart4392388.FsbuvQ2I1O
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

On Wednesday 26 October 2005 04:24 pm, LMS wrote:
> Hi,
> I have this structure:
> -----------------------------------------------
> CREATE TABLE tabla (
> id int(10) unsigned NOT NULL auto_increment,
> nombre varchar(100) NOT NULL default '',


because your defaulting it to ''.. so null = '' on insert..

Jeff

--nextPart4392388.FsbuvQ2I1O
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQBDYTb9oOk9EvUv
EtgRAvWIAKDbXpN8Fquy
Usn8h3GusSH3XSORBQCg
x9qV
8I6A9gk7KaR6nZyWZQ7/w6s=
=4xpi
-----END PGP SIGNATURE-----

--nextPart4392388.FsbuvQ2I1O--
LMS

2005-10-27, 5:28 pm

Jeff Smelser escribió:
> On Wednesday 26 October 2005 04:24 pm, LMS wrote:
>
>
>
> because your defaulting it to ''.. so null = '' on insert..
>
> Jeff


Ok thanks for your answer, but I can't set any other property, and I
need that it gives back an error, because it would have thus to be.

Marcelo

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql? unsub...sie.nctu.edu.tw

Joerg Bruehe

2005-10-28, 7:23 am

Hi!

LMS wrote:
> Jeff Smelser escribió:
>
>
>
> Ok thanks for your answer, but I can't set any other property, and I
> need that it gives back an error, because it would have thus to be.


This seems to be a problem of history: It was not done in previous
versions, so introducing it now might break old applications ...

Please see the manual, especially sections 1.8.6.2 and 5.3.2.
AIUI, using a "strict" mode (new in 5.0) is the way for you.

Joerg

--
Joerg Bruehe, Senior Production Engineer
MySQL AB, www.mysql.com

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql? unsub...sie.nctu.edu.tw

Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2009 droptable.com