Ferdek,

I found the bug. If one specifies a non-latin1 character set in my.cnf, then
the internal data type of a CHAR column is DATA_MYSQL inside InnoDB. In that
case the foreign key check did not accept columns of different length.

I have now fixed this to 3.23.52.

But a note on programming style: usually it is logical that the column in
the referenced table should have the exact same data type as the column in
the referencing table.

Thank you for discovering this bug!

Heikki
Innobase Oy

----- Original Message -----
From: "Ferdek" <[EMAIL PROTECTED]>
To: "Heikki Tuuri" <[EMAIL PROTECTED]>
Sent: Wednesday, June 19, 2002 12:37 AM
Subject: Re: Alter table problem


> > Ferdek,
> >
> > what character set you have specified in my.cnf? I tested your script
with
> > latin1 (the default) and 3.23.52, and it seemed to work without errors.
> >
> > For example, for the table reklamacja you see below it created the 3
> foreign
> > key constraints.
> >
> > Can you provide a simple repeatable test case (and my.cnf) where it
fails?
> >
> > Regards,
> >
> > Heikki
> > Innobase Oy
>
> Hello.
>
> It's amazing, that it worked without any errors. I use character set
> win1250.
> But I managed problem - I changed type of column "id_czesci" in the table
> "czesc" from char to varchar and others columns too. This is a copy of
> manual:
>
> "Corresponding columns in the foreign key and the referenced key must have
> similar internal data types inside InnoDB so that they can be compared
> without
> a type conversion. The size and the signedness of integer types has to be
> the
> same. The length of string types need not be the same."
>
> So, I had tables with columns (one or more) of type text and char. MySQL
> automaticly change the type char to varchar in this case. And "id_czesci"
> from table "czesc" was char. And IMHO this was a problem (comparing
> char with varchar).
>
> This is a copy of my my.cnf file :
>
> [mysqld]
> default-character-set=win1250
> basedir=C:/mysql
> innodb_data_home_dir = c:\ibdata
> innodb_data_file_path = ibdata1:50M:autoextend:max:200M
> set-variable = innodb_buffer_pool_size=50M
> set-variable = innodb_additional_mem_pool_size=10M
> innodb_log_group_home_dir=c:\iblogs
> innodb_log_arch_dir = c:\iblogs
> innodb_log_archive=0
> set-variable = innodb_log_files_in_group=3
> set-variable = innodb_log_file_size=10M
> set-variable = innodb_log_buffer_size=8M
> innodb_flush_log_at_trx_commit=1
> set-variable = innodb_file_io_threads=10
> set-variable = innodb_lock_wait_timeout=50
> datadir=C:/mysql/data
> [WinMySQLadmin]
> Server=C:/mysql/bin/mysqld-max-nt.exe
> user=user
> password=password
>
> Anyway, great thanks !
> If you have any other ideas, why it didn't work,
> I'm looking hearing from you.
>
> Best regards
> Adrian Sosialuk
>
> P.S. Sorry for my English.
>
>



---------------------------------------------------------------------
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

Reply via email to