If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > Mysql & case sensitive question!

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-06-07, 05:58
petitof petitof is offline
Registered User
 
Join Date: Apr 2004
Posts: 54
Smile Mysql & case sensitive question!

Hi guys!
I have a problem with restore from backup, I use:
mysql myschema<mypath/script.sql -u mysql --password=mysql

but I have two rows that have same values except the case senditivive of one letter, so my questions are..

1) Can i enable case sensitive?
2) Can i configure mysql to don't stop where there is an error? ..the tables after the "duplicate key" error are empty (


I use mysql 5 on linux...


Thanks
Reply With Quote
  #2 (permalink)  
Old 06-07-07, 09:15
aschk aschk is offline
Registered User
 
Join Date: Mar 2007
Location: 636f6d7075746572
Posts: 770
What collation do you have on the column(s) in question?
Reply With Quote
  #3 (permalink)  
Old 06-07-07, 20:39
ISPserver ISPserver is offline
Registered User
 
Join Date: Jun 2007
Posts: 9
What version mysql backup from? Also mysql5?
Reply With Quote
  #4 (permalink)  
Old 06-08-07, 03:10
petitof petitof is offline
Registered User
 
Join Date: Apr 2004
Posts: 54
Yes..I have MySql v5 on Linux!

Example:

I have this table in ORACLE:

create table pippo (
idpippo number(18),
cdesc varchar2(20)
)
create unique index udxpippo on pippo (cdesc asc);

whith this rows inside:
insert into pippo values (1, 'Malattie oncologiche');
insert into pippo values (2, 'Malattie Oncologiche');

In Oracle v10 (Linux) I haven't problem to keep these rows because it's CASE SENSITIVE but when I try to migrate data to PIPPO in Mysql I've got this error:
ERROR 1062 (23000) at line 17197: Duplicate entry 'Malattie Oncologiche' for key 2

Can I turn CASE SENSITIVE on in Mysql v5 like Oracle?

Fabio
Reply With Quote
  #5 (permalink)  
Old 06-08-07, 03:47
gvee gvee is offline
www.gvee.co.uk
 
Join Date: Jan 2007
Location: UK
Posts: 10,156
The real question is why you are adding an index to a decription field and then trying to insert duplicate records in the first place.
Surely the constraint should be on the identifier field (idpippo)?
__________________
George
Twitter | Blog
Reply With Quote
  #6 (permalink)  
Old 06-08-07, 03:57
petitof petitof is offline
Registered User
 
Join Date: Apr 2004
Posts: 54
The scenario is more complicated than this example!

Sure the administration in this case isn't correct but these rows have some foreign keys so when I try to migrate from Oracle to MySql I would to have identical situation and without error! and I can't remove index!!
Reply With Quote
  #7 (permalink)  
Old 06-08-07, 04:32
aschk aschk is offline
Registered User
 
Join Date: Mar 2007
Location: 636f6d7075746572
Posts: 770
Ah, you didn't specify that you were migrating a DB from Oracle to MySQL.
What is your create table DDL for MySQL??? And thus what is your column collation for that particular column? Please post your create table statement for the table (it will be contained within your script.sql). You will need to alter the default collation for MySQL so that the tables are created to be case sensitive. Careful what you do with this though (i.e. you might want to change it back after your import).
Reply With Quote
  #8 (permalink)  
Old 06-08-07, 04:33
aschk aschk is offline
Registered User
 
Join Date: Mar 2007
Location: 636f6d7075746572
Posts: 770
It's also worth noting that there is no equivalent to varchar2 in MySQL so if your script contains special types (from Oracle) you will have to manually convert these to MySQL types.
Reply With Quote
  #9 (permalink)  
Old 06-08-07, 05:19
petitof petitof is offline
Registered User
 
Join Date: Apr 2004
Posts: 54
Talking

I'm sorry...here the rest:

-- ORACLE
.
.
cdesc VARCHAR2(50) NULL
.

>

-- MySQL
create table pippo(
idpippo decimal(10) not null ,
cdesc varchar(50) default null,
)
...I want to thank you because now I know that I must specify the collation at the end of the creation table! (example latin1_general_cs cs -> case sensitive!!)

Thanks!
Reply With Quote
  #10 (permalink)  
Old 06-08-07, 05:57
aschk aschk is offline
Registered User
 
Join Date: Mar 2007
Location: 636f6d7075746572
Posts: 770
It's worth noting that collations can be set on a per column basis as of MySQL version 5.0

e.g.

Code:
CREATE TABLE Table1
(
    column1 VARCHAR(5) COLLATE latin1_german1_ci,
    column2 VARCHAR(5) COLLATE latin1_general_cs,
    column3 VARCHAR(5)
) COLLATE latin1_swedish_ci;
As you can see
column1 is german case sensitive
column2 is german case insenitive
and (because we set default table collation to latin1_swedish_ci)
column3 is swedish case insenitive

Last edited by aschk; 06-08-07 at 06:00.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On