Apache OpenOffice (AOO) Bugzilla – Issue 81921
[cws dba24a] mysql odbc releations design: error when close dialog with OK
Last modified: 2013-08-07 15:45:14 UTC
I use - Linux - mysql 5.0.18 - mysql-connector-odbc-3.51.20-0 - the tables are create with this SQL command: drop TABLE if EXISTS rel1 ; CREATE TABLE `rel1` ( `id` int(11) NOT NULL, `text_1` varchar(20) default NULL, `text_2` varchar(20) default NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; drop TABLE if EXISTS rel2; CREATE TABLE `rel2` ( `id` int(11) NOT NULL, `text_1` varchar(20) default NULL, `text_2` varchar(20) default NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; 1. open a database with type mysql and ODBC to connect to the mysql server 2. open TOOLS / RELATIONS 3. add table rel1 and rel2 4. d&d id field from rel1 to rel2 5. double click the relation 6. close the dialog with OK ==>> error messages: You have an error in your SQL syntax: 'CONSTRAINT 'NULL''
Driver problem. The driver doesn't return the name of the foreign key. So we can not drop it.
*** Issue 81927 has been marked as a duplicate of this issue. ***
SQLForeignKeys returns for a foreign key the name 'NULL'. Afterwards when trying to delete the foreign key the name 'NULL' is not accepted in ALTER TABLE 'x' DROP FOREIGN KEY 'NULL' So I assume that the name of the foreign key is wrong. Tested with a 3.51.23.00 (version 5.1 hangs under Windows)
Seems this is reported in MySQL's bug database as http://bugs.mysql.com/bug.php?id=25772. Which is marked as duplicate of issue http://bugs.mysql.com/bug.php?id=19923, which IMO describes another problem. Besides this, there is a comment in #m25772# which claims the behaviour is correct, pointing to http://msdn2.microsoft.com/en-gb/library/ms709315.aspx, where the respective text portion reads "Foreign key name. NULL if not applicable to the data source.". However, neither in the ODBC documentation nor in the MySQL-issue is an explanation what "not applicable to the data source" means.