| Bug #7615 | No warning when inserting a NULL value into a non null column | ||
|---|---|---|---|
| Submitted: | 2 Jan 2005 10:33 | Modified: | 11 Jan 2005 11:13 |
| Reporter: | Georg Richter | Email Updates: | |
| Status: | Not a Bug | Impact on me: | |
| Category: | MySQL Server: Embedded Library ( libmysqld ) | Severity: | S3 (Non-critical) |
| Version: | 4.1.8 | OS: | Linux (Linux) |
| Assigned to: | Alexey Botchkov | CPU Architecture: | Any |
[11 Jan 2005 11:13]
Alexey Botchkov
Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.mysql.com/documentation/ and the instructions on how to report a bug at http://bugs.mysql.com/how-to-report.php Additional info: As i can see the above is the correct behaviour. Warnings are produced only if the INSERT has multiple values to insert or in INSERT SELECT statement. Single-valued INSERT returns error both in 'embedded' and 'remote' libraries.

Description: When inserting a NULL value in a column which is defined as NOT NULL, mysql_warning_count returns 0 instead of 1. How to repeat: ... mysql_query(mysql, "CREATE TABLE t1 (a int NOT NULL)"); mysql_query(mysql,"INSERT INTO t1 VALUES (NULL)"); if (mysql_warning_count(mysql)) { printf("Warning! ...."); } else { printf("Bug :(\n"); }