I thought you might be interested in a bug that I traced to my having used
the wrong case for the table name. This had me baffled for a while because
the behaviour was not consistent, sometimes the error was duplicate key,
other times wrong column count....
============ CORRECT BEHAVIOR =========
DROP TABLE IF EXISTS task
RESULT: 0 Rows affected.
CREATE TABLE task (
projectid varchar(8) NOT NULL default '',
taskid varchar(8) NOT NULL default '',
name varchar(60) NOT NULL default '',
PRIMARY KEY (projectid,taskid)
) TYPE=MyISAM
RESULT: 0 Rows affected.
INSERT INTO task VALUES ('BROWSP','1','Maintain data code')
RESULT: 1 Rows affected.
INSERT INTO task VALUES ('BROWSP','2','Test software, hardware and
linkages')
RESULT: 1 Rows affected.
select * from task
| projectid | taskid | name |
| BROWSP | 1 |Maintain data code|
| BROWSP | 2 |Test software, hardware and linkages|
Number of Results: 2
What happens if you use Task instead of task in the second Insert
============== APPEARED TO WORK ===============
DROP TABLE IF EXISTS task
RESULT: 0 Rows affected.
CREATE TABLE task (
projectid varchar(8) NOT NULL default '',
taskid varchar(8) NOT NULL default '',
name varchar(60) NOT NULL default '',
PRIMARY KEY (projectid,taskid)
) TYPE=MyISAM
RESULT: 0 Rows affected.
INSERT INTO task VALUES ('SUPP','1','Maintain data code')
RESULT: 1 Rows affected.
INSERT INTO Task VALUES ('SUPP','2','Test software, hardware and linkages')
RESULT: 1 Rows affected.
============ SO TRIED IT WITH A SELECT AT THE END =================
DROP TABLE IF EXISTS task
RESULT: 0 Rows affected.
CREATE TABLE task (
projectid varchar(8) NOT NULL default '',
taskid varchar(8) NOT NULL default '',
name varchar(60) NOT NULL default '',
PRIMARY KEY (projectid,taskid)
) TYPE=MyISAM
RESULT: 0 Rows affected.
INSERT INTO task VALUES ('SUPP','1','Maintain data code')
RESULT: 1 Rows affected.
INSERT INTO Task VALUES ('SUPP','2','Test software, hardware and linkages')
ERROR: Query failed (Duplicate entry 'SUPP-2' for key 1)
select * from task
| projectid | taskid | name |
| SUPP | 1 | Maintain data code |
Number of Results: 1
================ ANOTHER VARIATION ==================
DROP TABLE IF EXISTS task
RESULT: 0 Rows affected.
CREATE TABLE task (
projectid varchar(8) NOT NULL default '',
taskid varchar(8) NOT NULL default '',
name varchar(60) NOT NULL default '',
PRIMARY KEY (projectid,taskid)
) TYPE=MyISAM
RESULT: 0 Rows affected.
INSERT INTO task VALUES ('BROWSP','1','Maintain data code')
RESULT: 1 Rows affected.
INSERT INTO Task VALUES ('BROWSP','2','Test software, hardware and
linkages')
ERROR: Query failed (Column count doesn't match value count at row 1)
=========== SAME AGAIN WITH A SELECT ================
DROP TABLE IF EXISTS task
RESULT: 0 Rows affected.
CREATE TABLE task (
projectid varchar(8) NOT NULL default '',
taskid varchar(8) NOT NULL default '',
name varchar(60) NOT NULL default '',
PRIMARY KEY (projectid,taskid)
) TYPE=MyISAM
RESULT: 0 Rows affected.
INSERT INTO task VALUES ('BROWSP','1','Maintain data code')
RESULT: 1 Rows affected.
INSERT INTO Task VALUES ('BROWSP','2','Test software, hardware and
linkages')
RESULT: 1 Rows affected.
select * from task
| projectid | taskid | name |
| BROWSP | 1 | Maintain data code |
Number of Results: 1
=============== WITHOUT THE SELECT ========================
DROP TABLE IF EXISTS task
RESULT: 0 Rows affected.
CREATE TABLE task (
projectid varchar(8) NOT NULL default '',
taskid varchar(8) NOT NULL default '',
name varchar(60) NOT NULL default '',
PRIMARY KEY (projectid,taskid)
) TYPE=MyISAM
RESULT: 0 Rows affected.
INSERT INTO task VALUES ('BROWSP','1','Maintain data code')
RESULT: 1 Rows affected.
INSERT INTO Task VALUES ('BROWSP','2','Test software, hardware and
linkages')
ERROR: Query failed (Duplicate entry 'BROWSP-2' for key 1)
---------------------------------------------------------------------
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