MySQL Forums
Forum List  »  General

Re: What is happening with mySQL?
Posted by: Er Abbott
Date: June 24, 2005 02:12AM

Look at this. I've installed the latest mySQL version on my Win2K machine - so I don't have to be an unfair guy who is just screaming here.

This script I've ran was generated by FabForce's DB Designer.

mysql> CREATE TABLE usuarios (
-> usri_id INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
-> login VARCHAR(50) NULL,
-> PRIMARY KEY(usri_id)
-> )
-> TYPE=InnoDB;
Query OK, 0 rows affected, 1 warning (0.07 sec)

mysql> CREATE TABLE mylog (
-> log_id INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
-> usuarios_usri_id INTEGER UNSIGNED NOT NULL,
-> operacao VARCHAR(100) NULL,
-> PRIMARY KEY(log_id),
-> INDEX mylog_FKIndex1(usuarios_usri_id)
-> )
-> TYPE=InnoDB;
Query OK, 0 rows affected, 1 warning (0.09 sec)

So, then I've ran this and all worked fine:

mysql> insert into usuarios values (1, 'galvao');
Query OK, 1 row affected (0.04 sec)

mysql> insert into mylog values (1, 8, 'teste');
Query OK, 1 row affected (0.03 sec)

Then I've realized that DB Designer doesn't use the default syntax (REFERENCES table(column)), so I've dropped the mylog table and recreated it - again, I don't want to be unfair:

mysql> CREATE TABLE mylog (
-> log_id INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
-> usuarios_usri_id INTEGER UNSIGNED NOT NULL REFERENCES usuarios(id),
-> operacao VARCHAR(100) NULL,
-> PRIMARY KEY(log_id),
-> INDEX mylog_FKIndex1(usuarios_usri_id)
-> )
-> TYPE=InnoDB;
Query OK, 0 rows affected, 1 warning (0.07 sec)

Notice the warning. I have a warning, but mySQL doesn't tell me what is wrong (cool, huh?).

So here I go again: look what a shame that is:

mysql> insert into mylog values (1, 8, 'teste');
Query OK, 1 row affected (0.05 sec)

This is really, REALLY wrong.

Sorry, folks, but there is no excuse for this.

Options: ReplyQuote


Subject
Written By
Posted
Re: What is happening with mySQL?
June 24, 2005 02:12AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.